[PATCH 6/6] d3dcompiler: Prepend static global initializers to the entry function's body.
Zebediah Figura
z.figura12 at gmail.com
Thu Jun 11 16:44:22 CDT 2020
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
dlls/d3dcompiler_43/hlsl.y | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y
index 734289f66a5..c651fb9d7fa 100644
--- a/dlls/d3dcompiler_43/hlsl.y
+++ b/dlls/d3dcompiler_43/hlsl.y
@@ -3005,6 +3005,21 @@ HRESULT parse_hlsl(enum shader_type type, DWORD major, DWORD minor,
"entry point \"%s\" is missing a return value semantic", entry_func->func->name);
}
+ /* Walk through the list in reverse, so that initializers are added in the
+ * order that they were declared. */
+ LIST_FOR_EACH_ENTRY_REV(var, &hlsl_ctx.globals->vars, struct hlsl_ir_var, scope_entry)
+ {
+ if (var->modifiers & HLSL_STORAGE_STATIC)
+ {
+ if (!add_assignment_to_initializer(var))
+ {
+ hlsl_ctx.status = PARSE_ERR;
+ hr = E_OUTOFMEMORY;
+ }
+ list_move_head(entry_func->body, &var->initializer);
+ }
+ }
+
/* Index 0 means unused; index 1 means function entry, so start at 2. */
index_instructions(entry_func->body, 2);
--
2.27.0
More information about the wine-devel
mailing list