Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 15 ++++++++++----- dlls/d3d10/tests/effect.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 180d36ce65b..fbfe8d0113a 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -7104,19 +7104,24 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetPixelShader( ID3D10EffectShaderVariable *iface, UINT index, ID3D10PixelShader **shader) { struct d3d10_effect_variable *v = impl_from_ID3D10EffectShaderVariable(iface); + struct d3d10_effect_shader_variable *s; + D3D10_SHADER_VARIABLE_TYPE basetype; + HRESULT hr;
TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
- if (v->type->element_count) - v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index)); + *shader = NULL;
- if (v->type->basetype != D3D10_SVT_PIXELSHADER) + if (FAILED(hr = d3d10_get_shader_variable(v, index, &s, &basetype))) + return hr; + + if (basetype != D3D10_SVT_PIXELSHADER) { WARN("Shader is not a pixel shader.\n"); - return E_FAIL; + return D3DERR_INVALIDCALL; }
- if ((*shader = v->u.shader.shader.ps)) + if ((*shader = s->shader.ps)) ID3D10PixelShader_AddRef(*shader);
return S_OK; diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 4583863d59b..603f3dd049a 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -6015,6 +6015,7 @@ static void test_effect_shader_object(void) ID3D10EffectShaderVariable *s; ID3D10EffectVariable *v; ID3D10VertexShader *vs; + ID3D10PixelShader *ps; ID3D10Effect* effect; ID3D10Device *device; ULONG refcount; @@ -6060,6 +6061,37 @@ static void test_effect_shader_object(void) ok(!!vs, "Unexpected shader object.\n"); ID3D10VertexShader_Release(vs);
+ ps = (void *)0xdeadbeef; + hr = s->lpVtbl->GetPixelShader(s, 0, &ps); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(!ps, "Unexpected shader object.\n"); + + ps = (void *)0xdeadbeef; + hr = s->lpVtbl->GetPixelShader(s, 1, &ps); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(!ps, "Unexpected shader object.\n"); + + ps = (void *)0xdeadbeef; + hr = s->lpVtbl->GetPixelShader(s, 2, &ps); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(!ps, "Unexpected shader object.\n"); + + ps = (void *)0xdeadbeef; + hr = s->lpVtbl->GetPixelShader(s, 3, &ps); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(!ps, "Unexpected shader object.\n"); + + ps = (void *)0xdeadbeef; + hr = s->lpVtbl->GetPixelShader(s, 4, &ps); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(!ps, "Unexpected shader object.\n"); + + ps = NULL; + hr = s->lpVtbl->GetPixelShader(s, 5, &ps); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(!!ps, "Unexpected shader object.\n"); + ID3D10PixelShader_Release(ps); + effect->lpVtbl->Release(effect);
refcount = ID3D10Device_Release(device);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 15 +++++++++----- dlls/d3d10/tests/effect.c | 43 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index fbfe8d0113a..6e429c32b2d 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -7082,19 +7082,24 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetGeometryShader( ID3D10EffectShaderVariable *iface, UINT index, ID3D10GeometryShader **shader) { struct d3d10_effect_variable *v = impl_from_ID3D10EffectShaderVariable(iface); + struct d3d10_effect_shader_variable *s; + D3D10_SHADER_VARIABLE_TYPE basetype; + HRESULT hr;
TRACE("iface %p, index %u, shader %p.\n", iface, index, shader);
- if (v->type->element_count) - v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index)); + *shader = NULL;
- if (v->type->basetype != D3D10_SVT_GEOMETRYSHADER) + if (FAILED(hr = d3d10_get_shader_variable(v, index, &s, &basetype))) + return hr; + + if (basetype != D3D10_SVT_GEOMETRYSHADER) { WARN("Shader is not a geometry shader.\n"); - return E_FAIL; + return D3DERR_INVALIDCALL; }
- if ((*shader = v->u.shader.shader.gs)) + if ((*shader = s->shader.gs)) ID3D10GeometryShader_AddRef(*shader);
return S_OK; diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 603f3dd049a..df9777491b6 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -6013,6 +6013,7 @@ static void test_effect_shader_description(void) static void test_effect_shader_object(void) { ID3D10EffectShaderVariable *s; + ID3D10GeometryShader *gs; ID3D10EffectVariable *v; ID3D10VertexShader *vs; ID3D10PixelShader *ps; @@ -6092,6 +6093,48 @@ static void test_effect_shader_object(void) ok(!!ps, "Unexpected shader object.\n"); ID3D10PixelShader_Release(ps);
+ gs = (void *)0xdeadbeef; + hr = s->lpVtbl->GetGeometryShader(s, 0, &gs); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(!gs, "Unexpected shader object.\n"); + + gs = (void *)0xdeadbeef; + hr = s->lpVtbl->GetGeometryShader(s, 1, &gs); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(!gs, "Unexpected shader object.\n"); + + gs = (void *)0xdeadbeef; + hr = s->lpVtbl->GetGeometryShader(s, 2, &gs); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(!gs, "Unexpected shader object.\n"); + + gs = (void *)0xdeadbeef; + hr = s->lpVtbl->GetGeometryShader(s, 3, &gs); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(!gs, "Unexpected shader object.\n"); + + gs = (void *)0xdeadbeef; + hr = s->lpVtbl->GetGeometryShader(s, 4, &gs); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(!gs, "Unexpected shader object.\n"); + + gs = (void *)0xdeadbeef; + hr = s->lpVtbl->GetGeometryShader(s, 5, &gs); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(!gs, "Unexpected shader object.\n"); + + gs = NULL; + hr = s->lpVtbl->GetGeometryShader(s, 6, &gs); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(!!gs, "Unexpected shader object.\n"); + ID3D10GeometryShader_Release(gs); + + gs = NULL; + hr = s->lpVtbl->GetGeometryShader(s, 7, &gs); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(!!gs, "Unexpected shader object.\n"); + ID3D10GeometryShader_Release(gs); + effect->lpVtbl->Release(effect);
refcount = ID3D10Device_Release(device);
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 4 ++-- dlls/d3d10/tests/effect.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 6e429c32b2d..5efeb2901c0 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -3322,7 +3322,7 @@ static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableB { struct d3d10_effect_variable *v = &l->members[j];
- if (v->semantic && !strcmp(v->semantic, semantic)) + if (v->semantic && !stricmp(v->semantic, semantic)) { TRACE("Returning variable %p.\n", v); return &v->ID3D10EffectVariable_iface; @@ -3334,7 +3334,7 @@ static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableB { struct d3d10_effect_variable *v = &This->local_variables[i];
- if (v->semantic && !strcmp(v->semantic, semantic)) + if (v->semantic && !stricmp(v->semantic, semantic)) { TRACE("Returning variable %p.\n", v); return &v->ID3D10EffectVariable_iface; diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index df9777491b6..a448ba83714 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -3850,6 +3850,9 @@ static void test_effect_get_variable_by(void) variable = effect->lpVtbl->GetVariableBySemantic(effect, "SV_POSITION"); ok(variable_by_index == variable, "GetVariableBySemantic got %p, expected %p\n", variable, variable_by_index);
+ variable = effect->lpVtbl->GetVariableBySemantic(effect, "sv_POSITION"); + ok(variable_by_index == variable, "GetVariableBySemantic got %p, expected %p\n", variable, variable_by_index); + /* variable f2 */ variable_by_index = effect->lpVtbl->GetVariableByIndex(effect, 1); ok(null_variable != variable_by_index, "GetVariableByIndex failed %p\n", variable_by_index); @@ -3860,6 +3863,9 @@ static void test_effect_get_variable_by(void) variable = effect->lpVtbl->GetVariableBySemantic(effect, "COLOR0"); ok(variable_by_index == variable, "GetVariableBySemantic got %p, expected %p\n", variable, variable_by_index);
+ variable = effect->lpVtbl->GetVariableBySemantic(effect, "color0"); + ok(variable_by_index == variable, "GetVariableBySemantic got %p, expected %p\n", variable, variable_by_index); + /* variable f3 */ variable_by_index = effect->lpVtbl->GetVariableByIndex(effect, 2); ok(null_variable != variable_by_index, "GetVariableByIndex failed %p\n", variable_by_index);
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 2 +- dlls/d3d10/tests/effect.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 5efeb2901c0..5ade60537ef 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -8277,7 +8277,7 @@ static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTy { struct d3d10_effect_type_member *typem = &This->members[i];
- if (typem->semantic && !strcmp(typem->semantic, semantic)) + if (typem->semantic && !stricmp(typem->semantic, semantic)) { TRACE("Returning type %p.\n", typem->type); return &typem->type->ID3D10EffectType_iface; diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index a448ba83714..029d4271b14 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -390,11 +390,12 @@ static void test_effect_variable_type(void) ok(type_desc.UnpackedSize == 0x8, "UnpackedSize is %#x, expected 0x8\n", type_desc.UnpackedSize); ok(type_desc.Stride == 0x10, "Stride is %x, expected 0x10\n", type_desc.Stride);
- for (i = 0; i < 3; ++i) + for (i = 0; i < 4; ++i) { if (i == 0) type3 = type2->lpVtbl->GetMemberTypeByIndex(type2, 0); else if (i == 1) type3 = type2->lpVtbl->GetMemberTypeByName(type2, "f3"); - else type3 = type2->lpVtbl->GetMemberTypeBySemantic(type2, "SV_POSITION"); + else if (i == 2) type3 = type2->lpVtbl->GetMemberTypeBySemantic(type2, "SV_POSITION"); + else type3 = type2->lpVtbl->GetMemberTypeBySemantic(type2, "sv_POSITION");
hr = type3->lpVtbl->GetDesc(type3, &type_desc); ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); @@ -413,7 +414,8 @@ static void test_effect_variable_type(void)
if (i == 0) type3 = type2->lpVtbl->GetMemberTypeByIndex(type2, 1); else if (i == 1) type3 = type2->lpVtbl->GetMemberTypeByName(type2, "f4"); - else type3 = type2->lpVtbl->GetMemberTypeBySemantic(type2, "COLOR0"); + else if (i == 2) type3 = type2->lpVtbl->GetMemberTypeBySemantic(type2, "COLOR0"); + else type3 = type2->lpVtbl->GetMemberTypeBySemantic(type2, "color0");
hr = type3->lpVtbl->GetDesc(type3, &type_desc); ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr);
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 2 +- dlls/d3d10/tests/effect.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 5ade60537ef..6d12920c762 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -4109,7 +4109,7 @@ static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_Get { struct d3d10_effect_variable *m = &This->members[i];
- if (m->semantic && !strcmp(m->semantic, semantic)) + if (m->semantic && !stricmp(m->semantic, semantic)) { TRACE("Returning member %p\n", m); return &m->ID3D10EffectVariable_iface; diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 029d4271b14..60db5ad55be 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -651,6 +651,9 @@ static void test_effect_variable_member(void) variable = variable2->lpVtbl->GetMemberBySemantic(variable2, "SV_POSITION"); ok(variable == variable3, "GetMemberBySemantic got %p, expected %p\n", variable, variable3);
+ variable = variable2->lpVtbl->GetMemberBySemantic(variable2, "sv_POSITION"); + ok(variable == variable3, "GetMemberBySemantic got %p, expected %p\n", variable, variable3); + variable = variable2->lpVtbl->GetMemberByIndex(variable2, 0); ok(variable == variable3, "GetMemberByIndex got %p, expected %p\n", variable, variable3);
@@ -668,6 +671,9 @@ static void test_effect_variable_member(void) variable = variable2->lpVtbl->GetMemberBySemantic(variable2, "COLOR0"); ok(variable == variable3, "GetMemberBySemantic got %p, expected %p\n", variable, variable3);
+ variable = variable2->lpVtbl->GetMemberBySemantic(variable2, "color0"); + ok(variable == variable3, "GetMemberBySemantic got %p, expected %p\n", variable, variable3); + variable = variable2->lpVtbl->GetMemberByIndex(variable2, 1); ok(variable == variable3, "GetMemberByIndex got %p, expected %p\n", variable, variable3);
Signed-off-by: Matteo Bruni mbruni@codeweavers.com