Zebediah Figura : vkd3d-shader: Store the shader type and version in the hlsl_ctx structure.

Alexandre Julliard julliard at winehq.org
Tue Apr 13 16:17:34 CDT 2021


Module: vkd3d
Branch: master
Commit: 60ece9cd6288d70c85a212b3cc0d2373988edcb4
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=60ece9cd6288d70c85a212b3cc0d2373988edcb4

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Thu Apr  8 23:38:25 2021 -0500

vkd3d-shader: Store the shader type and version in the hlsl_ctx structure.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d-shader/hlsl.c | 18 +++++-------------
 libs/vkd3d-shader/hlsl.h | 13 +++++++++++++
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
index f1db47c..d797aa1 100644
--- a/libs/vkd3d-shader/hlsl.c
+++ b/libs/vkd3d-shader/hlsl.c
@@ -1370,17 +1370,6 @@ void hlsl_add_function(struct rb_tree *funcs, char *name, struct hlsl_ir_functio
     rb_put(funcs, func->name, &func->entry);
 }
 
-struct hlsl_profile_info
-{
-    const char *name;
-    enum vkd3d_shader_type type;
-    DWORD sm_major;
-    DWORD sm_minor;
-    DWORD level_major;
-    DWORD level_minor;
-    bool sw;
-};
-
 static const struct hlsl_profile_info *get_target_info(const char *target)
 {
     unsigned int i;
@@ -1556,10 +1545,13 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
     }
 }
 
-static bool hlsl_ctx_init(struct hlsl_ctx *ctx, struct vkd3d_shader_message_context *message_context)
+static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const struct hlsl_profile_info *profile,
+        struct vkd3d_shader_message_context *message_context)
 {
     memset(ctx, 0, sizeof(*ctx));
 
+    ctx->profile = profile;
+
     ctx->message_context = message_context;
 
     if (!(ctx->source_files = vkd3d_malloc(sizeof(*ctx->source_files))))
@@ -1642,7 +1634,7 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d
 
     vkd3d_shader_dump_shader(profile->type, &compile_info->source);
 
-    if (!hlsl_ctx_init(&ctx, message_context))
+    if (!hlsl_ctx_init(&ctx, profile, message_context))
         return VKD3D_ERROR_OUT_OF_MEMORY;
 
     if (hlsl_lexer_compile(&ctx, hlsl) == 2)
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
index 4122711..3f6abdc 100644
--- a/libs/vkd3d-shader/hlsl.h
+++ b/libs/vkd3d-shader/hlsl.h
@@ -390,8 +390,21 @@ struct hlsl_scope
     struct hlsl_scope *upper;
 };
 
+struct hlsl_profile_info
+{
+    const char *name;
+    enum vkd3d_shader_type type;
+    unsigned int major_version;
+    unsigned int minor_version;
+    unsigned int major_level;
+    unsigned int minor_level;
+    bool software;
+};
+
 struct hlsl_ctx
 {
+    const struct hlsl_profile_info *profile;
+
     const char **source_files;
     unsigned int source_files_count;
     struct vkd3d_shader_location location;




More information about the wine-cvs mailing list