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
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;
......
......@@ -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(&reg_maps->indexable_temps, &reg->entry);
*reg = ins.declaration.indexable_temp;
list_add_tail(&reg_maps->indexable_temps, &reg->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)
{
......
......@@ -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
......
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