wined3d: Implement temporary registers per phase.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2017-05-20 13:46:03 +02:00 committed by Alexandre Julliard
parent bf27e30aef
commit 1ac5db4fc0
3 changed files with 20 additions and 6 deletions

View File

@ -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;

View File

@ -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)
{

View File

@ -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