From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2 (Matteo): Update require_space() check for inline shaders.
dlls/d3d10/effect.c | 18 ++++++++++++++++-- dlls/d3d10/tests/effect.c | 4 +--- 2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index d521684f788..48df10acff5 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -1629,7 +1629,7 @@ static HRESULT parse_fx10_object(const char *data, size_t data_size, { ID3D10EffectVariable *variable = &null_variable.ID3D10EffectVariable_iface; const char *data_ptr = NULL; - DWORD offset; + DWORD offset, sodecl_offset; enum d3d10_effect_object_operation operation; HRESULT hr; struct d3d10_effect *effect = o->pass->technique->effect; @@ -1753,7 +1753,7 @@ static HRESULT parse_fx10_object(const char *data, size_t data_size, return E_FAIL; }
- if (offset >= data_size || !require_space(offset, 1, sizeof(DWORD), data_size)) + if (offset >= data_size || !require_space(offset, 2, sizeof(DWORD), data_size)) { WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size); return E_FAIL; @@ -1761,6 +1761,7 @@ static HRESULT parse_fx10_object(const char *data, size_t data_size, data_ptr = data + offset; read_dword(&data_ptr, &offset); TRACE("Effect object starts at offset %#x.\n", offset); + read_dword(&data_ptr, &sodecl_offset);
if (FAILED(hr = parse_fx10_anonymous_shader(effect, &effect->anonymous_shaders[effect->anonymous_shader_current], o->type))) @@ -1770,6 +1771,19 @@ static HRESULT parse_fx10_object(const char *data, size_t data_size, variable = &v->ID3D10EffectVariable_iface; ++effect->anonymous_shader_current;
+ if (sodecl_offset) + { + TRACE("Anonymous shader stream output declaration at offset %#x.\n", sodecl_offset); + if (!fx10_copy_string(data, data_size, sodecl_offset, + &v->u.shader.stream_output_declaration)) + { + ERR("Failed to copy stream output declaration.\n"); + return E_OUTOFMEMORY; + } + + TRACE("Stream output declaration: %s.\n", debugstr_a(v->u.shader.stream_output_declaration)); + } + switch (o->type) { case D3D10_EOT_VERTEXSHADER: diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index f59686c26a3..a9d077566e0 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -3672,10 +3672,8 @@ if (0) hr = pdesc.pShaderVariable->lpVtbl->GetShaderDesc(pdesc.pShaderVariable, 0, &shaderdesc); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(shaderdesc.IsInline, "Unexpected inline flag.\n"); -todo_wine { - ok(shaderdesc.SODecl && !strcmp(shaderdesc.SODecl, "SV_POSITION.y"), "Unexpected stream output declaration %s.\n", + ok(!strcmp(shaderdesc.SODecl, "SV_POSITION.y"), "Unexpected stream output declaration %s.\n", shaderdesc.SODecl); -}
v = effect->lpVtbl->GetVariableByName(effect, "g_so"); gs = v->lpVtbl->AsShader(v);