From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2 (Matteo): Fix typo, improve code style.
dlls/d3d10/effect.c | 3 + dlls/d3d10/tests/effect.c | 127 ++++++++++++++++++++++++-------------- 2 files changed, 84 insertions(+), 46 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 30650eca82d..6d2f862f252 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -836,6 +836,7 @@ static D3D10_SHADER_VARIABLE_TYPE d3d10_variable_type(DWORD t, BOOL is_object, D *flags = D3D10_EOT_FLAG_GS_SO; return D3D10_SVT_GEOMETRYSHADER;
+ case 9: return D3D10_SVT_TEXTURE; case 10: return D3D10_SVT_TEXTURE1D; case 11: return D3D10_SVT_TEXTURE1DARRAY; case 12: return D3D10_SVT_TEXTURE2D; @@ -1158,6 +1159,7 @@ static void set_variable_vtbl(struct d3d10_effect_variable *v) *vtbl = (const ID3D10EffectVariableVtbl *)&d3d10_effect_string_variable_vtbl; break;
+ case D3D10_SVT_TEXTURE: case D3D10_SVT_TEXTURE1D: case D3D10_SVT_TEXTURE1DARRAY: case D3D10_SVT_TEXTURE2D: @@ -2119,6 +2121,7 @@ static HRESULT parse_fx10_local_variable(const char *data, size_t data_size,
switch (v->type->basetype) { + case D3D10_SVT_TEXTURE: case D3D10_SVT_TEXTURE1D: case D3D10_SVT_TEXTURE1DARRAY: case D3D10_SVT_TEXTURE2D: diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index a7fef6433fa..5e548a96172 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -1256,6 +1256,7 @@ RasterizerState rast; SamplerState sam; RenderTargetView rtv; DepthStencilView dsv; +Texture t0; Texture1D t1; Texture1DArray t1a; Texture2D t2; @@ -1274,9 +1275,9 @@ SamplerState sam2[2]; #endif static DWORD fx_test_evtc[] = { - 0x43425844, 0x2f42ba4c, 0x2e600cca, 0x3cf98c90, 0xab9f5124, 0x00000001, 0x00000768, 0x00000001, - 0x00000024, 0x30315846, 0x0000073c, 0xfeff1001, 0x00000001, 0x00000004, 0x00000015, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x0000046c, 0x00000000, 0x00000008, 0x00000003, 0x00000003, + 0x43425844, 0xbcafa6f1, 0x8baf9e54, 0x8e1fd2ef, 0x115ba370, 0x00000001, 0x000007a3, 0x00000001, + 0x00000024, 0x30315846, 0x00000777, 0xfeff1001, 0x00000001, 0x00000004, 0x00000016, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000493, 0x00000000, 0x00000009, 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000001, 0x00000001, 0x00000004, 0x00000000, 0x00000000, 0x53006263, 0x6e697274, 0x00070067, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00730000, 0x49525453, 0x7300474e, 0x6c660032, 0x0074616f, 0x00000036, 0x00000001, 0x00000000, @@ -1293,47 +1294,49 @@ static DWORD fx_test_evtc[] = 0x73000000, 0x52006d61, 0x65646e65, 0x72615472, 0x56746567, 0x00776569, 0x0000018f, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000013, 0x00767472, 0x74706544, 0x65745368, 0x6c69636e, 0x77656956, 0x0001c000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00001400, 0x76736400, 0x78655400, 0x65727574, 0xf1004431, 0x02000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x0a000000, 0x74000000, 0x65540031, 0x72757478, 0x41443165, 0x79617272, - 0x00021a00, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000b00, 0x61317400, - 0x78655400, 0x65727574, 0x49004432, 0x02000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x0c000000, 0x74000000, 0x65540032, 0x72757478, 0x4d443265, 0x02720053, 0x00020000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x000e0000, 0x32740000, 0x00736d64, 0x74786554, 0x32657275, - 0x72724144, 0xa0007961, 0x02000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0d000000, - 0x74000000, 0x54006132, 0x75747865, 0x44326572, 0x7241534d, 0x00796172, 0x000002cf, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000f, 0x6d643274, 0x54006173, 0x75747865, - 0x44336572, 0x00030300, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001000, - 0x00337400, 0x74786554, 0x43657275, 0x00656275, 0x0000032c, 0x00000002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000011, 0x47007174, 0x656d6f65, 0x53797274, 0x65646168, 0x03570072, - 0x00020000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00070000, 0x73670000, 0x78695000, - 0x68536c65, 0x72656461, 0x00038500, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000500, 0x00737000, 0x74726556, 0x68537865, 0x72656461, 0x0003b000, 0x00000200, 0x00000100, - 0x00000000, 0x00000000, 0x00000000, 0x00000600, 0x00737600, 0x000000c9, 0x00000002, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x6e656c62, 0xf6003264, 0x02000000, 0x02000000, - 0x00000000, 0x00000000, 0x00000000, 0x03000000, 0x64000000, 0x68747065, 0x6e657473, 0x326c6963, - 0x00013100, 0x00000200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0x73617200, - 0x62003274, 0x02000001, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x15000000, 0x73000000, - 0x00326d61, 0x00000004, 0x00000060, 0x00000000, 0x00000004, 0xffffffff, 0x00000002, 0x0000002a, - 0x0000000e, 0x0000002c, 0x00000033, 0x0000000e, 0x0000002c, 0x00000058, 0x0000003c, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000007b, 0x0000005f, 0x00000000, 0x00000004, - 0x00000000, 0x00000000, 0x00000000, 0x000000a1, 0x00000085, 0x00000000, 0x00000010, 0x00000000, - 0x00000000, 0x00000000, 0x000000c7, 0x000000ab, 0x00000000, 0x00000040, 0x00000000, 0x00000000, - 0x00000000, 0x000000f0, 0x000000d4, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000124, - 0x00000108, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x0000015d, 0x00000141, 0x00000000, - 0xffffffff, 0x00000000, 0x00000000, 0x0000018b, 0x0000016f, 0x00000000, 0xffffffff, 0x00000000, - 0x00000000, 0x000001bc, 0x000001a0, 0x00000000, 0xffffffff, 0x00000000, 0x000001ed, 0x000001d1, - 0x00000000, 0xffffffff, 0x00000000, 0x00000217, 0x000001fb, 0x00000000, 0xffffffff, 0x00000000, - 0x00000245, 0x00000229, 0x00000000, 0xffffffff, 0x00000000, 0x0000026f, 0x00000253, 0x00000000, - 0xffffffff, 0x00000000, 0x0000029a, 0x0000027e, 0x00000000, 0xffffffff, 0x00000000, 0x000002cb, - 0x000002af, 0x00000000, 0xffffffff, 0x00000000, 0x000002fc, 0x000002e0, 0x00000000, 0xffffffff, - 0x00000000, 0x00000329, 0x0000030d, 0x00000000, 0xffffffff, 0x00000000, 0x00000354, 0x00000338, - 0x00000000, 0xffffffff, 0x00000000, 0x00000382, 0x00000366, 0x00000000, 0xffffffff, 0x00000000, - 0x00000000, 0x00000000, 0x000003ad, 0x00000391, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, - 0x000003d9, 0x000003bd, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x000003f8, 0x000003dc, - 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x0000041b, 0x000003ff, 0x00000000, - 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000445, 0x00000429, 0x00000000, 0xffffffff, - 0x00000000, 0x00000000, 0x00000000, 0x00000467, 0x0000044b, 0x00000000, 0xffffffff, 0x00000000, - 0x00000000, 0x00000000, + 0x00001400, 0x76736400, 0x78657400, 0x65727574, 0x0001f100, 0x00000200, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000900, 0x00307400, 0x74786554, 0x31657275, 0x02180044, 0x00020000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000a0000, 0x31740000, 0x78655400, 0x65727574, + 0x72414431, 0x00796172, 0x00000241, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x0000000b, 0x00613174, 0x74786554, 0x32657275, 0x02700044, 0x00020000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x000c0000, 0x32740000, 0x78655400, 0x65727574, 0x534d4432, 0x00029900, + 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000e00, 0x64327400, 0x5400736d, + 0x75747865, 0x44326572, 0x61727241, 0x02c70079, 0x00020000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x000d0000, 0x32740000, 0x65540061, 0x72757478, 0x4d443265, 0x72724153, 0xf6007961, + 0x02000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0f000000, 0x74000000, 0x736d6432, + 0x65540061, 0x72757478, 0x00443365, 0x0000032a, 0x00000002, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000010, 0x54003374, 0x75747865, 0x75436572, 0x53006562, 0x02000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x11000000, 0x74000000, 0x65470071, 0x74656d6f, 0x68537972, + 0x72656461, 0x00037e00, 0x00000200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000700, + 0x00736700, 0x65786950, 0x6168536c, 0x00726564, 0x000003ac, 0x00000002, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000005, 0x56007370, 0x65747265, 0x61685378, 0x00726564, 0x000003d7, + 0x00000002, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000006, 0xc9007376, 0x02000000, + 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x62000000, 0x646e656c, 0x00f60032, + 0x00020000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00030000, 0x65640000, 0x73687470, + 0x636e6574, 0x00326c69, 0x00000131, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, + 0x00000004, 0x74736172, 0x01620032, 0x00020000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, + 0x00150000, 0x61730000, 0x0400326d, 0x60000000, 0x00000000, 0x04000000, 0xff000000, 0x02ffffff, + 0x2a000000, 0x0e000000, 0x2c000000, 0x33000000, 0x0e000000, 0x2c000000, 0x58000000, 0x3c000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7b000000, 0x5f000000, 0x00000000, + 0x04000000, 0x00000000, 0x00000000, 0x00000000, 0xa1000000, 0x85000000, 0x00000000, 0x10000000, + 0x00000000, 0x00000000, 0x00000000, 0xc7000000, 0xab000000, 0x00000000, 0x40000000, 0x00000000, + 0x00000000, 0x00000000, 0xf0000000, 0xd4000000, 0x00000000, 0xff000000, 0x00ffffff, 0x00000000, + 0x24000000, 0x08000001, 0x00000001, 0xff000000, 0x00ffffff, 0x00000000, 0x5d000000, 0x41000001, + 0x00000001, 0xff000000, 0x00ffffff, 0x00000000, 0x8b000000, 0x6f000001, 0x00000001, 0xff000000, + 0x00ffffff, 0x00000000, 0xbc000000, 0xa0000001, 0x00000001, 0xff000000, 0x00ffffff, 0xed000000, + 0xd1000001, 0x00000001, 0xff000000, 0x00ffffff, 0x15000000, 0xf9000002, 0x00000001, 0xff000000, + 0x00ffffff, 0x3e000000, 0x22000002, 0x00000002, 0xff000000, 0x00ffffff, 0x6c000000, 0x50000002, + 0x00000002, 0xff000000, 0x00ffffff, 0x96000000, 0x7a000002, 0x00000002, 0xff000000, 0x00ffffff, + 0xc1000000, 0xa5000002, 0x00000002, 0xff000000, 0x00ffffff, 0xf2000000, 0xd6000002, 0x00000002, + 0xff000000, 0x00ffffff, 0x23000000, 0x07000003, 0x00000003, 0xff000000, 0x00ffffff, 0x50000000, + 0x34000003, 0x00000003, 0xff000000, 0x00ffffff, 0x7b000000, 0x5f000003, 0x00000003, 0xff000000, + 0x00ffffff, 0xa9000000, 0x8d000003, 0x00000003, 0xff000000, 0x00ffffff, 0x00000000, 0x00000000, + 0xd4000000, 0xb8000003, 0x00000003, 0xff000000, 0x00ffffff, 0x00000000, 0x00000000, 0xe4000004, + 0x00000003, 0xff000000, 0x00ffffff, 0x00000000, 0x1f000000, 0x03000004, 0x00000004, 0xff000000, + 0x00ffffff, 0x00000000, 0x00000000, 0x42000000, 0x26000004, 0x00000004, 0xff000000, 0x00ffffff, + 0x00000000, 0x00000000, 0x6c000000, 0x50000004, 0x00000004, 0xff000000, 0x00ffffff, 0x00000000, + 0x00000000, 0x8e000000, 0x72000004, 0x00000004, 0xff000000, 0x00ffffff, 0x00000000, 0x00000000, + 0x00000000, };
static BOOL is_valid_check(BOOL a, BOOL b) @@ -1411,7 +1414,7 @@ static void check_as(ID3D10EffectVariable *variable)
variable2 = (ID3D10EffectVariable *)variable->lpVtbl->AsShaderResource(variable); is_valid = variable2->lpVtbl->IsValid(variable2); - ret = is_valid_check(is_valid, td.Type == D3D10_SVT_TEXTURE1D + ret = is_valid_check(is_valid, td.Type == D3D10_SVT_TEXTURE || td.Type == D3D10_SVT_TEXTURE1D || td.Type == D3D10_SVT_TEXTURE1DARRAY || td.Type == D3D10_SVT_TEXTURE2D || td.Type == D3D10_SVT_TEXTURE2DMS || td.Type == D3D10_SVT_TEXTURE2DARRAY || td.Type == D3D10_SVT_TEXTURE2DMSARRAY || td.Type == D3D10_SVT_TEXTURE3D @@ -1457,7 +1460,7 @@ static void test_effect_variable_type_class(void) effect_desc.ConstantBuffers); ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n", effect_desc.SharedConstantBuffers); - ok(effect_desc.GlobalVariables == 25, "Unexpected global variables count %u.\n", + ok(effect_desc.GlobalVariables == 26, "Unexpected global variables count %u.\n", effect_desc.GlobalVariables); ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n", effect_desc.SharedGlobalVariables); @@ -1873,6 +1876,38 @@ static void test_effect_variable_type_class(void) ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize); ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
+ /* check Texture t0 */ + variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++); + hr = variable->lpVtbl->GetDesc(variable, &vd); + ok(SUCCEEDED(hr), "Unexpected hr %#x.\n", hr); + + ok(!strcmp(vd.Name, "t0"), "Unexpected Name "%s".\n", vd.Name); + ok(!vd.Semantic, "Unexpected Semantic "%s".\n", vd.Semantic); + ok(!vd.Flags, "Unexpected Flags %u.\n", vd.Flags); + ok(!vd.Annotations, "Unexpected Annotations %u.\n", vd.Annotations); + ok(!vd.BufferOffset, "Unexpected BufferOffset %u.\n", vd.BufferOffset); + ok(!vd.ExplicitBindPoint, "Unexpected ExplicitBindPoint %u.\n", vd.ExplicitBindPoint); + + check_as(variable); + + parent = variable->lpVtbl->GetParentConstantBuffer(variable); + ok(null_buffer == parent, "Unexpected parent %p.\n", parent); + + type = variable->lpVtbl->GetType(variable); + hr = type->lpVtbl->GetDesc(type, &td); + ok(SUCCEEDED(hr), "Unexpected hr %#x.\n", hr); + + ok(!strcmp(td.TypeName, "texture"), "Unexpected TypeName "%s".\n", td.TypeName); + ok(td.Class == D3D10_SVC_OBJECT, "Unexpected Class %x.\n", td.Class); + ok(td.Type == D3D10_SVT_TEXTURE, "Unexpected Type %x.\n", td.Type); + ok(!td.Elements, "Unexpected Elements %u.\n", td.Elements); + ok(!td.Members, "Unexpected Members %u.\n", td.Members); + ok(!td.Rows, "Unexpected Rows %u.\n", td.Rows); + ok(!td.Columns, "Unexpected Columns %u.\n", td.Columns); + ok(!td.PackedSize, "Unexpected PackedSize %#x.\n", td.PackedSize); + ok(!td.UnpackedSize, "Unexpected UnpackedSize %#x.\n", td.UnpackedSize); + ok(!td.Stride, "Unexpected Stride %#x.\n", td.Stride); + /* check Texture1D t1 */ variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++); hr = variable->lpVtbl->GetDesc(variable, &vd);