diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index dd967030d97..27f089ff709 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -7509,10 +7509,13 @@ static HRESULT shader_glsl_generate_shader_phase(const struct wined3d_shader *sh struct shader_glsl_ctx_priv *priv_ctx, const struct wined3d_shader_phase *phase, const char *phase_name, unsigned phase_idx) { + unsigned int i; HRESULT hr; shader_addline(buffer, "void hs_%s_phase%u(%s)\n{\n", phase_name, phase_idx, phase->instance_count ? "int phase_instance_id" : ""); + for (i = 0; i < phase->temporary_count; ++i) + shader_addline(buffer, "vec4 R%u;\n", i); hr = shader_generate_code(shader, buffer, reg_maps, priv_ctx, phase->start, phase->end); shader_addline(buffer, "}\n"); return hr; diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index a4d3a59cf95..74cb92ef059 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -1105,13 +1105,20 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st } else if (ins.handler_idx == WINED3DSIH_DCL_INDEXABLE_TEMP) { - struct wined3d_shader_indexable_temp *reg; + if (phase) + { + FIXME("Indexable temporary registers not supported.\n"); + } + else + { + struct wined3d_shader_indexable_temp *reg; - if (!(reg = HeapAlloc(GetProcessHeap(), 0, sizeof(*reg)))) - return E_OUTOFMEMORY; + if (!(reg = HeapAlloc(GetProcessHeap(), 0, sizeof(*reg)))) + return E_OUTOFMEMORY; - *reg = ins.declaration.indexable_temp; - list_add_tail(®_maps->indexable_temps, ®->entry); + *reg = ins.declaration.indexable_temp; + list_add_tail(®_maps->indexable_temps, ®->entry); + } } else if (ins.handler_idx == WINED3DSIH_DCL_INPUT_PRIMITIVE) { @@ -1168,7 +1175,10 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st } else if (ins.handler_idx == WINED3DSIH_DCL_TEMPS) { - reg_maps->temporary_count = ins.declaration.count; + if (phase) + phase->temporary_count = ins.declaration.count; + else + reg_maps->temporary_count = ins.declaration.count; } else if (ins.handler_idx == WINED3DSIH_DCL_TESSELLATOR_DOMAIN) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index d1779767291..4f2916b3f9b 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3738,6 +3738,7 @@ struct wined3d_shader_phase const DWORD *start; const DWORD *end; unsigned int instance_count; + unsigned int temporary_count; }; struct wined3d_vertex_shader