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

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-04-08 23:38:25 -05:00 committed by Alexandre Julliard
parent e957d3a346
commit 60ece9cd62
2 changed files with 18 additions and 13 deletions

View File

@ -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)

View File

@ -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;