From 4080242d7f1d5316a2c998f6e7edf609bc12666c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20Sch=C3=BCller?= Date: Tue, 1 Mar 2011 22:36:19 +0100 Subject: [PATCH] d3dcompiler: Implement ID3D11ShaderReflectionType::IsEqual(). --- dlls/d3dcompiler_43/reflection.c | 15 +++++++++++-- dlls/d3dcompiler_43/tests/reflection.c | 29 ++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index e97512fdee4..96c29201ad7 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -872,9 +872,20 @@ static LPCSTR STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberType static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_IsEqual( ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *type) { - FIXME("iface %p, type %p stub!\n", iface, type); + struct d3dcompiler_shader_reflection_type *This = impl_from_ID3D11ShaderReflectionType(iface); - return E_NOTIMPL; + TRACE("iface %p, type %p\n", iface, type); + + if (This == &null_type) + { + WARN("Null type specified\n"); + return E_FAIL; + } + + if (iface == type) + return S_OK; + + return S_FALSE; } static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetSubType( diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index fb27e0d14a5..70c062e6548 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -1380,6 +1380,18 @@ static void test_reflection_constant_buffer(void) t11 = t11_valid->lpVtbl->GetMemberTypeByName(t11_valid, "invalid"); ok(t11_dummy == t11, "GetMemberTypeByName failed, got %p, expected %p\n", t11, t11_dummy); + hr = t11_dummy->lpVtbl->IsEqual(t11_dummy, t11_dummy); + ok(hr == E_FAIL, "IsEqual failed, got %x, expected %x\n", hr, E_FAIL); + + hr = t11_valid->lpVtbl->IsEqual(t11_valid, t11_dummy); + ok(hr == S_FALSE, "IsEqual failed, got %x, expected %x\n", hr, S_FALSE); + + hr = t11_dummy->lpVtbl->IsEqual(t11_dummy, t11_valid); + ok(hr == E_FAIL, "IsEqual failed, got %x, expected %x\n", hr, E_FAIL); + + hr = t11_valid->lpVtbl->IsEqual(t11_valid, t11_valid); + ok(hr == S_OK, "IsEqual failed, got %x, expected %x\n", hr, S_OK); + /* constant buffers */ for (i = 0; i < sizeof(test_reflection_constant_buffer_cb_result)/sizeof(*test_reflection_constant_buffer_cb_result); ++i) { @@ -1472,6 +1484,23 @@ static void test_reflection_constant_buffer(void) string = t11->lpVtbl->GetMemberTypeName(t11, 1); ok(!strcmp(string, "b"), "GetMemberTypeName failed, got \"%s\", expected \"%s\"\n", string, "b"); + /* float vs float (in struct) */ + hr = t11->lpVtbl->IsEqual(t11, t11_valid); + ok(hr == S_FALSE, "IsEqual failed, got %x, expected %x\n", hr, S_FALSE); + + hr = t11_valid->lpVtbl->IsEqual(t11_valid, t11); + ok(hr == S_FALSE, "IsEqual failed, got %x, expected %x\n", hr, S_FALSE); + + /* float vs float */ + t = t11->lpVtbl->GetMemberTypeByIndex(t11, 0); + ok(t != t11_dummy, "GetMemberTypeByIndex failed\n"); + + t2 = t11->lpVtbl->GetMemberTypeByIndex(t11, 1); + ok(t2 != t11_dummy, "GetMemberTypeByIndex failed\n"); + + hr = t->lpVtbl->IsEqual(t, t2); + ok(hr == S_OK, "IsEqual failed, got %x, expected %x\n", hr, S_OK); + count = ref11->lpVtbl->Release(ref11); ok(count == 0, "Release failed %u\n", count); }