From c1265cfd129c86b2e6d954259a154384e7583963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20Sch=C3=BCller?= Date: Wed, 21 Oct 2009 23:00:02 +0200 Subject: [PATCH] d3d10/tests: Add ID3D10EffectVariable::GetElement() test. --- dlls/d3d10/tests/effect.c | 515 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 515 insertions(+) diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 162f6daca13..7b07e10b540 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -599,6 +599,520 @@ static void test_effect_variable_member(ID3D10Device *device) effect->lpVtbl->Release(effect); } +/* + * test_effect_variable_element + */ +#if 0 +struct test +{ + float f3 : SV_POSITION; + float f4 : COLOR0; + float f5 : COLOR1; +}; +struct test1 +{ + float f1; + float f2[3]; + test t[2]; +}; +cbuffer cb +{ + test1 t1; +}; +#endif +static DWORD fx_test_eve[] = { +0x43425844, 0x6ea69fd9, 0x9b4e6390, 0x006f9f71, +0x57ad58f4, 0x00000001, 0x000001c2, 0x00000001, +0x00000024, 0x30315846, 0x00000196, 0xfeff1001, +0x00000001, 0x00000001, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000116, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x74006263, +0x31747365, 0x00316600, 0x616f6c66, 0x00100074, +0x00010000, 0x00000000, 0x00040000, 0x00100000, +0x00040000, 0x09090000, 0x32660000, 0x00001000, +0x00000100, 0x00000300, 0x00002400, 0x00001000, +0x00000c00, 0x00090900, 0x74007400, 0x00747365, +0x53003366, 0x4f505f56, 0x49544953, 0x66004e4f, +0x4f430034, 0x30524f4c, 0x00356600, 0x4f4c4f43, +0x53003152, 0x03000000, 0x02000000, 0x1c000000, +0x10000000, 0x18000000, 0x03000000, 0x58000000, +0x5b000000, 0x00000000, 0x16000000, 0x67000000, +0x6a000000, 0x04000000, 0x16000000, 0x71000000, +0x74000000, 0x08000000, 0x16000000, 0x07000000, +0x03000000, 0x00000000, 0x5c000000, 0x60000000, +0x28000000, 0x03000000, 0x0d000000, 0x00000000, +0x00000000, 0x16000000, 0x32000000, 0x00000000, +0x10000000, 0x35000000, 0x51000000, 0x00000000, +0x40000000, 0x7b000000, 0x74000000, 0x00040031, +0x00600000, 0x00000000, 0x00010000, 0xffff0000, +0x0000ffff, 0x01130000, 0x00c70000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, +}; + +static void test_effect_variable_element(ID3D10Device *device) +{ + ID3D10Effect *effect; + ID3D10EffectConstantBuffer *constantbuffer, *parent; + ID3D10EffectVariable *variable, *variable2, *variable3, *variable4, *variable5; + ID3D10EffectType *type, *type2; + D3D10_EFFECT_VARIABLE_DESC desc; + D3D10_EFFECT_TYPE_DESC type_desc; + HRESULT hr; + + hr = D3D10CreateEffectFromMemory(fx_test_eve, fx_test_eve[6], 0, device, NULL, &effect); + ok(SUCCEEDED(hr), "D3D10CreateEffectFromMemory failed (%x)\n", hr); + + constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 0); + hr = constantbuffer->lpVtbl->GetDesc(constantbuffer, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(desc.Name, "cb") == 0, "Name is \"%s\", expected \"cb\"\n", desc.Name); + ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic); + ok(desc.Flags == 0, "Type is %u, expected 0\n", desc.Flags); + ok(desc.Annotations == 0, "Elements is %u, expected 0\n", desc.Annotations); + ok(desc.BufferOffset == 0, "Members is %u, expected 0\n", desc.BufferOffset); + ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint); + + variable = constantbuffer->lpVtbl->GetMemberByIndex(constantbuffer, 0); + hr = variable->lpVtbl->GetDesc(variable, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + parent = variable->lpVtbl->GetParentConstantBuffer(variable); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", + parent, constantbuffer); + + variable2 = constantbuffer->lpVtbl->GetMemberByName(constantbuffer, "t1"); + hr = variable2->lpVtbl->GetDesc(variable2, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + parent = variable2->lpVtbl->GetParentConstantBuffer(variable2); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer); + + /* check variable f1 */ + variable3 = variable2->lpVtbl->GetMemberByName(variable2, "f1"); + hr = variable3->lpVtbl->GetDesc(variable3, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(desc.Name, "f1") == 0, "Name is \"%s\", expected \"f1\"\n", desc.Name); + ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic); + ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags); + ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations); + ok(desc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", desc.BufferOffset); + ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint); + + parent = variable3->lpVtbl->GetParentConstantBuffer(variable3); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", + parent, constantbuffer); + + type = variable3->lpVtbl->GetType(variable3); + hr = type->lpVtbl->GetDesc(type, &type_desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName); + ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR); + ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT); + ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements); + ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members); + ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows); + ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns); + ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize); + ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize); + ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride); + + /* check variable f2 */ + variable3 = variable2->lpVtbl->GetMemberByName(variable2, "f2"); + hr = variable3->lpVtbl->GetDesc(variable3, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)!\n", hr); + + ok(strcmp(desc.Name, "f2") == 0, "Name is \"%s\", expected \"f2\"\n", desc.Name); + ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic); + ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags); + ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations); + ok(desc.BufferOffset == 16, "BufferOffset is %u, expected 16\n", desc.BufferOffset); + ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint); + + parent = variable3->lpVtbl->GetParentConstantBuffer(variable3); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", + parent, constantbuffer); + + type = variable3->lpVtbl->GetType(variable3); + hr = type->lpVtbl->GetDesc(type, &type_desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName); + ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR); + ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT); + ok(type_desc.Elements == 3, "Elements is %u, expected 3\n", type_desc.Elements); + ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members); + ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows); + ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns); + ok(type_desc.PackedSize == 0xc, "PackedSize is %#x, expected 0xc\n", type_desc.PackedSize); + ok(type_desc.UnpackedSize == 0x24, "UnpackedSize is %#x, expected 0x24\n", type_desc.UnpackedSize); + ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride); + + variable4 = variable3->lpVtbl->GetElement(variable3, 0); + hr = variable4->lpVtbl->GetDesc(variable4, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(desc.Name, "f2") == 0, "Name is \"%s\", expected \"f2\"\n", desc.Name); + ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic); + ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags); + ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations); + ok(desc.BufferOffset == 16, "BufferOffset is %u, expected 16\n", desc.BufferOffset); + ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint); + + parent = variable4->lpVtbl->GetParentConstantBuffer(variable4); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", + parent, constantbuffer); + + type = variable4->lpVtbl->GetType(variable4); + hr = type->lpVtbl->GetDesc(type, &type_desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName); + ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR); + ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT); + ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements); + ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members); + ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows); + ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns); + ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize); + ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize); + ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride); + + variable4 = variable3->lpVtbl->GetElement(variable3, 1); + hr = variable4->lpVtbl->GetDesc(variable4, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(desc.Name, "f2") == 0, "Name is \"%s\", expected \"f2\"\n", desc.Name); + ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic); + ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags); + ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations); + ok(desc.BufferOffset == 32, "BufferOffset is %u, expected 32\n", desc.BufferOffset); + ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint); + + parent = variable4->lpVtbl->GetParentConstantBuffer(variable4); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", + parent, constantbuffer); + + type2 = variable4->lpVtbl->GetType(variable4); + hr = type2->lpVtbl->GetDesc(type2, &type_desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + ok(type == type2, "type(%p) != type2(%p)\n", type, type2); + + ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName); + ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR); + ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT); + ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements); + ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members); + ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows); + ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns); + ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize); + ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize); + ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride); + + variable4 = variable3->lpVtbl->GetElement(variable3, 2); + hr = variable4->lpVtbl->GetDesc(variable4, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(desc.Name, "f2") == 0, "Name is \"%s\", expected \"f2\"\n", desc.Name); + ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic); + ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags); + ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations); + ok(desc.BufferOffset == 48, "BufferOffset is %u, expected 48\n", desc.BufferOffset); + ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint); + + parent = variable4->lpVtbl->GetParentConstantBuffer(variable4); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", + parent, constantbuffer); + + type2 = variable4->lpVtbl->GetType(variable4); + hr = type2->lpVtbl->GetDesc(type2, &type_desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + ok(type == type2, "type(%p) != type2(%p)\n", type, type2); + + ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName); + ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR); + ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT); + ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements); + ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members); + ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows); + ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns); + ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize); + ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize); + ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride); + + /* check variable t */ + variable3 = variable2->lpVtbl->GetMemberByName(variable2, "t"); + hr = variable3->lpVtbl->GetDesc(variable3, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)!\n", hr); + + ok(strcmp(desc.Name, "t") == 0, "Name is \"%s\", expected \"t\"\n", desc.Name); + ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic); + ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags); + ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations); + ok(desc.BufferOffset == 64, "BufferOffset is %u, expected 64\n", desc.BufferOffset); + ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint); + + parent = variable3->lpVtbl->GetParentConstantBuffer(variable3); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", + parent, constantbuffer); + + type = variable3->lpVtbl->GetType(variable3); + hr = type->lpVtbl->GetDesc(type, &type_desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(type_desc.TypeName, "test") == 0, "TypeName is \"%s\", expected \"test\"\n", type_desc.TypeName); + ok(type_desc.Class == D3D10_SVC_STRUCT, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_STRUCT); + ok(type_desc.Type == D3D10_SVT_VOID, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_VOID); + ok(type_desc.Elements == 2, "Elements is %u, expected 2\n", type_desc.Elements); + ok(type_desc.Members == 3, "Members is %u, expected 3\n", type_desc.Members); + ok(type_desc.Rows == 0, "Rows is %u, expected 0\n", type_desc.Rows); + ok(type_desc.Columns == 0, "Columns is %u, expected 0\n", type_desc.Columns); + ok(type_desc.PackedSize == 0x18, "PackedSize is %#x, expected 0x18\n", type_desc.PackedSize); + ok(type_desc.UnpackedSize == 0x1c, "UnpackedSize is %#x, expected 0x1c\n", type_desc.UnpackedSize); + ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride); + + variable4 = variable3->lpVtbl->GetElement(variable3, 0); + hr = variable4->lpVtbl->GetDesc(variable4, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(desc.Name, "t") == 0, "Name is \"%s\", expected \"t\"\n", desc.Name); + ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic); + ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags); + ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations); + ok(desc.BufferOffset == 64, "BufferOffset is %u, expected 64\n", desc.BufferOffset); + ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint); + + parent = variable4->lpVtbl->GetParentConstantBuffer(variable4); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", + parent, constantbuffer); + + type = variable4->lpVtbl->GetType(variable4); + hr = type->lpVtbl->GetDesc(type, &type_desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(type_desc.TypeName, "test") == 0, "TypeName is \"%s\", expected \"test\"\n", type_desc.TypeName); + ok(type_desc.Class == D3D10_SVC_STRUCT, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_STRUCT); + ok(type_desc.Type == D3D10_SVT_VOID, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_VOID); + ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements); + ok(type_desc.Members == 3, "Members is %u, expected 3\n", type_desc.Members); + ok(type_desc.Rows == 0, "Rows is %u, expected 0\n", type_desc.Rows); + ok(type_desc.Columns == 0, "Columns is %u, expected 0\n", type_desc.Columns); + ok(type_desc.PackedSize == 0xc, "PackedSize is %#x, expected 0xc\n", type_desc.PackedSize); + ok(type_desc.UnpackedSize == 0xc, "UnpackedSize is %#x, expected 0xc\n", type_desc.UnpackedSize); + ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride); + + variable5 = variable4->lpVtbl->GetMemberByIndex(variable4, 0); + hr = variable5->lpVtbl->GetDesc(variable5, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(desc.Name, "f3") == 0, "Name is \"%s\", expected \"f3\"\n", desc.Name); + ok(strcmp(desc.Semantic, "SV_POSITION") == 0, "Semantic is \"%s\", expected \"SV_POSITION\"\n", desc.Semantic); + ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags); + ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations); + ok(desc.BufferOffset == 64, "BufferOffset is %u, expected 64\n", desc.BufferOffset); + ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint); + + parent = variable5->lpVtbl->GetParentConstantBuffer(variable5); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer); + + type = variable5->lpVtbl->GetType(variable5); + hr = type->lpVtbl->GetDesc(type, &type_desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName); + ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR); + ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT); + ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements); + ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members); + ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows); + ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns); + ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize); + ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize); + ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride); + + variable5 = variable4->lpVtbl->GetMemberByIndex(variable4, 1); + hr = variable5->lpVtbl->GetDesc(variable5, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(desc.Name, "f4") == 0, "Name is \"%s\", expected \"f4\"\n", desc.Name); + ok(strcmp(desc.Semantic, "COLOR0") == 0, "Semantic is \"%s\", expected \"COLOR0\"\n", desc.Semantic); + ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags); + ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations); + ok(desc.BufferOffset == 68, "BufferOffset is %u, expected 68\n", desc.BufferOffset); + ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint); + + parent = variable5->lpVtbl->GetParentConstantBuffer(variable5); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer); + + type = variable5->lpVtbl->GetType(variable5); + hr = type->lpVtbl->GetDesc(type, &type_desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName); + ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR); + ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT); + ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements); + ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members); + ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows); + ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns); + ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize); + ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize); + ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride); + + variable5 = variable4->lpVtbl->GetMemberByIndex(variable4, 2); + hr = variable5->lpVtbl->GetDesc(variable5, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(desc.Name, "f5") == 0, "Name is \"%s\", expected \"f5\"\n", desc.Name); + ok(strcmp(desc.Semantic, "COLOR1") == 0, "Semantic is \"%s\", expected \"COLOR1\"\n", desc.Semantic); + ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags); + ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations); + ok(desc.BufferOffset == 72, "BufferOffset is %u, expected 72\n", desc.BufferOffset); + ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint); + + parent = variable5->lpVtbl->GetParentConstantBuffer(variable5); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer); + + type = variable5->lpVtbl->GetType(variable5); + hr = type->lpVtbl->GetDesc(type, &type_desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName); + ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR); + ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT); + ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements); + ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members); + ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows); + ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns); + ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize); + ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize); + ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride); + + variable4 = variable3->lpVtbl->GetElement(variable3, 1); + hr = variable4->lpVtbl->GetDesc(variable4, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(desc.Name, "t") == 0, "Name is \"%s\", expected \"t\"\n", desc.Name); + ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic); + ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags); + ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations); + ok(desc.BufferOffset == 80, "BufferOffset is %u, expected 80\n", desc.BufferOffset); + ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint); + + parent = variable4->lpVtbl->GetParentConstantBuffer(variable4); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", + parent, constantbuffer); + + type = variable4->lpVtbl->GetType(variable4); + hr = type->lpVtbl->GetDesc(type, &type_desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(type_desc.TypeName, "test") == 0, "TypeName is \"%s\", expected \"test\"\n", type_desc.TypeName); + ok(type_desc.Class == D3D10_SVC_STRUCT, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_STRUCT); + ok(type_desc.Type == D3D10_SVT_VOID, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_VOID); + ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements); + ok(type_desc.Members == 3, "Members is %u, expected 3\n", type_desc.Members); + ok(type_desc.Rows == 0, "Rows is %u, expected 0\n", type_desc.Rows); + ok(type_desc.Columns == 0, "Columns is %u, expected 0\n", type_desc.Columns); + ok(type_desc.PackedSize == 0xc, "PackedSize is %#x, expected 0xc\n", type_desc.PackedSize); + ok(type_desc.UnpackedSize == 0xc, "UnpackedSize is %#x, expected 0xc\n", type_desc.UnpackedSize); + ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride); + + variable5 = variable4->lpVtbl->GetMemberByIndex(variable4, 0); + hr = variable5->lpVtbl->GetDesc(variable5, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(desc.Name, "f3") == 0, "Name is \"%s\", expected \"f3\"\n", desc.Name); + ok(strcmp(desc.Semantic, "SV_POSITION") == 0, "Semantic is \"%s\", expected \"SV_POSITION\"\n", desc.Semantic); + ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags); + ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations); + ok(desc.BufferOffset == 80, "BufferOffset is %u, expected 80\n", desc.BufferOffset); + ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint); + + parent = variable5->lpVtbl->GetParentConstantBuffer(variable5); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer); + + type = variable5->lpVtbl->GetType(variable5); + hr = type->lpVtbl->GetDesc(type, &type_desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName); + ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR); + ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT); + ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements); + ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members); + ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows); + ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns); + ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize); + ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize); + ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride); + + variable5 = variable4->lpVtbl->GetMemberByIndex(variable4, 1); + hr = variable5->lpVtbl->GetDesc(variable5, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(desc.Name, "f4") == 0, "Name is \"%s\", expected \"f4\"\n", desc.Name); + ok(strcmp(desc.Semantic, "COLOR0") == 0, "Semantic is \"%s\", expected \"COLOR0\"\n", desc.Semantic); + ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags); + ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations); + ok(desc.BufferOffset == 84, "BufferOffset is %u, expected 84\n", desc.BufferOffset); + ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint); + + parent = variable5->lpVtbl->GetParentConstantBuffer(variable5); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer); + + type = variable5->lpVtbl->GetType(variable5); + hr = type->lpVtbl->GetDesc(type, &type_desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName); + ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR); + ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT); + ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements); + ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members); + ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows); + ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns); + ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize); + ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize); + ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride); + + variable5 = variable4->lpVtbl->GetMemberByIndex(variable4, 2); + hr = variable5->lpVtbl->GetDesc(variable5, &desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(desc.Name, "f5") == 0, "Name is \"%s\", expected \"f5\"\n", desc.Name); + ok(strcmp(desc.Semantic, "COLOR1") == 0, "Semantic is \"%s\", expected \"COLOR1\"\n", desc.Semantic); + ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags); + ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations); + ok(desc.BufferOffset == 88, "BufferOffset is %u, expected 88\n", desc.BufferOffset); + ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint); + + parent = variable5->lpVtbl->GetParentConstantBuffer(variable5); + ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer); + + type = variable5->lpVtbl->GetType(variable5); + hr = type->lpVtbl->GetDesc(type, &type_desc); + ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); + + ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName); + ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR); + ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT); + ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements); + ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members); + ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows); + ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns); + ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize); + ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize); + ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride); + + effect->lpVtbl->Release(effect); +} + START_TEST(effect) { ID3D10Device *device; @@ -614,6 +1128,7 @@ START_TEST(effect) test_effect_constant_buffer_type(device); test_effect_variable_type(device); test_effect_variable_member(device); + test_effect_variable_element(device); refcount = ID3D10Device_Release(device); ok(!refcount, "Device has %u references left\n", refcount);