[PATCH vkd3d v2 4/6] vkd3d-shader: Store the shader profile information in the hlsl_ctx structure.

Zebediah Figura zfigura at codeweavers.com
Sun Apr 4 23:32:03 CDT 2021


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 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 3618f26e..8023fc70 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 a1549304..f3ad3666 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;
-- 
2.31.0




More information about the wine-devel mailing list