Henri Verbeet : vkd3d-shader/hlsl: Set the source name in hlsl_ctx_init().
Module: vkd3d Branch: master Commit: 7fa0de03b907b6a9afb24883edd20acad630ccb1 URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=7fa0de03b907b6a9afb24883... Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Wed Sep 1 15:45:06 2021 +0200 vkd3d-shader/hlsl: Set the source name in hlsl_ctx_init(). Without this, HLSL compiler messages were missing the source name. For example, when attempting to compile gears.hlsl from the "gears" demo with vkd3d-compiler: ":33:17: E5000: syntax error, unexpected NEW_IDENTIFIER" Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- libs/vkd3d-shader/hlsl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 13ef6cf..0d53960 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -1694,8 +1694,8 @@ static void declare_predefined_types(struct hlsl_ctx *ctx) } } -static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const struct hlsl_profile_info *profile, - struct vkd3d_shader_message_context *message_context) +static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const char *source_name, + const struct hlsl_profile_info *profile, struct vkd3d_shader_message_context *message_context) { memset(ctx, 0, sizeof(*ctx)); @@ -1705,7 +1705,7 @@ static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const struct hlsl_profile_info * if (!(ctx->source_files = hlsl_alloc(ctx, sizeof(*ctx->source_files)))) return false; - if (!(ctx->source_files[0] = hlsl_strdup(ctx, ""))) + if (!(ctx->source_files[0] = hlsl_strdup(ctx, source_name ? source_name : "<anonymous>"))) { vkd3d_free(ctx->source_files); return false; @@ -1800,7 +1800,7 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d vkd3d_shader_dump_shader(compile_info->source_type, profile->type, &compile_info->source); - if (!hlsl_ctx_init(&ctx, profile, message_context)) + if (!hlsl_ctx_init(&ctx, compile_info->source_name, profile, message_context)) return VKD3D_ERROR_OUT_OF_MEMORY; if ((ret = hlsl_lexer_compile(&ctx, hlsl)) == 2)
participants (1)
-
Alexandre Julliard