[PATCH vkd3d] vkd3d-shader/hlsl: Do not swallow compilation errors.

Giovanni Mascellani gmascellani at codeweavers.com
Fri Aug 27 05:12:59 CDT 2021


There are cases where compilation fails, but no error message is
recorded. They usually correspond to unimplemented features, but
still failure should be forwarded to the caller, otherwise it will
manifest itself later in more confusing ways (like not being able
to find a function even though it was apparently correctly compiled).

Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
---
 libs/vkd3d-shader/hlsl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
index 0d9186ae..aafd8acb 100644
--- a/libs/vkd3d-shader/hlsl.c
+++ b/libs/vkd3d-shader/hlsl.c
@@ -1803,10 +1803,10 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d
     if (!hlsl_ctx_init(&ctx, profile, message_context))
         return VKD3D_ERROR_OUT_OF_MEMORY;
 
-    if (hlsl_lexer_compile(&ctx, hlsl) == 2)
+    if ((ret = hlsl_lexer_compile(&ctx, hlsl)))
     {
         hlsl_ctx_cleanup(&ctx);
-        return VKD3D_ERROR_OUT_OF_MEMORY;
+        return ret == 2 ? VKD3D_ERROR_OUT_OF_MEMORY : VKD3D_ERROR_INVALID_SHADER;
     }
 
     if (ctx.result)
-- 
2.33.0




More information about the wine-devel mailing list