1*7ce1a24aSAmine Khaldi /*
2*7ce1a24aSAmine Khaldi  * Copyright 2010 Rico Schüller
3*7ce1a24aSAmine Khaldi  *
4*7ce1a24aSAmine Khaldi  * This library is free software; you can redistribute it and/or
5*7ce1a24aSAmine Khaldi  * modify it under the terms of the GNU Lesser General Public
6*7ce1a24aSAmine Khaldi  * License as published by the Free Software Foundation; either
7*7ce1a24aSAmine Khaldi  * version 2.1 of the License, or (at your option) any later version.
8*7ce1a24aSAmine Khaldi  *
9*7ce1a24aSAmine Khaldi  * This library is distributed in the hope that it will be useful,
10*7ce1a24aSAmine Khaldi  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11*7ce1a24aSAmine Khaldi  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12*7ce1a24aSAmine Khaldi  * Lesser General Public License for more details.
13*7ce1a24aSAmine Khaldi  *
14*7ce1a24aSAmine Khaldi  * You should have received a copy of the GNU Lesser General Public
15*7ce1a24aSAmine Khaldi  * License along with this library; if not, write to the Free Software
16*7ce1a24aSAmine Khaldi  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17*7ce1a24aSAmine Khaldi  */
18*7ce1a24aSAmine Khaldi 
19*7ce1a24aSAmine Khaldi /*
20*7ce1a24aSAmine Khaldi  * Nearly all compiler functions need the shader blob and the size. The size
21*7ce1a24aSAmine Khaldi  * is always located at DWORD #6 in the shader blob (blob[6]).
22*7ce1a24aSAmine Khaldi  * The functions are e.g.: D3DGet*SignatureBlob, D3DReflect
23*7ce1a24aSAmine Khaldi  */
24*7ce1a24aSAmine Khaldi 
25*7ce1a24aSAmine Khaldi #define COBJMACROS
26*7ce1a24aSAmine Khaldi #include "initguid.h"
27*7ce1a24aSAmine Khaldi #include "d3dcompiler.h"
28*7ce1a24aSAmine Khaldi #include "wine/test.h"
29*7ce1a24aSAmine Khaldi 
30*7ce1a24aSAmine Khaldi /* includes for older reflection interfaces */
31*7ce1a24aSAmine Khaldi #ifndef __REACTOS__
32*7ce1a24aSAmine Khaldi #include "d3d10.h"
33*7ce1a24aSAmine Khaldi #include "d3d10_1shader.h"
34*7ce1a24aSAmine Khaldi #endif
35*7ce1a24aSAmine Khaldi 
36*7ce1a24aSAmine Khaldi /*
37*7ce1a24aSAmine Khaldi  * This doesn't belong here, but for some functions it is possible to return that value,
38*7ce1a24aSAmine Khaldi  * see http://msdn.microsoft.com/en-us/library/bb205278%28v=VS.85%29.aspx
39*7ce1a24aSAmine Khaldi  * The original definition is in D3DX10core.h.
40*7ce1a24aSAmine Khaldi  */
41*7ce1a24aSAmine Khaldi #define D3DERR_INVALIDCALL 0x8876086c
42*7ce1a24aSAmine Khaldi 
43*7ce1a24aSAmine Khaldi static HRESULT (WINAPI *pD3DReflect)(const void *, SIZE_T, REFIID, void **);
44*7ce1a24aSAmine Khaldi 
45*7ce1a24aSAmine Khaldi /* Creator string for comparison - Version 9.29.952.3111 (43) */
46*7ce1a24aSAmine Khaldi static DWORD shader_creator[] = {
47*7ce1a24aSAmine Khaldi 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
48*7ce1a24aSAmine Khaldi 0x39207265, 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00,
49*7ce1a24aSAmine Khaldi };
50*7ce1a24aSAmine Khaldi 
51*7ce1a24aSAmine Khaldi /*
52*7ce1a24aSAmine Khaldi  * fxc.exe /E VS /Tvs_4_0 /Fx
53*7ce1a24aSAmine Khaldi  */
54*7ce1a24aSAmine Khaldi #if 0
55*7ce1a24aSAmine Khaldi float4 VS(float4 position : POSITION, float4 pos : SV_POSITION) : SV_POSITION
56*7ce1a24aSAmine Khaldi {
57*7ce1a24aSAmine Khaldi   return position;
58*7ce1a24aSAmine Khaldi }
59*7ce1a24aSAmine Khaldi #endif
60*7ce1a24aSAmine Khaldi 
61*7ce1a24aSAmine Khaldi #ifndef __REACTOS__
62*7ce1a24aSAmine Khaldi 
63*7ce1a24aSAmine Khaldi static DWORD test_reflection_blob[] = {
64*7ce1a24aSAmine Khaldi 0x43425844, 0x77c6324f, 0xfd27948a, 0xe6958d31, 0x53361cba, 0x00000001, 0x000001d8, 0x00000005,
65*7ce1a24aSAmine Khaldi 0x00000034, 0x0000008c, 0x000000e4, 0x00000118, 0x0000015c, 0x46454452, 0x00000050, 0x00000000,
66*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x0000001c, 0xfffe0400, 0x00000100, 0x0000001c, 0x7263694d, 0x666f736f,
67*7ce1a24aSAmine Khaldi 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
68*7ce1a24aSAmine Khaldi 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038,
69*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041, 0x00000000, 0x00000000,
70*7ce1a24aSAmine Khaldi 0x00000003, 0x00000001, 0x0000000f, 0x49534f50, 0x4e4f4954, 0x5f565300, 0x49534f50, 0x4e4f4954,
71*7ce1a24aSAmine Khaldi 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000001,
72*7ce1a24aSAmine Khaldi 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x52444853, 0x0000003c,
73*7ce1a24aSAmine Khaldi 0x00010040, 0x0000000f, 0x0300005f, 0x001010f2, 0x00000000, 0x04000067, 0x001020f2, 0x00000000,
74*7ce1a24aSAmine Khaldi 0x00000001, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000000, 0x0100003e, 0x54415453,
75*7ce1a24aSAmine Khaldi 0x00000074, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
76*7ce1a24aSAmine Khaldi 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
77*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
78*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
79*7ce1a24aSAmine Khaldi };
80*7ce1a24aSAmine Khaldi 
test_reflection_references(void)81*7ce1a24aSAmine Khaldi static void test_reflection_references(void)
82*7ce1a24aSAmine Khaldi {
83*7ce1a24aSAmine Khaldi     HRESULT hr;
84*7ce1a24aSAmine Khaldi     ULONG count;
85*7ce1a24aSAmine Khaldi     ID3D11ShaderReflection *ref11, *ref11_test;
86*7ce1a24aSAmine Khaldi     ID3D10ShaderReflection *ref10;
87*7ce1a24aSAmine Khaldi     ID3D10ShaderReflection1 *ref10_1;
88*7ce1a24aSAmine Khaldi 
89*7ce1a24aSAmine Khaldi     hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
90*7ce1a24aSAmine Khaldi     ok(hr == S_OK, "D3DReflect failed, got %x, expected %x\n", hr, S_OK);
91*7ce1a24aSAmine Khaldi 
92*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D11ShaderReflection, (void **)&ref11_test);
93*7ce1a24aSAmine Khaldi     ok(hr == S_OK, "QueryInterface failed, got %x, expected %x\n", hr, S_OK);
94*7ce1a24aSAmine Khaldi 
95*7ce1a24aSAmine Khaldi     count = ref11_test->lpVtbl->Release(ref11_test);
96*7ce1a24aSAmine Khaldi     ok(count == 1, "Release failed %u\n", count);
97*7ce1a24aSAmine Khaldi 
98*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D10ShaderReflection, (void **)&ref10);
99*7ce1a24aSAmine Khaldi     ok(hr == E_NOINTERFACE, "QueryInterface failed, got %x, expected %x\n", hr, E_NOINTERFACE);
100*7ce1a24aSAmine Khaldi 
101*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
102*7ce1a24aSAmine Khaldi     ok(hr == E_NOINTERFACE, "QueryInterface failed, got %x, expected %x\n", hr, E_NOINTERFACE);
103*7ce1a24aSAmine Khaldi 
104*7ce1a24aSAmine Khaldi     count = ref11->lpVtbl->Release(ref11);
105*7ce1a24aSAmine Khaldi     ok(count == 0, "Release failed %u\n", count);
106*7ce1a24aSAmine Khaldi 
107*7ce1a24aSAmine Khaldi     /* check invalid cases */
108*7ce1a24aSAmine Khaldi     hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D10ShaderReflection, (void **)&ref10);
109*7ce1a24aSAmine Khaldi     ok(hr == E_NOINTERFACE, "D3DReflect failed, got %x, expected %x\n", hr, E_NOINTERFACE);
110*7ce1a24aSAmine Khaldi 
111*7ce1a24aSAmine Khaldi     hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
112*7ce1a24aSAmine Khaldi     ok(hr == E_NOINTERFACE, "D3DReflect failed, got %x, expected %x\n", hr, E_NOINTERFACE);
113*7ce1a24aSAmine Khaldi 
114*7ce1a24aSAmine Khaldi     hr = pD3DReflect(NULL, test_reflection_blob[6], &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
115*7ce1a24aSAmine Khaldi     ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
116*7ce1a24aSAmine Khaldi 
117*7ce1a24aSAmine Khaldi     hr = pD3DReflect(NULL, test_reflection_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
118*7ce1a24aSAmine Khaldi     ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
119*7ce1a24aSAmine Khaldi 
120*7ce1a24aSAmine Khaldi     /* returns different errors with different sizes */
121*7ce1a24aSAmine Khaldi     hr = pD3DReflect(test_reflection_blob, 31, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
122*7ce1a24aSAmine Khaldi     ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
123*7ce1a24aSAmine Khaldi 
124*7ce1a24aSAmine Khaldi     hr = pD3DReflect(test_reflection_blob,  32, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
125*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL);
126*7ce1a24aSAmine Khaldi 
127*7ce1a24aSAmine Khaldi     hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6]-1, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
128*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL);
129*7ce1a24aSAmine Khaldi 
130*7ce1a24aSAmine Khaldi     hr = pD3DReflect(test_reflection_blob,  31, &IID_ID3D11ShaderReflection, (void **)&ref11);
131*7ce1a24aSAmine Khaldi     ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
132*7ce1a24aSAmine Khaldi 
133*7ce1a24aSAmine Khaldi     hr = pD3DReflect(test_reflection_blob,  32, &IID_ID3D11ShaderReflection, (void **)&ref11);
134*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL);
135*7ce1a24aSAmine Khaldi 
136*7ce1a24aSAmine Khaldi     hr = pD3DReflect(test_reflection_blob,  test_reflection_blob[6]-1, &IID_ID3D11ShaderReflection, (void **)&ref11);
137*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL);
138*7ce1a24aSAmine Khaldi }
139*7ce1a24aSAmine Khaldi 
140*7ce1a24aSAmine Khaldi #endif /* !__REACTOS__ */
141*7ce1a24aSAmine Khaldi 
142*7ce1a24aSAmine Khaldi /*
143*7ce1a24aSAmine Khaldi  * fxc.exe /E VS /Tvs_4_1 /Fx
144*7ce1a24aSAmine Khaldi  */
145*7ce1a24aSAmine Khaldi #if 0
146*7ce1a24aSAmine Khaldi struct vsin
147*7ce1a24aSAmine Khaldi {
148*7ce1a24aSAmine Khaldi     float4 x : SV_position;
149*7ce1a24aSAmine Khaldi     float4 a : BINORMAL;
150*7ce1a24aSAmine Khaldi     uint b : BLENDINDICES;
151*7ce1a24aSAmine Khaldi     float c : BLENDWEIGHT;
152*7ce1a24aSAmine Khaldi     float4 d : COLOR;
153*7ce1a24aSAmine Khaldi     float4 d1 : COLOR1;
154*7ce1a24aSAmine Khaldi     float4 e : NORMAL;
155*7ce1a24aSAmine Khaldi     float4 f : POSITION;
156*7ce1a24aSAmine Khaldi     float4 g : POSITIONT;
157*7ce1a24aSAmine Khaldi     float h : PSIZE;
158*7ce1a24aSAmine Khaldi     float4 i : TANGENT;
159*7ce1a24aSAmine Khaldi     float4 j : TEXCOORD;
160*7ce1a24aSAmine Khaldi     uint k : SV_VertexID;
161*7ce1a24aSAmine Khaldi     uint l : SV_InstanceID;
162*7ce1a24aSAmine Khaldi     float m : testin;
163*7ce1a24aSAmine Khaldi };
164*7ce1a24aSAmine Khaldi struct vsout
165*7ce1a24aSAmine Khaldi {
166*7ce1a24aSAmine Khaldi     float4 x : SV_position;
167*7ce1a24aSAmine Khaldi     float4 a : COLOR0;
168*7ce1a24aSAmine Khaldi     float b : FOG;
169*7ce1a24aSAmine Khaldi     float4 c : POSITION0;
170*7ce1a24aSAmine Khaldi     float d : PSIZE;
171*7ce1a24aSAmine Khaldi     float e : TESSFACTOR0;
172*7ce1a24aSAmine Khaldi     float4 f : TEXCOORD0;
173*7ce1a24aSAmine Khaldi     float g : SV_ClipDistance0;
174*7ce1a24aSAmine Khaldi     float h : SV_CullDistance0;
175*7ce1a24aSAmine Khaldi     uint i : SV_InstanceID;
176*7ce1a24aSAmine Khaldi     float j : testout;
177*7ce1a24aSAmine Khaldi };
178*7ce1a24aSAmine Khaldi vsout VS(vsin x)
179*7ce1a24aSAmine Khaldi {
180*7ce1a24aSAmine Khaldi     vsout s;
181*7ce1a24aSAmine Khaldi     s.x = float4(1.6f, 0.3f, 0.1f, 0.0f);
182*7ce1a24aSAmine Khaldi     int y = 1;
183*7ce1a24aSAmine Khaldi     int p[5] = {1, 2, 3, 5, 4};
184*7ce1a24aSAmine Khaldi     y = y << (int) x.x.x & 0xf;
185*7ce1a24aSAmine Khaldi     s.x.x = p[y];
186*7ce1a24aSAmine Khaldi     s.a = x.d;
187*7ce1a24aSAmine Khaldi     s.b = x.c;
188*7ce1a24aSAmine Khaldi     s.c = x.f;
189*7ce1a24aSAmine Khaldi     s.d = x.h;
190*7ce1a24aSAmine Khaldi     s.e = x.h;
191*7ce1a24aSAmine Khaldi     s.f = x.j;
192*7ce1a24aSAmine Khaldi     s.g = 1.0f;
193*7ce1a24aSAmine Khaldi     s.h = 1.0f;
194*7ce1a24aSAmine Khaldi     s.i = 2;
195*7ce1a24aSAmine Khaldi     s.j = x.m;
196*7ce1a24aSAmine Khaldi     return s;
197*7ce1a24aSAmine Khaldi }
198*7ce1a24aSAmine Khaldi #endif
199*7ce1a24aSAmine Khaldi static DWORD test_reflection_desc_vs_blob[] = {
200*7ce1a24aSAmine Khaldi 0x43425844, 0xb65955ac, 0xcea1cb75, 0x06c5a1ad, 0x8a555fa1, 0x00000001, 0x0000076c, 0x00000005,
201*7ce1a24aSAmine Khaldi 0x00000034, 0x0000008c, 0x0000028c, 0x00000414, 0x000006f0, 0x46454452, 0x00000050, 0x00000000,
202*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x0000001c, 0xfffe0401, 0x00000100, 0x0000001c, 0x7263694d, 0x666f736f,
203*7ce1a24aSAmine Khaldi 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
204*7ce1a24aSAmine Khaldi 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x000001f8, 0x0000000f, 0x00000008, 0x00000170,
205*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000010f, 0x0000017c, 0x00000000, 0x00000000,
206*7ce1a24aSAmine Khaldi 0x00000003, 0x00000001, 0x0000000f, 0x00000185, 0x00000000, 0x00000000, 0x00000001, 0x00000002,
207*7ce1a24aSAmine Khaldi 0x00000001, 0x00000192, 0x00000000, 0x00000000, 0x00000003, 0x00000003, 0x00000101, 0x0000019e,
208*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x00000f0f, 0x0000019e, 0x00000001, 0x00000000,
209*7ce1a24aSAmine Khaldi 0x00000003, 0x00000005, 0x0000000f, 0x000001a4, 0x00000000, 0x00000000, 0x00000003, 0x00000006,
210*7ce1a24aSAmine Khaldi 0x0000000f, 0x000001ab, 0x00000000, 0x00000000, 0x00000003, 0x00000007, 0x00000f0f, 0x000001b4,
211*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000003, 0x00000008, 0x0000000f, 0x000001be, 0x00000000, 0x00000000,
212*7ce1a24aSAmine Khaldi 0x00000003, 0x00000009, 0x00000101, 0x000001c4, 0x00000000, 0x00000000, 0x00000003, 0x0000000a,
213*7ce1a24aSAmine Khaldi 0x0000000f, 0x000001cc, 0x00000000, 0x00000000, 0x00000003, 0x0000000b, 0x00000f0f, 0x000001d5,
214*7ce1a24aSAmine Khaldi 0x00000000, 0x00000006, 0x00000001, 0x0000000c, 0x00000001, 0x000001e1, 0x00000000, 0x00000008,
215*7ce1a24aSAmine Khaldi 0x00000001, 0x0000000d, 0x00000001, 0x000001ef, 0x00000000, 0x00000000, 0x00000003, 0x0000000e,
216*7ce1a24aSAmine Khaldi 0x00000101, 0x705f5653, 0x7469736f, 0x006e6f69, 0x4f4e4942, 0x4c414d52, 0x454c4200, 0x4e49444e,
217*7ce1a24aSAmine Khaldi 0x45434944, 0x4c420053, 0x57444e45, 0x48474945, 0x4f430054, 0x00524f4c, 0x4d524f4e, 0x50004c41,
218*7ce1a24aSAmine Khaldi 0x5449534f, 0x004e4f49, 0x49534f50, 0x4e4f4954, 0x53500054, 0x00455a49, 0x474e4154, 0x00544e45,
219*7ce1a24aSAmine Khaldi 0x43584554, 0x44524f4f, 0x5f565300, 0x74726556, 0x44497865, 0x5f565300, 0x74736e49, 0x65636e61,
220*7ce1a24aSAmine Khaldi 0x74004449, 0x69747365, 0xabab006e, 0x4e47534f, 0x00000180, 0x0000000b, 0x00000008, 0x00000110,
221*7ce1a24aSAmine Khaldi 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000011c, 0x00000000, 0x00000000,
222*7ce1a24aSAmine Khaldi 0x00000003, 0x00000001, 0x0000000f, 0x00000122, 0x00000000, 0x00000000, 0x00000003, 0x00000002,
223*7ce1a24aSAmine Khaldi 0x00000e01, 0x00000126, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000d02, 0x0000012c,
224*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000b04, 0x00000137, 0x00000000, 0x00000000,
225*7ce1a24aSAmine Khaldi 0x00000003, 0x00000002, 0x00000708, 0x0000013f, 0x00000000, 0x00000000, 0x00000003, 0x00000003,
226*7ce1a24aSAmine Khaldi 0x0000000f, 0x00000148, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x0000000f, 0x00000151,
227*7ce1a24aSAmine Khaldi 0x00000000, 0x00000002, 0x00000003, 0x00000005, 0x00000e01, 0x00000161, 0x00000000, 0x00000003,
228*7ce1a24aSAmine Khaldi 0x00000003, 0x00000005, 0x00000d02, 0x00000171, 0x00000000, 0x00000000, 0x00000001, 0x00000006,
229*7ce1a24aSAmine Khaldi 0x00000e01, 0x705f5653, 0x7469736f, 0x006e6f69, 0x4f4c4f43, 0x4f460052, 0x53500047, 0x00455a49,
230*7ce1a24aSAmine Khaldi 0x53534554, 0x54434146, 0x7400524f, 0x6f747365, 0x50007475, 0x5449534f, 0x004e4f49, 0x43584554,
231*7ce1a24aSAmine Khaldi 0x44524f4f, 0x5f565300, 0x70696c43, 0x74736944, 0x65636e61, 0x5f565300, 0x6c6c7543, 0x74736944,
232*7ce1a24aSAmine Khaldi 0x65636e61, 0x5f565300, 0x74736e49, 0x65636e61, 0xab004449, 0x52444853, 0x000002d4, 0x00010041,
233*7ce1a24aSAmine Khaldi 0x000000b5, 0x0100086a, 0x0300005f, 0x00101012, 0x00000000, 0x0300005f, 0x00101012, 0x00000003,
234*7ce1a24aSAmine Khaldi 0x0300005f, 0x001010f2, 0x00000004, 0x0300005f, 0x001010f2, 0x00000007, 0x0300005f, 0x00101012,
235*7ce1a24aSAmine Khaldi 0x00000009, 0x0300005f, 0x001010f2, 0x0000000b, 0x0300005f, 0x00101012, 0x0000000e, 0x04000067,
236*7ce1a24aSAmine Khaldi 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000001, 0x03000065, 0x00102012,
237*7ce1a24aSAmine Khaldi 0x00000002, 0x03000065, 0x00102022, 0x00000002, 0x03000065, 0x00102042, 0x00000002, 0x03000065,
238*7ce1a24aSAmine Khaldi 0x00102082, 0x00000002, 0x03000065, 0x001020f2, 0x00000003, 0x03000065, 0x001020f2, 0x00000004,
239*7ce1a24aSAmine Khaldi 0x04000067, 0x00102012, 0x00000005, 0x00000002, 0x04000067, 0x00102022, 0x00000005, 0x00000003,
240*7ce1a24aSAmine Khaldi 0x03000065, 0x00102012, 0x00000006, 0x02000068, 0x00000001, 0x04000069, 0x00000000, 0x00000005,
241*7ce1a24aSAmine Khaldi 0x00000004, 0x06000036, 0x00203012, 0x00000000, 0x00000000, 0x00004001, 0x00000001, 0x06000036,
242*7ce1a24aSAmine Khaldi 0x00203012, 0x00000000, 0x00000001, 0x00004001, 0x00000002, 0x06000036, 0x00203012, 0x00000000,
243*7ce1a24aSAmine Khaldi 0x00000002, 0x00004001, 0x00000003, 0x06000036, 0x00203012, 0x00000000, 0x00000003, 0x00004001,
244*7ce1a24aSAmine Khaldi 0x00000005, 0x06000036, 0x00203012, 0x00000000, 0x00000004, 0x00004001, 0x00000004, 0x0500001b,
245*7ce1a24aSAmine Khaldi 0x00100012, 0x00000000, 0x0010100a, 0x00000000, 0x07000029, 0x00100012, 0x00000000, 0x00004001,
246*7ce1a24aSAmine Khaldi 0x00000001, 0x0010000a, 0x00000000, 0x07000001, 0x00100012, 0x00000000, 0x0010000a, 0x00000000,
247*7ce1a24aSAmine Khaldi 0x00004001, 0x0000000f, 0x07000036, 0x00100012, 0x00000000, 0x0420300a, 0x00000000, 0x0010000a,
248*7ce1a24aSAmine Khaldi 0x00000000, 0x0500002b, 0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x08000036, 0x001020e2,
249*7ce1a24aSAmine Khaldi 0x00000000, 0x00004002, 0x00000000, 0x3e99999a, 0x3dcccccd, 0x00000000, 0x05000036, 0x001020f2,
250*7ce1a24aSAmine Khaldi 0x00000001, 0x00101e46, 0x00000004, 0x05000036, 0x00102012, 0x00000002, 0x0010100a, 0x00000003,
251*7ce1a24aSAmine Khaldi 0x05000036, 0x00102062, 0x00000002, 0x00101006, 0x00000009, 0x05000036, 0x00102082, 0x00000002,
252*7ce1a24aSAmine Khaldi 0x0010100a, 0x0000000e, 0x05000036, 0x001020f2, 0x00000003, 0x00101e46, 0x00000007, 0x05000036,
253*7ce1a24aSAmine Khaldi 0x001020f2, 0x00000004, 0x00101e46, 0x0000000b, 0x05000036, 0x00102012, 0x00000005, 0x00004001,
254*7ce1a24aSAmine Khaldi 0x3f800000, 0x05000036, 0x00102022, 0x00000005, 0x00004001, 0x3f800000, 0x05000036, 0x00102012,
255*7ce1a24aSAmine Khaldi 0x00000006, 0x00004001, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000015, 0x00000001,
256*7ce1a24aSAmine Khaldi 0x00000000, 0x00000012, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000000,
257*7ce1a24aSAmine Khaldi 0x00000005, 0x00000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
258*7ce1a24aSAmine Khaldi 0x00000000, 0x0000000a, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
259*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000,
260*7ce1a24aSAmine Khaldi };
261*7ce1a24aSAmine Khaldi 
262*7ce1a24aSAmine Khaldi static const D3D11_SIGNATURE_PARAMETER_DESC test_reflection_desc_vs_resultin[] =
263*7ce1a24aSAmine Khaldi {
264*7ce1a24aSAmine Khaldi     {"SV_position", 0, 0, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x1, 0},
265*7ce1a24aSAmine Khaldi     {"BINORMAL", 0, 1, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
266*7ce1a24aSAmine Khaldi     {"BLENDINDICES", 0, 2, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0x0, 0},
267*7ce1a24aSAmine Khaldi     {"BLENDWEIGHT", 0, 3, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0x1, 0},
268*7ce1a24aSAmine Khaldi     {"COLOR", 0, 4, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0xf, 0},
269*7ce1a24aSAmine Khaldi     {"COLOR", 1, 5, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
270*7ce1a24aSAmine Khaldi     {"NORMAL", 0, 6, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
271*7ce1a24aSAmine Khaldi     {"POSITION", 0, 7, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0xf, 0},
272*7ce1a24aSAmine Khaldi     {"POSITIONT", 0, 8, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
273*7ce1a24aSAmine Khaldi     {"PSIZE", 0, 9, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0x1, 0},
274*7ce1a24aSAmine Khaldi     {"TANGENT", 0, 10, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
275*7ce1a24aSAmine Khaldi     {"TEXCOORD", 0, 11, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0xf, 0},
276*7ce1a24aSAmine Khaldi     {"SV_VertexID", 0, 12, D3D_NAME_VERTEX_ID, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0x0, 0},
277*7ce1a24aSAmine Khaldi     {"SV_InstanceID", 0, 13, D3D_NAME_INSTANCE_ID, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0x0, 0},
278*7ce1a24aSAmine Khaldi     {"testin", 0, 14, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0x1, 0},
279*7ce1a24aSAmine Khaldi };
280*7ce1a24aSAmine Khaldi 
281*7ce1a24aSAmine Khaldi static const D3D11_SIGNATURE_PARAMETER_DESC test_reflection_desc_vs_resultout[] =
282*7ce1a24aSAmine Khaldi {
283*7ce1a24aSAmine Khaldi     {"SV_position", 0, 0, D3D_NAME_POSITION, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
284*7ce1a24aSAmine Khaldi     {"COLOR", 0, 1, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
285*7ce1a24aSAmine Khaldi     {"FOG", 0, 2, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
286*7ce1a24aSAmine Khaldi     {"PSIZE", 0, 2, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x2, 0xd, 0},
287*7ce1a24aSAmine Khaldi     {"TESSFACTOR", 0, 2, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x4, 0xb, 0},
288*7ce1a24aSAmine Khaldi     {"testout", 0, 2, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x8, 0x7, 0},
289*7ce1a24aSAmine Khaldi     {"POSITION", 0, 3, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
290*7ce1a24aSAmine Khaldi     {"TEXCOORD", 0, 4, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
291*7ce1a24aSAmine Khaldi     {"SV_ClipDistance", 0, 5, D3D_NAME_CLIP_DISTANCE, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
292*7ce1a24aSAmine Khaldi     {"SV_CullDistance", 0, 5, D3D_NAME_CULL_DISTANCE, D3D_REGISTER_COMPONENT_FLOAT32, 0x2, 0xd, 0},
293*7ce1a24aSAmine Khaldi     {"SV_InstanceID", 0, 6, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0xe, 0},
294*7ce1a24aSAmine Khaldi };
295*7ce1a24aSAmine Khaldi 
test_reflection_desc_vs(void)296*7ce1a24aSAmine Khaldi static void test_reflection_desc_vs(void)
297*7ce1a24aSAmine Khaldi {
298*7ce1a24aSAmine Khaldi     HRESULT hr;
299*7ce1a24aSAmine Khaldi     ULONG count;
300*7ce1a24aSAmine Khaldi     ID3D11ShaderReflection *ref11;
301*7ce1a24aSAmine Khaldi     D3D11_SHADER_DESC sdesc11 = {0};
302*7ce1a24aSAmine Khaldi     D3D11_SIGNATURE_PARAMETER_DESC desc = {0};
303*7ce1a24aSAmine Khaldi     const D3D11_SIGNATURE_PARAMETER_DESC *pdesc;
304*7ce1a24aSAmine Khaldi     UINT ret;
305*7ce1a24aSAmine Khaldi     unsigned int i;
306*7ce1a24aSAmine Khaldi 
307*7ce1a24aSAmine Khaldi     hr = pD3DReflect(test_reflection_desc_vs_blob, test_reflection_desc_vs_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
308*7ce1a24aSAmine Khaldi     ok(hr == S_OK, "D3DReflect failed %x\n", hr);
309*7ce1a24aSAmine Khaldi 
310*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->GetDesc(ref11, NULL);
311*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "GetDesc failed %x\n", hr);
312*7ce1a24aSAmine Khaldi 
313*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->GetDesc(ref11, &sdesc11);
314*7ce1a24aSAmine Khaldi     ok(hr == S_OK, "GetDesc failed %x\n", hr);
315*7ce1a24aSAmine Khaldi 
316*7ce1a24aSAmine Khaldi     ok(sdesc11.Version == 65601, "GetDesc failed, got %u, expected %u\n", sdesc11.Version, 65601);
317*7ce1a24aSAmine Khaldi     ok(strcmp(sdesc11.Creator, (char*) shader_creator) == 0, "GetDesc failed, got \"%s\", expected \"%s\"\n", sdesc11.Creator, (char*)shader_creator);
318*7ce1a24aSAmine Khaldi     ok(sdesc11.Flags == 256, "GetDesc failed, got %u, expected %u\n", sdesc11.Flags, 256);
319*7ce1a24aSAmine Khaldi     ok(sdesc11.ConstantBuffers == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.ConstantBuffers, 0);
320*7ce1a24aSAmine Khaldi     ok(sdesc11.BoundResources == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.BoundResources, 0);
321*7ce1a24aSAmine Khaldi     ok(sdesc11.InputParameters == 15, "GetDesc failed, got %u, expected %u\n", sdesc11.InputParameters, 15);
322*7ce1a24aSAmine Khaldi     ok(sdesc11.OutputParameters == 11, "GetDesc failed, got %u, expected %u\n", sdesc11.OutputParameters, 11);
323*7ce1a24aSAmine Khaldi     ok(sdesc11.InstructionCount == 21, "GetDesc failed, got %u, expected %u\n", sdesc11.InstructionCount, 21);
324*7ce1a24aSAmine Khaldi     ok(sdesc11.TempRegisterCount == 1, "GetDesc failed, got %u, expected %u\n", sdesc11.TempRegisterCount, 1);
325*7ce1a24aSAmine Khaldi     ok(sdesc11.TempArrayCount == 5, "GetDesc failed, got %u, expected %u\n", sdesc11.TempArrayCount, 5);
326*7ce1a24aSAmine Khaldi     ok(sdesc11.DefCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.DefCount, 0);
327*7ce1a24aSAmine Khaldi     ok(sdesc11.DclCount == 18, "GetDesc failed, got %u, expected %u\n", sdesc11.DclCount, 18);
328*7ce1a24aSAmine Khaldi     ok(sdesc11.TextureNormalInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureNormalInstructions, 0);
329*7ce1a24aSAmine Khaldi     ok(sdesc11.TextureLoadInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureLoadInstructions, 0);
330*7ce1a24aSAmine Khaldi     ok(sdesc11.TextureCompInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureCompInstructions, 0);
331*7ce1a24aSAmine Khaldi     ok(sdesc11.TextureBiasInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureBiasInstructions, 0);
332*7ce1a24aSAmine Khaldi     ok(sdesc11.TextureGradientInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureGradientInstructions, 0);
333*7ce1a24aSAmine Khaldi     ok(sdesc11.FloatInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.FloatInstructionCount, 0);
334*7ce1a24aSAmine Khaldi     ok(sdesc11.IntInstructionCount == 1, "GetDesc failed, got %u, expected %u\n", sdesc11.IntInstructionCount, 1);
335*7ce1a24aSAmine Khaldi     ok(sdesc11.UintInstructionCount == 1, "GetDesc failed, got %u, expected %u\n", sdesc11.UintInstructionCount, 1);
336*7ce1a24aSAmine Khaldi     ok(sdesc11.StaticFlowControlCount == 1, "GetDesc failed, got %u, expected %u\n", sdesc11.StaticFlowControlCount, 1);
337*7ce1a24aSAmine Khaldi     ok(sdesc11.DynamicFlowControlCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.DynamicFlowControlCount, 0);
338*7ce1a24aSAmine Khaldi     ok(sdesc11.MacroInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.MacroInstructionCount, 0);
339*7ce1a24aSAmine Khaldi     ok(sdesc11.ArrayInstructionCount == 6, "GetDesc failed, got %u, expected %u\n", sdesc11.ArrayInstructionCount, 6);
340*7ce1a24aSAmine Khaldi     ok(sdesc11.CutInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.CutInstructionCount, 0);
341*7ce1a24aSAmine Khaldi     ok(sdesc11.EmitInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.EmitInstructionCount, 0);
342*7ce1a24aSAmine Khaldi     ok(sdesc11.GSOutputTopology == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.GSOutputTopology, 0);
343*7ce1a24aSAmine Khaldi     ok(sdesc11.GSMaxOutputVertexCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.GSMaxOutputVertexCount, 0);
344*7ce1a24aSAmine Khaldi     ok(sdesc11.InputPrimitive == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.InputPrimitive, 0);
345*7ce1a24aSAmine Khaldi     ok(sdesc11.PatchConstantParameters == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.PatchConstantParameters, 0);
346*7ce1a24aSAmine Khaldi     ok(sdesc11.cGSInstanceCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cGSInstanceCount, 0);
347*7ce1a24aSAmine Khaldi     ok(sdesc11.cControlPoints == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cControlPoints, 0);
348*7ce1a24aSAmine Khaldi     ok(sdesc11.HSOutputPrimitive == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.HSOutputPrimitive, 0);
349*7ce1a24aSAmine Khaldi     ok(sdesc11.HSPartitioning == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.HSPartitioning, 0);
350*7ce1a24aSAmine Khaldi     ok(sdesc11.TessellatorDomain == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.TessellatorDomain, 0);
351*7ce1a24aSAmine Khaldi     ok(sdesc11.cBarrierInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cBarrierInstructions, 0);
352*7ce1a24aSAmine Khaldi     ok(sdesc11.cInterlockedInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cInterlockedInstructions, 0);
353*7ce1a24aSAmine Khaldi     ok(sdesc11.cTextureStoreInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cTextureStoreInstructions, 0);
354*7ce1a24aSAmine Khaldi 
355*7ce1a24aSAmine Khaldi     ret = ref11->lpVtbl->GetBitwiseInstructionCount(ref11);
356*7ce1a24aSAmine Khaldi     ok(ret == 0, "GetBitwiseInstructionCount failed, got %u, expected %u\n", ret, 0);
357*7ce1a24aSAmine Khaldi 
358*7ce1a24aSAmine Khaldi     ret = ref11->lpVtbl->GetConversionInstructionCount(ref11);
359*7ce1a24aSAmine Khaldi     ok(ret == 2, "GetConversionInstructionCount failed, got %u, expected %u\n", ret, 2);
360*7ce1a24aSAmine Khaldi 
361*7ce1a24aSAmine Khaldi     ret = ref11->lpVtbl->GetMovInstructionCount(ref11);
362*7ce1a24aSAmine Khaldi     ok(ret == 10, "GetMovInstructionCount failed, got %u, expected %u\n", ret, 10);
363*7ce1a24aSAmine Khaldi 
364*7ce1a24aSAmine Khaldi     ret = ref11->lpVtbl->GetMovcInstructionCount(ref11);
365*7ce1a24aSAmine Khaldi     ok(ret == 0, "GetMovcInstructionCount failed, got %u, expected %u\n", ret, 0);
366*7ce1a24aSAmine Khaldi 
367*7ce1a24aSAmine Khaldi     /* GetIn/OutputParameterDesc */
368*7ce1a24aSAmine Khaldi     for (i = 0; i < ARRAY_SIZE(test_reflection_desc_vs_resultin); ++i)
369*7ce1a24aSAmine Khaldi     {
370*7ce1a24aSAmine Khaldi         pdesc = &test_reflection_desc_vs_resultin[i];
371*7ce1a24aSAmine Khaldi 
372*7ce1a24aSAmine Khaldi         hr = ref11->lpVtbl->GetInputParameterDesc(ref11, i, &desc);
373*7ce1a24aSAmine Khaldi         ok(hr == S_OK, "GetInputParameterDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
374*7ce1a24aSAmine Khaldi 
375*7ce1a24aSAmine Khaldi         ok(!strcmp(desc.SemanticName, pdesc->SemanticName), "GetInputParameterDesc(%u) SemanticName failed, got \"%s\", expected \"%s\"\n",
376*7ce1a24aSAmine Khaldi                 i, desc.SemanticName, pdesc->SemanticName);
377*7ce1a24aSAmine Khaldi         ok(desc.SemanticIndex == pdesc->SemanticIndex, "GetInputParameterDesc(%u) SemanticIndex failed, got %u, expected %u\n",
378*7ce1a24aSAmine Khaldi                 i, desc.SemanticIndex, pdesc->SemanticIndex);
379*7ce1a24aSAmine Khaldi         ok(desc.Register == pdesc->Register, "GetInputParameterDesc(%u) Register failed, got %u, expected %u\n",
380*7ce1a24aSAmine Khaldi                 i, desc.Register, pdesc->Register);
381*7ce1a24aSAmine Khaldi         ok(desc.SystemValueType == pdesc->SystemValueType, "GetInputParameterDesc(%u) SystemValueType failed, got %x, expected %x\n",
382*7ce1a24aSAmine Khaldi                 i, desc.SystemValueType, pdesc->SystemValueType);
383*7ce1a24aSAmine Khaldi         ok(desc.ComponentType == pdesc->ComponentType, "GetInputParameterDesc(%u) ComponentType failed, got %x, expected %x\n",
384*7ce1a24aSAmine Khaldi                 i, desc.ComponentType, pdesc->ComponentType);
385*7ce1a24aSAmine Khaldi         ok(desc.Mask == pdesc->Mask, "GetInputParameterDesc(%u) Mask failed, got %x, expected %x\n",
386*7ce1a24aSAmine Khaldi                 i, desc.Mask, pdesc->Mask);
387*7ce1a24aSAmine Khaldi         ok(desc.ReadWriteMask == pdesc->ReadWriteMask, "GetInputParameterDesc(%u) ReadWriteMask failed, got %x, expected %x\n",
388*7ce1a24aSAmine Khaldi                 i, desc.ReadWriteMask, pdesc->ReadWriteMask);
389*7ce1a24aSAmine Khaldi         ok(desc.Stream == pdesc->Stream, "GetInputParameterDesc(%u) Stream failed, got %u, expected %u\n",
390*7ce1a24aSAmine Khaldi                 i, desc.Stream, pdesc->ReadWriteMask);
391*7ce1a24aSAmine Khaldi     }
392*7ce1a24aSAmine Khaldi 
393*7ce1a24aSAmine Khaldi     for (i = 0; i < ARRAY_SIZE(test_reflection_desc_vs_resultout); ++i)
394*7ce1a24aSAmine Khaldi     {
395*7ce1a24aSAmine Khaldi         pdesc = &test_reflection_desc_vs_resultout[i];
396*7ce1a24aSAmine Khaldi 
397*7ce1a24aSAmine Khaldi         hr = ref11->lpVtbl->GetOutputParameterDesc(ref11, i, &desc);
398*7ce1a24aSAmine Khaldi         ok(hr == S_OK, "GetOutputParameterDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
399*7ce1a24aSAmine Khaldi 
400*7ce1a24aSAmine Khaldi         ok(!strcmp(desc.SemanticName, pdesc->SemanticName), "GetOutputParameterDesc(%u) SemanticName failed, got \"%s\", expected \"%s\"\n",
401*7ce1a24aSAmine Khaldi                 i, desc.SemanticName, pdesc->SemanticName);
402*7ce1a24aSAmine Khaldi         ok(desc.SemanticIndex == pdesc->SemanticIndex, "GetOutputParameterDesc(%u) SemanticIndex failed, got %u, expected %u\n",
403*7ce1a24aSAmine Khaldi                 i, desc.SemanticIndex, pdesc->SemanticIndex);
404*7ce1a24aSAmine Khaldi         ok(desc.Register == pdesc->Register, "GetOutputParameterDesc(%u) Register failed, got %u, expected %u\n",
405*7ce1a24aSAmine Khaldi                 i, desc.Register, pdesc->Register);
406*7ce1a24aSAmine Khaldi         ok(desc.SystemValueType == pdesc->SystemValueType, "GetOutputParameterDesc(%u) SystemValueType failed, got %x, expected %x\n",
407*7ce1a24aSAmine Khaldi                 i, desc.SystemValueType, pdesc->SystemValueType);
408*7ce1a24aSAmine Khaldi         ok(desc.ComponentType == pdesc->ComponentType, "GetOutputParameterDesc(%u) ComponentType failed, got %x, expected %x\n",
409*7ce1a24aSAmine Khaldi                 i, desc.ComponentType, pdesc->ComponentType);
410*7ce1a24aSAmine Khaldi         ok(desc.Mask == pdesc->Mask, "GetOutputParameterDesc(%u) Mask failed, got %x, expected %x\n",
411*7ce1a24aSAmine Khaldi                 i, desc.Mask, pdesc->Mask);
412*7ce1a24aSAmine Khaldi         ok(desc.ReadWriteMask == pdesc->ReadWriteMask, "GetOutputParameterDesc(%u) ReadWriteMask failed, got %x, expected %x\n",
413*7ce1a24aSAmine Khaldi                 i, desc.ReadWriteMask, pdesc->ReadWriteMask);
414*7ce1a24aSAmine Khaldi         ok(desc.Stream == pdesc->Stream, "GetOutputParameterDesc(%u) Stream failed, got %u, expected %u\n",
415*7ce1a24aSAmine Khaldi                 i, desc.Stream, pdesc->ReadWriteMask);
416*7ce1a24aSAmine Khaldi     }
417*7ce1a24aSAmine Khaldi 
418*7ce1a24aSAmine Khaldi     count = ref11->lpVtbl->Release(ref11);
419*7ce1a24aSAmine Khaldi     ok(count == 0, "Release failed %u\n", count);
420*7ce1a24aSAmine Khaldi }
421*7ce1a24aSAmine Khaldi 
422*7ce1a24aSAmine Khaldi /*
423*7ce1a24aSAmine Khaldi  * fxc.exe /E PS /Tps_4_1 /Fx
424*7ce1a24aSAmine Khaldi  */
425*7ce1a24aSAmine Khaldi #if 0
426*7ce1a24aSAmine Khaldi Texture2D tex1;
427*7ce1a24aSAmine Khaldi Texture2D tex2;
428*7ce1a24aSAmine Khaldi SamplerState sam
429*7ce1a24aSAmine Khaldi {
430*7ce1a24aSAmine Khaldi     Filter = MIN_MAG_MIP_LINEAR;
431*7ce1a24aSAmine Khaldi     AddressU = Wrap;
432*7ce1a24aSAmine Khaldi     AddressV = Wrap;
433*7ce1a24aSAmine Khaldi };
434*7ce1a24aSAmine Khaldi SamplerComparisonState samc
435*7ce1a24aSAmine Khaldi {
436*7ce1a24aSAmine Khaldi     Filter = MIN_MAG_MIP_LINEAR;
437*7ce1a24aSAmine Khaldi     AddressU = w1;
438*7ce1a24aSAmine Khaldi     AddressV = Wrap;
439*7ce1a24aSAmine Khaldi     ComparisonFunc = LESS;
440*7ce1a24aSAmine Khaldi };
441*7ce1a24aSAmine Khaldi struct psin
442*7ce1a24aSAmine Khaldi {
443*7ce1a24aSAmine Khaldi     uint f : SV_RenderTargetArrayIndex;
444*7ce1a24aSAmine Khaldi     uint g : SV_InstanceID;
445*7ce1a24aSAmine Khaldi     uint h : SV_PrimitiveID;
446*7ce1a24aSAmine Khaldi     float2 uv : TEXCOORD;
447*7ce1a24aSAmine Khaldi     float4 a : COLOR3;
448*7ce1a24aSAmine Khaldi     float b : VFACE;
449*7ce1a24aSAmine Khaldi     float4 c : SV_position;
450*7ce1a24aSAmine Khaldi     bool d : SV_Coverage;
451*7ce1a24aSAmine Khaldi     bool e : SV_IsFrontFace;
452*7ce1a24aSAmine Khaldi };
453*7ce1a24aSAmine Khaldi struct psout
454*7ce1a24aSAmine Khaldi {
455*7ce1a24aSAmine Khaldi     float a : SV_Target1;
456*7ce1a24aSAmine Khaldi     float b : SV_Depth;
457*7ce1a24aSAmine Khaldi     float x : SV_Target;
458*7ce1a24aSAmine Khaldi     bool c : SV_Coverage;
459*7ce1a24aSAmine Khaldi };
460*7ce1a24aSAmine Khaldi psout PS(psin p)
461*7ce1a24aSAmine Khaldi {
462*7ce1a24aSAmine Khaldi     psout a;
463*7ce1a24aSAmine Khaldi     float4 x = tex1.Sample(sam, p.uv);
464*7ce1a24aSAmine Khaldi     x += tex1.SampleCmp(samc, p.uv, 0.3f);
465*7ce1a24aSAmine Khaldi     if (x.y < 0.1f)
466*7ce1a24aSAmine Khaldi         x += tex2.SampleCmp(samc, p.uv, 0.4f);
467*7ce1a24aSAmine Khaldi     else if (x.y < 0.2f)
468*7ce1a24aSAmine Khaldi         x += tex2.SampleCmp(samc, p.uv, 0.1f);
469*7ce1a24aSAmine Khaldi     else if (x.y < 0.3f)
470*7ce1a24aSAmine Khaldi         x += tex2.SampleBias(sam, p.uv, 0.1f);
471*7ce1a24aSAmine Khaldi     else if (x.y < 0.4f)
472*7ce1a24aSAmine Khaldi         x += tex2.SampleBias(sam, p.uv, 0.2f);
473*7ce1a24aSAmine Khaldi     else if (x.y < 0.5f)
474*7ce1a24aSAmine Khaldi         x += tex2.SampleBias(sam, p.uv, 0.3f);
475*7ce1a24aSAmine Khaldi     else
476*7ce1a24aSAmine Khaldi         x += tex2.SampleBias(sam, p.uv, 0.4f);
477*7ce1a24aSAmine Khaldi     x += tex2.SampleGrad(sam, p.uv, x.xy, x.xy);
478*7ce1a24aSAmine Khaldi     x += tex2.SampleGrad(sam, p.uv, x.xz, x.xz);
479*7ce1a24aSAmine Khaldi     x += tex2.SampleGrad(sam, p.uv, x.xz, x.zy);
480*7ce1a24aSAmine Khaldi     x += tex2.SampleGrad(sam, p.uv, x.xz, x.zw);
481*7ce1a24aSAmine Khaldi     x += tex2.SampleGrad(sam, p.uv, x.xz, x.wz);
482*7ce1a24aSAmine Khaldi     a.a = x.y;
483*7ce1a24aSAmine Khaldi     a.b = x.x;
484*7ce1a24aSAmine Khaldi     a.x = x.x;
485*7ce1a24aSAmine Khaldi     a.c = true;
486*7ce1a24aSAmine Khaldi     return a;
487*7ce1a24aSAmine Khaldi }
488*7ce1a24aSAmine Khaldi #endif
489*7ce1a24aSAmine Khaldi static DWORD test_reflection_desc_ps_blob[] = {
490*7ce1a24aSAmine Khaldi 0x43425844, 0x19e2f325, 0xf1ec39a3, 0x3c5a8b53, 0x5bd5fb65, 0x00000001, 0x000008d0, 0x00000005,
491*7ce1a24aSAmine Khaldi 0x00000034, 0x0000011c, 0x00000254, 0x000002e4, 0x00000854, 0x46454452, 0x000000e0, 0x00000000,
492*7ce1a24aSAmine Khaldi 0x00000000, 0x00000004, 0x0000001c, 0xffff0401, 0x00000100, 0x000000af, 0x0000009c, 0x00000003,
493*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x000000a0, 0x00000003,
494*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x000000a5, 0x00000002,
495*7ce1a24aSAmine Khaldi 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000c, 0x000000aa, 0x00000002,
496*7ce1a24aSAmine Khaldi 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000c, 0x006d6173, 0x636d6173,
497*7ce1a24aSAmine Khaldi 0x78657400, 0x65740031, 0x4d003278, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
498*7ce1a24aSAmine Khaldi 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x4e475349,
499*7ce1a24aSAmine Khaldi 0x00000130, 0x00000008, 0x00000008, 0x000000c8, 0x00000000, 0x00000004, 0x00000001, 0x00000000,
500*7ce1a24aSAmine Khaldi 0x00000001, 0x000000e2, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000002, 0x000000f0,
501*7ce1a24aSAmine Khaldi 0x00000000, 0x00000007, 0x00000001, 0x00000000, 0x00000004, 0x000000ff, 0x00000000, 0x00000009,
502*7ce1a24aSAmine Khaldi 0x00000001, 0x00000000, 0x00000008, 0x0000010e, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
503*7ce1a24aSAmine Khaldi 0x00000303, 0x00000117, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000004, 0x0000011d,
504*7ce1a24aSAmine Khaldi 0x00000003, 0x00000000, 0x00000003, 0x00000002, 0x0000000f, 0x00000123, 0x00000000, 0x00000001,
505*7ce1a24aSAmine Khaldi 0x00000003, 0x00000003, 0x0000000f, 0x525f5653, 0x65646e65, 0x72615472, 0x41746567, 0x79617272,
506*7ce1a24aSAmine Khaldi 0x65646e49, 0x56530078, 0x736e495f, 0x636e6174, 0x00444965, 0x505f5653, 0x696d6972, 0x65766974,
507*7ce1a24aSAmine Khaldi 0x53004449, 0x73495f56, 0x6e6f7246, 0x63614674, 0x45540065, 0x4f4f4358, 0x56004452, 0x45434146,
508*7ce1a24aSAmine Khaldi 0x4c4f4300, 0x5300524f, 0x6f705f56, 0x69746973, 0xab006e6f, 0x4e47534f, 0x00000088, 0x00000004,
509*7ce1a24aSAmine Khaldi 0x00000008, 0x00000068, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000e01, 0x00000068,
510*7ce1a24aSAmine Khaldi 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000e01, 0x00000072, 0x00000000, 0x00000000,
511*7ce1a24aSAmine Khaldi 0x00000001, 0xffffffff, 0x00000e01, 0x0000007e, 0x00000000, 0x00000000, 0x00000003, 0xffffffff,
512*7ce1a24aSAmine Khaldi 0x00000e01, 0x545f5653, 0x65677261, 0x56530074, 0x766f435f, 0x67617265, 0x56530065, 0x7065445f,
513*7ce1a24aSAmine Khaldi 0xab006874, 0x52444853, 0x00000568, 0x00000041, 0x0000015a, 0x0100086a, 0x0300005a, 0x00106000,
514*7ce1a24aSAmine Khaldi 0x00000000, 0x0300085a, 0x00106000, 0x00000001, 0x04001858, 0x00107000, 0x00000000, 0x00005555,
515*7ce1a24aSAmine Khaldi 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065,
516*7ce1a24aSAmine Khaldi 0x00102012, 0x00000000, 0x03000065, 0x00102012, 0x00000001, 0x02000065, 0x0000f000, 0x02000065,
517*7ce1a24aSAmine Khaldi 0x0000c001, 0x02000068, 0x00000003, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001,
518*7ce1a24aSAmine Khaldi 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0b000046, 0x00100012, 0x00000001, 0x00101046,
519*7ce1a24aSAmine Khaldi 0x00000001, 0x00107006, 0x00000000, 0x00106000, 0x00000001, 0x00004001, 0x3e99999a, 0x07000000,
520*7ce1a24aSAmine Khaldi 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100006, 0x00000001, 0x07000031, 0x00100012,
521*7ce1a24aSAmine Khaldi 0x00000001, 0x0010001a, 0x00000000, 0x00004001, 0x3dcccccd, 0x0304001f, 0x0010000a, 0x00000001,
522*7ce1a24aSAmine Khaldi 0x0b000046, 0x00100012, 0x00000001, 0x00101046, 0x00000001, 0x00107006, 0x00000001, 0x00106000,
523*7ce1a24aSAmine Khaldi 0x00000001, 0x00004001, 0x3ecccccd, 0x07000000, 0x001000f2, 0x00000001, 0x00100e46, 0x00000000,
524*7ce1a24aSAmine Khaldi 0x00100006, 0x00000001, 0x01000012, 0x07000031, 0x00100012, 0x00000002, 0x0010001a, 0x00000000,
525*7ce1a24aSAmine Khaldi 0x00004001, 0x3e4ccccd, 0x0304001f, 0x0010000a, 0x00000002, 0x0b000046, 0x00100012, 0x00000002,
526*7ce1a24aSAmine Khaldi 0x00101046, 0x00000001, 0x00107006, 0x00000001, 0x00106000, 0x00000001, 0x00004001, 0x3dcccccd,
527*7ce1a24aSAmine Khaldi 0x07000000, 0x001000f2, 0x00000001, 0x00100e46, 0x00000000, 0x00100006, 0x00000002, 0x01000012,
528*7ce1a24aSAmine Khaldi 0x07000031, 0x00100012, 0x00000002, 0x0010001a, 0x00000000, 0x00004001, 0x3e99999a, 0x0304001f,
529*7ce1a24aSAmine Khaldi 0x0010000a, 0x00000002, 0x0b00004a, 0x001000f2, 0x00000002, 0x00101046, 0x00000001, 0x00107e46,
530*7ce1a24aSAmine Khaldi 0x00000001, 0x00106000, 0x00000000, 0x00004001, 0x3dcccccd, 0x07000000, 0x001000f2, 0x00000001,
531*7ce1a24aSAmine Khaldi 0x00100e46, 0x00000000, 0x00100e46, 0x00000002, 0x01000012, 0x07000031, 0x00100012, 0x00000002,
532*7ce1a24aSAmine Khaldi 0x0010001a, 0x00000000, 0x00004001, 0x3ecccccd, 0x0304001f, 0x0010000a, 0x00000002, 0x0b00004a,
533*7ce1a24aSAmine Khaldi 0x001000f2, 0x00000002, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000,
534*7ce1a24aSAmine Khaldi 0x00004001, 0x3e4ccccd, 0x07000000, 0x001000f2, 0x00000001, 0x00100e46, 0x00000000, 0x00100e46,
535*7ce1a24aSAmine Khaldi 0x00000002, 0x01000012, 0x07000031, 0x00100012, 0x00000002, 0x0010001a, 0x00000000, 0x00004001,
536*7ce1a24aSAmine Khaldi 0x3f000000, 0x0304001f, 0x0010000a, 0x00000002, 0x0b00004a, 0x001000f2, 0x00000002, 0x00101046,
537*7ce1a24aSAmine Khaldi 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x00004001, 0x3e99999a, 0x07000000,
538*7ce1a24aSAmine Khaldi 0x001000f2, 0x00000001, 0x00100e46, 0x00000000, 0x00100e46, 0x00000002, 0x01000012, 0x0b00004a,
539*7ce1a24aSAmine Khaldi 0x001000f2, 0x00000002, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000,
540*7ce1a24aSAmine Khaldi 0x00004001, 0x3ecccccd, 0x07000000, 0x001000f2, 0x00000001, 0x00100e46, 0x00000000, 0x00100e46,
541*7ce1a24aSAmine Khaldi 0x00000002, 0x01000015, 0x01000015, 0x01000015, 0x01000015, 0x01000015, 0x0d000049, 0x001000f2,
542*7ce1a24aSAmine Khaldi 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x00100046,
543*7ce1a24aSAmine Khaldi 0x00000001, 0x00100046, 0x00000001, 0x07000000, 0x001000f2, 0x00000000, 0x00100e46, 0x00000000,
544*7ce1a24aSAmine Khaldi 0x00100e46, 0x00000001, 0x0d000049, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46,
545*7ce1a24aSAmine Khaldi 0x00000001, 0x00106000, 0x00000000, 0x00100086, 0x00000000, 0x00100086, 0x00000000, 0x07000000,
546*7ce1a24aSAmine Khaldi 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0d000049, 0x001000f2,
547*7ce1a24aSAmine Khaldi 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x00100086,
548*7ce1a24aSAmine Khaldi 0x00000000, 0x00100a66, 0x00000000, 0x07000000, 0x001000f2, 0x00000000, 0x00100e46, 0x00000000,
549*7ce1a24aSAmine Khaldi 0x00100e46, 0x00000001, 0x0d000049, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46,
550*7ce1a24aSAmine Khaldi 0x00000001, 0x00106000, 0x00000000, 0x00100086, 0x00000000, 0x00100ae6, 0x00000000, 0x07000000,
551*7ce1a24aSAmine Khaldi 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0d000049, 0x001000c2,
552*7ce1a24aSAmine Khaldi 0x00000000, 0x00101046, 0x00000001, 0x001074e6, 0x00000001, 0x00106000, 0x00000000, 0x00100086,
553*7ce1a24aSAmine Khaldi 0x00000000, 0x00100fb6, 0x00000000, 0x07000000, 0x00100032, 0x00000000, 0x00100ae6, 0x00000000,
554*7ce1a24aSAmine Khaldi 0x00100046, 0x00000000, 0x05000036, 0x00102012, 0x00000001, 0x0010001a, 0x00000000, 0x04000036,
555*7ce1a24aSAmine Khaldi 0x0000c001, 0x0010000a, 0x00000000, 0x05000036, 0x00102012, 0x00000000, 0x0010000a, 0x00000000,
556*7ce1a24aSAmine Khaldi 0x04000036, 0x0000f001, 0x00004001, 0xffffffff, 0x0100003e, 0x54415453, 0x00000074, 0x00000032,
557*7ce1a24aSAmine Khaldi 0x00000003, 0x00000000, 0x00000005, 0x00000011, 0x00000000, 0x00000000, 0x00000006, 0x00000005,
558*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000003,
559*7ce1a24aSAmine Khaldi 0x00000004, 0x00000005, 0x00000018, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
560*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000,
561*7ce1a24aSAmine Khaldi };
562*7ce1a24aSAmine Khaldi 
563*7ce1a24aSAmine Khaldi static const D3D11_SIGNATURE_PARAMETER_DESC test_reflection_desc_ps_resultin[] =
564*7ce1a24aSAmine Khaldi {
565*7ce1a24aSAmine Khaldi     {"SV_RenderTargetArrayIndex", 0, 0, D3D_NAME_RENDER_TARGET_ARRAY_INDEX, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0x0, 0},
566*7ce1a24aSAmine Khaldi     {"SV_InstanceID", 0, 0, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_UINT32, 0x2, 0x0, 0},
567*7ce1a24aSAmine Khaldi     {"SV_PrimitiveID", 0, 0, D3D_NAME_PRIMITIVE_ID, D3D_REGISTER_COMPONENT_UINT32, 0x4, 0x0, 0},
568*7ce1a24aSAmine Khaldi     {"SV_IsFrontFace", 0, 0, D3D_NAME_IS_FRONT_FACE, D3D_REGISTER_COMPONENT_UINT32, 0x8, 0x0, 0},
569*7ce1a24aSAmine Khaldi     {"TEXCOORD", 0, 1, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x3, 0x3, 0},
570*7ce1a24aSAmine Khaldi     {"VFACE", 0, 1, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0x4, 0x0, 0},
571*7ce1a24aSAmine Khaldi     {"COLOR", 3, 2, D3D_NAME_UNDEFINED, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
572*7ce1a24aSAmine Khaldi     {"SV_position", 0, 3, D3D_NAME_POSITION, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0x0, 0},
573*7ce1a24aSAmine Khaldi };
574*7ce1a24aSAmine Khaldi 
575*7ce1a24aSAmine Khaldi static const D3D11_SIGNATURE_PARAMETER_DESC test_reflection_desc_ps_resultout[] =
576*7ce1a24aSAmine Khaldi {
577*7ce1a24aSAmine Khaldi     {"SV_Target", 0, 0, D3D_NAME_TARGET, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
578*7ce1a24aSAmine Khaldi     {"SV_Target", 1, 1, D3D_NAME_TARGET, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
579*7ce1a24aSAmine Khaldi     {"SV_Coverage", 0, 0xffffffff, D3D_NAME_COVERAGE, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0xe, 0},
580*7ce1a24aSAmine Khaldi     {"SV_Depth", 0, 0xffffffff, D3D_NAME_DEPTH, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
581*7ce1a24aSAmine Khaldi };
582*7ce1a24aSAmine Khaldi 
test_reflection_desc_ps(void)583*7ce1a24aSAmine Khaldi static void test_reflection_desc_ps(void)
584*7ce1a24aSAmine Khaldi {
585*7ce1a24aSAmine Khaldi     HRESULT hr;
586*7ce1a24aSAmine Khaldi     ULONG count;
587*7ce1a24aSAmine Khaldi     ID3D11ShaderReflection *ref11;
588*7ce1a24aSAmine Khaldi     D3D11_SHADER_DESC sdesc11 = {0};
589*7ce1a24aSAmine Khaldi     D3D11_SIGNATURE_PARAMETER_DESC desc = {0};
590*7ce1a24aSAmine Khaldi     const D3D11_SIGNATURE_PARAMETER_DESC *pdesc;
591*7ce1a24aSAmine Khaldi     UINT ret;
592*7ce1a24aSAmine Khaldi     unsigned int i;
593*7ce1a24aSAmine Khaldi 
594*7ce1a24aSAmine Khaldi     hr = pD3DReflect(test_reflection_desc_ps_blob, test_reflection_desc_ps_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
595*7ce1a24aSAmine Khaldi     ok(hr == S_OK, "D3DReflect failed %x\n", hr);
596*7ce1a24aSAmine Khaldi 
597*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->GetDesc(ref11, &sdesc11);
598*7ce1a24aSAmine Khaldi     ok(hr == S_OK, "GetDesc failed %x\n", hr);
599*7ce1a24aSAmine Khaldi 
600*7ce1a24aSAmine Khaldi     ok(sdesc11.Version == 65, "GetDesc failed, got %u, expected %u\n", sdesc11.Version, 65);
601*7ce1a24aSAmine Khaldi     ok(strcmp(sdesc11.Creator, (char*) shader_creator) == 0, "GetDesc failed, got \"%s\", expected \"%s\"\n", sdesc11.Creator, (char*)shader_creator);
602*7ce1a24aSAmine Khaldi     ok(sdesc11.Flags == 256, "GetDesc failed, got %u, expected %u\n", sdesc11.Flags, 256);
603*7ce1a24aSAmine Khaldi     ok(sdesc11.ConstantBuffers == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.ConstantBuffers, 0);
604*7ce1a24aSAmine Khaldi     ok(sdesc11.BoundResources == 4, "GetDesc failed, got %u, expected %u\n", sdesc11.BoundResources, 4);
605*7ce1a24aSAmine Khaldi     ok(sdesc11.InputParameters == 8, "GetDesc failed, got %u, expected %u\n", sdesc11.InputParameters, 8);
606*7ce1a24aSAmine Khaldi     ok(sdesc11.OutputParameters == 4, "GetDesc failed, got %u, expected %u\n", sdesc11.OutputParameters, 4);
607*7ce1a24aSAmine Khaldi     ok(sdesc11.InstructionCount == 50, "GetDesc failed, got %u, expected %u\n", sdesc11.InstructionCount, 50);
608*7ce1a24aSAmine Khaldi     ok(sdesc11.TempRegisterCount == 3, "GetDesc failed, got %u, expected %u\n", sdesc11.TempRegisterCount, 3);
609*7ce1a24aSAmine Khaldi     ok(sdesc11.TempArrayCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.TempArrayCount, 0);
610*7ce1a24aSAmine Khaldi     ok(sdesc11.DefCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.DefCount, 0);
611*7ce1a24aSAmine Khaldi     ok(sdesc11.DclCount == 5, "GetDesc failed, got %u, expected %u\n", sdesc11.DclCount, 5);
612*7ce1a24aSAmine Khaldi     ok(sdesc11.TextureNormalInstructions == 1, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureNormalInstructions, 1);
613*7ce1a24aSAmine Khaldi     ok(sdesc11.TextureLoadInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureLoadInstructions, 0);
614*7ce1a24aSAmine Khaldi     ok(sdesc11.TextureCompInstructions == 3, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureCompInstructions, 3);
615*7ce1a24aSAmine Khaldi     ok(sdesc11.TextureBiasInstructions == 4, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureBiasInstructions, 4);
616*7ce1a24aSAmine Khaldi     ok(sdesc11.TextureGradientInstructions == 5, "GetDesc failed, got %u, expected %u\n", sdesc11.TextureGradientInstructions, 5);
617*7ce1a24aSAmine Khaldi     ok(sdesc11.FloatInstructionCount == 17, "GetDesc failed, got %u, expected %u\n", sdesc11.FloatInstructionCount, 17);
618*7ce1a24aSAmine Khaldi     ok(sdesc11.IntInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.IntInstructionCount, 0);
619*7ce1a24aSAmine Khaldi     ok(sdesc11.UintInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.UintInstructionCount, 0);
620*7ce1a24aSAmine Khaldi     ok(sdesc11.StaticFlowControlCount == 6, "GetDesc failed, got %u, expected %u\n", sdesc11.StaticFlowControlCount, 6);
621*7ce1a24aSAmine Khaldi     ok(sdesc11.DynamicFlowControlCount == 5, "GetDesc failed, got %u, expected %u\n", sdesc11.DynamicFlowControlCount, 5);
622*7ce1a24aSAmine Khaldi     ok(sdesc11.MacroInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.MacroInstructionCount, 0);
623*7ce1a24aSAmine Khaldi     ok(sdesc11.ArrayInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.ArrayInstructionCount, 0);
624*7ce1a24aSAmine Khaldi     ok(sdesc11.CutInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.CutInstructionCount, 0);
625*7ce1a24aSAmine Khaldi     ok(sdesc11.EmitInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.EmitInstructionCount, 0);
626*7ce1a24aSAmine Khaldi     ok(sdesc11.GSOutputTopology == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.GSOutputTopology, 0);
627*7ce1a24aSAmine Khaldi     ok(sdesc11.GSMaxOutputVertexCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.GSMaxOutputVertexCount, 0);
628*7ce1a24aSAmine Khaldi     ok(sdesc11.InputPrimitive == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.InputPrimitive, 0);
629*7ce1a24aSAmine Khaldi     ok(sdesc11.PatchConstantParameters == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.PatchConstantParameters, 0);
630*7ce1a24aSAmine Khaldi     ok(sdesc11.cGSInstanceCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cGSInstanceCount, 0);
631*7ce1a24aSAmine Khaldi     ok(sdesc11.cControlPoints == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cControlPoints, 0);
632*7ce1a24aSAmine Khaldi     ok(sdesc11.HSOutputPrimitive == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.HSOutputPrimitive, 0);
633*7ce1a24aSAmine Khaldi     ok(sdesc11.HSPartitioning == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.HSPartitioning, 0);
634*7ce1a24aSAmine Khaldi     ok(sdesc11.TessellatorDomain == 0, "GetDesc failed, got %x, expected %x\n", sdesc11.TessellatorDomain, 0);
635*7ce1a24aSAmine Khaldi     ok(sdesc11.cBarrierInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cBarrierInstructions, 0);
636*7ce1a24aSAmine Khaldi     ok(sdesc11.cInterlockedInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cInterlockedInstructions, 0);
637*7ce1a24aSAmine Khaldi     ok(sdesc11.cTextureStoreInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cTextureStoreInstructions, 0);
638*7ce1a24aSAmine Khaldi 
639*7ce1a24aSAmine Khaldi     ret = ref11->lpVtbl->GetBitwiseInstructionCount(ref11);
640*7ce1a24aSAmine Khaldi     ok(ret == 0, "GetBitwiseInstructionCount failed, got %u, expected %u\n", ret, 0);
641*7ce1a24aSAmine Khaldi 
642*7ce1a24aSAmine Khaldi     ret = ref11->lpVtbl->GetConversionInstructionCount(ref11);
643*7ce1a24aSAmine Khaldi     ok(ret == 0, "GetConversionInstructionCount failed, got %u, expected %u\n", ret, 0);
644*7ce1a24aSAmine Khaldi 
645*7ce1a24aSAmine Khaldi     ret = ref11->lpVtbl->GetMovInstructionCount(ref11);
646*7ce1a24aSAmine Khaldi     ok(ret == 24, "GetMovInstructionCount failed, got %u, expected %u\n", ret, 24);
647*7ce1a24aSAmine Khaldi 
648*7ce1a24aSAmine Khaldi     ret = ref11->lpVtbl->GetMovcInstructionCount(ref11);
649*7ce1a24aSAmine Khaldi     ok(ret == 0, "GetMovcInstructionCount failed, got %u, expected %u\n", ret, 0);
650*7ce1a24aSAmine Khaldi 
651*7ce1a24aSAmine Khaldi     /* check invalid Get*ParameterDesc cases*/
652*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->GetInputParameterDesc(ref11, 0, NULL);
653*7ce1a24aSAmine Khaldi     ok(hr == E_INVALIDARG, "GetInputParameterDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
654*7ce1a24aSAmine Khaldi 
655*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->GetInputParameterDesc(ref11, 0xffffffff, &desc);
656*7ce1a24aSAmine Khaldi     ok(hr == E_INVALIDARG, "GetInputParameterDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
657*7ce1a24aSAmine Khaldi 
658*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->GetOutputParameterDesc(ref11, 0, NULL);
659*7ce1a24aSAmine Khaldi     ok(hr == E_INVALIDARG, "GetOutputParameterDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
660*7ce1a24aSAmine Khaldi 
661*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->GetOutputParameterDesc(ref11, 0xffffffff, &desc);
662*7ce1a24aSAmine Khaldi     ok(hr == E_INVALIDARG, "GetOutputParameterDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
663*7ce1a24aSAmine Khaldi 
664*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->GetPatchConstantParameterDesc(ref11, 0, &desc);
665*7ce1a24aSAmine Khaldi     ok(hr == E_INVALIDARG, "GetPatchConstantParameterDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
666*7ce1a24aSAmine Khaldi 
667*7ce1a24aSAmine Khaldi     /* GetIn/OutputParameterDesc */
668*7ce1a24aSAmine Khaldi     for (i = 0; i < ARRAY_SIZE(test_reflection_desc_ps_resultin); ++i)
669*7ce1a24aSAmine Khaldi     {
670*7ce1a24aSAmine Khaldi         pdesc = &test_reflection_desc_ps_resultin[i];
671*7ce1a24aSAmine Khaldi 
672*7ce1a24aSAmine Khaldi         hr = ref11->lpVtbl->GetInputParameterDesc(ref11, i, &desc);
673*7ce1a24aSAmine Khaldi         ok(hr == S_OK, "GetInputParameterDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
674*7ce1a24aSAmine Khaldi 
675*7ce1a24aSAmine Khaldi         ok(!strcmp(desc.SemanticName, pdesc->SemanticName), "GetInputParameterDesc(%u) SemanticName failed, got \"%s\", expected \"%s\"\n",
676*7ce1a24aSAmine Khaldi                 i, desc.SemanticName, pdesc->SemanticName);
677*7ce1a24aSAmine Khaldi         ok(desc.SemanticIndex == pdesc->SemanticIndex, "GetInputParameterDesc(%u) SemanticIndex failed, got %u, expected %u\n",
678*7ce1a24aSAmine Khaldi                 i, desc.SemanticIndex, pdesc->SemanticIndex);
679*7ce1a24aSAmine Khaldi         ok(desc.Register == pdesc->Register, "GetInputParameterDesc(%u) Register failed, got %u, expected %u\n",
680*7ce1a24aSAmine Khaldi                 i, desc.Register, pdesc->Register);
681*7ce1a24aSAmine Khaldi         ok(desc.SystemValueType == pdesc->SystemValueType, "GetInputParameterDesc(%u) SystemValueType failed, got %x, expected %x\n",
682*7ce1a24aSAmine Khaldi                 i, desc.SystemValueType, pdesc->SystemValueType);
683*7ce1a24aSAmine Khaldi         ok(desc.ComponentType == pdesc->ComponentType, "GetInputParameterDesc(%u) ComponentType failed, got %x, expected %x\n",
684*7ce1a24aSAmine Khaldi                 i, desc.ComponentType, pdesc->ComponentType);
685*7ce1a24aSAmine Khaldi         ok(desc.Mask == pdesc->Mask, "GetInputParameterDesc(%u) Mask failed, got %x, expected %x\n",
686*7ce1a24aSAmine Khaldi                 i, desc.Mask, pdesc->Mask);
687*7ce1a24aSAmine Khaldi         ok(desc.ReadWriteMask == pdesc->ReadWriteMask, "GetInputParameterDesc(%u) ReadWriteMask failed, got %x, expected %x\n",
688*7ce1a24aSAmine Khaldi                 i, desc.ReadWriteMask, pdesc->ReadWriteMask);
689*7ce1a24aSAmine Khaldi         ok(desc.Stream == pdesc->Stream, "GetInputParameterDesc(%u) Stream failed, got %u, expected %u\n",
690*7ce1a24aSAmine Khaldi                 i, desc.Stream, pdesc->ReadWriteMask);
691*7ce1a24aSAmine Khaldi     }
692*7ce1a24aSAmine Khaldi 
693*7ce1a24aSAmine Khaldi     for (i = 0; i < ARRAY_SIZE(test_reflection_desc_ps_resultout); ++i)
694*7ce1a24aSAmine Khaldi     {
695*7ce1a24aSAmine Khaldi         pdesc = &test_reflection_desc_ps_resultout[i];
696*7ce1a24aSAmine Khaldi 
697*7ce1a24aSAmine Khaldi         hr = ref11->lpVtbl->GetOutputParameterDesc(ref11, i, &desc);
698*7ce1a24aSAmine Khaldi         ok(hr == S_OK, "GetOutputParameterDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
699*7ce1a24aSAmine Khaldi 
700*7ce1a24aSAmine Khaldi         ok(!strcmp(desc.SemanticName, pdesc->SemanticName), "GetOutputParameterDesc(%u) SemanticName failed, got \"%s\", expected \"%s\"\n",
701*7ce1a24aSAmine Khaldi                 i, desc.SemanticName, pdesc->SemanticName);
702*7ce1a24aSAmine Khaldi         ok(desc.SemanticIndex == pdesc->SemanticIndex, "GetOutputParameterDesc(%u) SemanticIndex failed, got %u, expected %u\n",
703*7ce1a24aSAmine Khaldi                 i, desc.SemanticIndex, pdesc->SemanticIndex);
704*7ce1a24aSAmine Khaldi         ok(desc.Register == pdesc->Register, "GetOutputParameterDesc(%u) Register failed, got %u, expected %u\n",
705*7ce1a24aSAmine Khaldi                 i, desc.Register, pdesc->Register);
706*7ce1a24aSAmine Khaldi         ok(desc.SystemValueType == pdesc->SystemValueType, "GetOutputParameterDesc(%u) SystemValueType failed, got %x, expected %x\n",
707*7ce1a24aSAmine Khaldi                 i, desc.SystemValueType, pdesc->SystemValueType);
708*7ce1a24aSAmine Khaldi         ok(desc.ComponentType == pdesc->ComponentType, "GetOutputParameterDesc(%u) ComponentType failed, got %x, expected %x\n",
709*7ce1a24aSAmine Khaldi                 i, desc.ComponentType, pdesc->ComponentType);
710*7ce1a24aSAmine Khaldi         ok(desc.Mask == pdesc->Mask, "GetOutputParameterDesc(%u) Mask failed, got %x, expected %x\n",
711*7ce1a24aSAmine Khaldi                 i, desc.Mask, pdesc->Mask);
712*7ce1a24aSAmine Khaldi         ok(desc.ReadWriteMask == pdesc->ReadWriteMask, "GetOutputParameterDesc(%u) ReadWriteMask failed, got %x, expected %x\n",
713*7ce1a24aSAmine Khaldi                 i, desc.ReadWriteMask, pdesc->ReadWriteMask);
714*7ce1a24aSAmine Khaldi         ok(desc.Stream == pdesc->Stream, "GetOutputParameterDesc(%u) Stream failed, got %u, expected %u\n",
715*7ce1a24aSAmine Khaldi                 i, desc.Stream, pdesc->ReadWriteMask);
716*7ce1a24aSAmine Khaldi     }
717*7ce1a24aSAmine Khaldi 
718*7ce1a24aSAmine Khaldi     count = ref11->lpVtbl->Release(ref11);
719*7ce1a24aSAmine Khaldi     ok(count == 0, "Release failed %u\n", count);
720*7ce1a24aSAmine Khaldi }
721*7ce1a24aSAmine Khaldi 
722*7ce1a24aSAmine Khaldi /*
723*7ce1a24aSAmine Khaldi  * fxc.exe /E PS /Tps_5_0 /Fx
724*7ce1a24aSAmine Khaldi  */
725*7ce1a24aSAmine Khaldi #if 0
726*7ce1a24aSAmine Khaldi float4 PS() : SV_Target3
727*7ce1a24aSAmine Khaldi {
728*7ce1a24aSAmine Khaldi     float4 a = float4(1.2f, 1.0f, 0.2f, 0.0f);
729*7ce1a24aSAmine Khaldi     return a;
730*7ce1a24aSAmine Khaldi }
731*7ce1a24aSAmine Khaldi #endif
732*7ce1a24aSAmine Khaldi static const DWORD test_reflection_desc_ps_output_blob_0[] = {
733*7ce1a24aSAmine Khaldi 0x43425844, 0x3e7b77e6, 0xe4e920b7, 0x9cad0533, 0x240117cc, 0x00000001, 0x0000018c, 0x00000005,
734*7ce1a24aSAmine Khaldi 0x00000034, 0x0000008c, 0x0000009c, 0x000000d0, 0x00000110, 0x46454452, 0x00000050, 0x00000000,
735*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, 0x666f736f,
736*7ce1a24aSAmine Khaldi 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
737*7ce1a24aSAmine Khaldi 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
738*7ce1a24aSAmine Khaldi 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000003, 0x00000000, 0x00000003, 0x00000003,
739*7ce1a24aSAmine Khaldi 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000038, 0x00000040, 0x0000000e,
740*7ce1a24aSAmine Khaldi 0x03000065, 0x001020f2, 0x00000003, 0x08000036, 0x001020f2, 0x00000003, 0x00004002, 0x3f99999a,
741*7ce1a24aSAmine Khaldi 0x3f800000, 0x3e4ccccd, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000,
742*7ce1a24aSAmine Khaldi 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
743*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
744*7ce1a24aSAmine Khaldi 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
745*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000
746*7ce1a24aSAmine Khaldi };
747*7ce1a24aSAmine Khaldi 
748*7ce1a24aSAmine Khaldi /*
749*7ce1a24aSAmine Khaldi  * fxc.exe /E PS /Tps_5_0 /Fx
750*7ce1a24aSAmine Khaldi  */
751*7ce1a24aSAmine Khaldi #if 0
752*7ce1a24aSAmine Khaldi float PS() : SV_DepthLessEqual
753*7ce1a24aSAmine Khaldi {
754*7ce1a24aSAmine Khaldi     float a = 1.2f;
755*7ce1a24aSAmine Khaldi     return a;
756*7ce1a24aSAmine Khaldi }
757*7ce1a24aSAmine Khaldi #endif
758*7ce1a24aSAmine Khaldi static const DWORD test_reflection_desc_ps_output_blob_1[] = {
759*7ce1a24aSAmine Khaldi 0x43425844, 0xd8ead3ec, 0x61276ada, 0x70cdaa9e, 0x2cfd7f4c, 0x00000001, 0x000001c4, 0x00000005,
760*7ce1a24aSAmine Khaldi 0x00000034, 0x000000ac, 0x000000bc, 0x000000f8, 0x00000128, 0x46454452, 0x00000070, 0x00000000,
761*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x0000003c, 0xffff0500, 0x00000100, 0x0000003c, 0x31314452, 0x0000003c,
762*7ce1a24aSAmine Khaldi 0x00000018, 0x00000020, 0x00000028, 0x00000024, 0x0000000c, 0x00000000, 0x7263694d, 0x666f736f,
763*7ce1a24aSAmine Khaldi 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
764*7ce1a24aSAmine Khaldi 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
765*7ce1a24aSAmine Khaldi 0x00000034, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0xffffffff,
766*7ce1a24aSAmine Khaldi 0x00000e01, 0x445f5653, 0x68747065, 0x7373654c, 0x61757145, 0xabab006c, 0x58454853, 0x00000028,
767*7ce1a24aSAmine Khaldi 0x00000050, 0x0000000a, 0x0100086a, 0x02000065, 0x00027001, 0x04000036, 0x00027001, 0x00004001,
768*7ce1a24aSAmine Khaldi 0x3f99999a, 0x0100003e, 0x54415453, 0x00000094, 0x00000002, 0x00000000, 0x00000000, 0x00000001,
769*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
770*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
771*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
772*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
773*7ce1a24aSAmine Khaldi 0x00000000,
774*7ce1a24aSAmine Khaldi };
775*7ce1a24aSAmine Khaldi 
776*7ce1a24aSAmine Khaldi /*
777*7ce1a24aSAmine Khaldi  * fxc.exe /E PS /Tps_5_0 /Fx
778*7ce1a24aSAmine Khaldi  */
779*7ce1a24aSAmine Khaldi #if 0
780*7ce1a24aSAmine Khaldi float PS() : SV_DepthGreaterEqual
781*7ce1a24aSAmine Khaldi {
782*7ce1a24aSAmine Khaldi     float a = 1.2f;
783*7ce1a24aSAmine Khaldi     return a;
784*7ce1a24aSAmine Khaldi }
785*7ce1a24aSAmine Khaldi #endif
786*7ce1a24aSAmine Khaldi static const DWORD test_reflection_desc_ps_output_blob_2[] = {
787*7ce1a24aSAmine Khaldi 0x43425844, 0x9f61c8df, 0x612cbb1f, 0x9e1d039e, 0xf925a074, 0x00000001, 0x000001c8, 0x00000005,
788*7ce1a24aSAmine Khaldi 0x00000034, 0x000000ac, 0x000000bc, 0x000000fc, 0x0000012c, 0x46454452, 0x00000070, 0x00000000,
789*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x0000003c, 0xffff0500, 0x00000100, 0x0000003c, 0x31314452, 0x0000003c,
790*7ce1a24aSAmine Khaldi 0x00000018, 0x00000020, 0x00000028, 0x00000024, 0x0000000c, 0x00000000, 0x7263694d, 0x666f736f,
791*7ce1a24aSAmine Khaldi 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
792*7ce1a24aSAmine Khaldi 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
793*7ce1a24aSAmine Khaldi 0x00000038, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0xffffffff,
794*7ce1a24aSAmine Khaldi 0x00000e01, 0x445f5653, 0x68747065, 0x61657247, 0x45726574, 0x6c617571, 0xababab00, 0x58454853,
795*7ce1a24aSAmine Khaldi 0x00000028, 0x00000050, 0x0000000a, 0x0100086a, 0x02000065, 0x00026001, 0x04000036, 0x00026001,
796*7ce1a24aSAmine Khaldi 0x00004001, 0x3f99999a, 0x0100003e, 0x54415453, 0x00000094, 0x00000002, 0x00000000, 0x00000000,
797*7ce1a24aSAmine Khaldi 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
798*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
799*7ce1a24aSAmine Khaldi 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
800*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
801*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000,
802*7ce1a24aSAmine Khaldi };
803*7ce1a24aSAmine Khaldi 
804*7ce1a24aSAmine Khaldi /*
805*7ce1a24aSAmine Khaldi  * fxc.exe /E PS /Tps_5_0 /Fx
806*7ce1a24aSAmine Khaldi  */
807*7ce1a24aSAmine Khaldi #if 0
808*7ce1a24aSAmine Khaldi float PS() : sV_DePtH
809*7ce1a24aSAmine Khaldi {
810*7ce1a24aSAmine Khaldi     float a = 1.2f;
811*7ce1a24aSAmine Khaldi     return a;
812*7ce1a24aSAmine Khaldi }
813*7ce1a24aSAmine Khaldi #endif
814*7ce1a24aSAmine Khaldi static const DWORD test_reflection_desc_ps_output_blob_3[] = {
815*7ce1a24aSAmine Khaldi 0x43425844, 0x32cec0e6, 0x3873ed32, 0x2e86ffd0, 0x21bb00e8, 0x00000001, 0x000001bc, 0x00000005,
816*7ce1a24aSAmine Khaldi 0x00000034, 0x000000ac, 0x000000bc, 0x000000f0, 0x00000120, 0x46454452, 0x00000070, 0x00000000,
817*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x0000003c, 0xffff0500, 0x00000100, 0x0000003c, 0x31314452, 0x0000003c,
818*7ce1a24aSAmine Khaldi 0x00000018, 0x00000020, 0x00000028, 0x00000024, 0x0000000c, 0x00000000, 0x7263694d, 0x666f736f,
819*7ce1a24aSAmine Khaldi 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
820*7ce1a24aSAmine Khaldi 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
821*7ce1a24aSAmine Khaldi 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0xffffffff,
822*7ce1a24aSAmine Khaldi 0x00000e01, 0x445f5673, 0x48745065, 0xababab00, 0x58454853, 0x00000028, 0x00000050, 0x0000000a,
823*7ce1a24aSAmine Khaldi 0x0100086a, 0x02000065, 0x0000c001, 0x04000036, 0x0000c001, 0x00004001, 0x3f99999a, 0x0100003e,
824*7ce1a24aSAmine Khaldi 0x54415453, 0x00000094, 0x00000002, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
825*7ce1a24aSAmine Khaldi 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
826*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
827*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
828*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
829*7ce1a24aSAmine Khaldi };
830*7ce1a24aSAmine Khaldi 
831*7ce1a24aSAmine Khaldi /*
832*7ce1a24aSAmine Khaldi  * fxc.exe /E PS /Tps_4_0 /Fx
833*7ce1a24aSAmine Khaldi  */
834*7ce1a24aSAmine Khaldi #if 0
835*7ce1a24aSAmine Khaldi float PS() : SV_Depth
836*7ce1a24aSAmine Khaldi {
837*7ce1a24aSAmine Khaldi     float a = 1.2f;
838*7ce1a24aSAmine Khaldi     return a;
839*7ce1a24aSAmine Khaldi }
840*7ce1a24aSAmine Khaldi #endif
841*7ce1a24aSAmine Khaldi static const DWORD test_reflection_desc_ps_output_blob_4[] = {
842*7ce1a24aSAmine Khaldi 0x43425844, 0x7af34874, 0x975f09ad, 0xf6e50764, 0xdfb1255f, 0x00000001, 0x00000178, 0x00000005,
843*7ce1a24aSAmine Khaldi 0x00000034, 0x0000008c, 0x0000009c, 0x000000d0, 0x000000fc, 0x46454452, 0x00000050, 0x00000000,
844*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, 0x666f736f,
845*7ce1a24aSAmine Khaldi 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
846*7ce1a24aSAmine Khaldi 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
847*7ce1a24aSAmine Khaldi 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0xffffffff,
848*7ce1a24aSAmine Khaldi 0x00000e01, 0x445f5653, 0x68747065, 0xababab00, 0x52444853, 0x00000024, 0x00000040, 0x00000009,
849*7ce1a24aSAmine Khaldi 0x02000065, 0x0000c001, 0x04000036, 0x0000c001, 0x00004001, 0x3f99999a, 0x0100003e, 0x54415453,
850*7ce1a24aSAmine Khaldi 0x00000074, 0x00000002, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
851*7ce1a24aSAmine Khaldi 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
852*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
853*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
854*7ce1a24aSAmine Khaldi };
855*7ce1a24aSAmine Khaldi 
856*7ce1a24aSAmine Khaldi /*
857*7ce1a24aSAmine Khaldi  * fxc.exe /E PS /Tps_4_0 /Fx
858*7ce1a24aSAmine Khaldi  */
859*7ce1a24aSAmine Khaldi #if 0
860*7ce1a24aSAmine Khaldi bool PS() : SV_COVERAGE
861*7ce1a24aSAmine Khaldi {
862*7ce1a24aSAmine Khaldi     bool a = true;
863*7ce1a24aSAmine Khaldi     return a;
864*7ce1a24aSAmine Khaldi }
865*7ce1a24aSAmine Khaldi #endif
866*7ce1a24aSAmine Khaldi static const DWORD test_reflection_desc_ps_output_blob_5[] = {
867*7ce1a24aSAmine Khaldi 0x43425844, 0x40ae32a7, 0xe944bb1c, 0x1a2b1923, 0xea25962d, 0x00000001, 0x000001bc, 0x00000005,
868*7ce1a24aSAmine Khaldi 0x00000034, 0x000000ac, 0x000000bc, 0x000000f0, 0x00000120, 0x46454452, 0x00000070, 0x00000000,
869*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x0000003c, 0xffff0500, 0x00000100, 0x0000003c, 0x31314452, 0x0000003c,
870*7ce1a24aSAmine Khaldi 0x00000018, 0x00000020, 0x00000028, 0x00000024, 0x0000000c, 0x00000000, 0x7263694d, 0x666f736f,
871*7ce1a24aSAmine Khaldi 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e,
872*7ce1a24aSAmine Khaldi 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
873*7ce1a24aSAmine Khaldi 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000001, 0xffffffff,
874*7ce1a24aSAmine Khaldi 0x00000e01, 0x435f5653, 0x5245564f, 0x00454741, 0x58454853, 0x00000028, 0x00000050, 0x0000000a,
875*7ce1a24aSAmine Khaldi 0x0100086a, 0x02000065, 0x0000f000, 0x04000036, 0x0000f001, 0x00004001, 0xffffffff, 0x0100003e,
876*7ce1a24aSAmine Khaldi 0x54415453, 0x00000094, 0x00000002, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
877*7ce1a24aSAmine Khaldi 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
878*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
879*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
880*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
881*7ce1a24aSAmine Khaldi };
882*7ce1a24aSAmine Khaldi 
883*7ce1a24aSAmine Khaldi static const DWORD *test_reflection_desc_ps_output_blob[] = {
884*7ce1a24aSAmine Khaldi     test_reflection_desc_ps_output_blob_0,
885*7ce1a24aSAmine Khaldi     test_reflection_desc_ps_output_blob_1,
886*7ce1a24aSAmine Khaldi     test_reflection_desc_ps_output_blob_2,
887*7ce1a24aSAmine Khaldi     test_reflection_desc_ps_output_blob_3,
888*7ce1a24aSAmine Khaldi     test_reflection_desc_ps_output_blob_4,
889*7ce1a24aSAmine Khaldi     test_reflection_desc_ps_output_blob_5,
890*7ce1a24aSAmine Khaldi };
891*7ce1a24aSAmine Khaldi 
892*7ce1a24aSAmine Khaldi static const D3D11_SIGNATURE_PARAMETER_DESC test_reflection_desc_ps_output_result[] =
893*7ce1a24aSAmine Khaldi {
894*7ce1a24aSAmine Khaldi     {"SV_Target", 3, 3, D3D_NAME_TARGET, D3D_REGISTER_COMPONENT_FLOAT32, 0xf, 0, 0},
895*7ce1a24aSAmine Khaldi     {"SV_DepthLessEqual", 0, 0xffffffff, D3D_NAME_DEPTH_LESS_EQUAL, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
896*7ce1a24aSAmine Khaldi     {"SV_DepthGreaterEqual", 0, 0xffffffff, D3D11_NAME_DEPTH_GREATER_EQUAL, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
897*7ce1a24aSAmine Khaldi     {"sV_DePtH", 0, 0xffffffff, D3D_NAME_DEPTH, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
898*7ce1a24aSAmine Khaldi     {"SV_Depth", 0, 0xffffffff, D3D_NAME_DEPTH, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe, 0},
899*7ce1a24aSAmine Khaldi     {"SV_COVERAGE", 0, 0xffffffff, D3D_NAME_COVERAGE, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0xe, 0},
900*7ce1a24aSAmine Khaldi };
901*7ce1a24aSAmine Khaldi 
test_reflection_desc_ps_output(void)902*7ce1a24aSAmine Khaldi static void test_reflection_desc_ps_output(void)
903*7ce1a24aSAmine Khaldi {
904*7ce1a24aSAmine Khaldi     HRESULT hr;
905*7ce1a24aSAmine Khaldi     ULONG count;
906*7ce1a24aSAmine Khaldi     ID3D11ShaderReflection *ref11;
907*7ce1a24aSAmine Khaldi     D3D11_SIGNATURE_PARAMETER_DESC desc = {0};
908*7ce1a24aSAmine Khaldi     const D3D11_SIGNATURE_PARAMETER_DESC *pdesc;
909*7ce1a24aSAmine Khaldi     unsigned int i;
910*7ce1a24aSAmine Khaldi 
911*7ce1a24aSAmine Khaldi     for (i = 0; i < ARRAY_SIZE(test_reflection_desc_ps_output_result); ++i)
912*7ce1a24aSAmine Khaldi     {
913*7ce1a24aSAmine Khaldi         hr = pD3DReflect(test_reflection_desc_ps_output_blob[i], test_reflection_desc_ps_output_blob[i][6], &IID_ID3D11ShaderReflection, (void **)&ref11);
914*7ce1a24aSAmine Khaldi         ok(hr == S_OK, "(%u): D3DReflect failed %x\n", i, hr);
915*7ce1a24aSAmine Khaldi 
916*7ce1a24aSAmine Khaldi         pdesc = &test_reflection_desc_ps_output_result[i];
917*7ce1a24aSAmine Khaldi 
918*7ce1a24aSAmine Khaldi         hr = ref11->lpVtbl->GetOutputParameterDesc(ref11, 0, &desc);
919*7ce1a24aSAmine Khaldi         ok(hr == S_OK, "(%u): GetOutputParameterDesc failed, got %x, expected %x\n", i, hr, S_OK);
920*7ce1a24aSAmine Khaldi 
921*7ce1a24aSAmine Khaldi         ok(!strcmp(desc.SemanticName, pdesc->SemanticName), "(%u): GetOutputParameterDesc SemanticName failed, got \"%s\", expected \"%s\"\n",
922*7ce1a24aSAmine Khaldi                 i, desc.SemanticName, pdesc->SemanticName);
923*7ce1a24aSAmine Khaldi         ok(desc.SemanticIndex == pdesc->SemanticIndex, "(%u): GetOutputParameterDesc SemanticIndex failed, got %u, expected %u\n",
924*7ce1a24aSAmine Khaldi                 i, desc.SemanticIndex, pdesc->SemanticIndex);
925*7ce1a24aSAmine Khaldi         ok(desc.Register == pdesc->Register, "(%u): GetOutputParameterDesc Register failed, got %u, expected %u\n",
926*7ce1a24aSAmine Khaldi                 i, desc.Register, pdesc->Register);
927*7ce1a24aSAmine Khaldi         ok(desc.SystemValueType == pdesc->SystemValueType, "(%u): GetOutputParameterDesc SystemValueType failed, got %x, expected %x\n",
928*7ce1a24aSAmine Khaldi                 i, desc.SystemValueType, pdesc->SystemValueType);
929*7ce1a24aSAmine Khaldi         ok(desc.ComponentType == pdesc->ComponentType, "(%u): GetOutputParameterDesc ComponentType failed, got %x, expected %x\n",
930*7ce1a24aSAmine Khaldi                 i, desc.ComponentType, pdesc->ComponentType);
931*7ce1a24aSAmine Khaldi         ok(desc.Mask == pdesc->Mask, "(%u): GetOutputParameterDesc Mask failed, got %x, expected %x\n",
932*7ce1a24aSAmine Khaldi                 i, desc.Mask, pdesc->Mask);
933*7ce1a24aSAmine Khaldi         ok(desc.ReadWriteMask == pdesc->ReadWriteMask, "(%u): GetOutputParameterDesc ReadWriteMask failed, got %x, expected %x\n",
934*7ce1a24aSAmine Khaldi                 i, desc.ReadWriteMask, pdesc->ReadWriteMask);
935*7ce1a24aSAmine Khaldi         ok(desc.Stream == pdesc->Stream, "(%u): GetOutputParameterDesc Stream failed, got %u, expected %u\n",
936*7ce1a24aSAmine Khaldi                 i, desc.Stream, pdesc->ReadWriteMask);
937*7ce1a24aSAmine Khaldi 
938*7ce1a24aSAmine Khaldi         count = ref11->lpVtbl->Release(ref11);
939*7ce1a24aSAmine Khaldi         ok(count == 0, "(%u): Release failed %u\n", i, count);
940*7ce1a24aSAmine Khaldi     }
941*7ce1a24aSAmine Khaldi }
942*7ce1a24aSAmine Khaldi 
943*7ce1a24aSAmine Khaldi /*
944*7ce1a24aSAmine Khaldi  * fxc.exe /E PS /Tps_4_0 /Fx
945*7ce1a24aSAmine Khaldi  */
946*7ce1a24aSAmine Khaldi #if 0
947*7ce1a24aSAmine Khaldi Texture2D tex1;
948*7ce1a24aSAmine Khaldi SamplerState sam
949*7ce1a24aSAmine Khaldi {
950*7ce1a24aSAmine Khaldi     Filter = MIN_MAG_MIP_LINEAR;
951*7ce1a24aSAmine Khaldi     AddressU = Wrap;
952*7ce1a24aSAmine Khaldi     AddressV = Wrap;
953*7ce1a24aSAmine Khaldi };
954*7ce1a24aSAmine Khaldi cbuffer c1
955*7ce1a24aSAmine Khaldi {
956*7ce1a24aSAmine Khaldi     float x;
957*7ce1a24aSAmine Khaldi     float y[2];
958*7ce1a24aSAmine Khaldi     int z;
959*7ce1a24aSAmine Khaldi };
960*7ce1a24aSAmine Khaldi cbuffer c2
961*7ce1a24aSAmine Khaldi {
962*7ce1a24aSAmine Khaldi     float t;
963*7ce1a24aSAmine Khaldi };
964*7ce1a24aSAmine Khaldi 
965*7ce1a24aSAmine Khaldi float4 PS(float2 uv : TEXCOORD0) : sv_target
966*7ce1a24aSAmine Khaldi {
967*7ce1a24aSAmine Khaldi     float4 q = tex1.Sample(sam, uv);
968*7ce1a24aSAmine Khaldi     q.x = q.x + x;
969*7ce1a24aSAmine Khaldi     q.w = q.w + y[0] + y[1] + t;
970*7ce1a24aSAmine Khaldi     return q;
971*7ce1a24aSAmine Khaldi }
972*7ce1a24aSAmine Khaldi #endif
973*7ce1a24aSAmine Khaldi static DWORD test_reflection_bound_resources_blob[] = {
974*7ce1a24aSAmine Khaldi 0x43425844, 0xe4af0279, 0x690268fc, 0x76bf6a72, 0xe5aff43b, 0x00000001, 0x000003f4, 0x00000005,
975*7ce1a24aSAmine Khaldi 0x00000034, 0x000001e8, 0x0000021c, 0x00000250, 0x00000378, 0x46454452, 0x000001ac, 0x00000002,
976*7ce1a24aSAmine Khaldi 0x000000ac, 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x0000017a, 0x0000009c, 0x00000003,
977*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x000000a0, 0x00000002,
978*7ce1a24aSAmine Khaldi 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000c, 0x000000a5, 0x00000000,
979*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x000000a8, 0x00000000,
980*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x006d6173, 0x31786574,
981*7ce1a24aSAmine Khaldi 0x00316300, 0xab003263, 0x000000a5, 0x00000003, 0x000000dc, 0x00000030, 0x00000000, 0x00000000,
982*7ce1a24aSAmine Khaldi 0x000000a8, 0x00000001, 0x00000160, 0x00000010, 0x00000000, 0x00000000, 0x00000124, 0x00000000,
983*7ce1a24aSAmine Khaldi 0x00000004, 0x00000002, 0x00000128, 0x00000000, 0x00000138, 0x00000010, 0x00000014, 0x00000002,
984*7ce1a24aSAmine Khaldi 0x0000013c, 0x00000000, 0x0000014c, 0x00000024, 0x00000004, 0x00000000, 0x00000150, 0x00000000,
985*7ce1a24aSAmine Khaldi 0xabab0078, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0xabab0079, 0x00030000, 0x00010001,
986*7ce1a24aSAmine Khaldi 0x00000002, 0x00000000, 0xabab007a, 0x00020000, 0x00010001, 0x00000000, 0x00000000, 0x00000178,
987*7ce1a24aSAmine Khaldi 0x00000000, 0x00000004, 0x00000002, 0x00000128, 0x00000000, 0x694d0074, 0x736f7263, 0x2074666f,
988*7ce1a24aSAmine Khaldi 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39,
989*7ce1a24aSAmine Khaldi 0x31332e32, 0xab003131, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000,
990*7ce1a24aSAmine Khaldi 0x00000000, 0x00000003, 0x00000000, 0x00000303, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f,
991*7ce1a24aSAmine Khaldi 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
992*7ce1a24aSAmine Khaldi 0x0000000f, 0x745f7673, 0x65677261, 0xabab0074, 0x52444853, 0x00000120, 0x00000040, 0x00000048,
993*7ce1a24aSAmine Khaldi 0x04000059, 0x00208e46, 0x00000000, 0x00000003, 0x04000059, 0x00208e46, 0x00000001, 0x00000001,
994*7ce1a24aSAmine Khaldi 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062,
995*7ce1a24aSAmine Khaldi 0x00101032, 0x00000000, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045,
996*7ce1a24aSAmine Khaldi 0x001000f2, 0x00000000, 0x00101046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000,
997*7ce1a24aSAmine Khaldi 0x08000000, 0x00100082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000000, 0x00000001,
998*7ce1a24aSAmine Khaldi 0x08000000, 0x00100082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000000, 0x00000002,
999*7ce1a24aSAmine Khaldi 0x08000000, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000001, 0x00000000,
1000*7ce1a24aSAmine Khaldi 0x08000000, 0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x0020800a, 0x00000000, 0x00000000,
1001*7ce1a24aSAmine Khaldi 0x05000036, 0x00102062, 0x00000000, 0x00100656, 0x00000000, 0x0100003e, 0x54415453, 0x00000074,
1002*7ce1a24aSAmine Khaldi 0x00000007, 0x00000001, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000001,
1003*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
1004*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1005*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1006*7ce1a24aSAmine Khaldi };
1007*7ce1a24aSAmine Khaldi 
1008*7ce1a24aSAmine Khaldi static const D3D11_SHADER_INPUT_BIND_DESC test_reflection_bound_resources_result[] =
1009*7ce1a24aSAmine Khaldi {
1010*7ce1a24aSAmine Khaldi     {"sam", D3D_SIT_SAMPLER, 0, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0},
1011*7ce1a24aSAmine Khaldi     {"tex1", D3D_SIT_TEXTURE, 0, 1, 12, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, 0xffffffff},
1012*7ce1a24aSAmine Khaldi     {"c1", D3D_SIT_CBUFFER, 0, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0},
1013*7ce1a24aSAmine Khaldi     {"c2", D3D_SIT_CBUFFER, 1, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0},
1014*7ce1a24aSAmine Khaldi };
1015*7ce1a24aSAmine Khaldi 
test_reflection_bound_resources(void)1016*7ce1a24aSAmine Khaldi static void test_reflection_bound_resources(void)
1017*7ce1a24aSAmine Khaldi {
1018*7ce1a24aSAmine Khaldi     HRESULT hr;
1019*7ce1a24aSAmine Khaldi     ULONG count;
1020*7ce1a24aSAmine Khaldi     ID3D11ShaderReflection *ref11;
1021*7ce1a24aSAmine Khaldi     D3D11_SHADER_INPUT_BIND_DESC desc;
1022*7ce1a24aSAmine Khaldi     const D3D11_SHADER_INPUT_BIND_DESC *pdesc;
1023*7ce1a24aSAmine Khaldi     unsigned int i;
1024*7ce1a24aSAmine Khaldi 
1025*7ce1a24aSAmine Khaldi     hr = pD3DReflect(test_reflection_bound_resources_blob, test_reflection_bound_resources_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
1026*7ce1a24aSAmine Khaldi     ok(hr == S_OK, "D3DReflect failed %x\n", hr);
1027*7ce1a24aSAmine Khaldi 
1028*7ce1a24aSAmine Khaldi     /* check invalid cases */
1029*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, 0, NULL);
1030*7ce1a24aSAmine Khaldi     ok(hr == E_INVALIDARG, "GetResourceBindingDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
1031*7ce1a24aSAmine Khaldi 
1032*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, 0xffffffff, &desc);
1033*7ce1a24aSAmine Khaldi     ok(hr == E_INVALIDARG, "GetResourceBindingDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
1034*7ce1a24aSAmine Khaldi 
1035*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, NULL, &desc);
1036*7ce1a24aSAmine Khaldi     ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG);
1037*7ce1a24aSAmine Khaldi 
1038*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, "sam", NULL);
1039*7ce1a24aSAmine Khaldi     ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG);
1040*7ce1a24aSAmine Khaldi 
1041*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, "invalid", NULL);
1042*7ce1a24aSAmine Khaldi     ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG);
1043*7ce1a24aSAmine Khaldi 
1044*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, "invalid", &desc);
1045*7ce1a24aSAmine Khaldi     ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG);
1046*7ce1a24aSAmine Khaldi 
1047*7ce1a24aSAmine Khaldi     /* GetResourceBindingDesc */
1048*7ce1a24aSAmine Khaldi     for (i = 0; i < ARRAY_SIZE(test_reflection_bound_resources_result); ++i)
1049*7ce1a24aSAmine Khaldi     {
1050*7ce1a24aSAmine Khaldi         pdesc = &test_reflection_bound_resources_result[i];
1051*7ce1a24aSAmine Khaldi 
1052*7ce1a24aSAmine Khaldi         hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, i, &desc);
1053*7ce1a24aSAmine Khaldi         ok(hr == S_OK, "GetResourceBindingDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
1054*7ce1a24aSAmine Khaldi 
1055*7ce1a24aSAmine Khaldi         ok(!strcmp(desc.Name, pdesc->Name), "GetResourceBindingDesc(%u) Name failed, got \"%s\", expected \"%s\"\n",
1056*7ce1a24aSAmine Khaldi                 i, desc.Name, pdesc->Name);
1057*7ce1a24aSAmine Khaldi         ok(desc.Type == pdesc->Type, "GetResourceBindingDesc(%u) Type failed, got %x, expected %x\n",
1058*7ce1a24aSAmine Khaldi                 i, desc.Type, pdesc->Type);
1059*7ce1a24aSAmine Khaldi         ok(desc.BindPoint == pdesc->BindPoint, "GetResourceBindingDesc(%u) BindPoint failed, got %u, expected %u\n",
1060*7ce1a24aSAmine Khaldi                 i, desc.BindPoint, pdesc->BindPoint);
1061*7ce1a24aSAmine Khaldi         ok(desc.BindCount == pdesc->BindCount, "GetResourceBindingDesc(%u) BindCount failed, got %u, expected %u\n",
1062*7ce1a24aSAmine Khaldi                 i, desc.BindCount, pdesc->BindCount);
1063*7ce1a24aSAmine Khaldi         ok(desc.uFlags == pdesc->uFlags, "GetResourceBindingDesc(%u) uFlags failed, got %u, expected %u\n",
1064*7ce1a24aSAmine Khaldi                 i, desc.uFlags, pdesc->uFlags);
1065*7ce1a24aSAmine Khaldi         ok(desc.ReturnType == pdesc->ReturnType, "GetResourceBindingDesc(%u) ReturnType failed, got %x, expected %x\n",
1066*7ce1a24aSAmine Khaldi                 i, desc.ReturnType, pdesc->ReturnType);
1067*7ce1a24aSAmine Khaldi         ok(desc.Dimension == pdesc->Dimension, "GetResourceBindingDesc(%u) Dimension failed, got %x, expected %x\n",
1068*7ce1a24aSAmine Khaldi                 i, desc.Dimension, pdesc->Dimension);
1069*7ce1a24aSAmine Khaldi         ok(desc.NumSamples == pdesc->NumSamples, "GetResourceBindingDesc(%u) NumSamples failed, got %u, expected %u\n",
1070*7ce1a24aSAmine Khaldi                 i, desc.NumSamples, pdesc->NumSamples);
1071*7ce1a24aSAmine Khaldi     }
1072*7ce1a24aSAmine Khaldi 
1073*7ce1a24aSAmine Khaldi     /* GetResourceBindingDescByName */
1074*7ce1a24aSAmine Khaldi     for (i = 0; i < ARRAY_SIZE(test_reflection_bound_resources_result); ++i)
1075*7ce1a24aSAmine Khaldi     {
1076*7ce1a24aSAmine Khaldi         pdesc = &test_reflection_bound_resources_result[i];
1077*7ce1a24aSAmine Khaldi 
1078*7ce1a24aSAmine Khaldi         hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, pdesc->Name, &desc);
1079*7ce1a24aSAmine Khaldi         ok(hr == S_OK, "GetResourceBindingDescByName(%u) failed, got %x, expected %x\n", i, hr, S_OK);
1080*7ce1a24aSAmine Khaldi 
1081*7ce1a24aSAmine Khaldi         ok(!strcmp(desc.Name, pdesc->Name), "GetResourceBindingDescByName(%u) Name failed, got \"%s\", expected \"%s\"\n",
1082*7ce1a24aSAmine Khaldi                 i, desc.Name, pdesc->Name);
1083*7ce1a24aSAmine Khaldi         ok(desc.Type == pdesc->Type, "GetResourceBindingDescByName(%u) Type failed, got %x, expected %x\n",
1084*7ce1a24aSAmine Khaldi                 i, desc.Type, pdesc->Type);
1085*7ce1a24aSAmine Khaldi         ok(desc.BindPoint == pdesc->BindPoint, "GetResourceBindingDescByName(%u) BindPoint failed, got %u, expected %u\n",
1086*7ce1a24aSAmine Khaldi                 i, desc.BindPoint, pdesc->BindPoint);
1087*7ce1a24aSAmine Khaldi         ok(desc.BindCount == pdesc->BindCount, "GetResourceBindingDescByName(%u) BindCount failed, got %u, expected %u\n",
1088*7ce1a24aSAmine Khaldi                 i, desc.BindCount, pdesc->BindCount);
1089*7ce1a24aSAmine Khaldi         ok(desc.uFlags == pdesc->uFlags, "GetResourceBindingDescByName(%u) uFlags failed, got %u, expected %u\n",
1090*7ce1a24aSAmine Khaldi                 i, desc.uFlags, pdesc->uFlags);
1091*7ce1a24aSAmine Khaldi         ok(desc.ReturnType == pdesc->ReturnType, "GetResourceBindingDescByName(%u) ReturnType failed, got %x, expected %x\n",
1092*7ce1a24aSAmine Khaldi                 i, desc.ReturnType, pdesc->ReturnType);
1093*7ce1a24aSAmine Khaldi         ok(desc.Dimension == pdesc->Dimension, "GetResourceBindingDescByName(%u) Dimension failed, got %x, expected %x\n",
1094*7ce1a24aSAmine Khaldi                 i, desc.Dimension, pdesc->Dimension);
1095*7ce1a24aSAmine Khaldi         ok(desc.NumSamples == pdesc->NumSamples, "GetResourceBindingDescByName(%u) NumSamples failed, got %u, expected %u\n",
1096*7ce1a24aSAmine Khaldi                 i, desc.NumSamples, pdesc->NumSamples);
1097*7ce1a24aSAmine Khaldi     }
1098*7ce1a24aSAmine Khaldi 
1099*7ce1a24aSAmine Khaldi     count = ref11->lpVtbl->Release(ref11);
1100*7ce1a24aSAmine Khaldi     ok(count == 0, "Release failed %u\n", count);
1101*7ce1a24aSAmine Khaldi }
1102*7ce1a24aSAmine Khaldi 
1103*7ce1a24aSAmine Khaldi /*
1104*7ce1a24aSAmine Khaldi  * fxc.exe /E PS /Tps_5_0 /Fx
1105*7ce1a24aSAmine Khaldi  */
1106*7ce1a24aSAmine Khaldi #if 0
1107*7ce1a24aSAmine Khaldi cbuffer c1
1108*7ce1a24aSAmine Khaldi {
1109*7ce1a24aSAmine Khaldi     float a;
1110*7ce1a24aSAmine Khaldi     float b[2];
1111*7ce1a24aSAmine Khaldi     int i;
1112*7ce1a24aSAmine Khaldi     struct s {
1113*7ce1a24aSAmine Khaldi         float a;
1114*7ce1a24aSAmine Khaldi         float b;
1115*7ce1a24aSAmine Khaldi     } t;
1116*7ce1a24aSAmine Khaldi };
1117*7ce1a24aSAmine Khaldi 
1118*7ce1a24aSAmine Khaldi interface iTest
1119*7ce1a24aSAmine Khaldi {
1120*7ce1a24aSAmine Khaldi     float4 test(float2 vec);
1121*7ce1a24aSAmine Khaldi };
1122*7ce1a24aSAmine Khaldi 
1123*7ce1a24aSAmine Khaldi class cTest : iTest
1124*7ce1a24aSAmine Khaldi {
1125*7ce1a24aSAmine Khaldi     bool m_on;
1126*7ce1a24aSAmine Khaldi     float4 test(float2 vec);
1127*7ce1a24aSAmine Khaldi };
1128*7ce1a24aSAmine Khaldi 
1129*7ce1a24aSAmine Khaldi float4 cTest::test(float2 vec)
1130*7ce1a24aSAmine Khaldi {
1131*7ce1a24aSAmine Khaldi     float4 res;
1132*7ce1a24aSAmine Khaldi     if(m_on)
1133*7ce1a24aSAmine Khaldi         res = float4(vec.x, vec.y, vec.x+vec.y, 0);
1134*7ce1a24aSAmine Khaldi     else
1135*7ce1a24aSAmine Khaldi         res = 0;
1136*7ce1a24aSAmine Khaldi     return res;
1137*7ce1a24aSAmine Khaldi }
1138*7ce1a24aSAmine Khaldi 
1139*7ce1a24aSAmine Khaldi iTest g_Test;
1140*7ce1a24aSAmine Khaldi 
1141*7ce1a24aSAmine Khaldi 
1142*7ce1a24aSAmine Khaldi float4 PS(float2 uv : TEXCOORD0) : sv_target
1143*7ce1a24aSAmine Khaldi {
1144*7ce1a24aSAmine Khaldi     float4 q = g_Test.test(uv);
1145*7ce1a24aSAmine Khaldi     q.x = q.x + t.a;
1146*7ce1a24aSAmine Khaldi     return q;
1147*7ce1a24aSAmine Khaldi }
1148*7ce1a24aSAmine Khaldi #endif
1149*7ce1a24aSAmine Khaldi static DWORD test_reflection_constant_buffer_blob[] = {
1150*7ce1a24aSAmine Khaldi 0x43425844, 0xe6470e0d, 0x0d5698bb, 0x29373c30, 0x64a5d268, 0x00000001, 0x00000590, 0x00000006,
1151*7ce1a24aSAmine Khaldi 0x00000038, 0x00000318, 0x0000034c, 0x00000380, 0x000003d8, 0x000004f4, 0x46454452, 0x000002d8,
1152*7ce1a24aSAmine Khaldi 0x00000002, 0x00000060, 0x00000001, 0x0000003c, 0xffff0500, 0x00000100, 0x000002a4, 0x31314452,
1153*7ce1a24aSAmine Khaldi 0x0000003c, 0x00000018, 0x00000020, 0x00000028, 0x00000024, 0x0000000c, 0x00000001, 0x0000005c,
1154*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0xab003163,
1155*7ce1a24aSAmine Khaldi 0x00000090, 0x00000001, 0x000000a0, 0x00000010, 0x00000000, 0x00000002, 0x0000005c, 0x00000004,
1156*7ce1a24aSAmine Khaldi 0x00000120, 0x00000040, 0x00000000, 0x00000000, 0x69685424, 0x696f5073, 0x7265746e, 0xababab00,
1157*7ce1a24aSAmine Khaldi 0x000000c8, 0x00000000, 0x00000001, 0x00000006, 0x000000fc, 0x00000000, 0xffffffff, 0x00000000,
1158*7ce1a24aSAmine Khaldi 0xffffffff, 0x00000000, 0x65545f67, 0x69007473, 0x74736554, 0xababab00, 0x00000006, 0x00000001,
1159*7ce1a24aSAmine Khaldi 0x00000000, 0x000000d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000cf, 0x00250007,
1160*7ce1a24aSAmine Khaldi 0x00040001, 0x00000000, 0x00000000, 0x000000d8, 0x00000000, 0x00000000, 0x00000000, 0x000000cf,
1161*7ce1a24aSAmine Khaldi 0x000001c0, 0x00000000, 0x00000004, 0x00000000, 0x000001c8, 0x00000000, 0xffffffff, 0x00000000,
1162*7ce1a24aSAmine Khaldi 0xffffffff, 0x00000000, 0x000001ec, 0x00000010, 0x00000014, 0x00000000, 0x000001f0, 0x00000000,
1163*7ce1a24aSAmine Khaldi 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000214, 0x00000024, 0x00000004, 0x00000000,
1164*7ce1a24aSAmine Khaldi 0x0000021c, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000240, 0x00000030,
1165*7ce1a24aSAmine Khaldi 0x00000008, 0x00000002, 0x00000280, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000,
1166*7ce1a24aSAmine Khaldi 0x6c660061, 0x0074616f, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1167*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x000001c2, 0xabab0062, 0x00030000, 0x00010001, 0x00000002, 0x00000000,
1168*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000001c2, 0x6e690069, 0xabab0074, 0x00020000,
1169*7ce1a24aSAmine Khaldi 0x00010001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000216,
1170*7ce1a24aSAmine Khaldi 0x00730074, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1171*7ce1a24aSAmine Khaldi 0x00000000, 0x000001c2, 0x000001c0, 0x00000244, 0x00000000, 0x000001ec, 0x00000244, 0x00000004,
1172*7ce1a24aSAmine Khaldi 0x00000005, 0x00020001, 0x00020000, 0x00000268, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1173*7ce1a24aSAmine Khaldi 0x00000242, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072,
1174*7ce1a24aSAmine Khaldi 0x6c69706d, 0x39207265, 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x0000002c,
1175*7ce1a24aSAmine Khaldi 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000303,
1176*7ce1a24aSAmine Khaldi 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
1177*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x745f7673, 0x65677261, 0xabab0074,
1178*7ce1a24aSAmine Khaldi 0x45434649, 0x00000050, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000040, 0x00000034,
1179*7ce1a24aSAmine Khaldi 0x00000024, 0x00000000, 0x4e47534f, 0x00000001, 0x00000001, 0x00000040, 0x00000044, 0x00000048,
1180*7ce1a24aSAmine Khaldi 0x00010000, 0x00000000, 0xabab0000, 0x00000000, 0x73655463, 0xabab0074, 0x58454853, 0x00000114,
1181*7ce1a24aSAmine Khaldi 0x00000050, 0x00000045, 0x0100086a, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, 0x03000091,
1182*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x05000092, 0x00000000, 0x00000000, 0x00010001, 0x00000000, 0x03001062,
1183*7ce1a24aSAmine Khaldi 0x00101032, 0x00000000, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x07000000,
1184*7ce1a24aSAmine Khaldi 0x00100042, 0x00000000, 0x0010101a, 0x00000000, 0x0010100a, 0x00000000, 0x05000036, 0x00100032,
1185*7ce1a24aSAmine Khaldi 0x00000000, 0x00101046, 0x00000000, 0x05000036, 0x00100082, 0x00000000, 0x00004001, 0x00000000,
1186*7ce1a24aSAmine Khaldi 0x05000036, 0x00100032, 0x00000001, 0x0011d516, 0x00000000, 0x0a000001, 0x001000f2, 0x00000000,
1187*7ce1a24aSAmine Khaldi 0x00100e46, 0x00000000, 0x04a08006, 0x0010001a, 0x00000001, 0x0010000a, 0x00000001, 0x08000000,
1188*7ce1a24aSAmine Khaldi 0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x0020800a, 0x00000000, 0x00000003, 0x05000036,
1189*7ce1a24aSAmine Khaldi 0x001020e2, 0x00000000, 0x00100e56, 0x00000000, 0x0100003e, 0x54415453, 0x00000094, 0x00000008,
1190*7ce1a24aSAmine Khaldi 0x00000002, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000001, 0x00000001, 0x00000000,
1191*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1192*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1193*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1194*7ce1a24aSAmine Khaldi 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1195*7ce1a24aSAmine Khaldi };
1196*7ce1a24aSAmine Khaldi 
1197*7ce1a24aSAmine Khaldi static const D3D11_SHADER_BUFFER_DESC test_reflection_constant_buffer_cb_result[] =
1198*7ce1a24aSAmine Khaldi {
1199*7ce1a24aSAmine Khaldi     {"$ThisPointer", D3D_CT_INTERFACE_POINTERS, 1, 16, 0},
1200*7ce1a24aSAmine Khaldi     {"c1", D3D_CT_CBUFFER, 4, 64, 0},
1201*7ce1a24aSAmine Khaldi };
1202*7ce1a24aSAmine Khaldi 
1203*7ce1a24aSAmine Khaldi static const struct {
1204*7ce1a24aSAmine Khaldi     D3D11_SHADER_VARIABLE_DESC desc;
1205*7ce1a24aSAmine Khaldi     unsigned int type;
1206*7ce1a24aSAmine Khaldi } test_reflection_constant_buffer_variable_result[] =
1207*7ce1a24aSAmine Khaldi {
1208*7ce1a24aSAmine Khaldi     {{"g_Test", 0, 1, 6, 0}, 0},
1209*7ce1a24aSAmine Khaldi     {{"a", 0, 4, 0, 0}, 1},
1210*7ce1a24aSAmine Khaldi     {{"b", 16, 20, 0, 0}, 2},
1211*7ce1a24aSAmine Khaldi     {{"i", 36, 4, 0, 0}, 3},
1212*7ce1a24aSAmine Khaldi     {{"t", 48, 8, 2, 0}, 4},
1213*7ce1a24aSAmine Khaldi };
1214*7ce1a24aSAmine Khaldi 
1215*7ce1a24aSAmine Khaldi static const D3D11_SHADER_TYPE_DESC test_reflection_constant_buffer_type_result[] =
1216*7ce1a24aSAmine Khaldi {
1217*7ce1a24aSAmine Khaldi     {D3D11_SVC_INTERFACE_POINTER, D3D11_SVT_INTERFACE_POINTER, 1, 4, 0, 1, 0, "iTest"},
1218*7ce1a24aSAmine Khaldi     {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 0, 1, 0, "float"},
1219*7ce1a24aSAmine Khaldi     {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 2, 1, 0, "float"},
1220*7ce1a24aSAmine Khaldi     {D3D_SVC_SCALAR, D3D_SVT_INT, 1, 1, 0, 1, 0, "int"},
1221*7ce1a24aSAmine Khaldi     {D3D_SVC_STRUCT, D3D_SVT_VOID, 1, 2, 0, 1, 0, "s"},
1222*7ce1a24aSAmine Khaldi };
1223*7ce1a24aSAmine Khaldi 
test_reflection_constant_buffer(void)1224*7ce1a24aSAmine Khaldi static void test_reflection_constant_buffer(void)
1225*7ce1a24aSAmine Khaldi {
1226*7ce1a24aSAmine Khaldi     HRESULT hr;
1227*7ce1a24aSAmine Khaldi     ULONG count;
1228*7ce1a24aSAmine Khaldi     ID3D11ShaderReflection *ref11;
1229*7ce1a24aSAmine Khaldi     ID3D11ShaderReflectionConstantBuffer *cb11, *cb11_dummy = NULL, *cb11_valid = NULL;
1230*7ce1a24aSAmine Khaldi     ID3D11ShaderReflectionVariable *v11, *v11_dummy = NULL, *v11_valid = NULL;
1231*7ce1a24aSAmine Khaldi     ID3D11ShaderReflectionType *t11, *t, *t2, *t11_dummy = NULL, *t11_valid = NULL;
1232*7ce1a24aSAmine Khaldi     D3D11_SHADER_BUFFER_DESC cbdesc = {0};
1233*7ce1a24aSAmine Khaldi     D3D11_SHADER_VARIABLE_DESC vdesc = {0};
1234*7ce1a24aSAmine Khaldi     D3D11_SHADER_TYPE_DESC tdesc = {0};
1235*7ce1a24aSAmine Khaldi     D3D11_SHADER_DESC sdesc = {0};
1236*7ce1a24aSAmine Khaldi     const D3D11_SHADER_BUFFER_DESC *pcbdesc;
1237*7ce1a24aSAmine Khaldi     const D3D11_SHADER_VARIABLE_DESC *pvdesc;
1238*7ce1a24aSAmine Khaldi     const D3D11_SHADER_TYPE_DESC *ptdesc;
1239*7ce1a24aSAmine Khaldi     unsigned int i;
1240*7ce1a24aSAmine Khaldi     LPCSTR string;
1241*7ce1a24aSAmine Khaldi 
1242*7ce1a24aSAmine Khaldi     hr = pD3DReflect(test_reflection_constant_buffer_blob, test_reflection_constant_buffer_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
1243*7ce1a24aSAmine Khaldi     ok(hr == S_OK, "D3DReflect failed %x\n", hr);
1244*7ce1a24aSAmine Khaldi 
1245*7ce1a24aSAmine Khaldi     hr = ref11->lpVtbl->GetDesc(ref11, &sdesc);
1246*7ce1a24aSAmine Khaldi     ok(hr == S_OK, "GetDesc failed %x\n", hr);
1247*7ce1a24aSAmine Khaldi 
1248*7ce1a24aSAmine Khaldi     ok(sdesc.Version == 80, "GetDesc failed, got %u, expected %u\n", sdesc.Version, 80);
1249*7ce1a24aSAmine Khaldi     ok(strcmp(sdesc.Creator, (char*) shader_creator) == 0, "GetDesc failed, got \"%s\", expected \"%s\"\n", sdesc.Creator, (char*)shader_creator);
1250*7ce1a24aSAmine Khaldi     ok(sdesc.Flags == 256, "GetDesc failed, got %u, expected %u\n", sdesc.Flags, 256);
1251*7ce1a24aSAmine Khaldi     ok(sdesc.ConstantBuffers == 2, "GetDesc failed, got %u, expected %u\n", sdesc.ConstantBuffers, 2);
1252*7ce1a24aSAmine Khaldi     ok(sdesc.BoundResources == 1, "GetDesc failed, got %u, expected %u\n", sdesc.BoundResources, 1);
1253*7ce1a24aSAmine Khaldi     ok(sdesc.InputParameters == 1, "GetDesc failed, got %u, expected %u\n", sdesc.InputParameters, 1);
1254*7ce1a24aSAmine Khaldi     ok(sdesc.OutputParameters == 1, "GetDesc failed, got %u, expected %u\n", sdesc.OutputParameters, 1);
1255*7ce1a24aSAmine Khaldi     ok(sdesc.InstructionCount == 8, "GetDesc failed, got %u, expected %u\n", sdesc.InstructionCount, 8);
1256*7ce1a24aSAmine Khaldi     ok(sdesc.TempRegisterCount == 2, "GetDesc failed, got %u, expected %u\n", sdesc.TempRegisterCount, 2);
1257*7ce1a24aSAmine Khaldi     ok(sdesc.TempArrayCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.TempArrayCount, 0);
1258*7ce1a24aSAmine Khaldi     ok(sdesc.DefCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.DefCount, 0);
1259*7ce1a24aSAmine Khaldi     ok(sdesc.DclCount == 2, "GetDesc failed, got %u, expected %u\n", sdesc.DclCount, 2);
1260*7ce1a24aSAmine Khaldi     ok(sdesc.TextureNormalInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.TextureNormalInstructions, 0);
1261*7ce1a24aSAmine Khaldi     ok(sdesc.TextureLoadInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.TextureLoadInstructions, 0);
1262*7ce1a24aSAmine Khaldi     ok(sdesc.TextureCompInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.TextureCompInstructions, 0);
1263*7ce1a24aSAmine Khaldi     ok(sdesc.TextureBiasInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.TextureBiasInstructions, 0);
1264*7ce1a24aSAmine Khaldi     ok(sdesc.TextureGradientInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.TextureGradientInstructions, 0);
1265*7ce1a24aSAmine Khaldi     ok(sdesc.FloatInstructionCount == 2, "GetDesc failed, got %u, expected %u\n", sdesc.FloatInstructionCount, 2);
1266*7ce1a24aSAmine Khaldi     ok(sdesc.IntInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.IntInstructionCount, 0);
1267*7ce1a24aSAmine Khaldi     ok(sdesc.UintInstructionCount == 1, "GetDesc failed, got %u, expected %u\n", sdesc.UintInstructionCount, 1);
1268*7ce1a24aSAmine Khaldi     ok(sdesc.StaticFlowControlCount == 1, "GetDesc failed, got %u, expected %u\n", sdesc.StaticFlowControlCount, 1);
1269*7ce1a24aSAmine Khaldi     ok(sdesc.DynamicFlowControlCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.DynamicFlowControlCount, 0);
1270*7ce1a24aSAmine Khaldi     ok(sdesc.MacroInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.MacroInstructionCount, 0);
1271*7ce1a24aSAmine Khaldi     ok(sdesc.ArrayInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.ArrayInstructionCount, 0);
1272*7ce1a24aSAmine Khaldi     ok(sdesc.CutInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.CutInstructionCount, 0);
1273*7ce1a24aSAmine Khaldi     ok(sdesc.EmitInstructionCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.EmitInstructionCount, 0);
1274*7ce1a24aSAmine Khaldi     ok(sdesc.GSOutputTopology == 0, "GetDesc failed, got %x, expected %x\n", sdesc.GSOutputTopology, 0);
1275*7ce1a24aSAmine Khaldi     ok(sdesc.GSMaxOutputVertexCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.GSMaxOutputVertexCount, 0);
1276*7ce1a24aSAmine Khaldi     ok(sdesc.InputPrimitive == 0, "GetDesc failed, got %x, expected %x\n", sdesc.InputPrimitive, 0);
1277*7ce1a24aSAmine Khaldi     ok(sdesc.PatchConstantParameters == 0, "GetDesc failed, got %u, expected %u\n", sdesc.PatchConstantParameters, 0);
1278*7ce1a24aSAmine Khaldi     ok(sdesc.cGSInstanceCount == 0, "GetDesc failed, got %u, expected %u\n", sdesc.cGSInstanceCount, 0);
1279*7ce1a24aSAmine Khaldi     ok(sdesc.cControlPoints == 0, "GetDesc failed, got %u, expected %u\n", sdesc.cControlPoints, 0);
1280*7ce1a24aSAmine Khaldi     ok(sdesc.HSOutputPrimitive == 0, "GetDesc failed, got %x, expected %x\n", sdesc.HSOutputPrimitive, 0);
1281*7ce1a24aSAmine Khaldi     ok(sdesc.HSPartitioning == 0, "GetDesc failed, got %x, expected %x\n", sdesc.HSPartitioning, 0);
1282*7ce1a24aSAmine Khaldi     ok(sdesc.TessellatorDomain == 0, "GetDesc failed, got %x, expected %x\n", sdesc.TessellatorDomain, 0);
1283*7ce1a24aSAmine Khaldi     ok(sdesc.cBarrierInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.cBarrierInstructions, 0);
1284*7ce1a24aSAmine Khaldi     ok(sdesc.cInterlockedInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.cInterlockedInstructions, 0);
1285*7ce1a24aSAmine Khaldi     ok(sdesc.cTextureStoreInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc.cTextureStoreInstructions, 0);
1286*7ce1a24aSAmine Khaldi 
1287*7ce1a24aSAmine Khaldi     /* get the dummys for comparison */
1288*7ce1a24aSAmine Khaldi     cb11_dummy = ref11->lpVtbl->GetConstantBufferByIndex(ref11, 0xffffffff);
1289*7ce1a24aSAmine Khaldi     ok(cb11_dummy != NULL, "GetConstantBufferByIndex failed\n");
1290*7ce1a24aSAmine Khaldi 
1291*7ce1a24aSAmine Khaldi     v11_dummy = cb11_dummy->lpVtbl->GetVariableByIndex(cb11_dummy, 0xffffffff);
1292*7ce1a24aSAmine Khaldi     ok(v11_dummy != NULL, "GetVariableByIndex failed\n");
1293*7ce1a24aSAmine Khaldi 
1294*7ce1a24aSAmine Khaldi     t11_dummy = v11_dummy->lpVtbl->GetType(v11_dummy);
1295*7ce1a24aSAmine Khaldi     ok(t11_dummy != NULL, "GetType failed\n");
1296*7ce1a24aSAmine Khaldi 
1297*7ce1a24aSAmine Khaldi     /* get the valid variables */
1298*7ce1a24aSAmine Khaldi     cb11_valid = ref11->lpVtbl->GetConstantBufferByIndex(ref11, 1);
1299*7ce1a24aSAmine Khaldi     ok(cb11_valid != cb11_dummy && cb11_valid, "GetConstantBufferByIndex failed\n");
1300*7ce1a24aSAmine Khaldi 
1301*7ce1a24aSAmine Khaldi     v11_valid = cb11_valid->lpVtbl->GetVariableByIndex(cb11_valid, 0);
1302*7ce1a24aSAmine Khaldi     ok(v11_valid != v11_dummy && v11_valid, "GetVariableByIndex failed\n");
1303*7ce1a24aSAmine Khaldi 
1304*7ce1a24aSAmine Khaldi     t11_valid = v11_valid->lpVtbl->GetType(v11_valid);
1305*7ce1a24aSAmine Khaldi     ok(t11_valid != t11_dummy && t11_valid, "GetType failed\n");
1306*7ce1a24aSAmine Khaldi 
1307*7ce1a24aSAmine Khaldi     /* reflection calls */
1308*7ce1a24aSAmine Khaldi     cb11 = ref11->lpVtbl->GetConstantBufferByName(ref11, "invalid");
1309*7ce1a24aSAmine Khaldi     ok(cb11_dummy == cb11, "GetConstantBufferByName failed, got %p, expected %p\n", cb11, cb11_dummy);
1310*7ce1a24aSAmine Khaldi 
1311*7ce1a24aSAmine Khaldi     cb11 = ref11->lpVtbl->GetConstantBufferByName(ref11, NULL);
1312*7ce1a24aSAmine Khaldi     ok(cb11_dummy == cb11, "GetConstantBufferByName failed, got %p, expected %p\n", cb11, cb11_dummy);
1313*7ce1a24aSAmine Khaldi 
1314*7ce1a24aSAmine Khaldi     v11 = ref11->lpVtbl->GetVariableByName(ref11, NULL);
1315*7ce1a24aSAmine Khaldi     ok(v11_dummy == v11, "GetVariableByIndex failed, got %p, expected %p\n", v11, v11_dummy);
1316*7ce1a24aSAmine Khaldi 
1317*7ce1a24aSAmine Khaldi     v11 = ref11->lpVtbl->GetVariableByName(ref11, "invalid");
1318*7ce1a24aSAmine Khaldi     ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy);
1319*7ce1a24aSAmine Khaldi 
1320*7ce1a24aSAmine Khaldi     v11 = ref11->lpVtbl->GetVariableByName(ref11, "a");
1321*7ce1a24aSAmine Khaldi     ok(v11_valid == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_valid);
1322*7ce1a24aSAmine Khaldi 
1323*7ce1a24aSAmine Khaldi     /* constant buffer calls */
1324*7ce1a24aSAmine Khaldi     v11 = cb11_dummy->lpVtbl->GetVariableByName(cb11_dummy, NULL);
1325*7ce1a24aSAmine Khaldi     ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy);
1326*7ce1a24aSAmine Khaldi 
1327*7ce1a24aSAmine Khaldi     v11 = cb11_dummy->lpVtbl->GetVariableByName(cb11_dummy, "invalid");
1328*7ce1a24aSAmine Khaldi     ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy);
1329*7ce1a24aSAmine Khaldi 
1330*7ce1a24aSAmine Khaldi     v11 = cb11_valid->lpVtbl->GetVariableByName(cb11_valid, NULL);
1331*7ce1a24aSAmine Khaldi     ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy);
1332*7ce1a24aSAmine Khaldi 
1333*7ce1a24aSAmine Khaldi     v11 = cb11_valid->lpVtbl->GetVariableByName(cb11_valid, "invalid");
1334*7ce1a24aSAmine Khaldi     ok(v11_dummy == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_dummy);
1335*7ce1a24aSAmine Khaldi 
1336*7ce1a24aSAmine Khaldi     v11 = cb11_valid->lpVtbl->GetVariableByName(cb11_valid, "a");
1337*7ce1a24aSAmine Khaldi     ok(v11_valid == v11, "GetVariableByName failed, got %p, expected %p\n", v11, v11_valid);
1338*7ce1a24aSAmine Khaldi 
1339*7ce1a24aSAmine Khaldi     hr = cb11_dummy->lpVtbl->GetDesc(cb11_dummy, NULL);
1340*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
1341*7ce1a24aSAmine Khaldi 
1342*7ce1a24aSAmine Khaldi     hr = cb11_dummy->lpVtbl->GetDesc(cb11_dummy, &cbdesc);
1343*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
1344*7ce1a24aSAmine Khaldi 
1345*7ce1a24aSAmine Khaldi     hr = cb11_valid->lpVtbl->GetDesc(cb11_valid, NULL);
1346*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
1347*7ce1a24aSAmine Khaldi 
1348*7ce1a24aSAmine Khaldi     /* variable calls */
1349*7ce1a24aSAmine Khaldi     hr = v11_dummy->lpVtbl->GetDesc(v11_dummy, NULL);
1350*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
1351*7ce1a24aSAmine Khaldi 
1352*7ce1a24aSAmine Khaldi     hr = v11_dummy->lpVtbl->GetDesc(v11_dummy, &vdesc);
1353*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
1354*7ce1a24aSAmine Khaldi 
1355*7ce1a24aSAmine Khaldi     hr = v11_valid->lpVtbl->GetDesc(v11_valid, NULL);
1356*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
1357*7ce1a24aSAmine Khaldi 
1358*7ce1a24aSAmine Khaldi     /* type calls */
1359*7ce1a24aSAmine Khaldi     hr = t11_dummy->lpVtbl->GetDesc(t11_dummy, NULL);
1360*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
1361*7ce1a24aSAmine Khaldi 
1362*7ce1a24aSAmine Khaldi     hr = t11_dummy->lpVtbl->GetDesc(t11_dummy, &tdesc);
1363*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
1364*7ce1a24aSAmine Khaldi 
1365*7ce1a24aSAmine Khaldi     hr = t11_valid->lpVtbl->GetDesc(t11_valid, NULL);
1366*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "GetDesc failed, got %x, expected %x\n", hr, E_FAIL);
1367*7ce1a24aSAmine Khaldi 
1368*7ce1a24aSAmine Khaldi     string = t11_dummy->lpVtbl->GetMemberTypeName(t11_dummy, 0xffffffff);
1369*7ce1a24aSAmine Khaldi     ok(!strcmp(string, "$Invalid"), "GetMemberTypeName failed, got \"%s\", expected \"%s\"\n", string, "$Invalid");
1370*7ce1a24aSAmine Khaldi 
1371*7ce1a24aSAmine Khaldi     string = t11_valid->lpVtbl->GetMemberTypeName(t11_valid, 0xffffffff);
1372*7ce1a24aSAmine Khaldi     ok(!string, "GetMemberTypeName failed, got \"%s\", expected NULL\n", string);
1373*7ce1a24aSAmine Khaldi 
1374*7ce1a24aSAmine Khaldi     t11 = t11_dummy->lpVtbl->GetMemberTypeByIndex(t11_dummy, 0xffffffff);
1375*7ce1a24aSAmine Khaldi     ok(t11_dummy == t11, "GetMemberTypeByIndex failed, got %p, expected %p\n", t11, t11_dummy);
1376*7ce1a24aSAmine Khaldi 
1377*7ce1a24aSAmine Khaldi     t11 = t11_valid->lpVtbl->GetMemberTypeByIndex(t11_valid, 0xffffffff);
1378*7ce1a24aSAmine Khaldi     ok(t11_dummy == t11, "GetMemberTypeByIndex failed, got %p, expected %p\n", t11, t11_dummy);
1379*7ce1a24aSAmine Khaldi 
1380*7ce1a24aSAmine Khaldi     t11 = t11_dummy->lpVtbl->GetMemberTypeByName(t11_dummy, NULL);
1381*7ce1a24aSAmine Khaldi     ok(t11_dummy == t11, "GetMemberTypeByName failed, got %p, expected %p\n", t11, t11_dummy);
1382*7ce1a24aSAmine Khaldi 
1383*7ce1a24aSAmine Khaldi     t11 = t11_dummy->lpVtbl->GetMemberTypeByName(t11_dummy, "invalid");
1384*7ce1a24aSAmine Khaldi     ok(t11_dummy == t11, "GetMemberTypeByName failed, got %p, expected %p\n", t11, t11_dummy);
1385*7ce1a24aSAmine Khaldi 
1386*7ce1a24aSAmine Khaldi     t11 = t11_valid->lpVtbl->GetMemberTypeByName(t11_valid, NULL);
1387*7ce1a24aSAmine Khaldi     ok(t11_dummy == t11, "GetMemberTypeByName failed, got %p, expected %p\n", t11, t11_dummy);
1388*7ce1a24aSAmine Khaldi 
1389*7ce1a24aSAmine Khaldi     t11 = t11_valid->lpVtbl->GetMemberTypeByName(t11_valid, "invalid");
1390*7ce1a24aSAmine Khaldi     ok(t11_dummy == t11, "GetMemberTypeByName failed, got %p, expected %p\n", t11, t11_dummy);
1391*7ce1a24aSAmine Khaldi 
1392*7ce1a24aSAmine Khaldi     hr = t11_dummy->lpVtbl->IsEqual(t11_dummy, t11_dummy);
1393*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "IsEqual failed, got %x, expected %x\n", hr, E_FAIL);
1394*7ce1a24aSAmine Khaldi 
1395*7ce1a24aSAmine Khaldi     hr = t11_valid->lpVtbl->IsEqual(t11_valid, t11_dummy);
1396*7ce1a24aSAmine Khaldi     ok(hr == S_FALSE, "IsEqual failed, got %x, expected %x\n", hr, S_FALSE);
1397*7ce1a24aSAmine Khaldi 
1398*7ce1a24aSAmine Khaldi     hr = t11_dummy->lpVtbl->IsEqual(t11_dummy, t11_valid);
1399*7ce1a24aSAmine Khaldi     ok(hr == E_FAIL, "IsEqual failed, got %x, expected %x\n", hr, E_FAIL);
1400*7ce1a24aSAmine Khaldi 
1401*7ce1a24aSAmine Khaldi     hr = t11_valid->lpVtbl->IsEqual(t11_valid, t11_valid);
1402*7ce1a24aSAmine Khaldi     ok(hr == S_OK, "IsEqual failed, got %x, expected %x\n", hr, S_OK);
1403*7ce1a24aSAmine Khaldi 
1404*7ce1a24aSAmine Khaldi     /* constant buffers */
1405*7ce1a24aSAmine Khaldi     for (i = 0; i < ARRAY_SIZE(test_reflection_constant_buffer_cb_result); ++i)
1406*7ce1a24aSAmine Khaldi     {
1407*7ce1a24aSAmine Khaldi         pcbdesc = &test_reflection_constant_buffer_cb_result[i];
1408*7ce1a24aSAmine Khaldi 
1409*7ce1a24aSAmine Khaldi         cb11 = ref11->lpVtbl->GetConstantBufferByIndex(ref11, i);
1410*7ce1a24aSAmine Khaldi         ok(cb11_dummy != cb11, "GetConstantBufferByIndex(%u) failed\n", i);
1411*7ce1a24aSAmine Khaldi 
1412*7ce1a24aSAmine Khaldi         hr = cb11->lpVtbl->GetDesc(cb11, &cbdesc);
1413*7ce1a24aSAmine Khaldi         ok(hr == S_OK, "GetDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
1414*7ce1a24aSAmine Khaldi 
1415*7ce1a24aSAmine Khaldi         ok(!strcmp(cbdesc.Name, pcbdesc->Name), "GetDesc(%u) Name failed, got \"%s\", expected \"%s\"\n",
1416*7ce1a24aSAmine Khaldi                 i, cbdesc.Name, pcbdesc->Name);
1417*7ce1a24aSAmine Khaldi         ok(cbdesc.Type == pcbdesc->Type, "GetDesc(%u) Type failed, got %x, expected %x\n",
1418*7ce1a24aSAmine Khaldi                 i, cbdesc.Type, pcbdesc->Type);
1419*7ce1a24aSAmine Khaldi         ok(cbdesc.Variables == pcbdesc->Variables, "GetDesc(%u) Variables failed, got %u, expected %u\n",
1420*7ce1a24aSAmine Khaldi                 i, cbdesc.Variables, pcbdesc->Variables);
1421*7ce1a24aSAmine Khaldi         ok(cbdesc.Size == pcbdesc->Size, "GetDesc(%u) Size failed, got %u, expected %u\n",
1422*7ce1a24aSAmine Khaldi                 i, cbdesc.Size, pcbdesc->Size);
1423*7ce1a24aSAmine Khaldi         ok(cbdesc.uFlags == pcbdesc->uFlags, "GetDesc(%u) uFlags failed, got %u, expected %u\n",
1424*7ce1a24aSAmine Khaldi                 i, cbdesc.uFlags, pcbdesc->uFlags);
1425*7ce1a24aSAmine Khaldi     }
1426*7ce1a24aSAmine Khaldi 
1427*7ce1a24aSAmine Khaldi     /* variables */
1428*7ce1a24aSAmine Khaldi     for (i = 0; i < ARRAY_SIZE(test_reflection_constant_buffer_variable_result); ++i)
1429*7ce1a24aSAmine Khaldi     {
1430*7ce1a24aSAmine Khaldi         pvdesc = &test_reflection_constant_buffer_variable_result[i].desc;
1431*7ce1a24aSAmine Khaldi 
1432*7ce1a24aSAmine Khaldi         v11 = ref11->lpVtbl->GetVariableByName(ref11, pvdesc->Name);
1433*7ce1a24aSAmine Khaldi         ok(v11_dummy != v11, "GetVariableByName(%u) failed\n", i);
1434*7ce1a24aSAmine Khaldi 
1435*7ce1a24aSAmine Khaldi         hr = v11->lpVtbl->GetDesc(v11, &vdesc);
1436*7ce1a24aSAmine Khaldi         ok(hr == S_OK, "GetDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
1437*7ce1a24aSAmine Khaldi 
1438*7ce1a24aSAmine Khaldi         ok(!strcmp(vdesc.Name, pvdesc->Name), "GetDesc(%u) Name failed, got \"%s\", expected \"%s\"\n",
1439*7ce1a24aSAmine Khaldi                 i, vdesc.Name, pvdesc->Name);
1440*7ce1a24aSAmine Khaldi         ok(vdesc.StartOffset == pvdesc->StartOffset, "GetDesc(%u) StartOffset failed, got %u, expected %u\n",
1441*7ce1a24aSAmine Khaldi                 i, vdesc.StartOffset, pvdesc->StartOffset);
1442*7ce1a24aSAmine Khaldi         ok(vdesc.Size == pvdesc->Size, "GetDesc(%u) Size failed, got %u, expected %u\n",
1443*7ce1a24aSAmine Khaldi                 i, vdesc.Size, pvdesc->Size);
1444*7ce1a24aSAmine Khaldi         ok(vdesc.uFlags == pvdesc->uFlags, "GetDesc(%u) uFlags failed, got %u, expected %u\n",
1445*7ce1a24aSAmine Khaldi                 i, vdesc.uFlags, pvdesc->uFlags);
1446*7ce1a24aSAmine Khaldi         ok(vdesc.DefaultValue == pvdesc->DefaultValue, "GetDesc(%u) DefaultValue failed\n", i);
1447*7ce1a24aSAmine Khaldi 
1448*7ce1a24aSAmine Khaldi         /* types */
1449*7ce1a24aSAmine Khaldi         ptdesc = &test_reflection_constant_buffer_type_result[test_reflection_constant_buffer_variable_result[i].type];
1450*7ce1a24aSAmine Khaldi 
1451*7ce1a24aSAmine Khaldi         t11 = v11->lpVtbl->GetType(v11);
1452*7ce1a24aSAmine Khaldi         ok(t11_dummy != t11, "GetType(%u) failed\n", i);
1453*7ce1a24aSAmine Khaldi 
1454*7ce1a24aSAmine Khaldi         hr = t11->lpVtbl->GetDesc(t11, &tdesc);
1455*7ce1a24aSAmine Khaldi         ok(hr == S_OK, "GetDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK);
1456*7ce1a24aSAmine Khaldi 
1457*7ce1a24aSAmine Khaldi         ok(tdesc.Class == ptdesc->Class, "GetDesc(%u) Class failed, got %x, expected %x\n",
1458*7ce1a24aSAmine Khaldi                 i, tdesc.Class, ptdesc->Class);
1459*7ce1a24aSAmine Khaldi         ok(tdesc.Type == ptdesc->Type, "GetDesc(%u) Type failed, got %x, expected %x\n",
1460*7ce1a24aSAmine Khaldi                 i, tdesc.Type, ptdesc->Type);
1461*7ce1a24aSAmine Khaldi         ok(tdesc.Rows == ptdesc->Rows, "GetDesc(%u) Rows failed, got %x, expected %x\n",
1462*7ce1a24aSAmine Khaldi                 i, tdesc.Rows, ptdesc->Rows);
1463*7ce1a24aSAmine Khaldi         ok(tdesc.Columns == ptdesc->Columns, "GetDesc(%u) Columns failed, got %u, expected %u\n",
1464*7ce1a24aSAmine Khaldi                 i, tdesc.Columns, ptdesc->Columns);
1465*7ce1a24aSAmine Khaldi         ok(tdesc.Elements == ptdesc->Elements, "GetDesc(%u) Elements failed, got %u, expected %u\n",
1466*7ce1a24aSAmine Khaldi                 i, tdesc.Elements, ptdesc->Elements);
1467*7ce1a24aSAmine Khaldi         ok(tdesc.Offset == ptdesc->Offset, "GetDesc(%u) Offset failed, got %u, expected %u\n",
1468*7ce1a24aSAmine Khaldi                 i, tdesc.Offset, ptdesc->Offset);
1469*7ce1a24aSAmine Khaldi         ok(!strcmp(tdesc.Name, ptdesc->Name), "GetDesc(%u) Name failed, got %s, expected %s\n",
1470*7ce1a24aSAmine Khaldi                 i, tdesc.Name, ptdesc->Name);
1471*7ce1a24aSAmine Khaldi     }
1472*7ce1a24aSAmine Khaldi 
1473*7ce1a24aSAmine Khaldi     /* types */
1474*7ce1a24aSAmine Khaldi     v11 = ref11->lpVtbl->GetVariableByName(ref11, "t");
1475*7ce1a24aSAmine Khaldi     ok(v11_dummy != v11, "GetVariableByName failed\n");
1476*7ce1a24aSAmine Khaldi 
1477*7ce1a24aSAmine Khaldi     t11 = v11->lpVtbl->GetType(v11);
1478*7ce1a24aSAmine Khaldi     ok(t11 != t11_dummy, "GetType failed\n");
1479*7ce1a24aSAmine Khaldi 
1480*7ce1a24aSAmine Khaldi     t = t11->lpVtbl->GetMemberTypeByIndex(t11, 0);
1481*7ce1a24aSAmine Khaldi     ok(t != t11_dummy, "GetMemberTypeByIndex failed\n");
1482*7ce1a24aSAmine Khaldi 
1483*7ce1a24aSAmine Khaldi     t2 = t11->lpVtbl->GetMemberTypeByName(t11, "a");
1484*7ce1a24aSAmine Khaldi     ok(t == t2, "GetMemberTypeByName failed, got %p, expected %p\n", t2, t);
1485*7ce1a24aSAmine Khaldi 
1486*7ce1a24aSAmine Khaldi     string = t11->lpVtbl->GetMemberTypeName(t11, 0);
1487*7ce1a24aSAmine Khaldi     ok(!strcmp(string, "a"), "GetMemberTypeName failed, got \"%s\", expected \"%s\"\n", string, "a");
1488*7ce1a24aSAmine Khaldi 
1489*7ce1a24aSAmine Khaldi     t = t11->lpVtbl->GetMemberTypeByIndex(t11, 1);
1490*7ce1a24aSAmine Khaldi     ok(t != t11_dummy, "GetMemberTypeByIndex failed\n");
1491*7ce1a24aSAmine Khaldi 
1492*7ce1a24aSAmine Khaldi     t2 = t11->lpVtbl->GetMemberTypeByName(t11, "b");
1493*7ce1a24aSAmine Khaldi     ok(t == t2, "GetMemberTypeByName failed, got %p, expected %p\n", t2, t);
1494*7ce1a24aSAmine Khaldi 
1495*7ce1a24aSAmine Khaldi     string = t11->lpVtbl->GetMemberTypeName(t11, 1);
1496*7ce1a24aSAmine Khaldi     ok(!strcmp(string, "b"), "GetMemberTypeName failed, got \"%s\", expected \"%s\"\n", string, "b");
1497*7ce1a24aSAmine Khaldi 
1498*7ce1a24aSAmine Khaldi     /* float vs float (in struct) */
1499*7ce1a24aSAmine Khaldi     hr = t11->lpVtbl->IsEqual(t11, t11_valid);
1500*7ce1a24aSAmine Khaldi     ok(hr == S_FALSE, "IsEqual failed, got %x, expected %x\n", hr, S_FALSE);
1501*7ce1a24aSAmine Khaldi 
1502*7ce1a24aSAmine Khaldi     hr = t11_valid->lpVtbl->IsEqual(t11_valid, t11);
1503*7ce1a24aSAmine Khaldi     ok(hr == S_FALSE, "IsEqual failed, got %x, expected %x\n", hr, S_FALSE);
1504*7ce1a24aSAmine Khaldi 
1505*7ce1a24aSAmine Khaldi     /* float vs float */
1506*7ce1a24aSAmine Khaldi     t = t11->lpVtbl->GetMemberTypeByIndex(t11, 0);
1507*7ce1a24aSAmine Khaldi     ok(t != t11_dummy, "GetMemberTypeByIndex failed\n");
1508*7ce1a24aSAmine Khaldi 
1509*7ce1a24aSAmine Khaldi     t2 = t11->lpVtbl->GetMemberTypeByIndex(t11, 1);
1510*7ce1a24aSAmine Khaldi     ok(t2 != t11_dummy, "GetMemberTypeByIndex failed\n");
1511*7ce1a24aSAmine Khaldi 
1512*7ce1a24aSAmine Khaldi     hr = t->lpVtbl->IsEqual(t, t2);
1513*7ce1a24aSAmine Khaldi     ok(hr == S_OK, "IsEqual failed, got %x, expected %x\n", hr, S_OK);
1514*7ce1a24aSAmine Khaldi 
1515*7ce1a24aSAmine Khaldi     count = ref11->lpVtbl->Release(ref11);
1516*7ce1a24aSAmine Khaldi     ok(count == 0, "Release failed %u\n", count);
1517*7ce1a24aSAmine Khaldi }
1518*7ce1a24aSAmine Khaldi 
load_d3dcompiler(void)1519*7ce1a24aSAmine Khaldi static BOOL load_d3dcompiler(void)
1520*7ce1a24aSAmine Khaldi {
1521*7ce1a24aSAmine Khaldi     HMODULE module;
1522*7ce1a24aSAmine Khaldi 
1523*7ce1a24aSAmine Khaldi     if (!(module = LoadLibraryA("d3dcompiler_43.dll"))) return FALSE;
1524*7ce1a24aSAmine Khaldi 
1525*7ce1a24aSAmine Khaldi     pD3DReflect = (void*)GetProcAddress(module, "D3DReflect");
1526*7ce1a24aSAmine Khaldi     return TRUE;
1527*7ce1a24aSAmine Khaldi }
1528*7ce1a24aSAmine Khaldi 
START_TEST(reflection)1529*7ce1a24aSAmine Khaldi START_TEST(reflection)
1530*7ce1a24aSAmine Khaldi {
1531*7ce1a24aSAmine Khaldi     if (!load_d3dcompiler())
1532*7ce1a24aSAmine Khaldi     {
1533*7ce1a24aSAmine Khaldi         win_skip("Could not load d3dcompiler_43.dll\n");
1534*7ce1a24aSAmine Khaldi         return;
1535*7ce1a24aSAmine Khaldi     }
1536*7ce1a24aSAmine Khaldi 
1537*7ce1a24aSAmine Khaldi #ifndef __REACTOS__
1538*7ce1a24aSAmine Khaldi     test_reflection_references();
1539*7ce1a24aSAmine Khaldi #endif
1540*7ce1a24aSAmine Khaldi     test_reflection_desc_vs();
1541*7ce1a24aSAmine Khaldi     test_reflection_desc_ps();
1542*7ce1a24aSAmine Khaldi     test_reflection_desc_ps_output();
1543*7ce1a24aSAmine Khaldi     test_reflection_bound_resources();
1544*7ce1a24aSAmine Khaldi     test_reflection_constant_buffer();
1545*7ce1a24aSAmine Khaldi }
1546