From 3f04448dbbe5d096e44847a788981544dd504ca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20Sch=C3=BCller?= Date: Sun, 27 Feb 2011 22:50:52 +0100 Subject: [PATCH] d3dcompiler: Fix SystemValueType for pixelshader output signature. --- dlls/d3dcompiler_43/reflection.c | 26 ++++++++++++++++++++++---- dlls/d3dcompiler_43/tests/reflection.c | 2 +- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 9119a83e8e1..120eff0757a 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -1315,7 +1315,7 @@ err_out: return hr; } -HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *s, struct dxbc_section *section) +static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *s, struct dxbc_section *section, DWORD target) { D3D11_SIGNATURE_PARAMETER_DESC *d; unsigned int string_data_offset; @@ -1393,6 +1393,24 @@ HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *s, stru d[i].ReadWriteMask = (mask >> 8) & 0xff; d[i].Mask = mask & 0xff; + /* pixel shaders have a special handling for SystemValueType in the output signature */ + if (((target & 0xffff0000) == 0xffff0000) && (section->tag == TAG_OSG5 || section->tag == TAG_OSGN)) + { + TRACE("Pixelshader output signature fixup.\n"); + + if (d[i].Register == 0xffffffff) + { + if (!strcasecmp(d[i].SemanticName, "sv_depth")) d[i].SystemValueType = D3D_NAME_DEPTH; + if (!strcasecmp(d[i].SemanticName, "sv_coverage")) d[i].SystemValueType = D3D_NAME_COVERAGE; + if (!strcasecmp(d[i].SemanticName, "sv_depthgreaterequal")) d[i].SystemValueType = D3D_NAME_DEPTH_GREATER_EQUAL; + if (!strcasecmp(d[i].SemanticName, "sv_depthlessequal")) d[i].SystemValueType = D3D_NAME_DEPTH_LESS_EQUAL; + } + else + { + d[i].SystemValueType = D3D_NAME_TARGET; + } + } + TRACE("semantic: %s, semantic idx: %u, sysval_semantic %#x, " "type %u, register idx: %u, use_mask %#x, input_mask %#x, stream %u\n", debugstr_a(d[i].SemanticName), d[i].SemanticIndex, d[i].SystemValueType, @@ -1484,7 +1502,7 @@ HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_reflection goto err_out; } - hr = d3dcompiler_parse_signature(reflection->isgn, section); + hr = d3dcompiler_parse_signature(reflection->isgn, section, reflection->target); if (FAILED(hr)) { WARN("Failed to parse section ISGN.\n"); @@ -1502,7 +1520,7 @@ HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_reflection goto err_out; } - hr = d3dcompiler_parse_signature(reflection->osgn, section); + hr = d3dcompiler_parse_signature(reflection->osgn, section, reflection->target); if (FAILED(hr)) { WARN("Failed to parse section OSGN.\n"); @@ -1519,7 +1537,7 @@ HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_reflection goto err_out; } - hr = d3dcompiler_parse_signature(reflection->pcsg, section); + hr = d3dcompiler_parse_signature(reflection->pcsg, section, reflection->target); if (FAILED(hr)) { WARN("Failed to parse section PCSG.\n"); diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index fdfbf1ba79a..98b8c0c0a87 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -694,7 +694,7 @@ static void test_reflection_desc_ps(void) i, desc.SemanticIndex, pdesc->SemanticIndex); ok(desc.Register == pdesc->Register, "GetOutputParameterDesc(%u) Register failed, got %u, expected %u\n", i, desc.Register, pdesc->Register); - todo_wine ok(desc.SystemValueType == pdesc->SystemValueType, "GetOutputParameterDesc(%u) SystemValueType failed, got %x, expected %x\n", + ok(desc.SystemValueType == pdesc->SystemValueType, "GetOutputParameterDesc(%u) SystemValueType failed, got %x, expected %x\n", i, desc.SystemValueType, pdesc->SystemValueType); ok(desc.ComponentType == pdesc->ComponentType, "GetOutputParameterDesc(%u) ComponentType failed, got %x, expected %x\n", i, desc.ComponentType, pdesc->ComponentType);