Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- libs/vkd3d-shader/hlsl.c | 7 ++++--- libs/vkd3d-shader/hlsl.h | 10 +++++----- libs/vkd3d-shader/hlsl_codegen.c | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index f7e2ad5c..441fd6c2 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -39,7 +39,8 @@ void hlsl_error(struct hlsl_ctx *ctx, const struct vkd3d_shader_location loc, vkd3d_shader_verror(ctx->message_context, &loc, error, fmt, args); va_end(args);
- ctx->failed = true; + if (!ctx->result) + ctx->result = VKD3D_ERROR_INVALID_SHADER; }
void hlsl_warning(struct hlsl_ctx *ctx, const struct vkd3d_shader_location loc, @@ -1648,10 +1649,10 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d return VKD3D_ERROR_OUT_OF_MEMORY; }
- if (ctx.failed) + if (ctx.result) { hlsl_ctx_cleanup(&ctx); - return VKD3D_ERROR_INVALID_SHADER; + return ctx.result; }
if (!(entry_func = hlsl_get_func_decl(&ctx, entry_point))) diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 55665c19..4fe90a91 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -428,7 +428,7 @@ struct hlsl_ctx struct vkd3d_shader_location location; struct vkd3d_shader_message_context *message_context; struct vkd3d_string_buffer_cache string_buffers; - bool failed; + int result;
void *scanner;
@@ -544,7 +544,7 @@ static inline void *hlsl_alloc(struct hlsl_ctx *ctx, size_t size) void *ptr = vkd3d_calloc(1, size);
if (!ptr) - ctx->failed = true; + ctx->result = VKD3D_ERROR_OUT_OF_MEMORY; return ptr; }
@@ -553,7 +553,7 @@ static inline char *hlsl_strdup(struct hlsl_ctx *ctx, const char *string) char *ptr = vkd3d_strdup(string);
if (!ptr) - ctx->failed = true; + ctx->result = VKD3D_ERROR_OUT_OF_MEMORY; return ptr; }
@@ -563,7 +563,7 @@ static inline bool hlsl_array_reserve(struct hlsl_ctx *ctx, void **elements, bool ret = vkd3d_array_reserve(elements, capacity, element_count, element_size);
if (!ret) - ctx->failed = true; + ctx->result = VKD3D_ERROR_OUT_OF_MEMORY; return ret; }
@@ -572,7 +572,7 @@ static inline struct vkd3d_string_buffer *hlsl_get_string_buffer(struct hlsl_ctx struct vkd3d_string_buffer *ret = vkd3d_string_buffer_get(&ctx->string_buffers);
if (!ret) - ctx->failed = true; + ctx->result = VKD3D_ERROR_OUT_OF_MEMORY; return ret; }
diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 243deec8..b4ea8396 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -1968,8 +1968,8 @@ int hlsl_emit_dxbc(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_fun allocate_const_registers(ctx, entry_func); allocate_semantic_registers(ctx);
- if (ctx->failed) - return VKD3D_ERROR_INVALID_SHADER; + if (ctx->result) + return ctx->result;
if (ctx->profile->major_version < 4) return write_sm1_shader(ctx, entry_func, out);