Commit 1ac5db4f authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Implement temporary registers per phase.

parent bf27e30a
...@@ -7509,10 +7509,13 @@ static HRESULT shader_glsl_generate_shader_phase(const struct wined3d_shader *sh ...@@ -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, struct shader_glsl_ctx_priv *priv_ctx, const struct wined3d_shader_phase *phase,
const char *phase_name, unsigned phase_idx) const char *phase_name, unsigned phase_idx)
{ {
unsigned int i;
HRESULT hr; HRESULT hr;
shader_addline(buffer, "void hs_%s_phase%u(%s)\n{\n", shader_addline(buffer, "void hs_%s_phase%u(%s)\n{\n",
phase_name, phase_idx, phase->instance_count ? "int phase_instance_id" : ""); 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); hr = shader_generate_code(shader, buffer, reg_maps, priv_ctx, phase->start, phase->end);
shader_addline(buffer, "}\n"); shader_addline(buffer, "}\n");
return hr; return hr;
......
...@@ -1105,6 +1105,12 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st ...@@ -1105,6 +1105,12 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
} }
else if (ins.handler_idx == WINED3DSIH_DCL_INDEXABLE_TEMP) else if (ins.handler_idx == WINED3DSIH_DCL_INDEXABLE_TEMP)
{ {
if (phase)
{
FIXME("Indexable temporary registers not supported.\n");
}
else
{
struct wined3d_shader_indexable_temp *reg; struct wined3d_shader_indexable_temp *reg;
if (!(reg = HeapAlloc(GetProcessHeap(), 0, sizeof(*reg)))) if (!(reg = HeapAlloc(GetProcessHeap(), 0, sizeof(*reg))))
...@@ -1113,6 +1119,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st ...@@ -1113,6 +1119,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
*reg = ins.declaration.indexable_temp; *reg = ins.declaration.indexable_temp;
list_add_tail(&reg_maps->indexable_temps, &reg->entry); list_add_tail(&reg_maps->indexable_temps, &reg->entry);
} }
}
else if (ins.handler_idx == WINED3DSIH_DCL_INPUT_PRIMITIVE) else if (ins.handler_idx == WINED3DSIH_DCL_INPUT_PRIMITIVE)
{ {
if (shader_version.type == WINED3D_SHADER_TYPE_GEOMETRY) if (shader_version.type == WINED3D_SHADER_TYPE_GEOMETRY)
...@@ -1168,6 +1175,9 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st ...@@ -1168,6 +1175,9 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
} }
else if (ins.handler_idx == WINED3DSIH_DCL_TEMPS) else if (ins.handler_idx == WINED3DSIH_DCL_TEMPS)
{ {
if (phase)
phase->temporary_count = ins.declaration.count;
else
reg_maps->temporary_count = ins.declaration.count; reg_maps->temporary_count = ins.declaration.count;
} }
else if (ins.handler_idx == WINED3DSIH_DCL_TESSELLATOR_DOMAIN) else if (ins.handler_idx == WINED3DSIH_DCL_TESSELLATOR_DOMAIN)
......
...@@ -3738,6 +3738,7 @@ struct wined3d_shader_phase ...@@ -3738,6 +3738,7 @@ struct wined3d_shader_phase
const DWORD *start; const DWORD *start;
const DWORD *end; const DWORD *end;
unsigned int instance_count; unsigned int instance_count;
unsigned int temporary_count;
}; };
struct wined3d_vertex_shader struct wined3d_vertex_shader
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment