[PATCH 5/7] d3dcompiler/tests: Test d3d12 interface in test_reflection_bound_resources().
Paul Gofman
pgofman at codeweavers.com
Tue Sep 8 15:46:59 CDT 2020
On 9/8/20 23:43, Matteo Bruni wrote:
> On Wed, Sep 2, 2020 at 9:30 PM Paul Gofman <pgofman at codeweavers.com> wrote:
>> Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
>> ---
>> dlls/d3dcompiler_43/tests/reflection.c | 267 ++++++++++++++++---------
>> 1 file changed, 175 insertions(+), 92 deletions(-)
>>
>> @@ -1204,31 +1228,57 @@ static void test_reflection_bound_resources(const DWORD *blob, const D3D11_SHADE
>> {
>> pdesc = &result[i];
>>
>> - hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, i, &desc);
>> - ok(hr == S_OK, "GetResourceBindingDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
>> -
>> - ok(!strcmp(desc.Name, pdesc->Name), "GetResourceBindingDesc(%u) Name failed, got \"%s\", expected \"%s\"\n",
>> - i, desc.Name, pdesc->Name);
>> - ok(desc.Type == pdesc->Type, "GetResourceBindingDesc(%u) Type failed, got %x, expected %x\n",
>> - i, desc.Type, pdesc->Type);
>> - ok(desc.BindPoint == pdesc->BindPoint, "GetResourceBindingDesc(%u) BindPoint failed, got %u, expected %u\n",
>> - i, desc.BindPoint, pdesc->BindPoint);
>> - ok(desc.BindCount == pdesc->BindCount, "GetResourceBindingDesc(%u) BindCount failed, got %u, expected %u\n",
>> - i, desc.BindCount, pdesc->BindCount);
>> + hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, i, &desc11);
>> + ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i);
>> +
>> + ok(!strcmp(desc11.Name, pdesc->Name), "Got unexpected Name \"%s\", i %u.\n", desc11.Name, i);
>> + ok(desc11.Type == pdesc->Type, "Got unexpected Type %#x, i %u.\n", desc11.Type, i);
>> + ok(desc11.BindPoint == pdesc->BindPoint, "Got unexpected BindPoint %u, i %u.\n", desc11.BindPoint, i);
>> + ok(desc11.BindCount == pdesc->BindCount, "Got unexpected BindCount %u, i %u.\n", desc11.BindCount, i);
>> #if D3D_COMPILER_VERSION
>> expected = pdesc->uFlags;
>> #else
>> expected = 0;
>> todo_wine_if(pdesc->uFlags)
>> #endif
>> - ok(desc.uFlags == expected, "(%u): Got unexpected uFlags %#x, expected %#x.\n",
>> - i, desc.uFlags, expected);
>> - ok(desc.ReturnType == pdesc->ReturnType, "GetResourceBindingDesc(%u) ReturnType failed, got %x, expected %x\n",
>> - i, desc.ReturnType, pdesc->ReturnType);
>> - ok(desc.Dimension == pdesc->Dimension, "GetResourceBindingDesc(%u) Dimension failed, got %x, expected %x\n",
>> - i, desc.Dimension, pdesc->Dimension);
>> - ok(desc.NumSamples == pdesc->NumSamples, "GetResourceBindingDesc(%u) NumSamples failed, got %u, expected %u\n",
>> - i, desc.NumSamples, pdesc->NumSamples);
>> + ok(desc11.uFlags == expected, "Got unexpected uFlags %#x, i %u.\n", desc11.uFlags, i);
>> + ok(desc11.ReturnType == pdesc->ReturnType, "Got unexpected ReturnType %#x, i %u.\n", desc11.ReturnType, i);
>> + ok(desc11.Dimension == pdesc->Dimension, "Got unexpected Dimenstion %#x, i %u.\n", desc11.Dimension, i);
>> + ok(desc11.NumSamples == pdesc->NumSamples, "Got unexpected NumSamples %u, i %u.\n", desc11.NumSamples, i);
>> +
>> + if (ref12)
>> + {
>> + memset(&desc12, 0, sizeof(desc12));
>> + desc12.Space = 0xdeadbeef;
>> + desc12.uID = 0xdeadbeef;
>> +
>> + hr = ref12->lpVtbl->GetResourceBindingDescByName(ref12, pdesc->Name, &desc12);
>> + ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i);
> Did you mean to test GetResourceBindingDesc() here instead, mirroring
> the test above?
Yes, sure, I will update that.
>> +
>> + ok(!strcmp(desc12.Name, pdesc->Name), "Got unexpected Name \"%s\", i %u.\n", desc12.Name, i);
>> + ok(!memcmp(&desc12.Type, &desc11.Type, sizeof(desc11) - offsetof(D3D11_SHADER_INPUT_BIND_DESC, Type)),
>> + "D3D11 and D3D12 descs do not match.\n");
>> + ok(desc12.Space == pdesc->Space, "Got unexpected Space %u, i %u.\n", desc12.Space, i);
>> + ok(desc12.uID == pdesc->uID, "Got unexpected uID %#x, i %u.\n", desc12.uID, i);
>> +
>> + memset(&desc12, 0, sizeof(desc12));
>> + desc12.Space = 0xdeadbeef;
>> + desc12.uID = 0xdeadbeef;
>> + hr = ref12_from_d3d11->lpVtbl->GetResourceBindingDescByName(ref12_from_d3d11, pdesc->Name, &desc12);
>> + ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i);
>> +
>> + ok(!strcmp(desc12.Name, pdesc->Name), "Got unexpected Name \"%s\", i %u.\n", desc12.Name, i);
>> + ok(!memcmp(&desc12.Type, &desc11.Type, sizeof(desc11) - offsetof(D3D11_SHADER_INPUT_BIND_DESC, Type)),
>> + "D3D11 and D3D12 descs do not match.\n");
>> + /* Native d3dcompiler_47 returns the same interface pointer when queried for ID3D12ShaderReflection
>> + * from ID3D11ShaderReflection. Space field still gets the correct value on x64 due to
>> + * D3D11_SHADER_INPUT_BIND_DESC padding. */
>> + expected = offsetof(D3D12_SHADER_INPUT_BIND_DESC, Space) < sizeof(D3D11_SHADER_INPUT_BIND_DESC)
>> + ? pdesc->Space : 0xdeadbeef;
>> + ok(desc12.Space == expected, "Got unexpected Space %u, i %u.\n",
>> + desc12.Space, i);
>> + ok(desc12.uID == 0xdeadbeef, "Got unexpected uID %#x, i %u.\n", desc12.uID, i);
> I wonder if it makes sense to have the opposite test in Wine too:
> ref11_from_d3d12, passing in a D3D12_SHADER_INPUT_BIND_DESC pointer
> (with a cast) to make sure not to write over some other variable.
Yeah, I will add the test. It is probably more interesting to have than
the other ones checking identical interfaces.
More information about the wine-devel
mailing list