[PATCH 5/5] d3dcompiler: Initialize and fix compilation messages generation.

Matteo Bruni mbruni at codeweavers.com
Tue Jul 10 08:39:45 CDT 2012


---
 dlls/d3dcompiler_43/hlsl.y |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y
index 183f436..b4c9b25 100644
--- a/dlls/d3dcompiler_43/hlsl.y
+++ b/dlls/d3dcompiler_43/hlsl.y
@@ -926,6 +926,8 @@ struct bwriter_shader *parse_hlsl(enum shader_type type, DWORD major, DWORD mino
     struct hlsl_type *hlsl_type, *next_type;
     struct hlsl_ir_var *var, *next_var;
 
+    hlsl_ctx.status = PARSE_SUCCESS;
+    hlsl_ctx.messages.size = hlsl_ctx.messages.capacity = 0;
     hlsl_ctx.line_no = 1;
     hlsl_ctx.source_file = d3dcompiler_strdup("");
     hlsl_ctx.cur_scope = NULL;
@@ -951,6 +953,20 @@ struct bwriter_shader *parse_hlsl(enum shader_type type, DWORD major, DWORD mino
         }
     }
 
+    TRACE("Compilation status = %d\n", hlsl_ctx.status);
+    if (messages)
+    {
+        if (hlsl_ctx.messages.size)
+            *messages = hlsl_ctx.messages.string;
+        else
+            *messages = NULL;
+    }
+    else
+    {
+        if (hlsl_ctx.messages.capacity)
+            d3dcompiler_free(hlsl_ctx.messages.string);
+    }
+
     d3dcompiler_free(hlsl_ctx.source_file);
     TRACE("Freeing functions IR.\n");
     LIST_FOR_EACH_ENTRY(function, &hlsl_ctx.functions, struct hlsl_ir_function_decl, node.entry)
-- 
1.7.8.6




More information about the wine-patches mailing list