ws2_32: Also check the FQDN when injecting the local IP.
[wine.git] / dlls / d3dx9_36 / tests / shader.c
blob4a7ae67ccda23cae0f3843d57c4a4bc7afaf5e92
1 /*
2 * Copyright 2008 Luis Busquets
3 * Copyright 2011 Travis Athougies
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "wine/test.h"
21 #include "d3dx9.h"
23 #define FCC_TEXT MAKEFOURCC('T','E','X','T')
24 #define FCC_CTAB MAKEFOURCC('C','T','A','B')
26 static const DWORD shader_zero[] = {0x0};
28 static const DWORD shader_invalid[] = {0xeeee0100};
30 static const DWORD shader_empty[] = {0xfffe0200, 0x0000ffff};
32 static const DWORD simple_fx[] = {0x46580000, 0x0002fffe, FCC_TEXT, 0x00000000, 0x0000ffff};
34 static const DWORD simple_tx[] = {0x54580000, 0x0002fffe, FCC_TEXT, 0x00000000, 0x0000ffff};
36 static const DWORD simple_7ffe[] = {0x7ffe0000, 0x0002fffe, FCC_TEXT, 0x00000000, 0x0000ffff};
38 static const DWORD simple_7fff[] = {0x7fff0000, 0x0002fffe, FCC_TEXT, 0x00000000, 0x0000ffff};
40 static const DWORD simple_vs[] = {
41 0xfffe0101, /* vs_1_1 */
42 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */
43 0x00000009, 0xc0010000, 0x90e40000, 0xa0e40000, /* dp4 oPos.x, v0, c0 */
44 0x00000009, 0xc0020000, 0x90e40000, 0xa0e40001, /* dp4 oPos.y, v0, c1 */
45 0x00000009, 0xc0040000, 0x90e40000, 0xa0e40002, /* dp4 oPos.z, v0, c2 */
46 0x00000009, 0xc0080000, 0x90e40000, 0xa0e40003, /* dp4 oPos.w, v0, c3 */
47 0x0000ffff}; /* END */
49 static const DWORD simple_ps[] = {
50 0xffff0101, /* ps_1_1 */
51 0x00000051, 0xa00f0001, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, /* def c1 = 1.0, 0.0, 0.0, 0.0 */
52 0x00000042, 0xb00f0000, /* tex t0 */
53 0x00000008, 0x800f0000, 0xa0e40001, 0xa0e40000, /* dp3 r0, c1, c0 */
54 0x00000005, 0x800f0000, 0x90e40000, 0x80e40000, /* mul r0, v0, r0 */
55 0x00000005, 0x800f0000, 0xb0e40000, 0x80e40000, /* mul r0, t0, r0 */
56 0x0000ffff}; /* END */
58 static const DWORD shader_with_ctab[] = {
59 0xfffe0300, /* vs_3_0 */
60 0x0002fffe, FCC_TEXT, 0x00000000, /* TEXT comment */
61 0x0008fffe, FCC_CTAB, 0x0000001c, 0x00000010, 0xfffe0300, 0x00000000, /* CTAB comment */
62 0x00000000, 0x00000000, 0x00000000,
63 0x0004fffe, FCC_TEXT, 0x00000000, 0x00000000, 0x00000000, /* TEXT comment */
64 0x0000ffff}; /* END */
66 static const DWORD shader_with_invalid_ctab[] = {
67 0xfffe0300, /* vs_3_0 */
68 0x0005fffe, FCC_CTAB, /* CTAB comment */
69 0x0000001c, 0x000000a9, 0xfffe0300,
70 0x00000000, 0x00000000,
71 0x0000ffff}; /* END */
73 static const DWORD shader_with_ctab_constants[] = {
74 0xfffe0300, /* vs_3_0 */
75 0x002efffe, FCC_CTAB, /* CTAB comment */
76 0x0000001c, 0x000000a4, 0xfffe0300, 0x00000003, 0x0000001c, 0x20008100, /* Header */
77 0x0000009c,
78 0x00000058, 0x00070002, 0x00000001, 0x00000064, 0x00000000, /* Constant 1 desc */
79 0x00000074, 0x00000002, 0x00000004, 0x00000080, 0x00000000, /* Constant 2 desc */
80 0x00000090, 0x00040002, 0x00000003, 0x00000080, 0x00000000, /* Constant 3 desc */
81 0x736e6f43, 0x746e6174, 0xabab0031, /* Constant 1 name string */
82 0x00030001, 0x00040001, 0x00000001, 0x00000000, /* Constant 1 type desc */
83 0x736e6f43, 0x746e6174, 0xabab0032, /* Constant 2 name string */
84 0x00030003, 0x00040004, 0x00000001, 0x00000000, /* Constant 2 & 3 type desc */
85 0x736e6f43, 0x746e6174, 0xabab0033, /* Constant 3 name string */
86 0x335f7376, 0xab00305f, /* Target name string */
87 0x656e6957, 0x6f727020, 0x7463656a, 0xababab00, /* Creator name string */
88 0x0000ffff}; /* END */
90 static const DWORD ctab_basic[] = {
91 0xfffe0300, /* vs_3_0 */
92 0x0040fffe, FCC_CTAB, /* CTAB comment */
93 0x0000001c, 0x000000ec, 0xfffe0300, 0x00000005, 0x0000001c, 0x20008100, /* Header */
94 0x000000e4,
95 0x00000080, 0x00060002, 0x00000001, 0x00000084, 0x00000000, /* Constant 1 desc (f) */
96 0x00000094, 0x00070002, 0x00000001, 0x00000098, 0x00000000, /* Constant 2 desc (f4) */
97 0x000000A8, 0x00040002, 0x00000001, 0x000000AC, 0x00000000, /* Constant 3 desc (i) */
98 0x000000BC, 0x00050002, 0x00000001, 0x000000C0, 0x00000000, /* Constant 4 desc (i4) */
99 0x000000D0, 0x00000002, 0x00000004, 0x000000D4, 0x00000000, /* Constant 5 desc (mvp) */
100 0xabab0066, 0x00030000, 0x00010001, 0x00000001, 0x00000000, /* Constant 1 name/type desc */
101 0xab003466, 0x00030001, 0x00040001, 0x00000001, 0x00000000, /* Constant 2 name/type desc */
102 0xabab0069, 0x00020000, 0x00010001, 0x00000001, 0x00000000, /* Constant 3 name/type desc */
103 0xab003469, 0x00020001, 0x00040001, 0x00000001, 0x00000000, /* Constant 4 name/type desc */
104 0x0070766d, 0x00030003, 0x00040004, 0x00000001, 0x00000000, /* Constant 5 name/type desc */
105 0x335f7376, 0xab00305f, /* Target name string */
106 0x656e6957, 0x6f727020, 0x7463656a, 0xababab00, /* Creator name string */
107 0x0000ffff}; /* END */
109 static const D3DXCONSTANT_DESC ctab_basic_expected[] = {
110 {"mvp", D3DXRS_FLOAT4, 0, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 4, 4, 1, 0, 64, NULL},
111 {"i", D3DXRS_FLOAT4, 4, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL},
112 {"i4", D3DXRS_FLOAT4, 5, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 4, 1, 0, 16, NULL},
113 {"f", D3DXRS_FLOAT4, 6, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL},
114 {"f4", D3DXRS_FLOAT4, 7, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 1, 0, 16, NULL}};
116 static const DWORD ctab_matrices[] = {
117 0xfffe0300, /* vs_3_0 */
118 0x0032fffe, FCC_CTAB, /* CTAB comment */
119 0x0000001c, 0x000000b4, 0xfffe0300, 0x00000003, 0x0000001c, 0x20008100, /* Header */
120 0x000000ac,
121 0x00000058, 0x00070002, 0x00000001, 0x00000064, 0x00000000, /* Constant 1 desc (fmatrix3x1) */
122 0x00000074, 0x00000002, 0x00000004, 0x00000080, 0x00000000, /* Constant 2 desc (fmatrix4x4) */
123 0x00000090, 0x00040002, 0x00000002, 0x0000009c, 0x00000000, /* Constant 3 desc (imatrix2x3) */
124 0x74616D66, 0x33786972, 0xab003178, /* Constant 1 name */
125 0x00030003, 0x00010003, 0x00000001, 0x00000000, /* Constant 1 type desc */
126 0x74616D66, 0x34786972, 0xab003478, /* Constant 2 name */
127 0x00030003, 0x00040004, 0x00000001, 0x00000000, /* Constant 2 type desc */
128 0x74616D69, 0x32786972, 0xab003378, /* Constant 3 name */
129 0x00020002, 0x00030002, 0x00000001, 0x00000000, /* Constant 3 type desc */
130 0x335f7376, 0xab00305f, /* Target name string */
131 0x656e6957, 0x6f727020, 0x7463656a, 0xababab00, /* Creator name string */
132 0x0000ffff}; /* END */
134 static const D3DXCONSTANT_DESC ctab_matrices_expected[] = {
135 {"fmatrix4x4", D3DXRS_FLOAT4, 0, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 4, 4, 1, 0, 64, NULL},
136 {"imatrix2x3", D3DXRS_FLOAT4, 4, 2, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 1, 0, 24, NULL},
137 {"fmatrix3x1", D3DXRS_FLOAT4, 7, 1, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL},
140 static const DWORD ctab_matrices2[] = {
141 0xfffe0200, /* vs_2_0 */
142 0x0058fffe, FCC_CTAB, /* CTAB comment */
143 0x0000001c, 0x0000012b, 0xfffe0200, 0x00000006, 0x0000001c, 0x00000100, /* Header */
144 0x00000124,
145 0x00000094, 0x00070002, 0x00000003, 0x0000009c, 0x00000000, /* Constant 1 desc (c2x3) */
146 0x000000ac, 0x000d0002, 0x00000002, 0x000000b4, 0x00000000, /* Constant 2 desc (c3x2) */
147 0x000000c4, 0x000a0002, 0x00000003, 0x000000cc, 0x00000000, /* Constant 3 desc (c3x3) */
148 0x000000dc, 0x000f0002, 0x00000002, 0x000000e4, 0x00000000, /* Constant 4 desc (r2x3) */
149 0x000000f4, 0x00040002, 0x00000003, 0x000000fc, 0x00000000, /* Constant 5 desc (r3x2) */
150 0x0000010c, 0x00000002, 0x00000004, 0x00000114, 0x00000000, /* Constant 6 desc (r4x4) */
151 0x33783263, 0xababab00, /* Constant 1 name */
152 0x00030003, 0x00030002, 0x00000001, 0x00000000, /* Constant 1 type desc */
153 0x32783363, 0xababab00, /* Constant 2 name */
154 0x00030003, 0x00020003, 0x00000001, 0x00000000, /* Constant 2 type desc */
155 0x33783363, 0xababab00, /* Constant 3 name */
156 0x00030003, 0x00030003, 0x00000001, 0x00000000, /* Constant 3 type desc */
157 0x33783272, 0xababab00, /* Constant 4 name */
158 0x00030002, 0x00030002, 0x00000001, 0x00000000, /* Constant 4 type desc */
159 0x32783372, 0xababab00, /* Constant 5 name */
160 0x00030002, 0x00020003, 0x00000001, 0x00000000, /* Constant 5 type desc */
161 0x34783472, 0xababab00, /* Constant 6 name */
162 0x00030002, 0x00040004, 0x00000001, 0x00000000, /* Constant 6 type desc */
163 0x325f7376, 0x4100305f, 0x41414141, 0x00414141, /* Target and Creator name */
164 0x0000ffff}; /* END */
166 static const D3DXCONSTANT_DESC ctab_matrices2_expected[] = {
167 {"c2x3", D3DXRS_FLOAT4, 7, 3, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 2, 3, 1, 0, 24, NULL},
168 {"c3x2", D3DXRS_FLOAT4, 13, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL},
169 {"c3x3", D3DXRS_FLOAT4, 10, 3, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 3, 1, 0, 36, NULL},
170 {"r2x3", D3DXRS_FLOAT4, 15, 2, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 3, 1, 0, 24, NULL},
171 {"r3x2", D3DXRS_FLOAT4, 4, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL},
172 {"r4x4", D3DXRS_FLOAT4, 0, 4, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 4, 1, 0, 64, NULL}};
174 static const DWORD ctab_arrays[] = {
175 0xfffe0300, /* vs_3_0 */
176 0x0052fffe, FCC_CTAB, /* CTAB comment */
177 0x0000001c, 0x0000013c, 0xfffe0300, 0x00000006, 0x0000001c, 0x20008100, /* Header */
178 0x00000134,
179 0x00000094, 0x000E0002, 0x00000002, 0x0000009c, 0x00000000, /* Constant 1 desc (barray) */
180 0x000000ac, 0x00100002, 0x00000002, 0x000000b8, 0x00000000, /* Constant 2 desc (bvecarray) */
181 0x000000c8, 0x00080002, 0x00000004, 0x000000d0, 0x00000000, /* Constant 3 desc (farray) */
182 0x000000e0, 0x00000002, 0x00000008, 0x000000ec, 0x00000000, /* Constant 4 desc (fmtxarray) */
183 0x000000fc, 0x000C0002, 0x00000002, 0x00000108, 0x00000000, /* Constant 5 desc (fvecarray) */
184 0x00000118, 0x00120002, 0x00000001, 0x00000124, 0x00000000, /* Constant 6 desc (ivecarray) */
185 0x72726162, 0xab007961, /* Constant 1 name */
186 0x00010000, 0x00010001, 0x00000002, 0x00000000, /* Constant 1 type desc */
187 0x63657662, 0x61727261, 0xabab0079, /* Constant 2 name */
188 0x00010001, 0x00030001, 0x00000003, 0x00000000, /* Constant 2 type desc */
189 0x72726166, 0xab007961, /* Constant 3 name */
190 0x00030000, 0x00010001, 0x00000004, 0x00000000, /* constant 3 type desc */
191 0x78746d66, 0x61727261, 0xabab0079, /* Constant 4 name */
192 0x00030002, 0x00040004, 0x00000002, 0x00000000, /* Constant 4 type desc */
193 0x63657666, 0x61727261, 0xabab0079, /* Constant 5 name */
194 0x00030001, 0x00040001, 0x00000002, 0x00000000, /* Constant 5 type desc */
195 0x63657669, 0x61727261, 0xabab0079, /* Constant 6 name */
196 0x00020001, 0x00040001, 0x00000001, 0x00000000, /* Constant 6 type desc */
197 0x335f7376, 0xab00305f, /* Target name string */
198 0x656e6957, 0x6f727020, 0x7463656a, 0xababab00, /* Creator name string */
199 0x0000ffff}; /* END */
201 static const D3DXCONSTANT_DESC ctab_arrays_expected[] = {
202 {"fmtxarray", D3DXRS_FLOAT4, 0, 8, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 4, 2, 0, 128, NULL},
203 {"farray", D3DXRS_FLOAT4, 8, 4, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 4, 0, 16, NULL},
204 {"fvecarray", D3DXRS_FLOAT4, 12, 2, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 2, 0, 32, NULL},
205 {"barray", D3DXRS_FLOAT4, 14, 2, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 2, 0, 8, NULL},
206 {"bvecarray", D3DXRS_FLOAT4, 16, 2, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 3, 0, 36, NULL},
207 {"ivecarray", D3DXRS_FLOAT4, 18, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 4, 1, 0, 16, NULL}};
209 static const DWORD ctab_with_default_values[] = {
210 0xfffe0200, /* vs_2_0 */
211 0x007bfffe, FCC_CTAB, /* CTAB comment */
212 0x0000001c, 0x000001b7, 0xfffe0200, 0x00000005, 0x0000001c, /* header */
213 0x00000100, 0x000001b0,
214 0x00000080, 0x00080002, 0x00000003, 0x00000084, 0x00000094, /* constant 1 desc (arr) */
215 0x000000c4, 0x000c0002, 0x00000001, 0x000000c8, 0x000000d8, /* constant 2 desc (flt) */
216 0x000000e8, 0x00040002, 0x00000004, 0x000000f0, 0x00000100, /* constant 3 desc (mat3) */
217 0x00000140, 0x00000002, 0x00000004, 0x000000f0, 0x00000148, /* constant 4 desc (mat4) */
218 0x00000188, 0x000b0002, 0x00000001, 0x00000190, 0x000001a0, /* constant 5 desc (vec4) */
219 0x00727261, /* constant 1 name */
220 0x00030000, 0x00010001, 0x00000003, 0x00000000, /* constant 1 type desc */
221 0x42c80000, 0x00000000, 0x00000000, 0x00000000, /* constant 1 default value */
222 0x43480000, 0x00000000, 0x00000000, 0x00000000,
223 0x43960000, 0x00000000, 0x00000000, 0x00000000,
224 0x00746c66, /* constant 2 name */
225 0x00030000, 0x00010001, 0x00000001, 0x00000000, /* constant 2 type desc */
226 0x411fd70a, 0x00000000, 0x00000000, 0x00000000, /* constant 2 default value */
227 0x3374616d, /* constant 3 name */
228 0xababab00,
229 0x00030003, 0x00040004, 0x00000001, 0x00000000, /* constant 3 & 4 type desc */
230 0x41300000, 0x425c0000, 0x42c60000, 0x44a42000, /* constat 3 default value */
231 0x41b00000, 0x42840000, 0x447c8000, 0x44b0c000,
232 0x42040000, 0x429a0000, 0x448ae000, 0x44bd6000,
233 0x42300000, 0x42b00000, 0x44978000, 0x44ca0000,
234 0x3474616d, /* constant 4 name */
235 0xababab00,
236 0x3f800000, 0x40a00000, 0x41100000, 0x41500000, /* constant 4 default value */
237 0x40000000, 0x40c00000, 0x41200000, 0x41600000,
238 0x40400000, 0x40e00000, 0x41300000, 0x41700000,
239 0x40800000, 0x41000000, 0x41400000, 0x41800000,
240 0x34636576, /* constant 5 name */
241 0xababab00,
242 0x00030001, 0x00040001, 0x00000001, 0x00000000, /* constant 5 type desc */
243 0x41200000, 0x41a00000, 0x41f00000, 0x42200000, /* constant 5 default value */
244 0x325f7376, 0x4d004141, 0x41414141, 0x00000000, /* target & creator string */
245 0x0000ffff}; /* END */
247 static const float mat4_default_value[] = {1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 8, 12, 16};
248 static const float mat3_default_value[] = {11, 55, 99, 1313, 22, 66, 1010, 1414, 33, 77, 1111, 1515, 44, 88, 1212, 1616};
249 static const float arr_default_value[] = {100, 0, 0, 0, 200, 0, 0, 0, 300, 0, 0, 0};
250 static const float vec4_default_value[] = {10, 20, 30, 40};
251 static const float flt_default_value[] = {9.99, 0, 0, 0};
253 static const D3DXCONSTANT_DESC ctab_with_default_values_expected[] = {
254 {"mat4", D3DXRS_FLOAT4, 0, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 4, 4, 1, 0, 64, mat4_default_value},
255 {"mat3", D3DXRS_FLOAT4, 4, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 4, 4, 1, 0, 64, mat3_default_value},
256 {"arr", D3DXRS_FLOAT4, 8, 3, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 3, 0, 12, arr_default_value},
257 {"vec4", D3DXRS_FLOAT4, 11, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 1, 0, 16, vec4_default_value},
258 {"flt", D3DXRS_FLOAT4, 12, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, flt_default_value}};
260 static const DWORD ctab_samplers[] = {
261 0xfffe0300, /* vs_3_0 */
262 0x0032fffe, FCC_CTAB, /* CTAB comment */
263 0x0000001c, 0x000000b4, 0xfffe0300, 0x00000003, 0x0000001c, 0x20008100, /* Header */
264 0x000000ac,
265 0x00000058, 0x00020002, 0x00000001, 0x00000064, 0x00000000, /* Constant 1 desc (notsampler) */
266 0x00000074, 0x00000003, 0x00000001, 0x00000080, 0x00000000, /* Constant 2 desc (sampler1) */
267 0x00000090, 0x00030003, 0x00000001, 0x0000009c, 0x00000000, /* Constant 3 desc (sampler2) */
268 0x73746f6e, 0x6c706d61, 0xab007265, /* Constant 1 name */
269 0x00030001, 0x00040001, 0x00000001, 0x00000000, /* Constant 1 type desc */
270 0x706d6173, 0x3172656c, 0xababab00, /* Constant 2 name */
271 0x000c0004, 0x00010001, 0x00000001, 0x00000000, /* Constant 2 type desc */
272 0x706d6173, 0x3272656c, 0xababab00, /* Constant 3 name */
273 0x000d0004, 0x00010001, 0x00000001, 0x00000000, /* Constant 3 type desc */
274 0x335f7376, 0xab00305f, /* Target name string */
275 0x656e6957, 0x6f727020, 0x7463656a, 0xababab00, /* Creator name string */
276 0x0000ffff}; /* END */
278 static const D3DXCONSTANT_DESC ctab_samplers_expected[] = {
279 {"sampler1", D3DXRS_SAMPLER, 0, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER2D, 1, 1, 1, 0, 4, NULL},
280 {"sampler2", D3DXRS_SAMPLER, 3, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER3D, 1, 1, 1, 0, 4, NULL},
281 {"notsampler", D3DXRS_FLOAT4, 2, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 1, 0, 16, NULL}};
283 static const DWORD fx_shader_with_ctab[] =
285 0x46580200, /* FX20 */
286 0x002efffe, FCC_CTAB, /* CTAB comment */
287 0x0000001c, 0x000000a4, 0xfffe0300, 0x00000003, 0x0000001c, 0x20008100, /* Header */
288 0x0000009c,
289 0x00000058, 0x00070002, 0x00000001, 0x00000064, 0x00000000, /* Constant 1 desc */
290 0x00000074, 0x00000002, 0x00000004, 0x00000080, 0x00000000, /* Constant 2 desc */
291 0x00000090, 0x00040002, 0x00000003, 0x00000080, 0x00000000, /* Constant 3 desc */
292 0x736e6f43, 0x746e6174, 0xabab0031, /* Constant 1 name string */
293 0x00030001, 0x00040001, 0x00000001, 0x00000000, /* Constant 1 type desc */
294 0x736e6f43, 0x746e6174, 0xabab0032, /* Constant 2 name string */
295 0x00030003, 0x00040004, 0x00000001, 0x00000000, /* Constant 2 & 3 type desc */
296 0x736e6f43, 0x746e6174, 0xabab0033, /* Constant 3 name string */
297 0x335f7376, 0xab00305f, /* Target name string */
298 0x656e6957, 0x6f727020, 0x7463656a, 0xababab00, /* Creator name string */
299 0x0000ffff /* END */
302 static void test_get_shader_size(void)
304 UINT shader_size, expected;
306 shader_size = D3DXGetShaderSize(simple_vs);
307 expected = sizeof(simple_vs);
308 ok(shader_size == expected, "Got shader size %u, expected %u\n", shader_size, expected);
310 shader_size = D3DXGetShaderSize(simple_ps);
311 expected = sizeof(simple_ps);
312 ok(shader_size == expected, "Got shader size %u, expected %u\n", shader_size, expected);
314 shader_size = D3DXGetShaderSize(NULL);
315 ok(shader_size == 0, "Got shader size %u, expected 0\n", shader_size);
318 static void test_get_shader_version(void)
320 DWORD shader_version;
322 shader_version = D3DXGetShaderVersion(simple_vs);
323 ok(shader_version == D3DVS_VERSION(1, 1), "Got shader version 0x%08x, expected 0x%08x\n",
324 shader_version, D3DVS_VERSION(1, 1));
326 shader_version = D3DXGetShaderVersion(simple_ps);
327 ok(shader_version == D3DPS_VERSION(1, 1), "Got shader version 0x%08x, expected 0x%08x\n",
328 shader_version, D3DPS_VERSION(1, 1));
330 shader_version = D3DXGetShaderVersion(NULL);
331 ok(shader_version == 0, "Got shader version 0x%08x, expected 0\n", shader_version);
334 static void test_find_shader_comment(void)
336 const void *data = (void *)0xdeadbeef;
337 HRESULT hr;
338 UINT size = 100;
340 hr = D3DXFindShaderComment(NULL, MAKEFOURCC('C','T','A','B'), &data, &size);
341 ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
342 ok(!data, "Got %p, expected NULL\n", data);
343 ok(!size, "Got %u, expected 0\n", size);
345 hr = D3DXFindShaderComment(shader_with_ctab, MAKEFOURCC('C','T','A','B'), NULL, &size);
346 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
347 ok(size == 28, "Got %u, expected 28\n", size);
349 hr = D3DXFindShaderComment(shader_with_ctab, MAKEFOURCC('C','T','A','B'), &data, NULL);
350 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
351 ok(data == shader_with_ctab + 6, "Got result %p, expected %p\n", data, shader_with_ctab + 6);
353 hr = D3DXFindShaderComment(shader_with_ctab, 0, &data, &size);
354 ok(hr == S_FALSE, "Got result %x, expected 1 (S_FALSE)\n", hr);
355 ok(!data, "Got %p, expected NULL\n", data);
356 ok(!size, "Got %u, expected 0\n", size);
358 hr = D3DXFindShaderComment(shader_with_ctab, MAKEFOURCC('X','X','X','X'), &data, &size);
359 ok(hr == S_FALSE, "Got result %x, expected 1 (S_FALSE)\n", hr);
360 ok(!data, "Got %p, expected NULL\n", data);
361 ok(!size, "Got %u, expected 0\n", size);
363 hr = D3DXFindShaderComment(shader_with_ctab, MAKEFOURCC('C','T','A','B'), &data, &size);
364 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
365 ok(data == shader_with_ctab + 6, "Got result %p, expected %p\n", data, shader_with_ctab + 6);
366 ok(size == 28, "Got result %u, expected 28\n", size);
368 hr = D3DXFindShaderComment(shader_zero, MAKEFOURCC('C','T','A','B'), &data, &size);
369 ok(hr == D3DXERR_INVALIDDATA, "Got result %x, expected %x (D3DXERR_INVALIDDATA)\n", hr, D3DXERR_INVALIDDATA);
370 ok(!data, "Got %p, expected NULL\n", data);
371 ok(!size, "Got %u, expected 0\n", size);
373 hr = D3DXFindShaderComment(shader_invalid, MAKEFOURCC('C','T','A','B'), &data, &size);
374 ok(hr == D3DXERR_INVALIDDATA, "Got result %x, expected %x (D3DXERR_INVALIDDATA)\n", hr, D3DXERR_INVALIDDATA);
375 ok(!data, "Got %p, expected NULL\n", data);
376 ok(!size, "Got %u, expected 0\n", size);
378 hr = D3DXFindShaderComment(shader_empty, MAKEFOURCC('C','T','A','B'), &data, &size);
379 ok(hr == S_FALSE, "Got result %x, expected %x (S_FALSE)\n", hr, S_FALSE);
380 ok(!data, "Got %p, expected NULL\n", data);
381 ok(!size, "Got %u, expected 0\n", size);
383 hr = D3DXFindShaderComment(simple_fx, FCC_TEXT, &data, &size);
384 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
385 ok(data == simple_fx + 3, "Got result %p, expected %p\n", data, simple_fx + 3);
386 ok(size == 4, "Got result %u, expected 4\n", size);
388 hr = D3DXFindShaderComment(simple_tx, FCC_TEXT, &data, &size);
389 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
390 ok(data == simple_tx + 3, "Got result %p, expected %p\n", data, simple_tx + 3);
391 ok(size == 4, "Got result %u, expected 4\n", size);
393 hr = D3DXFindShaderComment(simple_7ffe, FCC_TEXT, &data, &size);
394 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
395 ok(data == simple_7ffe + 3, "Got result %p, expected %p\n", data, simple_7ffe + 3);
396 ok(size == 4, "Got result %u, expected 4\n", size);
398 hr = D3DXFindShaderComment(simple_7fff, FCC_TEXT, &data, &size);
399 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
400 ok(data == simple_7fff + 3, "Got result %p, expected %p\n", data, simple_7fff + 3);
401 ok(size == 4, "Got result %u, expected 4\n", size);
404 static void test_get_shader_constant_table_ex(void)
406 ID3DXConstantTable *constant_table;
407 HRESULT hr;
408 void *data;
409 DWORD size;
410 D3DXCONSTANTTABLE_DESC desc;
412 constant_table = (ID3DXConstantTable *)0xdeadbeef;
413 hr = D3DXGetShaderConstantTableEx(NULL, 0, &constant_table);
414 ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
415 ok(constant_table == NULL, "D3DXGetShaderConstantTableEx() failed, got %p\n", constant_table);
417 constant_table = (ID3DXConstantTable *)0xdeadbeef;
418 hr = D3DXGetShaderConstantTableEx(shader_zero, 0, &constant_table);
419 ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK);
420 ok(constant_table == NULL, "D3DXGetShaderConstantTableEx() failed, got %p\n", constant_table);
422 constant_table = (ID3DXConstantTable *)0xdeadbeef;
423 hr = D3DXGetShaderConstantTableEx(shader_invalid, 0, &constant_table);
424 ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK);
425 ok(constant_table == NULL, "D3DXGetShaderConstantTableEx() failed, got %p\n", constant_table);
427 constant_table = (ID3DXConstantTable *)0xdeadbeef;
428 hr = D3DXGetShaderConstantTableEx(shader_empty, 0, &constant_table);
429 ok(hr == D3DXERR_INVALIDDATA, "Got result %x, expected %x (D3DXERR_INVALIDDATA)\n", hr, D3DXERR_INVALIDDATA);
430 ok(constant_table == NULL, "D3DXGetShaderConstantTableEx() failed, got %p\n", constant_table);
432 /* No CTAB data */
433 constant_table = (ID3DXConstantTable *)0xdeadbeef;
434 hr = D3DXGetShaderConstantTableEx(simple_ps, 0, &constant_table);
435 ok(hr == D3DXERR_INVALIDDATA, "Got result %x, expected %x (D3DXERR_INVALIDDATA)\n", hr, D3DXERR_INVALIDDATA);
436 ok(constant_table == NULL, "D3DXGetShaderConstantTableEx() failed, got %p\n", constant_table);
438 /* With invalid CTAB data */
439 hr = D3DXGetShaderConstantTableEx(shader_with_invalid_ctab, 0, &constant_table);
440 ok(hr == D3DXERR_INVALIDDATA || broken(hr == D3D_OK), /* winxp 64-bit, w2k3 64-bit */
441 "Got result %x, expected %x (D3DXERR_INVALIDDATA)\n", hr, D3DXERR_INVALIDDATA);
442 if (constant_table) ID3DXConstantTable_Release(constant_table);
444 hr = D3DXGetShaderConstantTableEx(simple_fx, 0, &constant_table);
445 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
446 ok(!constant_table, "D3DXGetShaderConstantTableEx() returned a non-NULL constant table.\n");
448 hr = D3DXGetShaderConstantTableEx(simple_tx, 0, &constant_table);
449 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
450 ok(!constant_table, "D3DXGetShaderConstantTableEx() returned a non-NULL constant table.\n");
452 hr = D3DXGetShaderConstantTableEx(shader_with_ctab, 0, &constant_table);
453 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
454 ok(constant_table != NULL, "D3DXGetShaderConstantTableEx() failed, got NULL\n");
456 if (constant_table)
458 size = ID3DXConstantTable_GetBufferSize(constant_table);
459 ok(size == 28, "Got result %x, expected 28\n", size);
461 data = ID3DXConstantTable_GetBufferPointer(constant_table);
462 ok(!memcmp(data, shader_with_ctab + 6, size), "Retrieved wrong CTAB data\n");
464 hr = ID3DXConstantTable_GetDesc(constant_table, NULL);
465 ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
467 hr = ID3DXConstantTable_GetDesc(constant_table, &desc);
468 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
469 ok(desc.Creator == (const char *)data + 0x10, "Got result %p, expected %p\n",
470 desc.Creator, (const char *)data + 0x10);
471 ok(desc.Version == D3DVS_VERSION(3, 0), "Got result %x, expected %x\n", desc.Version, D3DVS_VERSION(3, 0));
472 ok(desc.Constants == 0, "Got result %x, expected 0\n", desc.Constants);
474 ID3DXConstantTable_Release(constant_table);
477 hr = D3DXGetShaderConstantTableEx(shader_with_ctab_constants, 0, &constant_table);
478 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
479 ok(constant_table != NULL, "D3DXGetShaderConstantTableEx() failed, got NULL\n");
481 if (constant_table)
483 D3DXHANDLE constant;
484 D3DXCONSTANT_DESC constant_desc;
485 D3DXCONSTANT_DESC constant_desc_save;
486 UINT nb;
488 /* Test GetDesc */
489 hr = ID3DXConstantTable_GetDesc(constant_table, &desc);
490 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
491 ok(!strcmp(desc.Creator, "Wine project"), "Got result '%s', expected 'Wine project'\n", desc.Creator);
492 ok(desc.Version == D3DVS_VERSION(3, 0), "Got result %x, expected %x\n", desc.Version, D3DVS_VERSION(3, 0));
493 ok(desc.Constants == 3, "Got result %x, expected 3\n", desc.Constants);
495 /* Test GetConstant */
496 constant = ID3DXConstantTable_GetConstant(constant_table, NULL, 0);
497 ok(constant != NULL, "No constant found\n");
498 hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &constant_desc, &nb);
499 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
500 ok(!strcmp(constant_desc.Name, "Constant1"), "Got result '%s', expected 'Constant1'\n",
501 constant_desc.Name);
502 ok(constant_desc.Class == D3DXPC_VECTOR, "Got result %x, expected %u (D3DXPC_VECTOR)\n",
503 constant_desc.Class, D3DXPC_VECTOR);
504 ok(constant_desc.Type == D3DXPT_FLOAT, "Got result %x, expected %u (D3DXPT_FLOAT)\n",
505 constant_desc.Type, D3DXPT_FLOAT);
506 ok(constant_desc.Rows == 1, "Got result %x, expected 1\n", constant_desc.Rows);
507 ok(constant_desc.Columns == 4, "Got result %x, expected 4\n", constant_desc.Columns);
509 constant = ID3DXConstantTable_GetConstant(constant_table, NULL, 1);
510 ok(constant != NULL, "No constant found\n");
511 hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &constant_desc, &nb);
512 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
513 ok(!strcmp(constant_desc.Name, "Constant2"), "Got result '%s', expected 'Constant2'\n",
514 constant_desc.Name);
515 ok(constant_desc.Class == D3DXPC_MATRIX_COLUMNS, "Got result %x, expected %u (D3DXPC_MATRIX_COLUMNS)\n",
516 constant_desc.Class, D3DXPC_MATRIX_COLUMNS);
517 ok(constant_desc.Type == D3DXPT_FLOAT, "Got result %x, expected %u (D3DXPT_FLOAT)\n",
518 constant_desc.Type, D3DXPT_FLOAT);
519 ok(constant_desc.Rows == 4, "Got result %x, expected 1\n", constant_desc.Rows);
520 ok(constant_desc.Columns == 4, "Got result %x, expected 4\n", constant_desc.Columns);
522 constant = ID3DXConstantTable_GetConstant(constant_table, NULL, 2);
523 ok(constant != NULL, "No constant found\n");
524 hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &constant_desc, &nb);
525 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
526 ok(!strcmp(constant_desc.Name, "Constant3"), "Got result '%s', expected 'Constant3'\n",
527 constant_desc.Name);
528 ok(constant_desc.Class == D3DXPC_MATRIX_COLUMNS, "Got result %x, expected %u (D3DXPC_MATRIX_COLUMNS)\n",
529 constant_desc.Class, D3DXPC_MATRIX_COLUMNS);
530 ok(constant_desc.Type == D3DXPT_FLOAT, "Got result %x, expected %u (D3DXPT_FLOAT)\n",
531 constant_desc.Type, D3DXPT_FLOAT);
532 ok(constant_desc.Rows == 4, "Got result %x, expected 1\n", constant_desc.Rows);
533 ok(constant_desc.Columns == 4, "Got result %x, expected 4\n", constant_desc.Columns);
534 constant_desc_save = constant_desc; /* For GetConstantDesc test */
536 constant = ID3DXConstantTable_GetConstant(constant_table, NULL, 3);
537 ok(constant == NULL, "Got result %p, expected NULL\n", constant);
539 /* Test GetConstantByName */
540 constant = ID3DXConstantTable_GetConstantByName(constant_table, NULL, "Constant unknown");
541 ok(constant == NULL, "Got result %p, expected NULL\n", constant);
542 constant = ID3DXConstantTable_GetConstantByName(constant_table, NULL, "Constant3");
543 ok(constant != NULL, "No constant found\n");
544 hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &constant_desc, &nb);
545 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
546 ok(!memcmp(&constant_desc, &constant_desc_save, sizeof(D3DXCONSTANT_DESC)), "Got different constant data\n");
548 /* Test GetConstantDesc */
549 constant = ID3DXConstantTable_GetConstant(constant_table, NULL, 0);
550 ok(constant != NULL, "No constant found\n");
551 hr = ID3DXConstantTable_GetConstantDesc(constant_table, NULL, &constant_desc, &nb);
552 ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
553 hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, NULL, &nb);
554 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
555 hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &constant_desc, NULL);
556 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
557 hr = ID3DXConstantTable_GetConstantDesc(constant_table, "Constant unknown", &constant_desc, &nb);
558 ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
559 hr = ID3DXConstantTable_GetConstantDesc(constant_table, "Constant3", &constant_desc, &nb);
560 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
561 ok(!memcmp(&constant_desc, &constant_desc_save, sizeof(D3DXCONSTANT_DESC)), "Got different constant data\n");
563 ID3DXConstantTable_Release(constant_table);
566 hr = D3DXGetShaderConstantTableEx(fx_shader_with_ctab, 0, &constant_table);
567 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
568 ok(!constant_table, "D3DXGetShaderConstantTableEx() returned a non-NULL constant table.\n");
571 static void test_constant_table(const char *test_name, const DWORD *ctable_fn,
572 const D3DXCONSTANT_DESC *expecteds, UINT count)
574 UINT i;
575 ID3DXConstantTable *ctable;
577 HRESULT res;
579 /* Get the constant table from the shader itself */
580 res = D3DXGetShaderConstantTable(ctable_fn, &ctable);
581 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed on %s: got %08x\n", test_name, res);
583 for (i = 0; i < count; i++)
585 const D3DXCONSTANT_DESC *expected = &expecteds[i];
586 D3DXHANDLE const_handle;
587 D3DXCONSTANT_DESC actual;
588 UINT pCount = 1;
590 const_handle = ID3DXConstantTable_GetConstantByName(ctable, NULL, expected->Name);
592 res = ID3DXConstantTable_GetConstantDesc(ctable, const_handle, &actual, &pCount);
593 ok(SUCCEEDED(res), "%s in %s: ID3DXConstantTable_GetConstantDesc returned %08x\n", expected->Name,
594 test_name, res);
595 ok(pCount == 1, "%s in %s: Got more or less descriptions: %d\n", expected->Name, test_name, pCount);
597 ok(strcmp(actual.Name, expected->Name) == 0,
598 "%s in %s: Got different names: Got %s, expected %s\n", expected->Name,
599 test_name, actual.Name, expected->Name);
600 ok(actual.RegisterSet == expected->RegisterSet,
601 "%s in %s: Got different register sets: Got %d, expected %d\n",
602 expected->Name, test_name, actual.RegisterSet, expected->RegisterSet);
603 ok(actual.RegisterIndex == expected->RegisterIndex,
604 "%s in %s: Got different register indices: Got %d, expected %d\n",
605 expected->Name, test_name, actual.RegisterIndex, expected->RegisterIndex);
606 ok(actual.RegisterCount == expected->RegisterCount,
607 "%s in %s: Got different register counts: Got %d, expected %d\n",
608 expected->Name, test_name, actual.RegisterCount, expected->RegisterCount);
609 ok(actual.Class == expected->Class,
610 "%s in %s: Got different classes: Got %d, expected %d\n", expected->Name,
611 test_name, actual.Class, expected->Class);
612 ok(actual.Type == expected->Type,
613 "%s in %s: Got different types: Got %d, expected %d\n", expected->Name,
614 test_name, actual.Type, expected->Type);
615 ok(actual.Rows == expected->Rows && actual.Columns == expected->Columns,
616 "%s in %s: Got different dimensions: Got (%d, %d), expected (%d, %d)\n",
617 expected->Name, test_name, actual.Rows, actual.Columns, expected->Rows,
618 expected->Columns);
619 ok(actual.Elements == expected->Elements,
620 "%s in %s: Got different element count: Got %d, expected %d\n",
621 expected->Name, test_name, actual.Elements, expected->Elements);
622 ok(actual.StructMembers == expected->StructMembers,
623 "%s in %s: Got different struct member count: Got %d, expected %d\n",
624 expected->Name, test_name, actual.StructMembers, expected->StructMembers);
625 ok(actual.Bytes == expected->Bytes,
626 "%s in %s: Got different byte count: Got %d, expected %d\n",
627 expected->Name, test_name, actual.Bytes, expected->Bytes);
629 if (!expected->DefaultValue)
631 ok(actual.DefaultValue == NULL,
632 "%s in %s: Got different default value: expected NULL\n",
633 expected->Name, test_name);
635 else
637 ok(actual.DefaultValue != NULL,
638 "%s in %s: Got different default value: expected non-NULL\n",
639 expected->Name, test_name);
640 ok(memcmp(actual.DefaultValue, expected->DefaultValue, expected->Bytes) == 0,
641 "%s in %s: Got different default value\n", expected->Name, test_name);
645 /* Finally, release the constant table */
646 ID3DXConstantTable_Release(ctable);
649 static void test_constant_tables(void)
651 test_constant_table("test_basic", ctab_basic, ctab_basic_expected,
652 sizeof(ctab_basic_expected)/sizeof(*ctab_basic_expected));
653 test_constant_table("test_matrices", ctab_matrices, ctab_matrices_expected,
654 sizeof(ctab_matrices_expected)/sizeof(*ctab_matrices_expected));
655 test_constant_table("test_matrices2", ctab_matrices2, ctab_matrices2_expected,
656 sizeof(ctab_matrices2_expected)/sizeof(*ctab_matrices2_expected));
657 test_constant_table("test_arrays", ctab_arrays, ctab_arrays_expected,
658 sizeof(ctab_arrays_expected)/sizeof(*ctab_arrays_expected));
659 test_constant_table("test_default_values", ctab_with_default_values, ctab_with_default_values_expected,
660 sizeof(ctab_with_default_values_expected)/sizeof(*ctab_with_default_values_expected));
661 test_constant_table("test_samplers", ctab_samplers, ctab_samplers_expected,
662 sizeof(ctab_samplers_expected)/sizeof(*ctab_samplers_expected));
665 static void test_setting_basic_table(IDirect3DDevice9 *device)
667 static const D3DXMATRIX mvp = {{{
668 0.514f, 0.626f, 0.804f, 0.786f,
669 0.238f, 0.956f, 0.374f, 0.483f,
670 0.109f, 0.586f, 0.900f, 0.255f,
671 0.898f, 0.411f, 0.932f, 0.275f}}};
672 static const D3DXVECTOR4 f4 = {0.350f, 0.526f, 0.925f, 0.021f};
673 static const float f = 0.12543f;
674 static const int i = 321;
675 static const D3DXMATRIX *matrix_pointer[] = {&mvp};
677 ID3DXConstantTable *ctable;
679 HRESULT res;
680 float out[16];
681 ULONG refcnt;
683 /* Get the constant table from the shader itself */
684 res = D3DXGetShaderConstantTable(ctab_basic, &ctable);
685 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got 0x%08x\n", res);
687 /* Set constants */
688 res = ID3DXConstantTable_SetMatrix(ctable, device, "mvp", &mvp);
689 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable mvp: got 0x%08x\n", res);
691 res = ID3DXConstantTable_SetInt(ctable, device, "i", i + 1);
692 ok(res == D3D_OK, "ID3DXConstantTable_SetInt failed on variable i: got 0x%08x\n", res);
694 /* Check that setting i again will overwrite the previous value */
695 res = ID3DXConstantTable_SetInt(ctable, device, "i", i);
696 ok(res == D3D_OK, "ID3DXConstantTable_SetInt failed on variable i: got 0x%08x\n", res);
698 res = ID3DXConstantTable_SetFloat(ctable, device, "f", f);
699 ok(res == D3D_OK, "ID3DXConstantTable_SetFloat failed on variable f: got 0x%08x\n", res);
701 res = ID3DXConstantTable_SetVector(ctable, device, "f4", &f4);
702 ok(res == D3D_OK, "ID3DXConstantTable_SetVector failed on variable f4: got 0x%08x\n", res);
704 /* Get constants back and validate */
705 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
706 ok(out[0] == S(U(mvp))._11 && out[4] == S(U(mvp))._12 && out[8] == S(U(mvp))._13 && out[12] == S(U(mvp))._14,
707 "The first row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
708 out[0], out[4], out[8], out[12], S(U(mvp))._11, S(U(mvp))._12, S(U(mvp))._13, S(U(mvp))._14);
709 ok(out[1] == S(U(mvp))._21 && out[5] == S(U(mvp))._22 && out[9] == S(U(mvp))._23 && out[13] == S(U(mvp))._24,
710 "The second row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
711 out[1], out[5], out[9], out[13], S(U(mvp))._21, S(U(mvp))._22, S(U(mvp))._23, S(U(mvp))._24);
712 ok(out[2] == S(U(mvp))._31 && out[6] == S(U(mvp))._32 && out[10] == S(U(mvp))._33 && out[14] == S(U(mvp))._34,
713 "The third row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
714 out[2], out[6], out[10], out[14], S(U(mvp))._31, S(U(mvp))._32, S(U(mvp))._33, S(U(mvp))._34);
715 ok(out[3] == S(U(mvp))._41 && out[7] == S(U(mvp))._42 && out[11] == S(U(mvp))._43 && out[15] == S(U(mvp))._44,
716 "The fourth row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
717 out[3], out[7], out[11], out[15], S(U(mvp))._41, S(U(mvp))._42, S(U(mvp))._43, S(U(mvp))._44);
719 IDirect3DDevice9_GetVertexShaderConstantF(device, 4, out, 1);
720 ok(out[0] == (float)i && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
721 "The variable i was not set correctly, out={%f, %f, %f, %f}, should be {%d, 0.0, 0.0, 0.0}\n",
722 out[0], out[1], out[2], out[3], i);
724 IDirect3DDevice9_GetVertexShaderConstantF(device, 6, out, 1);
725 ok(out[0] == f && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
726 "The variable f was not set correctly, out={%f, %f, %f, %f}, should be {%f, 0.0, 0.0, 0.0}\n",
727 out[0], out[1], out[2], out[3], f);
729 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
730 ok(memcmp(out, &f4, sizeof(f4)) == 0,
731 "The variable f4 was not set correctly, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
732 out[0], out[1], out[2], out[3], f4.x, f4.y, f4.z, f4.w);
734 /* Finally test using a set* function for one type to set a variable of another type (should succeed) */
735 res = ID3DXConstantTable_SetVector(ctable, device, "f", &f4);
736 ok(res == D3D_OK, "ID3DXConstantTable_SetVector failed on variable f: 0x%08x\n", res);
738 IDirect3DDevice9_GetVertexShaderConstantF(device, 6, out, 1);
739 ok(out[0] == f4.x && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
740 "The variable f was not set correctly by ID3DXConstantTable_SetVector, got %f, should be %f\n",
741 out[0], f4.x);
743 memset(out, 0, sizeof(out));
744 IDirect3DDevice9_SetVertexShaderConstantF(device, 6, out, 1);
745 res = ID3DXConstantTable_SetMatrix(ctable, device, "f", &mvp);
746 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable f: 0x%08x\n", res);
748 IDirect3DDevice9_GetVertexShaderConstantF(device, 6, out, 1);
749 ok(out[0] == S(U(mvp))._11 && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
750 "The variable f was not set correctly by ID3DXConstantTable_SetMatrix, got %f, should be %f\n",
751 out[0], S(U(mvp))._11);
753 /* Clear registers */
754 memset(out, 0, sizeof(out));
755 IDirect3DDevice9_SetVertexShaderConstantF(device, 0, out, 4);
756 IDirect3DDevice9_SetVertexShaderConstantF(device, 6, out, 1);
757 IDirect3DDevice9_SetVertexShaderConstantF(device, 7, out, 1);
759 /* SetVector shouldn't change the value of a matrix constant */
760 res = ID3DXConstantTable_SetVector(ctable, device, "mvp", &f4);
761 ok(res == D3D_OK, "ID3DXConstantTable_SetVector failed on variable f: 0x%08x\n", res);
763 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
764 ok(out[0] == 0.0f && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f
765 && out[4] == 0.0f && out[5] == 0.0f && out[6] == 0.0f && out[7] == 0.0f
766 && out[8] == 0.0f && out[9] == 0.0f && out[10] == 0.0f && out[11] == 0.0f
767 && out[12] == 0.0f && out[13] == 0.0f && out[14] == 0.0f && out[15] == 0.0f,
768 "The variable mvp was not set correctly by ID3DXConstantTable_SetVector, "
769 "got {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f %f; %f, %f, %f, %f}, "
770 "should be all 0.0f\n",
771 out[0], out[1], out[2], out[3],
772 out[4], out[5], out[6], out[7],
773 out[8], out[9], out[10], out[11],
774 out[12], out[13], out[14], out[15]);
776 res = ID3DXConstantTable_SetFloat(ctable, device, "mvp", f);
777 ok(res == D3D_OK, "ID3DXConstantTable_SetFloat failed on variable mvp: 0x%08x\n", res);
779 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
780 ok(out[0] == 0.0f && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f
781 && out[4] == 0.0f && out[5] == 0.0f && out[6] == 0.0f && out[7] == 0.0f
782 && out[8] == 0.0f && out[9] == 0.0f && out[10] == 0.0f && out[11] == 0.0f
783 && out[12] == 0.0f && out[13] == 0.0f && out[14] == 0.0f && out[15] == 0.0f,
784 "The variable mvp was not set correctly by ID3DXConstantTable_SetFloat, "
785 "got {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f %f; %f, %f, %f, %f}, "
786 "should be all 0.0f\n",
787 out[0], out[1], out[2], out[3],
788 out[4], out[5], out[6], out[7],
789 out[8], out[9], out[10], out[11],
790 out[12], out[13], out[14], out[15]);
792 res = ID3DXConstantTable_SetFloat(ctable, device, "f4", f);
793 ok(res == D3D_OK, "ID3DXConstantTable_SetFloat failed on variable f4: 0x%08x\n", res);
795 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
796 ok(out[0] == 0.0f && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
797 "The variable f4 was not set correctly by ID3DXConstantTable_SetFloat, "
798 "got {%f, %f, %f, %f}, should be all 0.0f\n",
799 out[0], out[1], out[2], out[3]);
801 res = ID3DXConstantTable_SetMatrixTranspose(ctable, device, "f", &mvp);
802 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTranspose failed on variable f: 0x%08x\n", res);
804 IDirect3DDevice9_GetVertexShaderConstantF(device, 6, out, 1);
805 ok(out[0] == S(U(mvp))._11 && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
806 "The variable f was not set correctly by ID3DXConstantTable_SetMatrixTranspose, got %f, should be %f\n",
807 out[0], S(U(mvp))._11);
809 res = ID3DXConstantTable_SetMatrixTranspose(ctable, device, "f4", &mvp);
810 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTranspose failed on variable f4: 0x%08x\n", res);
812 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
813 ok(out[0] == S(U(mvp))._11 && out[1] == S(U(mvp))._21 && out[2] == S(U(mvp))._31 && out[3] == S(U(mvp))._41,
814 "The variable f4 was not set correctly by ID3DXConstantTable_SetMatrixTranspose, "
815 "got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
816 out[0], out[1], out[2], out[3],
817 S(U(mvp))._11, S(U(mvp))._21, S(U(mvp))._31, S(U(mvp))._41);
819 memset(out, 0, sizeof(out));
820 IDirect3DDevice9_SetVertexShaderConstantF(device, 6, out, 1);
821 res = ID3DXConstantTable_SetMatrixPointerArray(ctable, device, "f", matrix_pointer, 1);
822 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixPointerArray failed on variable f: got %#x\n", res);
824 IDirect3DDevice9_GetVertexShaderConstantF(device, 6, out, 1);
825 ok(out[0] == S(U(mvp))._11 && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
826 "The variable f was not set correctly by ID3DXConstantTable_SetMatrixPointerArray, "
827 "got %f, should be %f\n",
828 out[0], S(U(mvp))._11);
830 res = ID3DXConstantTable_SetMatrixPointerArray(ctable, device, "f4", matrix_pointer, 1);
831 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixPointerArray failed on variable f4: got %#x\n", res);
833 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
834 ok(out[0] == S(U(mvp))._11 && out[1] == S(U(mvp))._12 && out[2] == S(U(mvp))._13 && out[3] == S(U(mvp))._14,
835 "The variable f4 was not set correctly by ID3DXConstantTable_SetMatrixPointerArray, "
836 "got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
837 out[0], out[1], out[2], out[3],
838 S(U(mvp))._11, S(U(mvp))._12, S(U(mvp))._13, S(U(mvp))._14);
840 memset(out, 0, sizeof(out));
841 IDirect3DDevice9_SetVertexShaderConstantF(device, 6, out, 1);
842 res = ID3DXConstantTable_SetMatrixTransposePointerArray(ctable, device, "f", matrix_pointer, 1);
843 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTransposePointerArray failed on variable f: got %#x\n", res);
845 IDirect3DDevice9_GetVertexShaderConstantF(device, 6, out, 1);
846 ok(out[0] == S(U(mvp))._11 && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
847 "The variable f was not set correctly by ID3DXConstantTable_SetMatrixTransposePointerArray, "
848 "got %f, should be %f\n",
849 out[0], S(U(mvp))._11);
851 res = ID3DXConstantTable_SetMatrixTransposePointerArray(ctable, device, "f4", matrix_pointer, 1);
852 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTransposePointerArray failed on variable f4: got %#x\n", res);
854 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
855 ok(out[0] == S(U(mvp))._11 && out[1] == S(U(mvp))._21 && out[2] == S(U(mvp))._31 && out[3] == S(U(mvp))._41,
856 "The variable f4 was not set correctly by ID3DXConstantTable_SetMatrixTransposePointerArray, "
857 "got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
858 out[0], out[1], out[2], out[3],
859 S(U(mvp))._11, S(U(mvp))._21, S(U(mvp))._31, S(U(mvp))._41);
861 refcnt = ID3DXConstantTable_Release(ctable);
862 ok(refcnt == 0, "The constant table reference count was %u, should be 0\n", refcnt);
865 static void test_setting_matrices_table(IDirect3DDevice9 *device)
867 static const D3DXMATRIX fmatrix =
868 {{{2.001f, 1.502f, 9.003f, 1.004f,
869 5.005f, 3.006f, 3.007f, 6.008f,
870 9.009f, 5.010f, 7.011f, 1.012f,
871 5.013f, 5.014f, 5.015f, 9.016f}}};
872 static const D3DXMATRIX *matrix_pointer[] = {&fmatrix};
874 ID3DXConstantTable *ctable;
876 HRESULT res;
877 float out[32];
879 res = D3DXGetShaderConstantTable(ctab_matrices, &ctable);
880 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %#x\n", res);
882 res = ID3DXConstantTable_SetMatrix(ctable, device, "imatrix2x3", &fmatrix);
883 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable imatrix2x3: got %#x\n", res);
885 res = ID3DXConstantTable_SetMatrix(ctable, device, "fmatrix3x1", &fmatrix);
886 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable fmatrix3x1: got %#x\n", res);
888 IDirect3DDevice9_GetVertexShaderConstantF(device, 4, out, 2);
889 ok(out[0] == (int)S(U(fmatrix))._11 && out[1] == (int)S(U(fmatrix))._12 && out[2] == (int)S(U(fmatrix))._13
890 && out[3] == 0
891 && out[4] == (int)S(U(fmatrix))._21 && out[5] == (int)S(U(fmatrix))._22 && out[6] == (int)S(U(fmatrix))._23
892 && out[7] == 0,
893 "The variable imatrix2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f}, "
894 "should be {%d, %d, %d, %d; %d, %d, %d, %d}\n",
895 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
896 (int)S(U(fmatrix))._11, (int)S(U(fmatrix))._12, (int)S(U(fmatrix))._13, 0,
897 (int)S(U(fmatrix))._21, (int)S(U(fmatrix))._22, (int)S(U(fmatrix))._23, 0);
899 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
900 ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._21 && out[2] == S(U(fmatrix))._31 && out[3] == 0.0f,
901 "The variable fmatrix3x1 was not set correctly, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
902 out[0], out[1], out[2], out[3],
903 S(U(fmatrix))._11, S(U(fmatrix))._21, S(U(fmatrix))._31, 0.0f);
905 ID3DXConstantTable_Release(ctable);
907 res = D3DXGetShaderConstantTable(ctab_matrices2, &ctable);
908 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %#x\n", res);
910 /* SetMatrix */
911 res = ID3DXConstantTable_SetMatrix(ctable, device, "c2x3", &fmatrix);
912 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable c2x3: got %#x\n", res);
914 res = ID3DXConstantTable_SetMatrix(ctable, device, "r2x3", &fmatrix);
915 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable r2x3: got %#x\n", res);
917 res = ID3DXConstantTable_SetMatrix(ctable, device, "c3x2", &fmatrix);
918 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable c3x2: got %#x\n", res);
920 res = ID3DXConstantTable_SetMatrix(ctable, device, "r3x2", &fmatrix);
921 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable r3x2: got %#x\n", res);
923 res = ID3DXConstantTable_SetMatrix(ctable, device, "c3x3", &fmatrix);
924 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable c3x3: got %#x\n", res);
926 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 3);
927 ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._21 && out[2] == 0.0f && out[3] == 0.0f
928 && out[4] == S(U(fmatrix))._12 && out[5] == S(U(fmatrix))._22 && out[6] == 0.0f && out[7] == 0.0f
929 && out[8] == S(U(fmatrix))._13 && out[9] == S(U(fmatrix))._23 && out[10] == 0.0f && out[11] == 0.0f,
930 "The variable c2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
931 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
932 out[0], out[1], out[2], out[3],
933 out[4], out[5], out[6], out[7],
934 out[8], out[9], out[10], out[11],
935 S(U(fmatrix))._11, S(U(fmatrix))._21, 0.0f, 0.0f,
936 S(U(fmatrix))._12, S(U(fmatrix))._22, 0.0f, 0.0f,
937 S(U(fmatrix))._13, S(U(fmatrix))._23, 0.0f, 0.0f);
939 res = ID3DXConstantTable_SetMatrix(ctable, device, "r4x4", &fmatrix);
940 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable r4x4: got %#x\n", res);
942 IDirect3DDevice9_GetVertexShaderConstantF(device, 15, out, 2);
943 ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._12 && out[2] == S(U(fmatrix))._13 && out[3] == 0.0f
944 && out[4] == S(U(fmatrix))._21 && out[5] == S(U(fmatrix))._22 && out[6] == S(U(fmatrix))._23 && out[7] == 0.0f,
945 "The variable r2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f}, "
946 "should be {%f, %f, %f, %f; %f, %f, %f, %f}\n",
947 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
948 S(U(fmatrix))._11, S(U(fmatrix))._12, S(U(fmatrix))._13, 0.0f,
949 S(U(fmatrix))._21, S(U(fmatrix))._22, S(U(fmatrix))._23, 0.0f);
951 IDirect3DDevice9_GetVertexShaderConstantF(device, 13, out, 2);
952 ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._21 && out[2] == S(U(fmatrix))._31 && out[3] == 0.0f
953 && out[4] == S(U(fmatrix))._12 && out[5] == S(U(fmatrix))._22 && out[6] == S(U(fmatrix))._32 && out[7] == 0.0f,
954 "The variable c3x2 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f}, "
955 "should be {%f, %f, %f, %f; %f, %f, %f, %f}\n",
956 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
957 S(U(fmatrix))._11, S(U(fmatrix))._21, S(U(fmatrix))._31, 0.0f,
958 S(U(fmatrix))._12, S(U(fmatrix))._22, S(U(fmatrix))._32, 0.0f);
960 IDirect3DDevice9_GetVertexShaderConstantF(device, 4, out, 3);
961 ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._12 && out[2] == 0.0f && out[3] == 0.0f
962 && out[4] == S(U(fmatrix))._21 && out[5] == S(U(fmatrix))._22 && out[6] == 0.0f && out[7] == 0.0f
963 && out[8] == S(U(fmatrix))._31 && out[9] == S(U(fmatrix))._32 && out[10] == 0.0f && out[11] == 0.0f,
964 "The variable r3x2 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
965 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
966 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7], out[8], out[9], out[10], out[11],
967 S(U(fmatrix))._11, S(U(fmatrix))._12, 0.0f, 0.0f,
968 S(U(fmatrix))._21, S(U(fmatrix))._22, 0.0f, 0.0f,
969 S(U(fmatrix))._31, S(U(fmatrix))._32, 0.0f, 0.0f);
971 IDirect3DDevice9_GetVertexShaderConstantF(device, 10, out, 3);
972 ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._21 && out[2] == S(U(fmatrix))._31 && out[3] == 0.0f
973 && out[4] == S(U(fmatrix))._12 && out[5] == S(U(fmatrix))._22 && out[6] == S(U(fmatrix))._32 && out[7] == 0.0f
974 && out[8] == S(U(fmatrix))._13 && out[9] == S(U(fmatrix))._23 && out[10] == S(U(fmatrix))._33 && out[11] == 0.0f,
975 "The variable c3x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
976 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
977 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7], out[8], out[9], out[10], out[11],
978 S(U(fmatrix))._11, S(U(fmatrix))._21, S(U(fmatrix))._31, 0.0f,
979 S(U(fmatrix))._12, S(U(fmatrix))._22, S(U(fmatrix))._32, 0.0f,
980 S(U(fmatrix))._13, S(U(fmatrix))._23, S(U(fmatrix))._33, 0.0f);
982 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
983 ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._12 && out[2] == S(U(fmatrix))._13 && out[3] == S(U(fmatrix))._14
984 && out[4] == S(U(fmatrix))._21 && out[5] == S(U(fmatrix))._22 && out[6] == S(U(fmatrix))._23 && out[7] == S(U(fmatrix))._24
985 && out[8] == S(U(fmatrix))._31 && out[9] == S(U(fmatrix))._32 && out[10] == S(U(fmatrix))._33 && out[11] == S(U(fmatrix))._34
986 && out[12] == S(U(fmatrix))._41 && out[13] == S(U(fmatrix))._42 && out[14] == S(U(fmatrix))._43 && out[15] == S(U(fmatrix))._44,
987 "The variable r4x4 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
988 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
989 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
990 out[8], out[9], out[10], out[11], out[12], out[13], out[14], out[15],
991 S(U(fmatrix))._11, S(U(fmatrix))._12, S(U(fmatrix))._13, S(U(fmatrix))._14,
992 S(U(fmatrix))._21, S(U(fmatrix))._22, S(U(fmatrix))._23, S(U(fmatrix))._24,
993 S(U(fmatrix))._31, S(U(fmatrix))._32, S(U(fmatrix))._33, S(U(fmatrix))._34,
994 S(U(fmatrix))._41, S(U(fmatrix))._42, S(U(fmatrix))._43, S(U(fmatrix))._44);
996 /* SetMatrixTranspose */
997 res = ID3DXConstantTable_SetMatrixTranspose(ctable, device, "c2x3", &fmatrix);
998 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTranspose failed on variable c2x3: got %#x\n", res);
1000 res = ID3DXConstantTable_SetMatrixTranspose(ctable, device, "r2x3", &fmatrix);
1001 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTranspose failed on variable r2x3: got %#x\n", res);
1003 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 3);
1004 ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._12 && out[2] == 0.0f && out[3] == 0.0f
1005 && out[4] == S(U(fmatrix))._21 && out[5] == S(U(fmatrix))._22 && out[6] == 0.0f && out[7] == 0.0f
1006 && out[8] == S(U(fmatrix))._31 && out[9] == S(U(fmatrix))._32 && out[10] == 0.0f && out[11] == 0.0f,
1007 "The variable c2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
1008 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
1009 out[0], out[1], out[2], out[3],
1010 out[4], out[5], out[6], out[7],
1011 out[8], out[9], out[10], out[11],
1012 S(U(fmatrix))._11, S(U(fmatrix))._12, 0.0f, 0.0f,
1013 S(U(fmatrix))._21, S(U(fmatrix))._22, 0.0f, 0.0f,
1014 S(U(fmatrix))._31, S(U(fmatrix))._32, 0.0f, 0.0f);
1016 IDirect3DDevice9_GetVertexShaderConstantF(device, 15, out, 2);
1017 ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._21 && out[2] == S(U(fmatrix))._31 && out[3] == 0.0f
1018 && out[4] == S(U(fmatrix))._12 && out[5] == S(U(fmatrix))._22 && out[6] == S(U(fmatrix))._32 && out[7] == 0.0f,
1019 "The variable r2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f}, "
1020 "should be {%f, %f, %f, %f; %f, %f, %f, %f}\n",
1021 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1022 S(U(fmatrix))._11, S(U(fmatrix))._21, S(U(fmatrix))._31, 0.0f,
1023 S(U(fmatrix))._12, S(U(fmatrix))._22, S(U(fmatrix))._32, 0.0f);
1025 /* SetMatrixPointerArray */
1026 res = ID3DXConstantTable_SetMatrixPointerArray(ctable, device, "c2x3", matrix_pointer, 1);
1027 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixPointerArray failed on variable c2x3: got %#x\n", res);
1029 res = ID3DXConstantTable_SetMatrixPointerArray(ctable, device, "r2x3", matrix_pointer, 1);
1030 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixPointerArray failed on variable r2x3: got %#x\n", res);
1032 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 3);
1033 ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._21 && out[2] == 0.0f && out[3] == 0.0f
1034 && out[4] == S(U(fmatrix))._12 && out[5] == S(U(fmatrix))._22 && out[6] == 0.0f && out[7] == 0.0f
1035 && out[8] == S(U(fmatrix))._13 && out[9] == S(U(fmatrix))._23 && out[10] == 0.0f && out[11] == 0.0f,
1036 "The variable c2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
1037 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
1038 out[0], out[1], out[2], out[3],
1039 out[4], out[5], out[6], out[7],
1040 out[8], out[9], out[10], out[11],
1041 S(U(fmatrix))._11, S(U(fmatrix))._21, 0.0f, 0.0f,
1042 S(U(fmatrix))._12, S(U(fmatrix))._22, 0.0f, 0.0f,
1043 S(U(fmatrix))._13, S(U(fmatrix))._23, 0.0f, 0.0f);
1045 IDirect3DDevice9_GetVertexShaderConstantF(device, 15, out, 2);
1046 ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._12 && out[2] == S(U(fmatrix))._13 && out[3] == 0.0f
1047 && out[4] == S(U(fmatrix))._21 && out[5] == S(U(fmatrix))._22 && out[6] == S(U(fmatrix))._23 && out[7] == 0.0f,
1048 "The variable r2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f}, "
1049 "should be {%f, %f, %f, %f; %f, %f, %f, %f}\n",
1050 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1051 S(U(fmatrix))._11, S(U(fmatrix))._12, S(U(fmatrix))._13, 0.0f,
1052 S(U(fmatrix))._21, S(U(fmatrix))._22, S(U(fmatrix))._23, 0.0f);
1054 /* SetMatrixTransposePointerArray */
1055 res = ID3DXConstantTable_SetMatrixTransposePointerArray(ctable, device, "c2x3", matrix_pointer, 1);
1056 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTransposePointerArray failed on variable c2x3: got %#x\n", res);
1058 res = ID3DXConstantTable_SetMatrixTransposePointerArray(ctable, device, "r2x3", matrix_pointer, 1);
1059 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTransposePointerArray failed on variable r2x3: got %#x\n", res);
1061 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 3);
1062 ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._12 && out[2] == 0.0f && out[3] == 0.0f
1063 && out[4] == S(U(fmatrix))._21 && out[5] == S(U(fmatrix))._22 && out[6] == 0.0f && out[7] == 0.0f
1064 && out[8] == S(U(fmatrix))._31 && out[9] == S(U(fmatrix))._32 && out[10] == 0.0f && out[11] == 0.0f,
1065 "The variable c2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
1066 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
1067 out[0], out[1], out[2], out[3],
1068 out[4], out[5], out[6], out[7],
1069 out[8], out[9], out[10], out[11],
1070 S(U(fmatrix))._11, S(U(fmatrix))._12, 0.0f, 0.0f,
1071 S(U(fmatrix))._21, S(U(fmatrix))._22, 0.0f, 0.0f,
1072 S(U(fmatrix))._31, S(U(fmatrix))._32, 0.0f, 0.0f);
1074 IDirect3DDevice9_GetVertexShaderConstantF(device, 15, out, 2);
1075 ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._21 && out[2] == S(U(fmatrix))._31 && out[3] == 0.0f
1076 && out[4] == S(U(fmatrix))._12 && out[5] == S(U(fmatrix))._22 && out[6] == S(U(fmatrix))._32 && out[7] == 0.0f,
1077 "The variable r2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f}, "
1078 "should be {%f, %f, %f, %f; %f, %f, %f, %f}\n",
1079 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1080 S(U(fmatrix))._11, S(U(fmatrix))._21, S(U(fmatrix))._31, 0.0f,
1081 S(U(fmatrix))._12, S(U(fmatrix))._22, S(U(fmatrix))._32, 0.0f);
1083 ID3DXConstantTable_Release(ctable);
1086 static void test_setting_arrays_table(IDirect3DDevice9 *device)
1088 static const float farray[8] = {
1089 0.005f, 0.745f, 0.973f, 0.264f,
1090 0.010f, 0.020f, 0.030f, 0.040f};
1091 static const D3DXMATRIX fmtxarray[2] = {
1092 {{{0.001f, 0.002f, 0.003f, 0.004f,
1093 0.005f, 0.006f, 0.007f, 0.008f,
1094 0.009f, 0.010f, 0.011f, 0.012f,
1095 0.013f, 0.014f, 0.015f, 0.016f}}},
1096 {{{0.010f, 0.020f, 0.030f, 0.040f,
1097 0.050f, 0.060f, 0.070f, 0.080f,
1098 0.090f, 0.100f, 0.110f, 0.120f,
1099 0.130f, 0.140f, 0.150f, 0.160f}}}};
1100 static const int iarray[4] = {1, 2, 3, 4};
1101 static const D3DXVECTOR4 fvecarray[2] = {
1102 {0.745f, 0.997f, 0.353f, 0.237f},
1103 {0.060f, 0.455f, 0.333f, 0.983f}};
1104 static BOOL barray[4] = {FALSE, 100, TRUE, TRUE};
1106 ID3DXConstantTable *ctable;
1108 HRESULT res;
1109 float out[32];
1110 ULONG refcnt;
1112 /* Clear registers */
1113 memset(out, 0, sizeof(out));
1114 IDirect3DDevice9_SetVertexShaderConstantF(device, 8, out, 4);
1115 IDirect3DDevice9_SetVertexShaderConstantF(device, 12, out, 4);
1117 /* Get the constant table from the shader */
1118 res = D3DXGetShaderConstantTable(ctab_arrays, &ctable);
1119 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got 0x%08x\n", res);
1121 /* Set constants */
1123 /* Make sure that we cannot set registers that do not belong to this constant */
1124 res = ID3DXConstantTable_SetFloatArray(ctable, device, "farray", farray, 8);
1125 ok(res == D3D_OK, "ID3DXConstantTable_SetFloatArray failed: got 0x%08x\n", res);
1127 IDirect3DDevice9_GetVertexShaderConstantF(device, 8, out, 8);
1128 ok(out[0] == farray[0] && out[4] == farray[1] && out[8] == farray[2] && out[12] == farray[3],
1129 "The in-bounds elements of the array were not set, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1130 out[0], out[4], out[8], out[12], farray[0], farray[1], farray[2], farray[3]);
1131 ok(out[16] == 0.0f && out[20] == 0.0f && out[24] == 0.0f && out[28] == 0.0f,
1132 "The excess elements of the array were set, out={%f, %f, %f, %f}, should be all 0.0f\n",
1133 out[16], out[20], out[24], out[28]);
1135 /* ivecarray takes up only 1 register, but a matrix takes up 4, so no elements should be set */
1136 res = ID3DXConstantTable_SetMatrix(ctable, device, "ivecarray", &fmtxarray[0]);
1137 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed: got 0x%08x\n", res);
1139 IDirect3DDevice9_GetVertexShaderConstantF(device, 18, out, 4);
1140 ok(out[0] == 0.0f && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
1141 "The array was set, out={%f, %f, %f, %f}, should be all 0.0f\n", out[0], out[1], out[2], out[3]);
1143 /* Try setting an integer array to an array declared as a float array */
1144 res = ID3DXConstantTable_SetIntArray(ctable, device, "farray", iarray, 4);
1145 ok(res == D3D_OK, "ID3DXConstantTable_SetIntArray failed: got 0x%08x\n", res);
1147 IDirect3DDevice9_GetVertexShaderConstantF(device, 8, out, 4);
1148 ok(out[0] == iarray[0] && out[4] == iarray[1] && out[8] == iarray[2] && out[12] == iarray[3],
1149 "SetIntArray did not properly set a float array: out={%f, %f, %f, %f}, should be {%d, %d, %d, %d}\n",
1150 out[0], out[4], out[8], out[12], iarray[0], iarray[1], iarray[2], iarray[3]);
1152 res = ID3DXConstantTable_SetFloatArray(ctable, device, "farray", farray, 4);
1153 ok(res == D3D_OK, "ID3DXConstantTable_SetFloatArray failed: got x0%08x\n", res);
1155 res = ID3DXConstantTable_SetVectorArray(ctable, device, "fvecarray", fvecarray, 2);
1156 ok(res == D3D_OK, "ID3DXConstantTable_SetVectorArray failed: got 0x%08x\n", res);
1158 res = ID3DXConstantTable_SetMatrixArray(ctable, device, "fmtxarray", fmtxarray, 2);
1159 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixArray failed: got 0x%08x\n", res);
1161 res = ID3DXConstantTable_SetBoolArray(ctable, device, "barray", barray, 2);
1162 ok(res == D3D_OK, "ID3DXConstantTable_SetBoolArray failed: got 0x%08x\n", res);
1164 /* Read back constants */
1165 IDirect3DDevice9_GetVertexShaderConstantF(device, 8, out, 4);
1166 ok(out[0] == farray[0] && out[4] == farray[1] && out[8] == farray[2] && out[12] == farray[3],
1167 "The variable farray was not set correctly, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1168 out[0], out[4], out[8], out[12], farray[0], farray[1], farray[2], farray[3]);
1170 IDirect3DDevice9_GetVertexShaderConstantF(device, 12, out, 2);
1171 ok(out[0] == fvecarray[0].x && out[1] == fvecarray[0].y && out[2] == fvecarray[0].z && out[3] == fvecarray[0].w &&
1172 out[4] == fvecarray[1].x && out[5] == fvecarray[1].y && out[6] == fvecarray[1].z && out[7] == fvecarray[1].w,
1173 "The variable fvecarray was not set correctly, out={{%f, %f, %f, %f}, {%f, %f, %f, %f}}, should be "
1174 "{{%f, %f, %f, %f}, {%f, %f, %f, %f}}\n", out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1175 fvecarray[0].x, fvecarray[0].y, fvecarray[0].z, fvecarray[0].w, fvecarray[1].x, fvecarray[1].y,
1176 fvecarray[1].z, fvecarray[1].w);
1178 IDirect3DDevice9_GetVertexShaderConstantF(device, 14, out, 2);
1179 ok(out[0] == 0.0f && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f
1180 && out[4] == 1.0f && out[5] == 0.0f && out[6] == 0.0f && out[7] == 0.0f,
1181 "The variable barray was not set correctly, out={%f, %f %f, %f; %f, %f, %f, %f}, should be {%f, %f, %f, %f; %f, %f, %f, %f}\n",
1182 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1183 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f);
1185 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 8);
1186 /* Just check a few elements in each matrix to make sure fmtxarray was set row-major */
1187 ok(out[0] == S(U(fmtxarray[0]))._11 && out[1] == S(U(fmtxarray[0]))._12 && out[2] == S(U(fmtxarray[0]))._13 && out[3] == S(U(fmtxarray[0]))._14,
1188 "The variable fmtxarray was not set row-major, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1189 out[0], out[1], out[2], out[3], S(U(fmtxarray[0]))._11, S(U(fmtxarray[0]))._12, S(U(fmtxarray[0]))._13, S(U(fmtxarray[0]))._14);
1190 ok(out[16] == S(U(fmtxarray[1]))._11 && out[17] == S(U(fmtxarray[1]))._12 && out[18] == S(U(fmtxarray[1]))._13 && out[19] == S(U(fmtxarray[1]))._14,
1191 "The variable fmtxarray was not set row-major, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1192 out[16], out[17], out[18], out[19], S(U(fmtxarray[1]))._11, S(U(fmtxarray[1]))._12, S(U(fmtxarray[1]))._13, S(U(fmtxarray[1]))._14);
1194 refcnt = ID3DXConstantTable_Release(ctable);
1195 ok(refcnt == 0, "The constant table reference count was %u, should be 0\n", refcnt);
1198 static void test_SetDefaults(IDirect3DDevice9 *device)
1200 static const D3DXMATRIX mvp = {{{
1201 0.51f, 0.62f, 0.80f, 0.78f,
1202 0.23f, 0.95f, 0.37f, 0.48f,
1203 0.10f, 0.58f, 0.90f, 0.25f,
1204 0.89f, 0.41f, 0.93f, 0.27f}}};
1205 static const D3DXVECTOR4 f4 = {0.2f, 0.4f, 0.8f, 1.2f};
1207 float out[16];
1209 HRESULT res;
1210 ID3DXConstantTable *ctable;
1212 res = D3DXGetShaderConstantTable(ctab_basic, &ctable);
1213 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %08x\n", res);
1215 res = ID3DXConstantTable_SetVector(ctable, device, "f4", &f4);
1216 ok(res == D3D_OK, "ID3DXConstantTable_SetVector failed: got %08x\n", res);
1218 res = ID3DXConstantTable_SetMatrix(ctable, device, "mvp", &mvp);
1219 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed: got %08x\n", res);
1221 res = ID3DXConstantTable_SetDefaults(ctable, device);
1222 ok(res == D3D_OK, "ID3dXConstantTable_SetDefaults failed: got %08x\n", res);
1224 /* SetDefaults doesn't change constants without default values */
1225 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
1226 ok(out[0] == S(U(mvp))._11 && out[4] == S(U(mvp))._12 && out[8] == S(U(mvp))._13 && out[12] == S(U(mvp))._14,
1227 "The first row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1228 out[0], out[4], out[8], out[12], S(U(mvp))._11, S(U(mvp))._12, S(U(mvp))._13, S(U(mvp))._14);
1229 ok(out[1] == S(U(mvp))._21 && out[5] == S(U(mvp))._22 && out[9] == S(U(mvp))._23 && out[13] == S(U(mvp))._24,
1230 "The second row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1231 out[1], out[5], out[9], out[13], S(U(mvp))._21, S(U(mvp))._22, S(U(mvp))._23, S(U(mvp))._24);
1232 ok(out[2] == S(U(mvp))._31 && out[6] == S(U(mvp))._32 && out[10] == S(U(mvp))._33 && out[14] == S(U(mvp))._34,
1233 "The third row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1234 out[2], out[6], out[10], out[14], S(U(mvp))._31, S(U(mvp))._32, S(U(mvp))._33, S(U(mvp))._34);
1235 ok(out[3] == S(U(mvp))._41 && out[7] == S(U(mvp))._42 && out[11] == S(U(mvp))._43 && out[15] == S(U(mvp))._44,
1236 "The fourth row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1237 out[3], out[7], out[11], out[15], S(U(mvp))._41, S(U(mvp))._42, S(U(mvp))._43, S(U(mvp))._44);
1239 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
1240 ok(memcmp(out, &f4, sizeof(f4)) == 0,
1241 "The variable f4 was not set correctly, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1242 out[0], out[1], out[2], out[3], f4.x, f4.y, f4.z, f4.w);
1244 ID3DXConstantTable_Release(ctable);
1246 res = D3DXGetShaderConstantTable(ctab_with_default_values, &ctable);
1247 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %08x\n", res);
1249 res = ID3DXConstantTable_SetDefaults(ctable, device);
1250 ok(res == D3D_OK, "ID3DXConstantTable_SetDefaults failed: got %08x\n", res);
1252 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
1253 ok(memcmp(out, mat4_default_value, sizeof(mat4_default_value)) == 0,
1254 "The variable mat4 was not set correctly to default value\n");
1256 IDirect3DDevice9_GetVertexShaderConstantF(device, 4, out, 4);
1257 ok(memcmp(out, mat3_default_value, sizeof(mat3_default_value)) == 0,
1258 "The variable mat3 was not set correctly to default value\n");
1260 IDirect3DDevice9_GetVertexShaderConstantF(device, 8, out, 3);
1261 ok(memcmp(out, arr_default_value, sizeof(arr_default_value)) == 0,
1262 "The variable array was not set correctly to default value\n");
1264 IDirect3DDevice9_GetVertexShaderConstantF(device, 11, out, 1);
1265 ok(memcmp(out, vec4_default_value, sizeof(vec4_default_value)) == 0,
1266 "The variable vec4 was not set correctly to default value\n");
1268 IDirect3DDevice9_GetVertexShaderConstantF(device, 12, out, 1);
1269 ok(memcmp(out, flt_default_value, sizeof(flt_default_value)) == 0,
1270 "The variable flt was not set correctly to default value\n");
1272 ID3DXConstantTable_Release(ctable);
1275 static void test_SetValue(IDirect3DDevice9 *device)
1277 static const D3DXMATRIX mvp = {{{
1278 0.51f, 0.62f, 0.80f, 0.78f,
1279 0.23f, 0.95f, 0.37f, 0.48f,
1280 0.10f, 0.58f, 0.90f, 0.25f,
1281 0.89f, 0.41f, 0.93f, 0.27f}}};
1282 static const D3DXVECTOR4 f4 = {0.2f, 0.4f, 0.8f, 1.2f};
1283 static const FLOAT arr[] = {0.33f, 0.55f, 0.96f, 1.00f,
1284 1.00f, 1.00f, 1.00f, 1.00f,
1285 1.00f, 1.00f, 1.00f, 1.00f};
1286 static int imatrix[] = {1, 2, 3, 4, 5, 6};
1287 static float fmatrix[] = {1.1f, 2.2f, 3.3f, 4.4f};
1288 static BOOL barray[] = {TRUE, FALSE};
1289 static float fvecarray[] = {9.1f, 9.2f, 9.3f, 9.4f, 9.5f, 9.6f, 9.7f, 9.8f};
1290 static float farray[] = {2.2f, 3.3f};
1292 static const float def[16] = {5.5f, 5.5f, 5.5f, 5.5f,
1293 5.5f, 5.5f, 5.5f, 5.5f,
1294 5.5f, 5.5f, 5.5f, 5.5f,
1295 5.5f, 5.5f, 5.5f, 5.5f};
1296 float out[16];
1298 HRESULT res;
1299 ID3DXConstantTable *ctable;
1301 res = D3DXGetShaderConstantTable(ctab_basic, &ctable);
1302 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %08x\n", res);
1304 IDirect3DDevice9_SetVertexShaderConstantF(device, 7, def, 1);
1306 /* SetValue called with 0 bytes size doesn't change value */
1307 res = ID3DXConstantTable_SetValue(ctable, device, "f4", &f4, 0);
1308 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08x\n", res);
1310 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
1311 ok(memcmp(out, def, sizeof(f4)) == 0,
1312 "The variable f4 was not set correctly, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1313 out[0], out[1], out[2], out[3], def[0], def[1], def[2], def[3]);
1315 res = ID3DXConstantTable_SetValue(ctable, device, "f4", &f4, sizeof(f4));
1316 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08x\n", res);
1318 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
1319 ok(memcmp(out, &f4, sizeof(f4)) == 0,
1320 "The variable f4 was not set correctly, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1321 out[0], out[1], out[2], out[3], f4.x, f4.y, f4.z, f4.w);
1323 IDirect3DDevice9_SetVertexShaderConstantF(device, 0, def, 4);
1325 /* SetValue called with size smaller than constant size doesn't change value */
1326 res = ID3DXConstantTable_SetValue(ctable, device, "mvp", &mvp, sizeof(mvp) / 2);
1327 ok(res == D3D_OK, "ID3DXConstantTable_SetValue returned %08x\n", res);
1329 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
1330 ok(memcmp(out, def, sizeof(def)) == 0,
1331 "The variable mvp was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
1332 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
1333 out[0], out[4], out[ 8], out[12],
1334 out[1], out[5], out[ 9], out[13],
1335 out[2], out[6], out[10], out[14],
1336 out[3], out[7], out[11], out[15],
1337 def[0], def[4], def[ 8], def[12],
1338 def[1], def[5], def[ 9], def[13],
1339 def[2], def[6], def[10], def[14],
1340 def[3], def[7], def[11], def[15]);
1342 res = ID3DXConstantTable_SetValue(ctable, device, "mvp", &mvp, sizeof(mvp));
1343 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08x\n", res);
1345 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
1346 ok(out[0] == S(U(mvp))._11 && out[4] == S(U(mvp))._12 && out[8] == S(U(mvp))._13 && out[12] == S(U(mvp))._14,
1347 "The first row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1348 out[0], out[4], out[8], out[12], S(U(mvp))._11, S(U(mvp))._12, S(U(mvp))._13, S(U(mvp))._14);
1349 ok(out[1] == S(U(mvp))._21 && out[5] == S(U(mvp))._22 && out[9] == S(U(mvp))._23 && out[13] == S(U(mvp))._24,
1350 "The second row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1351 out[1], out[5], out[9], out[13], S(U(mvp))._21, S(U(mvp))._22, S(U(mvp))._23, S(U(mvp))._24);
1352 ok(out[2] == S(U(mvp))._31 && out[6] == S(U(mvp))._32 && out[10] == S(U(mvp))._33 && out[14] == S(U(mvp))._34,
1353 "The third row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1354 out[2], out[6], out[10], out[14], S(U(mvp))._31, S(U(mvp))._32, S(U(mvp))._33, S(U(mvp))._34);
1355 ok(out[3] == S(U(mvp))._41 && out[7] == S(U(mvp))._42 && out[11] == S(U(mvp))._43 && out[15] == S(U(mvp))._44,
1356 "The fourth row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1357 out[3], out[7], out[11], out[15], S(U(mvp))._41, S(U(mvp))._42, S(U(mvp))._43, S(U(mvp))._44);
1359 ID3DXConstantTable_Release(ctable);
1361 res = D3DXGetShaderConstantTable(ctab_with_default_values, &ctable);
1362 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %08x\n", res);
1364 res = ID3DXConstantTable_SetValue(ctable, device, "arr", arr, sizeof(arr));
1365 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08x\n", res);
1367 IDirect3DDevice9_GetVertexShaderConstantF(device, 8, out, 3);
1368 ok(out[0] == arr[0] && out[4] == arr[1] && out[8] == arr[2]
1369 && out[1] == 0 && out[2] == 0 && out[3] == 0 && out[5] == 0 && out[6] == 0 && out[7] == 0
1370 && out[9] == 0 && out[10] == 0 && out[11] == 0,
1371 "The variable arr was not set correctly, out={%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f}, "
1372 "should be {0.33, 0, 0, 0, 0.55, 0, 0, 0, 0.96, 0, 0, 0}\n",
1373 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7], out[8], out[9], out[10], out[11]);
1375 ID3DXConstantTable_Release(ctable);
1377 res = D3DXGetShaderConstantTable(ctab_matrices, &ctable);
1378 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %08x\n", res);
1380 res = ID3DXConstantTable_SetValue(ctable, device, "fmatrix3x1", fmatrix, sizeof(fmatrix));
1381 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08x\n", res);
1383 res = ID3DXConstantTable_SetValue(ctable, device, "imatrix2x3", imatrix, sizeof(imatrix));
1384 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08x\n", res);
1386 IDirect3DDevice9_GetVertexShaderConstantF(device, 4, out, 2);
1387 ok(out[0] == imatrix[0] && out[1] == imatrix[1] && out[2] == imatrix[2] && out[3] == 0.0f
1388 && out[4] == imatrix[3] && out[5] == imatrix[4] && out[6] == imatrix[5] && out[7] == 0.0f,
1389 "The variable imatrix2x3 was not set correctly, out={%f, %f, %f, %f, %f, %f, %f, %f}, "
1390 "should be {%d, %d, %d, 0, %d, %d, %d, 0}\n",
1391 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1392 imatrix[0], imatrix[1], imatrix[2], imatrix[3], imatrix[4], imatrix[5]);
1394 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 2);
1395 ok(out[0] == fmatrix[0] && out[1] == fmatrix[1] && out[2] == fmatrix[2] && out[3] == 0.0f,
1396 "The variable fmatrix3x1 was not set correctly, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1397 out[0], out[1] ,out[2], out[4],
1398 fmatrix[0], fmatrix[1], fmatrix[2], 0.0f);
1400 ID3DXConstantTable_Release(ctable);
1402 res = D3DXGetShaderConstantTable(ctab_arrays, &ctable);
1403 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %08x\n", res);
1405 res = ID3DXConstantTable_SetValue(ctable, device, "barray", barray, sizeof(barray));
1406 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08x\n", res);
1408 res = ID3DXConstantTable_SetValue(ctable, device, "fvecarray", fvecarray, sizeof(fvecarray));
1409 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08x\n", res);
1411 IDirect3DDevice9_SetVertexShaderConstantF(device, 8, def, 4);
1412 res = ID3DXConstantTable_SetValue(ctable, device, "farray", farray, sizeof(farray));
1413 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08x\n", res);
1415 /* 2 elements of farray were set */
1416 IDirect3DDevice9_GetVertexShaderConstantF(device, 8, out, 4);
1417 ok(out[0] == farray[0] && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f
1418 && out[4] == farray[1] && out[5] == 0.0f && out[6] == 0.0f && out[7] == 0.0f
1419 && out[8] == def[8] && out[9] == def[9] && out[10] == def[10] && out[11] == def[11]
1420 && out[12] == def[12] && out[13] == def[13] && out[14] == def[14] && out[15] == def[15],
1421 "The variable farray was not set correctly, should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
1422 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
1423 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1424 out[8], out[9], out[10], out[11], out[12], out[13], out[14], out[15],
1425 farray[0], 0.0f, 0.0f, 0.0f,
1426 farray[1], 0.0f, 0.0f, 0.0f,
1427 def[8], def[9], def[10], def[11],
1428 def[12], def[13], def[14], def[15]);
1430 IDirect3DDevice9_GetVertexShaderConstantF(device, 12, out, 2);
1431 ok(out[0] == fvecarray[0] && out[1] == fvecarray[1] && out[2] == fvecarray[2] && out[3] == fvecarray[3]
1432 && out[4] == fvecarray[4] && out[5] == fvecarray[5] && out[6] == fvecarray[6] && out[7] == fvecarray[7],
1433 "The variable fvecarray was not set correctly, out ={%f, %f, %f, %f, %f, %f, %f, %f}, "
1434 "should be {%f, %f, %f, %f, %f, %f, %f, %f}\n",
1435 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1436 fvecarray[0], fvecarray[1], fvecarray[2], fvecarray[3], fvecarray[4], fvecarray[5], fvecarray[6], fvecarray[7]);
1438 IDirect3DDevice9_GetVertexShaderConstantF(device, 14, out, 2);
1439 ok(out[0] == 1.0f && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f
1440 && out[4] == 0.0f && out[5] == 0.0f && out[6] == 0.0f && out[7] == 0.0f,
1441 "The variable barray was not set correctly, out={%f, %f, %f, %f, %f, %f, %f, %f}, "
1442 "should be {%f, %f, %f, %f, %f, %f, %f, %f}\n",
1443 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1444 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
1446 ID3DXConstantTable_Release(ctable);
1449 static void test_setting_constants(void)
1451 HWND wnd;
1452 IDirect3D9 *d3d;
1453 IDirect3DDevice9 *device;
1454 D3DPRESENT_PARAMETERS d3dpp;
1455 HRESULT hr;
1456 ULONG refcnt;
1458 if (!(wnd = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
1459 640, 480, NULL, NULL, NULL, NULL)))
1461 skip("Couldn't create application window\n");
1462 return;
1464 if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
1466 skip("Couldn't create IDirect3D9 object\n");
1467 DestroyWindow(wnd);
1468 return;
1471 ZeroMemory(&d3dpp, sizeof(d3dpp));
1472 d3dpp.Windowed = TRUE;
1473 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
1474 hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &device);
1475 if (FAILED(hr))
1477 skip("Failed to create IDirect3DDevice9 object %#x\n", hr);
1478 IDirect3D9_Release(d3d);
1479 DestroyWindow(wnd);
1480 return;
1483 test_setting_basic_table(device);
1484 test_setting_matrices_table(device);
1485 test_setting_arrays_table(device);
1486 test_SetDefaults(device);
1487 test_SetValue(device);
1489 /* Release resources */
1490 refcnt = IDirect3DDevice9_Release(device);
1491 ok(refcnt == 0, "The Direct3D device reference count was %u, should be 0\n", refcnt);
1493 refcnt = IDirect3D9_Release(d3d);
1494 ok(refcnt == 0, "The Direct3D object referenct count was %u, should be 0\n", refcnt);
1496 if (wnd) DestroyWindow(wnd);
1499 static void test_get_sampler_index(void)
1501 ID3DXConstantTable *ctable;
1503 HRESULT res;
1504 UINT index;
1506 ULONG refcnt;
1508 res = D3DXGetShaderConstantTable(ctab_samplers, &ctable);
1509 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed on ctab_samplers: got %08x\n", res);
1511 index = ID3DXConstantTable_GetSamplerIndex(ctable, "sampler1");
1512 ok(index == 0, "ID3DXConstantTable_GetSamplerIndex returned wrong index: Got %d, expected 0\n", index);
1514 index = ID3DXConstantTable_GetSamplerIndex(ctable, "sampler2");
1515 ok(index == 3, "ID3DXConstantTable_GetSamplerIndex returned wrong index: Got %d, expected 3\n", index);
1517 index = ID3DXConstantTable_GetSamplerIndex(ctable, "nonexistent");
1518 ok(index == -1, "ID3DXConstantTable_GetSamplerIndex found nonexistent sampler: Got %d\n",
1519 index);
1521 index = ID3DXConstantTable_GetSamplerIndex(ctable, "notsampler");
1522 ok(index == -1, "ID3DXConstantTable_GetSamplerIndex succeeded on non-sampler constant: Got %d\n",
1523 index);
1525 refcnt = ID3DXConstantTable_Release(ctable);
1526 ok(refcnt == 0, "The ID3DXConstantTable reference count was %u, should be 0\n", refcnt);
1530 * fxc.exe /Tps_3_0
1532 #if 0
1533 sampler s;
1534 sampler1D s1D;
1535 sampler2D s2D;
1536 sampler3D s3D;
1537 samplerCUBE scube;
1538 float4 init;
1539 float4 main(float3 tex : TEXCOORD0) : COLOR
1541 float4 tmp = init;
1542 tmp = tmp + tex1D(s1D, tex.x);
1543 tmp = tmp + tex1D(s1D, tex.y);
1544 tmp = tmp + tex3D(s3D, tex.xyz);
1545 tmp = tmp + tex1D(s, tex.x);
1546 tmp = tmp + tex2D(s2D, tex.xy);
1547 tmp = tmp + texCUBE(scube, tex.xyz);
1548 return tmp;
1550 #endif
1551 static const DWORD get_shader_samplers_blob[] =
1553 0xffff0300, /* ps_3_0 */
1554 0x0054fffe, FCC_CTAB, /* CTAB comment */
1555 0x0000001c, 0x0000011b, 0xffff0300, 0x00000006, 0x0000001c, 0x00000100, /* Header */
1556 0x00000114,
1557 0x00000094, 0x00000002, 0x00000001, 0x0000009c, 0x00000000, /* Constant 1 desc (init) */
1558 0x000000ac, 0x00040003, 0x00000001, 0x000000b0, 0x00000000, /* Constant 2 desc (s) */
1559 0x000000c0, 0x00000003, 0x00000001, 0x000000c4, 0x00000000, /* Constant 3 desc (s1D) */
1560 0x000000d4, 0x00010003, 0x00000001, 0x000000d8, 0x00000000, /* Constant 4 desc (s2D) */
1561 0x000000e8, 0x00030003, 0x00000001, 0x000000ec, 0x00000000, /* Constant 5 desc (s3D) */
1562 0x000000fc, 0x00020003, 0x00000001, 0x00000104, 0x00000000, /* Constant 6 desc (scube) */
1563 0x74696e69, 0xababab00, /* Constant 1 name */
1564 0x00030001, 0x00040001, 0x00000001, 0x00000000, /* Constant 1 type desc */
1565 0xabab0073, /* Constant 2 name */
1566 0x000c0004, 0x00010001, 0x00000001, 0x00000000, /* Constant 2 type desc */
1567 0x00443173, /* Constant 3 name */
1568 0x000b0004, 0x00010001, 0x00000001, 0x00000000, /* Constant 3 type desc */
1569 0x00443273, /* Constant 4 name */
1570 0x000c0004, 0x00010001, 0x00000001, 0x00000000, /* Constant 4 type desc */
1571 0x00443373, /* Constant 5 name */
1572 0x000d0004, 0x00010001, 0x00000001, 0x00000000, /* Constant 5 type desc */
1573 0x62756373, 0xabab0065, /* Constant 6 name */
1574 0x000e0004, 0x00010001, 0x00000001, 0x00000000, /* Constant 6 type desc */
1575 0x335f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, /* Target/Creator name string */
1576 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
1577 0x332e3235, 0x00313131,
1578 0x0200001f, 0x80000005, 0x90070000, 0x0200001f, 0x90000000, 0xa00f0800, /* shader */
1579 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x98000000, 0xa00f0802,
1580 0x0200001f, 0xa0000000, 0xa00f0803, 0x0200001f, 0x90000000, 0xa00f0804,
1581 0x03000042, 0x800f0000, 0x90e40000, 0xa0e40800, 0x03000002, 0x800f0000,
1582 0x80e40000, 0xa0e40000, 0x03000042, 0x800f0001, 0x90550000, 0xa0e40800,
1583 0x03000002, 0x800f0000, 0x80e40000, 0x80e40001, 0x03000042, 0x800f0001,
1584 0x90e40000, 0xa0e40803, 0x03000002, 0x800f0000, 0x80e40000, 0x80e40001,
1585 0x03000042, 0x800f0001, 0x90e40000, 0xa0e40804, 0x03000002, 0x800f0000,
1586 0x80e40000, 0x80e40001, 0x03000042, 0x800f0001, 0x90e40000, 0xa0e40801,
1587 0x03000002, 0x800f0000, 0x80e40000, 0x80e40001, 0x03000042, 0x800f0001,
1588 0x90e40000, 0xa0e40802, 0x03000002, 0x800f0800, 0x80e40000, 0x80e40001,
1589 0x0000ffff, /* END */
1592 static void test_get_shader_samplers(void)
1594 const char *samplers[16] = {NULL}; /* maximum number of sampler registers v/ps 3.0 = 16 */
1595 const char *sampler_orig;
1596 UINT count = 2;
1597 HRESULT hr;
1599 if (0)
1601 /* crashes if bytecode is NULL */
1602 hr = D3DXGetShaderSamplers(NULL, NULL, &count);
1603 ok(hr == D3D_OK, "D3DXGetShaderSamplers failed, got %x, expected %x\n", hr, D3D_OK);
1606 hr = D3DXGetShaderSamplers(get_shader_samplers_blob, NULL, NULL);
1607 ok(hr == D3D_OK, "D3DXGetShaderSamplers failed, got %x, expected %x\n", hr, D3D_OK);
1609 samplers[5] = "dummy";
1611 hr = D3DXGetShaderSamplers(get_shader_samplers_blob, samplers, NULL);
1612 ok(hr == D3D_OK, "D3DXGetShaderSamplers failed, got %x, expected %x\n", hr, D3D_OK);
1614 /* check that sampler points to shader blob */
1615 sampler_orig = (const char *)&get_shader_samplers_blob[0x2e];
1616 ok(sampler_orig == samplers[0], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[0], sampler_orig);
1618 sampler_orig = (const char *)&get_shader_samplers_blob[0x33];
1619 ok(sampler_orig == samplers[1], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[1], sampler_orig);
1621 sampler_orig = (const char *)&get_shader_samplers_blob[0x38];
1622 ok(sampler_orig == samplers[2], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[2], sampler_orig);
1624 sampler_orig = (const char *)&get_shader_samplers_blob[0x3d];
1625 ok(sampler_orig == samplers[3], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[3], sampler_orig);
1627 sampler_orig = (const char *)&get_shader_samplers_blob[0x42];
1628 ok(sampler_orig == samplers[4], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[4], sampler_orig);
1630 ok(!strcmp(samplers[5], "dummy"), "D3DXGetShaderSamplers failed, got \"%s\", expected \"%s\"\n", samplers[5], "dummy");
1632 /* reset samplers */
1633 memset(samplers, 0, sizeof(samplers));
1634 samplers[5] = "dummy";
1636 hr = D3DXGetShaderSamplers(get_shader_samplers_blob, NULL, &count);
1637 ok(hr == D3D_OK, "D3DXGetShaderSamplers failed, got %x, expected %x\n", hr, D3D_OK);
1638 ok(count == 5, "D3DXGetShaderSamplers failed, got %u, expected %u\n", count, 5);
1640 hr = D3DXGetShaderSamplers(get_shader_samplers_blob, samplers, &count);
1641 ok(hr == D3D_OK, "D3DXGetShaderSamplers failed, got %x, expected %x\n", hr, D3D_OK);
1642 ok(count == 5, "D3DXGetShaderSamplers failed, got %u, expected %u\n", count, 5);
1644 /* check that sampler points to shader blob */
1645 sampler_orig = (const char *)&get_shader_samplers_blob[0x2e];
1646 ok(sampler_orig == samplers[0], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[0], sampler_orig);
1648 sampler_orig = (const char *)&get_shader_samplers_blob[0x33];
1649 ok(sampler_orig == samplers[1], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[1], sampler_orig);
1651 sampler_orig = (const char *)&get_shader_samplers_blob[0x38];
1652 ok(sampler_orig == samplers[2], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[2], sampler_orig);
1654 sampler_orig = (const char *)&get_shader_samplers_blob[0x3d];
1655 ok(sampler_orig == samplers[3], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[3], sampler_orig);
1657 sampler_orig = (const char *)&get_shader_samplers_blob[0x42];
1658 ok(sampler_orig == samplers[4], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[4], sampler_orig);
1660 ok(!strcmp(samplers[5], "dummy"), "D3DXGetShaderSamplers failed, got \"%s\", expected \"%s\"\n", samplers[5], "dummy");
1662 /* check without ctab */
1663 hr = D3DXGetShaderSamplers(simple_vs, samplers, &count);
1664 ok(hr == D3D_OK, "D3DXGetShaderSamplers failed, got %x, expected %x\n", hr, D3D_OK);
1665 ok(count == 0, "D3DXGetShaderSamplers failed, got %u, expected %u\n", count, 0);
1667 /* check invalid ctab */
1668 hr = D3DXGetShaderSamplers(shader_with_invalid_ctab, samplers, &count);
1669 ok(hr == D3D_OK, "D3DXGetShaderSamplers failed, got %x, expected %x\n", hr, D3D_OK);
1670 ok(count == 0, "D3DXGetShaderSamplers failed, got %u, expected %u\n", count, 0);
1674 * fxc.exe /Tvs_3_0
1676 #if 0
1677 float f = {1.1f}, f_2[2] = {2.1f, 2.2f};
1678 struct {float f; int i;} s = {3.1f, 31},
1679 s_2[2] = {{4.1f, 41}, {4.2f, 42}},
1680 s_3[3] = {{5.1f, 51}, {5.2f, 52}, {5.3f, 53}};
1681 struct {int i1; int i2; float2 f_2; row_major float3x1 r[2];}
1682 p[2] = {{11, 12, {13.1, 14.1}, {{3.11, 3.21, 3.31}, {3.41, 3.51, 3.61}}},
1683 {15, 16, {17.1, 18.1}, {{4.11, 4.21, 4.31}, {4.41, 4.51, 4.61}}}};
1684 int i[1] = {6};
1685 float2x3 f23[2] = {{0.11, 0.21, 0.31, 0.41, 0.51, 0.61}, {0.12, 0.22, 0.32, 0.42, 0.52, 0.62}};
1686 float3x2 f32[2] = {{1.11, 1.21, 1.31, 1.41, 1.51, 1.61}, {1.12, 1.22, 1.32, 1.42, 1.52, 1.62}};
1687 float3 v[2] = {{2.11, 2.21, 2.31}, {2.41, 2.51, 2.61}};
1688 row_major float3x1 r31[2] = {{3.11, 3.21, 3.31}, {3.41, 3.51, 3.61}};
1689 row_major float1x3 r13[2] = {{4.11, 4.21, 4.31}, {4.41, 4.51, 4.61}};
1690 float4 main(float4 pos : POSITION) : POSITION
1692 float4 tmp = 0.0f;
1693 tmp.zyw = v[1] + r13[1] + r31[1] + p[1].r[1];
1694 tmp.x += f * f_2[1] * pos.x * p[1].f_2.y;
1695 tmp.y += s.f * pos.y * s_2[0].i;
1696 tmp.z += s_3[0].f * pos.z * s_3[2].f * i[0] * f23[1]._11 * f32[1]._32;
1697 return tmp;
1699 #endif
1700 static const DWORD test_get_shader_constant_variables_blob[] =
1702 0xfffe0300, 0x0185fffe, 0x42415443, 0x0000001c, 0x000005df, 0xfffe0300, 0x0000000c, 0x0000001c,
1703 0x00000100, 0x000005d8, 0x0000010c, 0x002d0002, 0x00000001, 0x00000110, 0x00000120, 0x00000130,
1704 0x001d0002, 0x00000004, 0x00000134, 0x00000144, 0x000001a4, 0x00210002, 0x00000004, 0x000001a8,
1705 0x000001b8, 0x000001f8, 0x00250002, 0x00000002, 0x000001fc, 0x0000020c, 0x0000022c, 0x002f0002,
1706 0x00000001, 0x00000230, 0x00000240, 0x00000250, 0x00000002, 0x00000012, 0x000002b0, 0x000002c0,
1707 0x000003e0, 0x002b0002, 0x00000002, 0x000003e4, 0x000003f4, 0x00000414, 0x00120002, 0x00000006,
1708 0x00000418, 0x00000428, 0x00000488, 0x002e0002, 0x00000001, 0x000004ac, 0x000004bc, 0x000004dc,
1709 0x00270002, 0x00000002, 0x000004e0, 0x000004f0, 0x00000530, 0x00180002, 0x00000005, 0x00000534,
1710 0x00000544, 0x000005a4, 0x00290002, 0x00000002, 0x000005a8, 0x000005b8, 0xabab0066, 0x00030000,
1711 0x00010001, 0x00000001, 0x00000000, 0x3f8ccccd, 0x00000000, 0x00000000, 0x00000000, 0x00333266,
1712 0x00030003, 0x00030002, 0x00000002, 0x00000000, 0x3de147ae, 0x3ed1eb85, 0x00000000, 0x00000000,
1713 0x3e570a3d, 0x3f028f5c, 0x00000000, 0x00000000, 0x3e9eb852, 0x3f1c28f6, 0x00000000, 0x00000000,
1714 0x3df5c28f, 0x3ed70a3d, 0x00000000, 0x00000000, 0x3e6147ae, 0x3f051eb8, 0x00000000, 0x00000000,
1715 0x3ea3d70a, 0x3f1eb852, 0x00000000, 0x00000000, 0x00323366, 0x00030003, 0x00020003, 0x00000002,
1716 0x00000000, 0x3f8e147b, 0x3fa7ae14, 0x3fc147ae, 0x00000000, 0x3f9ae148, 0x3fb47ae1, 0x3fce147b,
1717 0x00000000, 0x3f8f5c29, 0x3fa8f5c3, 0x3fc28f5c, 0x00000000, 0x3f9c28f6, 0x3fb5c28f, 0x3fcf5c29,
1718 0x00000000, 0x00325f66, 0x00030000, 0x00010001, 0x00000002, 0x00000000, 0x40066666, 0x00000000,
1719 0x00000000, 0x00000000, 0x400ccccd, 0x00000000, 0x00000000, 0x00000000, 0xabab0069, 0x00020000,
1720 0x00010001, 0x00000001, 0x00000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x31690070,
1721 0xababab00, 0x00020000, 0x00010001, 0x00000001, 0x00000000, 0xab003269, 0x00030001, 0x00020001,
1722 0x00000001, 0x00000000, 0xabab0072, 0x00030002, 0x00010003, 0x00000002, 0x00000000, 0x00000252,
1723 0x00000258, 0x00000268, 0x00000258, 0x000001f8, 0x0000026c, 0x0000027c, 0x00000280, 0x00000005,
1724 0x000a0001, 0x00040002, 0x00000290, 0x41300000, 0x00000000, 0x00000000, 0x00000000, 0x41400000,
1725 0x00000000, 0x00000000, 0x00000000, 0x4151999a, 0x4161999a, 0x00000000, 0x00000000, 0x40470a3d,
1726 0x00000000, 0x00000000, 0x00000000, 0x404d70a4, 0x00000000, 0x00000000, 0x00000000, 0x4053d70a,
1727 0x00000000, 0x00000000, 0x00000000, 0x405a3d71, 0x00000000, 0x00000000, 0x00000000, 0x4060a3d7,
1728 0x00000000, 0x00000000, 0x00000000, 0x40670a3d, 0x00000000, 0x00000000, 0x00000000, 0x41700000,
1729 0x00000000, 0x00000000, 0x00000000, 0x41800000, 0x00000000, 0x00000000, 0x00000000, 0x4188cccd,
1730 0x4190cccd, 0x00000000, 0x00000000, 0x4083851f, 0x00000000, 0x00000000, 0x00000000, 0x4086b852,
1731 0x00000000, 0x00000000, 0x00000000, 0x4089eb85, 0x00000000, 0x00000000, 0x00000000, 0x408d1eb8,
1732 0x00000000, 0x00000000, 0x00000000, 0x409051ec, 0x00000000, 0x00000000, 0x00000000, 0x4093851f,
1733 0x00000000, 0x00000000, 0x00000000, 0x00333172, 0x00030002, 0x00030001, 0x00000002, 0x00000000,
1734 0x4083851f, 0x4086b852, 0x4089eb85, 0x00000000, 0x408d1eb8, 0x409051ec, 0x4093851f, 0x00000000,
1735 0x00313372, 0x00030002, 0x00010003, 0x00000002, 0x00000000, 0x40470a3d, 0x00000000, 0x00000000,
1736 0x00000000, 0x404d70a4, 0x00000000, 0x00000000, 0x00000000, 0x4053d70a, 0x00000000, 0x00000000,
1737 0x00000000, 0x405a3d71, 0x00000000, 0x00000000, 0x00000000, 0x4060a3d7, 0x00000000, 0x00000000,
1738 0x00000000, 0x40670a3d, 0x00000000, 0x00000000, 0x00000000, 0xabab0073, 0x00030000, 0x00010001,
1739 0x00000001, 0x00000000, 0x0000010c, 0x0000048c, 0x0000022c, 0x00000258, 0x00000005, 0x00020001,
1740 0x00020001, 0x0000049c, 0x40466666, 0x00000000, 0x00000000, 0x00000000, 0x41f80000, 0x00000000,
1741 0x00000000, 0x00000000, 0x00325f73, 0x00000005, 0x00020001, 0x00020002, 0x0000049c, 0x40833333,
1742 0x00000000, 0x00000000, 0x00000000, 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x40866666,
1743 0x00000000, 0x00000000, 0x00000000, 0x42280000, 0x00000000, 0x00000000, 0x00000000, 0x00335f73,
1744 0x00000005, 0x00020001, 0x00020003, 0x0000049c, 0x40a33333, 0x00000000, 0x00000000, 0x00000000,
1745 0x424c0000, 0x00000000, 0x00000000, 0x00000000, 0x40a66666, 0x00000000, 0x00000000, 0x00000000,
1746 0x42500000, 0x00000000, 0x00000000, 0x00000000, 0x40a9999a, 0x00000000, 0x00000000, 0x00000000,
1747 0x42540000, 0x00000000, 0x00000000, 0x00000000, 0xabab0076, 0x00030001, 0x00030001, 0x00000002,
1748 0x00000000, 0x40070a3d, 0x400d70a4, 0x4013d70a, 0x00000000, 0x401a3d71, 0x4020a3d7, 0x40270a3d,
1749 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
1750 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0200001f,
1751 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x02000001, 0x80070000, 0xa0e4002a,
1752 0x03000002, 0x80070000, 0x80e40000, 0xa0e4002c, 0x03000002, 0x80040000, 0x80aa0000, 0xa0000017,
1753 0x03000002, 0xe0080000, 0x80aa0000, 0xa0000011, 0x02000001, 0x80010001, 0xa000002d, 0x03000005,
1754 0x80040000, 0x80000001, 0xa0000026, 0x03000005, 0x80040000, 0x80aa0000, 0x90000000, 0x03000005,
1755 0xe0010000, 0x80aa0000, 0xa055000b, 0x03000002, 0x80020000, 0x80550000, 0xa0000016, 0x03000002,
1756 0x80010000, 0x80000000, 0xa0000015, 0x03000002, 0x80010000, 0x80000000, 0xa000000f, 0x03000002,
1757 0x80020000, 0x80550000, 0xa0000010, 0x03000005, 0x80040000, 0xa000002e, 0x90550000, 0x04000004,
1758 0xe0020000, 0x80aa0000, 0xa0000028, 0x80550000, 0x03000005, 0x80020000, 0xa0000018, 0x90aa0000,
1759 0x03000005, 0x80020000, 0x80550000, 0xa000001c, 0x03000005, 0x80020000, 0x80550000, 0xa000002f,
1760 0x03000005, 0x80020000, 0x80550000, 0xa0000020, 0x04000004, 0xe0040000, 0x80550000, 0xa0aa0024,
1761 0x80000000, 0x0000ffff,
1764 const struct
1766 const char *fullname;
1767 D3DXCONSTANT_DESC desc;
1768 UINT ctaboffset;
1770 test_get_shader_constant_variables_data[] =
1772 {"f", {"f", D3DXRS_FLOAT4, 45, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 72},
1773 {"f23", {"f23", D3DXRS_FLOAT4, 29, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 2, 3, 2, 0, 48, NULL}, 81},
1774 {"f23[0]", {"f23", D3DXRS_FLOAT4, 29, 3, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 2, 3, 1, 0, 24, NULL}, 81},
1775 {"f23[1]", {"f23", D3DXRS_FLOAT4, 32, 1, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 2, 3, 1, 0, 24, NULL}, 93},
1776 {"f32", {"f32", D3DXRS_FLOAT4, 33, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 2, 2, 0, 48, NULL}, 110},
1777 {"f32[0]", {"f32", D3DXRS_FLOAT4, 33, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 110},
1778 {"f32[1]", {"f32", D3DXRS_FLOAT4, 35, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 118},
1779 {"f_2", {"f_2", D3DXRS_FLOAT4, 37, 2, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 2, 0, 8, NULL}, 131},
1780 {"f_2[0]", {"f_2", D3DXRS_FLOAT4, 37, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 131},
1781 {"f_2[1]", {"f_2", D3DXRS_FLOAT4, 38, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 135},
1782 {"i", {"i", D3DXRS_FLOAT4, 47, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 144},
1783 {"i[0]", {"i", D3DXRS_FLOAT4, 47, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 144},
1784 {"p", {"p", D3DXRS_FLOAT4, 0, 18, D3DXPC_STRUCT, D3DXPT_VOID, 1, 10, 2, 4, 80, NULL}, 176},
1785 {"p[0]", {"p", D3DXRS_FLOAT4, 0, 9, D3DXPC_STRUCT, D3DXPT_VOID, 1, 10, 1, 4, 40, NULL}, 176},
1786 {"p[0].i1", {"i1", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 176},
1787 {"p[0].i2", {"i2", D3DXRS_FLOAT4, 1, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 180},
1788 {"p[0].f_2", {"f_2", D3DXRS_FLOAT4, 2, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 2, 1, 0, 8, NULL}, 184},
1789 {"p[0].r", {"r", D3DXRS_FLOAT4, 3, 6, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 2, 0, 24, NULL}, 188},
1790 {"p[0].r[0]", {"r", D3DXRS_FLOAT4, 3, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}, 188},
1791 {"p[0].r[1]", {"r", D3DXRS_FLOAT4, 6, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}, 200},
1792 {"p[1]", {"p", D3DXRS_FLOAT4, 9, 9, D3DXPC_STRUCT, D3DXPT_VOID, 1, 10, 1, 4, 40, NULL}, 212},
1793 {"p[1].i1", {"i1", D3DXRS_FLOAT4, 9, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 212},
1794 {"p[1].i2", {"i2", D3DXRS_FLOAT4, 10, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 216},
1795 {"p[1].f_2", {"f_2", D3DXRS_FLOAT4, 11, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 2, 1, 0, 8, NULL}, 220},
1796 {"p[1].r", {"r", D3DXRS_FLOAT4, 12, 6, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 2, 0, 24, NULL}, 224},
1797 {"p[1].r[0]", {"r", D3DXRS_FLOAT4, 12, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}, 224},
1798 {"p[1].r[1]", {"r", D3DXRS_FLOAT4, 15, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}, 236},
1799 {"r13", {"r13", D3DXRS_FLOAT4, 43, 2, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 2, 0, 24, NULL}, 253},
1800 {"r13[0]", {"r13", D3DXRS_FLOAT4, 43, 1, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 253},
1801 {"r13[1]", {"r13", D3DXRS_FLOAT4, 44, 1, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 257},
1802 {"r31", {"r31", D3DXRS_FLOAT4, 18, 6, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 2, 0, 24, NULL}, 266},
1803 {"r31[0]", {"r31", D3DXRS_FLOAT4, 18, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}, 266},
1804 {"r31[1]", {"r31", D3DXRS_FLOAT4, 21, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}, 278},
1805 {"s", {"s", D3DXRS_FLOAT4, 46, 1, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 1, 2, 8, NULL}, 303},
1806 {"s.f", {"f", D3DXRS_FLOAT4, 46, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 303},
1807 {"s.i", {"i", D3DXRS_FLOAT4, 47, 0, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 307},
1808 {"s_2", {"s_2", D3DXRS_FLOAT4, 39, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 2, 2, 16, NULL}, 316},
1809 {"s_2[0]", {"s_2", D3DXRS_FLOAT4, 39, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 1, 2, 8, NULL}, 316},
1810 {"s_2[0].f", {"f", D3DXRS_FLOAT4, 39, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 316},
1811 {"s_2[0].i", {"i", D3DXRS_FLOAT4, 40, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 320},
1812 {"s_2[1]", {"s_2", D3DXRS_FLOAT4, 41, 0, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 1, 2, 8, NULL}, 324},
1813 {"s_2[1].f", {"f", D3DXRS_FLOAT4, 41, 0, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 324},
1814 {"s_2[1].i", {"i", D3DXRS_FLOAT4, 41, 0, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 328},
1815 {"s_3", {"s_3", D3DXRS_FLOAT4, 24, 5, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 3, 2, 24, NULL}, 337},
1816 {"s_3[0]", {"s_3", D3DXRS_FLOAT4, 24, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 1, 2, 8, NULL}, 337},
1817 {"s_3[0].f", {"f", D3DXRS_FLOAT4, 24, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 337},
1818 {"s_3[0].i", {"i", D3DXRS_FLOAT4, 25, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 341},
1819 {"s_3[1]", {"s_3", D3DXRS_FLOAT4, 26, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 1, 2, 8, NULL}, 345},
1820 {"s_3[1].f", {"f", D3DXRS_FLOAT4, 26, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 345},
1821 {"s_3[1].i", {"i", D3DXRS_FLOAT4, 27, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 349},
1822 {"s_3[2]", {"s_3", D3DXRS_FLOAT4, 28, 1, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 1, 2, 8, NULL}, 353},
1823 {"s_3[2].f", {"f", D3DXRS_FLOAT4, 28, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 353},
1824 {"s_3[2].i", {"i", D3DXRS_FLOAT4, 29, 0, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 357},
1825 {"v", {"v", D3DXRS_FLOAT4, 41, 2, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 2, 0, 24, NULL}, 366},
1826 {"v[0]", {"v", D3DXRS_FLOAT4, 41, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 366},
1827 {"v[1]", {"v", D3DXRS_FLOAT4, 42, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 370},
1830 static void test_get_shader_constant_variables(void)
1832 ID3DXConstantTable *ctable;
1833 HRESULT hr;
1834 ULONG count;
1835 UINT i;
1836 UINT nr = 1;
1837 D3DXHANDLE constant, element;
1838 D3DXCONSTANT_DESC desc;
1839 DWORD *ctab;
1841 hr = D3DXGetShaderConstantTable(test_get_shader_constant_variables_blob, &ctable);
1842 ok(hr == D3D_OK, "D3DXGetShaderConstantTable failed, got %08x, expected %08x\n", hr, D3D_OK);
1844 ctab = ID3DXConstantTable_GetBufferPointer(ctable);
1845 ok(ctab[0] == test_get_shader_constant_variables_blob[3], "ID3DXConstantTable_GetBufferPointer failed\n");
1847 for (i = 0; i < sizeof(test_get_shader_constant_variables_data) / sizeof(*test_get_shader_constant_variables_data); ++i)
1849 const char *fullname = test_get_shader_constant_variables_data[i].fullname;
1850 const D3DXCONSTANT_DESC *expected_desc = &test_get_shader_constant_variables_data[i].desc;
1851 UINT ctaboffset = test_get_shader_constant_variables_data[i].ctaboffset;
1853 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, fullname);
1854 ok(constant != NULL, "GetConstantByName \"%s\" failed\n", fullname);
1856 hr = ID3DXConstantTable_GetConstantDesc(ctable, constant, &desc, &nr);
1857 ok(hr == D3D_OK, "GetConstantDesc \"%s\" failed, got %08x, expected %08x\n", fullname, hr, D3D_OK);
1859 ok(!strcmp(expected_desc->Name, desc.Name), "GetConstantDesc \"%s\" failed, got \"%s\", expected \"%s\"\n",
1860 fullname, desc.Name, expected_desc->Name);
1861 ok(expected_desc->RegisterSet == desc.RegisterSet, "GetConstantDesc \"%s\" failed, got %#x, expected %#x\n",
1862 fullname, desc.RegisterSet, expected_desc->RegisterSet);
1863 ok(expected_desc->RegisterIndex == desc.RegisterIndex, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1864 fullname, desc.RegisterIndex, expected_desc->RegisterIndex);
1865 ok(expected_desc->RegisterCount == desc.RegisterCount, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1866 fullname, desc.RegisterCount, expected_desc->RegisterCount);
1867 ok(expected_desc->Class == desc.Class, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1868 fullname, desc.Class, expected_desc->Class);
1869 ok(expected_desc->Type == desc.Type, "GetConstantDesc \"%s\" failed, got %#x, expected %#x\n",
1870 fullname, desc.Type, expected_desc->Type);
1871 ok(expected_desc->Rows == desc.Rows, "GetConstantDesc \"%s\" failed, got %#x, expected %#x\n",
1872 fullname, desc.Rows, expected_desc->Rows);
1873 ok(expected_desc->Columns == desc.Columns, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1874 fullname, desc.Columns, expected_desc->Columns);
1875 ok(expected_desc->Elements == desc.Elements, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1876 fullname, desc.Elements, expected_desc->Elements);
1877 ok(expected_desc->StructMembers == desc.StructMembers, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1878 fullname, desc.StructMembers, expected_desc->StructMembers);
1879 ok(expected_desc->Bytes == desc.Bytes, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1880 fullname, desc.Bytes, expected_desc->Bytes);
1881 ok(ctaboffset == (DWORD *)desc.DefaultValue - ctab, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1882 fullname, (UINT)((DWORD *)desc.DefaultValue - ctab), ctaboffset);
1885 element = ID3DXConstantTable_GetConstantElement(ctable, NULL, 0);
1886 ok(element == NULL, "GetConstantElement failed\n");
1888 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "i");
1889 ok(constant != NULL, "GetConstantByName failed\n");
1891 element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "i[0]");
1892 ok(constant == element, "GetConstantByName failed, got %p, expected %p\n", element, constant);
1894 element = ID3DXConstantTable_GetConstantElement(ctable, "i", 0);
1895 ok(element == constant, "GetConstantElement failed, got %p, expected %p\n", element, constant);
1897 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f");
1898 ok(constant != NULL, "GetConstantByName failed\n");
1900 element = ID3DXConstantTable_GetConstant(ctable, NULL, 0);
1901 ok(element == constant, "GetConstant failed, got %p, expected %p\n", element, constant);
1903 element = ID3DXConstantTable_GetConstant(ctable, "invalid", 0);
1904 ok(element == NULL, "GetConstant failed\n");
1906 element = ID3DXConstantTable_GetConstant(ctable, "f", 0);
1907 ok(element == NULL, "GetConstant failed\n");
1909 element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f[0]");
1910 ok(constant == element, "GetConstantByName failed, got %p, expected %p\n", element, constant);
1912 element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f[1]");
1913 ok(NULL == element, "GetConstantByName failed\n");
1915 element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f[0][0]");
1916 ok(constant == element, "GetConstantByName failed, got %p, expected %p\n", element, constant);
1918 element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f.");
1919 ok(element == NULL, "GetConstantByName failed\n");
1921 element = ID3DXConstantTable_GetConstantElement(ctable, "f", 0);
1922 ok(element == constant, "GetConstantElement failed, got %p, expected %p\n", element, constant);
1924 element = ID3DXConstantTable_GetConstantElement(ctable, "f", 1);
1925 ok(element == NULL, "GetConstantElement failed\n");
1927 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f_2[0]");
1928 ok(constant != NULL, "GetConstantByName failed\n");
1930 element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f_2");
1931 ok(element != constant, "GetConstantByName failed, got %p, expected %p\n", element, constant);
1933 element = ID3DXConstantTable_GetConstantElement(ctable, "f_2", 0);
1934 ok(element == constant, "GetConstantElement failed, got %p, expected %p\n", element, constant);
1936 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f_2[1]");
1937 ok(constant != NULL, "GetConstantByName failed\n");
1939 element = ID3DXConstantTable_GetConstantElement(ctable, "f_2", 1);
1940 ok(element == constant, "GetConstantElement failed, got %p, expected %p\n", element, constant);
1942 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "s_2[0].f");
1943 ok(constant != NULL, "GetConstantByName failed\n");
1945 element = ID3DXConstantTable_GetConstant(ctable, "s_2[0]", 0);
1946 ok(element == constant, "GetConstant failed, got %p, expected %p\n", element, constant);
1948 element = ID3DXConstantTable_GetConstantByName(ctable, "s_2[0]", "f");
1949 ok(element == constant, "GetConstantByName failed, got %p, expected %p\n", element, constant);
1951 element = ID3DXConstantTable_GetConstantByName(ctable, "s_2[0]", "invalid");
1952 ok(element == NULL, "GetConstantByName failed\n");
1954 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "s_2[0]");
1955 ok(constant != NULL, "GetConstantByName failed\n");
1957 element = ID3DXConstantTable_GetConstantElement(ctable, "s_2[0]", 0);
1958 ok(constant == element, "GetConstantByName failed, got %p, expected %p\n", element, constant);
1960 count = ID3DXConstantTable_Release(ctable);
1961 ok(count == 0, "Release failed, got %u, expected %u\n", count, 0);
1964 #define REGISTER_OUTPUT_SIZE 48
1966 enum Type {SetFloat, SetInt, SetBool, SetIntArray, SetBoolArray, SetFloatArray, SetMatrix,
1967 SetMatrixTranspose, SetMatrixArray, SetMatrixTransposeArray, SetVector, SetVectorArray,
1968 SetValue, SetMatrixPointerArray, SetMatrixTransposePointerArray};
1970 struct registerset_test
1972 enum Type type;
1973 UINT in_index;
1974 UINT in_count_min;
1975 UINT in_count_max;
1976 UINT out_count;
1977 DWORD out[REGISTER_OUTPUT_SIZE];
1980 struct registerset_constants
1982 const char *fullname;
1983 D3DXCONSTANT_DESC desc;
1984 UINT ctaboffset;
1987 static const DWORD registerset_test_input[][REGISTER_OUTPUT_SIZE] =
1989 /* float */
1990 {0x40000123, 0x00000000, 0x40800123, 0x40a00123,
1991 0x40c00123, 0x40e00123, 0x41000123, 0x41100123,
1992 0x41200123, 0x41300123, 0x41400123, 0x41500123,
1993 0x41600123, 0x41700123, 0x41800123, 0x41900123,
1994 0x41a00123, 0x41b00123, 0x41c00123, 0x41d00123,
1995 0x00000000, 0x41f00123, 0x42000123, 0x42100123,
1996 0x00000000, 0x42300123, 0x42400123, 0x42500123,
1997 0x42600123, 0x42700123, 0x42800123, 0x42900123,
1998 0x43000123, 0x43100123, 0x43200123, 0x43300123,
1999 0x43400123, 0x43500123, 0x43600123, 0x43700123,
2000 0x43800123, 0x43900123, 0x43a00123, 0x43b00123,
2001 0x43c00123, 0x43d00123, 0x43e00123, 0x43f00123},
2002 /* int */
2003 {0x00000002, 0x00000003, 0x00000004, 0x00000005,
2004 0x00000000, 0x00000007, 0x00000008, 0x00000009,
2005 0x0000000a, 0x0000000b, 0x0000000c, 0x0000000d,
2006 0x0000000e, 0x0000000f, 0x00000010, 0x00000011,
2007 0x00000012, 0x00000000, 0x00000000, 0x00000015,
2008 0x00000016, 0x00000017, 0x00000018, 0x00000019,
2009 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d,
2010 0x0000001e, 0x0000001f, 0x00000020, 0x00000021,
2011 0x00000022, 0x00000023, 0x00000024, 0x00000025,
2012 0x00000026, 0x00000027, 0x00000028, 0x00000029,
2013 0x0000002a, 0x0000002b, 0x0000002c, 0x0000002d,
2014 0x0000002e, 0x0000002f, 0x00000030, 0x00000031},
2018 * fxc.exe /Tvs_3_0
2020 #if 0
2021 bool b = 1;
2022 int n = 8;
2023 float f = 5.1;
2024 int nf = 11;
2025 bool bf = 1;
2026 float4 main(float4 pos : POSITION) : POSITION
2028 float4 tmp = 0;
2029 int i;
2030 if (b) for (i = 0; i < n; i++) tmp.x += pos.z * f * nf;
2031 else for (i = 0; i < n; i++) tmp.y += pos.y * f * bf;
2032 return tmp;
2034 #endif
2035 static const DWORD registerset_blob_scalar[] =
2037 0xfffe0300, 0x0051fffe, 0x42415443, 0x0000001c, 0x0000010f, 0xfffe0300, 0x00000005, 0x0000001c,
2038 0x00000100, 0x00000108, 0x00000080, 0x00000000, 0x00000001, 0x00000084, 0x00000094, 0x00000098,
2039 0x00020002, 0x00000001, 0x00000084, 0x0000009c, 0x000000ac, 0x00000002, 0x00000001, 0x000000b0,
2040 0x000000c0, 0x000000d0, 0x00000001, 0x00000001, 0x000000d4, 0x000000e4, 0x000000f4, 0x00010002,
2041 0x00000001, 0x000000d4, 0x000000f8, 0xabab0062, 0x00010000, 0x00010001, 0x00000001, 0x00000000,
2042 0xffffffff, 0xab006662, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0xabab0066, 0x00030000,
2043 0x00010001, 0x00000001, 0x00000000, 0x40a33333, 0x00000000, 0x00000000, 0x00000000, 0xabab006e,
2044 0x00020000, 0x00010001, 0x00000001, 0x00000000, 0x00000008, 0x00000000, 0x00000001, 0x00000000,
2045 0xab00666e, 0x41300000, 0x00000000, 0x00000000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369,
2046 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
2047 0x392e3932, 0x332e3235, 0x00313131, 0x05000051, 0xa00f0003, 0x00000000, 0x00000000, 0x00000000,
2048 0x00000000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x01000028,
2049 0xe0e40800, 0x03000005, 0x80010000, 0xa0000000, 0x90aa0000, 0x02000001, 0x80010001, 0xa0000003,
2050 0x01000026, 0xf0e40000, 0x04000004, 0x80010001, 0x80000000, 0xa0000001, 0x80000001, 0x00000027,
2051 0x02000001, 0x80020001, 0xa0000003, 0x0000002a, 0x03000005, 0x80010000, 0xa0000000, 0x90550000,
2052 0x02000001, 0x80020001, 0xa0000003, 0x01000026, 0xf0e40000, 0x04000004, 0x80020001, 0x80000000,
2053 0xa0000002, 0x80550001, 0x00000027, 0x02000001, 0x80010001, 0xa0000003, 0x0000002b, 0x02000001,
2054 0xe0030000, 0x80e40001, 0x02000001, 0xe00c0000, 0xa0000003, 0x0000ffff,
2057 static const struct registerset_constants registerset_constants_scalar_float[] =
2059 {"f", {"f", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 48},
2062 static const struct registerset_test registerset_test_scalar_float[] =
2064 {SetFloat, 0, 0, 0, 4, {0x40000123}},
2065 {SetInt, 1, 0, 0, 4, {0x40000000}},
2066 {SetBool, 1, 0, 0, 4, {0x3f800000}},
2067 {SetIntArray},
2068 {SetIntArray, 1, 1, REGISTER_OUTPUT_SIZE, 4, {0x40000000}},
2069 {SetBoolArray},
2070 {SetBoolArray, 1, 1, REGISTER_OUTPUT_SIZE, 4, {0x3f800000}},
2071 {SetFloatArray},
2072 {SetFloatArray, 0, 1, REGISTER_OUTPUT_SIZE, 4, {0x40000123}},
2073 {SetValue, 0, 0, 3},
2074 {SetValue, 0, 4, REGISTER_OUTPUT_SIZE * 4, 4, {0x40000123}},
2075 {SetVector, 0, 0, 0, 4, {0x40000123}},
2076 {SetVectorArray},
2077 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4, {0x40000123}},
2078 {SetMatrix, 0, 0, 0, 4, {0x40000123},},
2079 {SetMatrixArray},
2080 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123}},
2081 {SetMatrixTranspose, 0, 0, 0, 4, {0x40000123},},
2082 {SetMatrixTransposeArray},
2083 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123}},
2084 {SetMatrixPointerArray},
2085 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123}},
2086 {SetMatrixTransposePointerArray},
2087 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123}},
2090 static const struct registerset_constants registerset_constants_scalar_int[] =
2092 {"n", {"n", D3DXRS_INT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 57},
2095 static const struct registerset_test registerset_test_scalar_int[] =
2097 {SetFloat, 0, 0, 0, 4,
2098 {0x00000002, 0x00000000, 0x00000001}},
2099 {SetInt, 1, 0, 0, 4,
2100 {0x00000002, 0x00000000, 0x00000001}},
2101 {SetBool, 1, 0, 0, 4,
2102 {0x00000001, 0x00000000, 0x00000001}},
2103 {SetIntArray},
2104 {SetIntArray, 1, 1, REGISTER_OUTPUT_SIZE, 4,
2105 {0x00000002, 0x00000000, 0x00000001}},
2106 {SetBoolArray},
2107 {SetBoolArray, 1, 1, REGISTER_OUTPUT_SIZE, 4,
2108 {0x00000001, 0x00000000, 0x00000001}},
2109 {SetFloatArray},
2110 {SetFloatArray, 0, 1, REGISTER_OUTPUT_SIZE, 4,
2111 {0x00000002, 0x00000000, 0x00000001}},
2112 {SetValue, 1, 0, 3},
2113 {SetValue, 1, 4, REGISTER_OUTPUT_SIZE * 4, 4,
2114 {0x00000002, 0x00000000, 0x00000001}},
2115 {SetVector, 0, 0, 0, 4,
2116 {0x00000002, 0x00000000, 0x00000001},},
2117 {SetVectorArray},
2118 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4,
2119 {0x00000002, 0x00000000, 0x00000001}},
2120 {SetMatrix, 0, 0, 0, 4,
2121 {0x00000002, 0x00000000, 0x00000001}},
2122 {SetMatrixArray},
2123 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
2124 {0x00000002, 0x00000000, 0x00000001}},
2125 {SetMatrixTranspose, 0, 0, 0, 4,
2126 {0x00000002, 0x00000000, 0x00000001}},
2127 {SetMatrixTransposeArray},
2128 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
2129 {0x00000002, 0x00000000, 0x00000001}},
2130 {SetMatrixPointerArray},
2131 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
2132 {0x00000002, 0x00000000, 0x00000001}},
2133 {SetMatrixTransposePointerArray},
2134 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
2135 {0x00000002, 0x00000000, 0x00000001}},
2138 static const struct registerset_constants registerset_constants_scalar_int_float[] =
2140 {"nf", {"nf", D3DXRS_FLOAT4, 1, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 62},
2143 static const struct registerset_test registerset_test_scalar_int_float[] =
2145 {SetFloat, 0, 0, 0, 4, {0x40000000}},
2146 {SetInt, 1, 0, 0, 4, {0x40000000}},
2147 {SetBool, 1, 0, 0, 4, {0x3f800000}},
2148 {SetIntArray},
2149 {SetIntArray, 1, 1, REGISTER_OUTPUT_SIZE, 4, {0x40000000}},
2150 {SetBoolArray},
2151 {SetBoolArray, 1, 1, REGISTER_OUTPUT_SIZE, 4, {0x3f800000}},
2152 {SetFloatArray},
2153 {SetFloatArray, 0, 1, REGISTER_OUTPUT_SIZE, 4, {0x40000000}},
2154 {SetValue, 1, 0, 3},
2155 {SetValue, 1, 4, REGISTER_OUTPUT_SIZE * 4, 4, {0x40000000}},
2156 {SetVector, 0, 0, 0, 4, {0x40000000}},
2157 {SetVectorArray},
2158 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4, {0x40000000}},
2159 {SetMatrix, 0, 0, 0, 4, {0x40000000}},
2160 {SetMatrixArray},
2161 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000}},
2162 {SetMatrixTranspose, 0, 0, 0, 4, {0x40000000}},
2163 {SetMatrixTransposeArray},
2164 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000}},
2165 {SetMatrixPointerArray},
2166 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000}},
2167 {SetMatrixTransposePointerArray},
2168 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000}},
2171 static const struct registerset_constants registerset_constants_scalar_bool_float[] =
2173 {"bf", {"bf", D3DXRS_FLOAT4, 2, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 39},
2176 static const struct registerset_test registerset_test_scalar_bool_float[] =
2178 {SetFloat, 0, 0, 0, 4, {0x3f800000}},
2179 {SetInt, 1, 0, 0, 4, {0x3f800000}},
2180 {SetBool, 1, 0, 0, 4, {0x3f800000}},
2181 {SetIntArray},
2182 {SetIntArray, 1, 1, REGISTER_OUTPUT_SIZE, 4, {0x3f800000}},
2183 {SetBoolArray},
2184 {SetBoolArray, 1, 1, REGISTER_OUTPUT_SIZE, 4, {0x3f800000}},
2185 {SetFloatArray},
2186 {SetFloatArray, 0, 1, REGISTER_OUTPUT_SIZE, 4, {0x3f800000}},
2187 {SetValue, 1, 0, 3},
2188 {SetValue, 1, 4, REGISTER_OUTPUT_SIZE * 4, 4, {0x3f800000}},
2189 {SetVector, 0, 0, 0, 4, {0x3f800000}},
2190 {SetVectorArray},
2191 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4, {0x3f800000}},
2192 {SetMatrix, 0, 0, 0, 4, {0x3f800000}},
2193 {SetMatrixArray},
2194 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000}},
2195 {SetMatrixTranspose, 0, 0, 0, 4, {0x3f800000}},
2196 {SetMatrixTransposeArray},
2197 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000}},
2198 {SetMatrixPointerArray},
2199 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000}},
2200 {SetMatrixTransposePointerArray},
2201 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000}},
2204 static const struct registerset_constants registerset_constants_scalar_bool[] =
2206 {"b", {"b", D3DXRS_BOOL, 0, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 37},
2209 static const struct registerset_test registerset_test_scalar_bool[] =
2211 {SetFloat, 0, 0, 0, 1, {0x00000001}},
2212 {SetInt, 1, 0, 0, 1, {0x00000001}},
2213 {SetBool, 1, 0, 0, 1, {0x00000002}},
2214 {SetIntArray},
2215 {SetIntArray, 1, 1, REGISTER_OUTPUT_SIZE, 1, {0x00000001}},
2216 {SetBoolArray},
2217 {SetBoolArray, 1, 1, REGISTER_OUTPUT_SIZE, 1, {0x00000002}},
2218 {SetFloatArray},
2219 {SetFloatArray, 0, 1, REGISTER_OUTPUT_SIZE, 1, {0x00000001}},
2220 {SetValue, 1, 0, 3},
2221 {SetValue, 1, 4, REGISTER_OUTPUT_SIZE * 4, 1, {0x00000002}},
2222 {SetVector, 0, 0, 0, 1, {0x00000001}},
2223 {SetVectorArray},
2224 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 1, {0x00000001}},
2225 {SetMatrix, 0, 0, 0, 1, {0x00000001}},
2226 {SetMatrixArray},
2227 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 1, {0x00000001}},
2228 {SetMatrixTranspose, 0, 0, 0, 1, {0x00000001}},
2229 {SetMatrixTransposeArray},
2230 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 1, {0x00000001}},
2231 {SetMatrixPointerArray},
2232 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 1, {0x00000001}},
2233 {SetMatrixTransposePointerArray},
2234 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 1, {0x00000001}},
2238 * fxc.exe /Tvs_3_0
2240 #if 0
2241 bool ab[2] = {1, 0};
2242 int an[2] = {32, 33};
2243 float af[2] = {3.1, 3.2};
2244 int anf[2] = {14, 15};
2245 bool abf[2] = {1, 1};
2246 float4 main(float4 pos : POSITION) : POSITION
2248 float4 tmp = 0;
2249 int i;
2250 if (ab[1]) for (i = 0; i < an[1]; i++) tmp.x += pos.z * af[0] * anf[1];
2251 else for (i = 0; i < an[0]; i++) tmp.y += pos.y * af[1] * abf[1];
2252 return tmp;
2254 #endif
2255 static const DWORD registerset_blob_scalar_array[] =
2257 0xfffe0300, 0x006afffe, 0x42415443, 0x0000001c, 0x00000173, 0xfffe0300, 0x00000005, 0x0000001c,
2258 0x00000100, 0x0000016c, 0x00000080, 0x00000000, 0x00000002, 0x00000084, 0x00000094, 0x0000009c,
2259 0x00040002, 0x00000002, 0x000000a0, 0x000000b0, 0x000000d0, 0x00000002, 0x00000002, 0x000000d4,
2260 0x000000e4, 0x00000104, 0x00000001, 0x00000002, 0x00000108, 0x00000118, 0x00000138, 0x00020002,
2261 0x00000002, 0x0000013c, 0x0000014c, 0xab006261, 0x00010000, 0x00010001, 0x00000002, 0x00000000,
2262 0xffffffff, 0x00000000, 0x00666261, 0x00010000, 0x00010001, 0x00000002, 0x00000000, 0x3f800000,
2263 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0xab006661,
2264 0x00030000, 0x00010001, 0x00000002, 0x00000000, 0x40466666, 0x00000000, 0x00000000, 0x00000000,
2265 0x404ccccd, 0x00000000, 0x00000000, 0x00000000, 0xab006e61, 0x00020000, 0x00010001, 0x00000002,
2266 0x00000000, 0x00000020, 0x00000000, 0x00000001, 0x00000000, 0x00000021, 0x00000000, 0x00000001,
2267 0x00000000, 0x00666e61, 0x00020000, 0x00010001, 0x00000002, 0x00000000, 0x41600000, 0x00000000,
2268 0x00000000, 0x00000000, 0x41700000, 0x00000000, 0x00000000, 0x00000000, 0x335f7376, 0x4d00305f,
2269 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
2270 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x05000051, 0xa00f0006, 0x00000000, 0x00000000,
2271 0x00000000, 0x00000000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000,
2272 0x01000028, 0xe0e40801, 0x03000005, 0x80010000, 0xa0000000, 0x90aa0000, 0x02000001, 0x80010001,
2273 0xa0000006, 0x01000026, 0xf0e40001, 0x04000004, 0x80010001, 0x80000000, 0xa0000003, 0x80000001,
2274 0x00000027, 0x02000001, 0x80020001, 0xa0000006, 0x0000002a, 0x03000005, 0x80010000, 0xa0000001,
2275 0x90550000, 0x02000001, 0x80020001, 0xa0000006, 0x01000026, 0xf0e40000, 0x04000004, 0x80020001,
2276 0x80000000, 0xa0000005, 0x80550001, 0x00000027, 0x02000001, 0x80010001, 0xa0000006, 0x0000002b,
2277 0x02000001, 0xe0030000, 0x80e40001, 0x02000001, 0xe00c0000, 0xa0000006, 0x0000ffff,
2280 static const struct registerset_constants registerset_constants_scalar_array_float[] =
2282 {"af", {"af", D3DXRS_FLOAT4, 0, 2, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 2, 0, 8, NULL}, 57},
2283 {"af[0]", {"af", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 57},
2284 {"af[1]", {"af", D3DXRS_FLOAT4, 1, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 61},
2287 static const struct registerset_test registerset_test_scalar_array_float[] =
2289 {SetFloat, 0, 0, 0, 4, {0x40000123}},
2290 {SetInt, 1, 0, 0, 4, {0x40000000}},
2291 {SetBool, 1, 0, 0, 4, {0x3f800000}},
2292 {SetIntArray},
2293 {SetIntArray, 1, 1, 1, 4, {0x40000000}},
2294 {SetIntArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2295 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000}},
2296 {SetBoolArray},
2297 {SetBoolArray, 1, 1, 1, 4, {0x3f800000}},
2298 {SetBoolArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2299 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2300 {SetFloatArray},
2301 {SetFloatArray, 0, 1, 1, 4, {0x40000123}},
2302 {SetFloatArray, 0, 2, REGISTER_OUTPUT_SIZE, 8,
2303 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2304 {SetValue, 0, 0, 3},
2305 {SetValue, 0, 4, 7, 4, {0x40000123}},
2306 {SetValue, 0, 8, REGISTER_OUTPUT_SIZE * 4, 8,
2307 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2308 {SetVector, 0, 0, 0, 8,
2309 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2310 {SetVectorArray},
2311 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
2312 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2313 {SetMatrix, 0, 0, 0, 8,
2314 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2315 {SetMatrixArray},
2316 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2317 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2318 {SetMatrixTranspose, 0, 0, 0, 8,
2319 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123}},
2320 {SetMatrixTransposeArray},
2321 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2322 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123}},
2323 {SetMatrixPointerArray},
2324 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2325 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2326 {SetMatrixTransposePointerArray},
2327 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2328 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123}},
2331 static const struct registerset_constants registerset_constants_scalar_array_int[] =
2333 {"an", {"an", D3DXRS_INT4, 0, 2, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 2, 0, 8, NULL}, 70},
2334 {"an[0]", {"an", D3DXRS_INT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 70},
2335 {"an[1]", {"an", D3DXRS_INT4, 1, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 74},
2338 static const struct registerset_test registerset_test_scalar_array_int[] =
2340 {SetFloat, 0, 0, 0, 4, {0x00000002, 0x00000000, 0x00000001}},
2341 {SetInt, 1, 0, 0, 4, {0x00000002, 0x00000000, 0x00000001}},
2342 {SetBool, 1, 0, 0, 4, {0x00000001, 0x00000000, 0x00000001}},
2343 {SetIntArray},
2344 {SetIntArray, 1, 1, 1, 4, {0x00000002, 0x00000000, 0x00000001}},
2345 {SetIntArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2346 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000000, 0x00000001}},
2347 {SetBoolArray},
2348 {SetBoolArray, 1, 1, 1, 4, {0x00000001, 0x00000000, 0x00000001}},
2349 {SetBoolArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2350 {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001}},
2351 {SetFloatArray},
2352 {SetFloatArray, 0, 1, 1, 4, {0x00000002, 0x00000000, 0x00000001}},
2353 {SetFloatArray, 0, 2, REGISTER_OUTPUT_SIZE, 8,
2354 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
2355 {SetValue, 1, 0, 3},
2356 {SetValue, 1, 4, 7, 4, {0x00000002, 0x00000000, 0x00000001}},
2357 {SetValue, 1, 8, REGISTER_OUTPUT_SIZE * 4, 8,
2358 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000000, 0x00000001}},
2359 {SetVector, 0, 0, 0, 8,
2360 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
2361 {SetVectorArray},
2362 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
2363 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
2364 {SetMatrix, 0, 0, 0, 8,
2365 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
2366 {SetMatrixArray},
2367 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2368 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
2369 {SetMatrixTranspose, 0, 0, 0, 8,
2370 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000000, 0x00000001}},
2371 {SetMatrixTransposeArray},
2372 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2373 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000000, 0x00000001}},
2374 {SetMatrixPointerArray},
2375 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2376 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
2377 {SetMatrixTransposePointerArray},
2378 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2379 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000000, 0x00000001}},
2382 static const struct registerset_constants registerset_constants_scalar_array_bool[] =
2384 {"ab", {"ab", D3DXRS_BOOL, 0, 2, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 2, 0, 8, NULL}, 37},
2385 {"ab[0]", {"ab", D3DXRS_BOOL, 0, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 37},
2386 {"ab[1]", {"ab", D3DXRS_BOOL, 1, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 38},
2389 static const struct registerset_test registerset_test_scalar_array_bool[] =
2391 {SetFloat, 0, 0, 0, 1, {0x00000001}},
2392 {SetInt, 1, 0, 0, 1, {0x00000001}},
2393 {SetBool, 1, 0, 0, 1, {0x00000002}},
2394 {SetIntArray},
2395 {SetIntArray, 1, 1, 1, 1, {0x00000001}},
2396 {SetIntArray, 1, 2, REGISTER_OUTPUT_SIZE, 2, {0x00000001, 0x00000001}},
2397 {SetBoolArray},
2398 {SetBoolArray, 1, 1, 1, 1, {0x00000002}},
2399 {SetBoolArray, 1, 2, REGISTER_OUTPUT_SIZE, 2, {0x00000002, 0x00000003}},
2400 {SetFloatArray},
2401 {SetFloatArray, 0, 1, 1, 1, {0x00000001}},
2402 {SetFloatArray, 0, 2, REGISTER_OUTPUT_SIZE, 2, {0x00000001, 0x00000000}},
2403 {SetValue, 1, 0, 3},
2404 {SetValue, 1, 4, 7, 1, {0x00000002}},
2405 {SetValue, 1, 8, REGISTER_OUTPUT_SIZE * 4, 2, {0x00000002, 0x00000003}},
2406 {SetVector, 0, 0, 0, 2, {0x00000001, 0x00000000}},
2407 {SetVectorArray},
2408 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 2, {0x00000001, 0x00000000}},
2409 {SetMatrix, 0, 0, 0, 2, {0x00000001, 0x00000000}},
2410 {SetMatrixArray},
2411 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 2, {0x00000001, 0x00000000}},
2412 {SetMatrixTranspose, 0, 0, 0, 2, {0x00000001, 0x00000001}},
2413 {SetMatrixTransposeArray},
2414 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 2, {0x00000001, 0x00000001}},
2415 {SetMatrixPointerArray},
2416 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 2, {0x00000001, 0x00000000}},
2417 {SetMatrixTransposePointerArray},
2418 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 2, {0x00000001, 0x00000001}},
2421 static const struct registerset_constants registerset_constants_scalar_array_bool_float[] =
2423 {"abf", {"abf", D3DXRS_FLOAT4, 4, 2, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 2, 0, 8, NULL}, 44},
2424 {"abf[0]", {"abf", D3DXRS_FLOAT4, 4, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 44},
2425 {"abf[1]", {"abf", D3DXRS_FLOAT4, 5, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 48},
2428 static const struct registerset_test registerset_test_scalar_array_bool_float[] =
2430 {SetFloat, 0, 0, 0, 4, {0x3f800000}},
2431 {SetInt, 1, 0, 0, 4, {0x3f800000}},
2432 {SetBool, 1, 0, 0, 4, {0x3f800000}},
2433 {SetIntArray},
2434 {SetIntArray, 1, 1, 1, 4, {0x3f800000}},
2435 {SetIntArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2436 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2437 {SetBoolArray},
2438 {SetBoolArray, 1, 1, 1, 4, {0x3f800000}},
2439 {SetBoolArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2440 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2441 {SetFloatArray},
2442 {SetFloatArray, 0, 1, 1, 4, {0x3f800000}},
2443 {SetFloatArray, 0, 2, REGISTER_OUTPUT_SIZE, 8,
2444 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2445 {SetValue, 1, 0, 3},
2446 {SetValue, 1, 4, 7, 4, {0x3f800000}},
2447 {SetValue, 1, 8, REGISTER_OUTPUT_SIZE * 4, 8,
2448 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2449 {SetVector, 0, 0, 0, 8,
2450 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2451 {SetVectorArray},
2452 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
2453 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2454 {SetMatrix, 0, 0, 0, 8,
2455 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2456 {SetVectorArray},
2457 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2458 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2459 {SetMatrixTranspose, 0, 0, 0, 8,
2460 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2461 {SetMatrixTransposeArray},
2462 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2463 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2464 {SetMatrixPointerArray},
2465 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2466 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2467 {SetMatrixTransposePointerArray},
2468 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2469 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2472 static const struct registerset_constants registerset_constants_scalar_array_int_float[] =
2474 {"anf", {"anf", D3DXRS_FLOAT4, 2, 2, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 2, 0, 8, NULL}, 83},
2475 {"anf[0]", {"anf", D3DXRS_FLOAT4, 2, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 83},
2476 {"anf[1]", {"anf", D3DXRS_FLOAT4, 3, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 87},
2479 static const struct registerset_test registerset_test_scalar_array_int_float[] =
2481 {SetFloat, 0, 0, 0, 4, {0x40000000}},
2482 {SetInt, 1, 0, 0, 4, {0x40000000}},
2483 {SetBool, 1, 0, 0, 4, {0x3f800000}},
2484 {SetIntArray},
2485 {SetIntArray, 1, 1, 1, 4, {0x40000000}},
2486 {SetIntArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2487 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000}},
2488 {SetBoolArray},
2489 {SetBoolArray, 1, 1, 1, 4, {0x3f800000}},
2490 {SetBoolArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2491 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2492 {SetFloatArray},
2493 {SetFloatArray, 0, 1, 1, 4, {0x40000000}},
2494 {SetFloatArray, 0, 2, REGISTER_OUTPUT_SIZE, 8,
2495 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2496 {SetValue, 1, 0, 3},
2497 {SetValue, 1, 4, 7, 4, {0x40000000}},
2498 {SetValue, 1, 8, REGISTER_OUTPUT_SIZE * 4, 8,
2499 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000}},
2500 {SetVector, 0, 0, 0, 8,
2501 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2502 {SetVectorArray},
2503 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
2504 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2505 {SetMatrix, 0, 0, 0, 8,
2506 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2507 {SetMatrixArray},
2508 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2509 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2510 {SetMatrixTranspose, 0, 0, 0, 8,
2511 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000}},
2512 {SetMatrixTransposeArray},
2513 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2514 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000}},
2515 {SetMatrixPointerArray},
2516 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2517 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2518 {SetMatrixTransposePointerArray},
2519 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2520 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000}},
2524 * fxc.exe /Tvs_3_0
2526 #if 0
2527 bool3 vb = {1, 0, 1};
2528 int3 vn = {7, 8, 9};
2529 float3 vf = {5.1, 5.2, 5.3};
2530 int3 vnf = {11, 85, 62};
2531 bool3 vbf = {1, 1, 1};
2532 float4 main(float4 pos : POSITION) : POSITION
2534 float4 tmp = 0;
2535 int i;
2536 if (vb.z) for (i = 0; i < vn.z; i++) tmp.x += pos.z * vf.z * vnf.z;
2537 else for (i = 0; i < vn.y; i++) tmp.y += pos.y * vf.y * vbf.z;
2538 return tmp;
2540 #endif
2541 static const DWORD registerset_blob_vector[] =
2543 0xfffe0300, 0x0053fffe, 0x42415443, 0x0000001c, 0x00000117, 0xfffe0300, 0x00000005, 0x0000001c,
2544 0x00000100, 0x00000110, 0x00000080, 0x00000000, 0x00000003, 0x00000084, 0x00000094, 0x000000a0,
2545 0x00020002, 0x00000001, 0x00000084, 0x000000a4, 0x000000b4, 0x00000002, 0x00000001, 0x000000b8,
2546 0x000000c8, 0x000000d8, 0x00000001, 0x00000003, 0x000000dc, 0x000000ec, 0x000000fc, 0x00010002,
2547 0x00000001, 0x000000dc, 0x00000100, 0xab006276, 0x00010001, 0x00030001, 0x00000001, 0x00000000,
2548 0xffffffff, 0x00000000, 0xffffffff, 0x00666276, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
2549 0xab006676, 0x00030001, 0x00030001, 0x00000001, 0x00000000, 0x40a33333, 0x40a66666, 0x40a9999a,
2550 0x00000000, 0xab006e76, 0x00020001, 0x00030001, 0x00000001, 0x00000000, 0x00000007, 0x00000008,
2551 0x00000009, 0x00000000, 0x00666e76, 0x41300000, 0x42aa0000, 0x42780000, 0x00000000, 0x335f7376,
2552 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
2553 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x05000051, 0xa00f0003, 0x00000000,
2554 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000,
2555 0xe00f0000, 0x01000028, 0xe0e40802, 0x03000005, 0x80010000, 0xa0aa0000, 0x90aa0000, 0x02000001,
2556 0x80010001, 0xa0000003, 0x01000026, 0xf0e40002, 0x04000004, 0x80010001, 0x80000000, 0xa0aa0001,
2557 0x80000001, 0x00000027, 0x02000001, 0x80020001, 0xa0000003, 0x0000002a, 0x03000005, 0x80010000,
2558 0xa0550000, 0x90550000, 0x02000001, 0x80020001, 0xa0000003, 0x01000026, 0xf0e40001, 0x04000004,
2559 0x80020001, 0x80000000, 0xa0aa0002, 0x80550001, 0x00000027, 0x02000001, 0x80010001, 0xa0000003,
2560 0x0000002b, 0x02000001, 0xe0030000, 0x80e40001, 0x02000001, 0xe00c0000, 0xa0000003, 0x0000ffff,
2563 static const struct registerset_constants registerset_constants_vector_float[] =
2565 {"vf", {"vf", D3DXRS_FLOAT4, 0, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 50},
2568 static const struct registerset_test registerset_test_vector_float[] =
2570 {SetInt},
2571 {SetBool},
2572 {SetFloat},
2573 {SetIntArray, 1, 0, 2},
2574 {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x40000000, 0x40400000, 0x40800000}},
2575 {SetBoolArray, 1, 0, 2},
2576 {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2577 {SetFloatArray, 0, 0, 2},
2578 {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 4, {0x40000123, 0x00000000, 0x40800123}},
2579 {SetValue, 0, 0, 11},
2580 {SetValue, 0, 12, REGISTER_OUTPUT_SIZE * 4, 4, {0x40000123, 0x00000000, 0x40800123}},
2581 {SetVector, 0, 0, 0, 4, {0x40000123, 0x00000000, 0x40800123}},
2582 {SetVectorArray},
2583 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4, {0x40000123, 0x00000000, 0x40800123}},
2584 {SetMatrix, 0, 0, 0, 4, {0x40000123, 0x00000000, 0x40800123}},
2585 {SetMatrixArray},
2586 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123, 0x00000000, 0x40800123}},
2587 {SetMatrixTranspose, 0, 0, 0, 4, {0x40000123, 0x40c00123, 0x41200123}},
2588 {SetMatrixTransposeArray},
2589 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123, 0x40c00123, 0x41200123}},
2590 {SetMatrixPointerArray},
2591 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123, 0x00000000, 0x40800123}},
2592 {SetMatrixTransposePointerArray},
2593 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123, 0x40c00123, 0x41200123}},
2596 static const struct registerset_constants registerset_constants_vector_int[] =
2598 {"vn", {"vn", D3DXRS_INT4, 0, 3, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 59},
2601 static const struct registerset_test registerset_test_vector_int[] =
2603 {SetInt},
2604 {SetBool},
2605 {SetFloat},
2606 {SetIntArray, 1, 0, 2},
2607 {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x00000002, 0x00000003, 0x00000004}},
2608 {SetBoolArray, 1, 0, 2},
2609 {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x00000001, 0x00000001, 0x00000001}},
2610 {SetFloatArray, 0, 0, 2},
2611 {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 4, {0x00000002, 0x00000000, 0x00000004}},
2612 {SetValue, 1, 0, 11},
2613 {SetValue, 1, 12, REGISTER_OUTPUT_SIZE * 4, 4, {0x00000002, 0x00000003, 0x00000004}},
2614 {SetVector, 0, 0, 0, 4, {0x00000002, 0x00000000, 0x00000004}},
2615 {SetVectorArray},
2616 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4, {0x00000002, 0x00000000, 0x00000004}},
2617 {SetMatrix, 0, 0, 0, 4, {0x00000002, 0x00000000, 0x00000004}},
2618 {SetMatrixArray},
2619 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x00000002, 0x00000000, 0x00000004}},
2620 {SetMatrixTranspose, 0, 0, 0, 4, {0x00000002, 0x00000006, 0x0000000a}},
2621 {SetMatrixTransposeArray},
2622 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x00000002, 0x00000006, 0x0000000a}},
2623 {SetMatrixPointerArray},
2624 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x00000002, 0x00000000, 0x00000004}},
2625 {SetMatrixTransposePointerArray},
2626 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x00000002, 0x00000006, 0x0000000a}},
2629 static const struct registerset_constants registerset_constants_vector_bool[] =
2631 {"vb", {"vb", D3DXRS_BOOL, 0, 3, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 37},
2634 static const struct registerset_test registerset_test_vector_bool[] =
2636 {SetInt},
2637 {SetBool},
2638 {SetFloat},
2639 {SetIntArray, 1, 0, 2},
2640 {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 3, {0x00000001, 0x00000001, 0x00000001}},
2641 {SetBoolArray, 1, 0, 2},
2642 {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 3, {0x00000002, 0x00000003, 0x00000004}},
2643 {SetFloatArray, 0, 0, 2},
2644 {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 3, {0x00000001, 0x00000000, 0x00000001}},
2645 {SetValue, 1, 0, 11},
2646 {SetValue, 1, 12, REGISTER_OUTPUT_SIZE * 4, 3, {0x00000002, 0x00000003, 0x00000004}},
2647 {SetVector, 0, 0, 0, 3, {0x00000001, 0x00000000, 0x00000001}},
2648 {SetVectorArray},
2649 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 3, {0x00000001, 0x00000000, 0x00000001}},
2650 {SetMatrix, 0, 0, 0, 3, {0x00000001, 0x00000000, 0x00000001}},
2651 {SetMatrixArray},
2652 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000000, 0x00000001}},
2653 {SetMatrixTranspose, 0, 0, 0, 3, {0x00000001, 0x00000001, 0x00000001}},
2654 {SetMatrixTransposeArray},
2655 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000001, 0x00000001}},
2656 {SetMatrixPointerArray},
2657 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000000, 0x00000001}},
2658 {SetMatrixTransposePointerArray},
2659 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000001, 0x00000001}},
2662 static const struct registerset_constants registerset_constants_vector_bool_float[] =
2664 {"vbf", {"vbf", D3DXRS_FLOAT4, 2, 1, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 41},
2667 static const struct registerset_test registerset_test_vector_bool_float[] =
2669 {SetInt},
2670 {SetBool},
2671 {SetFloat},
2672 {SetIntArray, 1, 0, 2},
2673 {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2674 {SetBoolArray, 1, 0, 2},
2675 {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2676 {SetFloatArray, 0, 0, 2},
2677 {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2678 {SetValue, 1, 0, 11},
2679 {SetValue, 1, 12, REGISTER_OUTPUT_SIZE * 4, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2680 {SetVector, 0, 0, 0, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2681 {SetVectorArray},
2682 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2683 {SetMatrix, 0, 0, 0, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2684 {SetMatrixArray},
2685 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2686 {SetMatrixTranspose, 0, 0, 0, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2687 {SetMatrixTransposeArray},
2688 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2689 {SetMatrixPointerArray},
2690 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2691 {SetMatrixTransposePointerArray},
2692 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2695 static const struct registerset_constants registerset_constants_vector_int_float[] =
2697 {"vnf", {"vnf", D3DXRS_FLOAT4, 1, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 64},
2700 static const struct registerset_test registerset_test_vector_int_float[] =
2702 {SetInt},
2703 {SetBool},
2704 {SetFloat},
2705 {SetIntArray, 1, 0, 2},
2706 {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x40000000, 0x40400000, 0x40800000}},
2707 {SetBoolArray, 1, 0, 2},
2708 {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2709 {SetFloatArray, 0, 0, 2},
2710 {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 4, {0x40000000, 0x00000000, 0x40800000}},
2711 {SetValue, 1, 0, 11},
2712 {SetValue, 1, 12, REGISTER_OUTPUT_SIZE * 4, 4, {0x40000000, 0x40400000, 0x40800000}},
2713 {SetVector, 0, 0, 0, 4, {0x40000000, 0x00000000, 0x40800000}},
2714 {SetVectorArray},
2715 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4, {0x40000000, 0x00000000, 0x40800000}},
2716 {SetMatrix, 0, 0, 0, 4, {0x40000000, 0x00000000, 0x40800000}},
2717 {SetMatrixArray},
2718 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000, 0x00000000, 0x40800000}},
2719 {SetMatrixTranspose, 0, 0, 0, 4, {0x40000000, 0x40c00000, 0x41200000}},
2720 {SetMatrixTransposeArray},
2721 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000, 0x40c00000, 0x41200000}},
2722 {SetMatrixPointerArray},
2723 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000, 0x00000000, 0x40800000}},
2724 {SetMatrixTransposePointerArray},
2725 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000, 0x40c00000, 0x41200000}},
2729 * fxc.exe /Tvs_3_0
2731 #if 0
2732 bool3 vab[2] = {1, 0, 1, 1, 0, 1};
2733 int3 van[2] = {70, 80, 90, 100, 110, 120};
2734 float3 vaf[2] = {55.1, 55.2, 55.3, 55.4, 55.5, 55.6};
2735 int3 vanf[2] = {130, 140, 150, 160, 170, 180};
2736 bool3 vabf[2] = {1, 1, 1, 1, 1, 1};
2737 float4 main(float4 pos : POSITION) : POSITION
2739 float4 tmp = 0;
2740 int i;
2741 if (vab[1].z) for (i = 0; i < van[1].z; i++) tmp.x += pos.z * vaf[1].z * vanf[1].z;
2742 else for (i = 0; i < van[1].y; i++) tmp.y += pos.y * vaf[0].y * vabf[1].z;
2743 return tmp;
2745 #endif
2746 static const DWORD registerset_blob_vector_array[] =
2748 0xfffe0300, 0x0070fffe, 0x42415443, 0x0000001c, 0x0000018b, 0xfffe0300, 0x00000005, 0x0000001c,
2749 0x00000100, 0x00000184, 0x00000080, 0x00000000, 0x00000006, 0x00000084, 0x00000094, 0x000000ac,
2750 0x00040002, 0x00000002, 0x000000b4, 0x000000c4, 0x000000e4, 0x00000002, 0x00000002, 0x000000e8,
2751 0x000000f8, 0x00000118, 0x00000001, 0x00000006, 0x0000011c, 0x0000012c, 0x0000014c, 0x00020002,
2752 0x00000002, 0x00000154, 0x00000164, 0x00626176, 0x00010001, 0x00030001, 0x00000002, 0x00000000,
2753 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x66626176, 0xababab00,
2754 0x00010001, 0x00030001, 0x00000002, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
2755 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00666176, 0x00030001, 0x00030001, 0x00000002,
2756 0x00000000, 0x425c6666, 0x425ccccd, 0x425d3333, 0x00000000, 0x425d999a, 0x425e0000, 0x425e6666,
2757 0x00000000, 0x006e6176, 0x00020001, 0x00030001, 0x00000002, 0x00000000, 0x00000046, 0x00000050,
2758 0x0000005a, 0x00000000, 0x00000064, 0x0000006e, 0x00000078, 0x00000000, 0x666e6176, 0xababab00,
2759 0x00020001, 0x00030001, 0x00000002, 0x00000000, 0x43020000, 0x430c0000, 0x43160000, 0x00000000,
2760 0x43200000, 0x432a0000, 0x43340000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73,
2761 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
2762 0x332e3235, 0x00313131, 0x05000051, 0xa00f0006, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2763 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x01000028, 0xe0e40805,
2764 0x03000005, 0x80010000, 0xa0aa0001, 0x90aa0000, 0x02000001, 0x80010001, 0xa0000006, 0x01000026,
2765 0xf0e40005, 0x04000004, 0x80010001, 0x80000000, 0xa0aa0003, 0x80000001, 0x00000027, 0x02000001,
2766 0x80020001, 0xa0000006, 0x0000002a, 0x03000005, 0x80010000, 0xa0550000, 0x90550000, 0x02000001,
2767 0x80020001, 0xa0000006, 0x01000026, 0xf0e40004, 0x04000004, 0x80020001, 0x80000000, 0xa0aa0005,
2768 0x80550001, 0x00000027, 0x02000001, 0x80010001, 0xa0000006, 0x0000002b, 0x02000001, 0xe0030000,
2769 0x80e40001, 0x02000001, 0xe00c0000, 0xa0000006, 0x0000ffff,
2772 static const struct registerset_constants registerset_constants_vector_array_float[] =
2774 {"vaf", {"vaf", D3DXRS_FLOAT4, 0, 2, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 2, 0, 24, NULL}, 62},
2775 {"vaf[0]", {"vaf", D3DXRS_FLOAT4, 0, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 62},
2776 {"vaf[1]", {"vaf", D3DXRS_FLOAT4, 1, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 66},
2779 static const struct registerset_test registerset_test_vector_array_float[] =
2781 {SetInt},
2782 {SetBool},
2783 {SetFloat},
2784 {SetIntArray, 1, 0, 2},
2785 {SetIntArray, 1, 3, 5, 4, {0x40000000, 0x40400000, 0x40800000}},
2786 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
2787 {0x40000000, 0x40400000, 0x40800000, 0x00000000, 0x40a00000, 0x00000000, 0x40e00000}},
2788 {SetBoolArray, 1, 0, 2},
2789 {SetBoolArray, 1, 3, 5, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2790 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
2791 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000}},
2792 {SetFloatArray, 0, 0, 2},
2793 {SetFloatArray, 0, 3, 5, 4, {0x40000123, 0x00000000, 0x40800123}},
2794 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
2795 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40a00123, 0x40c00123, 0x40e00123}},
2796 {SetValue, 0, 0, 11},
2797 {SetValue, 0, 12, 23, 4, {0x40000123, 0x00000000, 0x40800123}},
2798 {SetValue, 0, 24, REGISTER_OUTPUT_SIZE * 4, 8,
2799 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40a00123, 0x40c00123, 0x40e00123}},
2800 {SetVector, 0, 0, 0, 4, {0x40000123, 0x00000000, 0x40800123}},
2801 {SetVectorArray},
2802 {SetVectorArray, 0, 1, 1, 4, {0x40000123, 0x00000000, 0x40800123}},
2803 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
2804 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
2805 {SetMatrix, 0, 0, 0, 8,
2806 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
2807 {SetMatrixArray},
2808 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2809 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
2810 {SetMatrixTranspose, 0, 0, 0, 8,
2811 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
2812 {SetMatrixTransposeArray},
2813 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2814 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
2815 {SetMatrixPointerArray},
2816 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2817 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
2818 {SetMatrixTransposePointerArray},
2819 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2820 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
2823 static const struct registerset_constants registerset_constants_vector_array_int[] =
2825 {"van", {"van", D3DXRS_INT4, 0, 6, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 2, 0, 24, NULL}, 75},
2826 {"van[0]", {"van", D3DXRS_INT4, 0, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 75},
2827 {"van[1]", {"van", D3DXRS_INT4, 1, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 79},
2830 static const struct registerset_test registerset_test_vector_array_int[] =
2832 {SetInt},
2833 {SetBool},
2834 {SetFloat},
2835 {SetIntArray, 1, 0, 2},
2836 {SetIntArray, 1, 3, 5, 4, {0x00000002, 0x00000003, 0x00000004}},
2837 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
2838 {0x00000002, 0x00000003, 0x00000004, 0x00000000, 0x00000005, 0x00000000, 0x00000007}},
2839 {SetBoolArray, 1, 0, 2},
2840 {SetBoolArray, 1, 3, 5, 4, {0x00000001, 0x00000001, 0x00000001}},
2841 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
2842 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001}},
2843 {SetFloatArray, 0, 0, 2},
2844 {SetFloatArray, 0, 3, 5, 4, {0x00000002, 0x00000000, 0x00000004}},
2845 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
2846 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000005, 0x00000006, 0x00000007}},
2847 {SetValue, 1, 0, 11},
2848 {SetValue, 1, 12, 23, 4, {0x00000002, 0x00000003, 0x00000004}},
2849 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 8,
2850 {0x00000002, 0x00000003, 0x00000004, 0x00000000, 0x00000005, 0x00000000, 0x00000007}},
2851 {SetVector, 0, 0, 0, 4, {0x00000002, 0x00000000, 0x00000004}},
2852 {SetVectorArray, 0, 0, 0},
2853 {SetVectorArray, 0, 1, 1, 4, {0x00000002, 0x00000000, 0x00000004}},
2854 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
2855 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
2856 {SetMatrix, 0, 0, 0, 8,
2857 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
2858 {SetMatrixArray},
2859 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2860 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
2861 {SetMatrixTranspose, 0, 0, 0, 8,
2862 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
2863 {SetMatrixTransposeArray},
2864 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2865 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
2866 {SetMatrixPointerArray},
2867 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2868 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
2869 {SetMatrixTransposePointerArray},
2870 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2871 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
2874 static const struct registerset_constants registerset_constants_vector_array_bool[] =
2876 {"vab", {"vab", D3DXRS_BOOL, 0, 6, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 2, 0, 24, NULL}, 37},
2877 {"vab[0]", {"vab", D3DXRS_BOOL, 0, 3, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 37},
2878 {"vab[1]", {"vab", D3DXRS_BOOL, 3, 3, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 40},
2881 static const struct registerset_test registerset_test_vector_array_bool[] =
2883 {SetInt},
2884 {SetBool},
2885 {SetFloat},
2886 {SetIntArray, 1, 0, 2},
2887 {SetIntArray, 1, 3, 5, 3, {0x00000001, 0x00000001, 0x00000001}},
2888 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
2889 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
2890 {SetBoolArray, 1, 0},
2891 {SetBoolArray, 1, 3, 5, 3, {0x00000002, 0x00000003, 0x00000004}},
2892 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
2893 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
2894 {SetFloatArray, 0, 0, 2},
2895 {SetFloatArray, 0, 3, 5, 3, {0x00000001, 0x00000000, 0x00000001}},
2896 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 6,
2897 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
2898 {SetValue, 1, 0, 11},
2899 {SetValue, 1, 12, 23, 3, {0x00000002, 0x00000003, 0x00000004}},
2900 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 6,
2901 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
2902 {SetVector, 0, 0, 0, 3, {0x00000001, 0x00000000, 0x00000001}},
2903 {SetVectorArray},
2904 {SetVectorArray, 0, 1, 1, 3, {0x00000001, 0x00000000, 0x00000001}},
2905 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 6,
2906 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
2907 {SetMatrix, 0, 0, 0, 6,
2908 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
2909 {SetMatrixArray},
2910 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
2911 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
2912 {SetMatrixTranspose, 0, 0, 0, 6,
2913 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
2914 {SetMatrixTransposeArray},
2915 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
2916 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
2917 {SetMatrixPointerArray},
2918 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
2919 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
2920 {SetMatrixTransposePointerArray},
2921 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
2922 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
2925 static const struct registerset_constants registerset_constants_vector_array_bool_float[] =
2927 {"vabf", {"vabf", D3DXRS_FLOAT4, 4, 2, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 2, 0, 24, NULL}, 49},
2928 {"vabf[0]", {"vabf", D3DXRS_FLOAT4, 4, 1, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 49},
2929 {"vabf[1]", {"vabf", D3DXRS_FLOAT4, 5, 1, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 53},
2932 static const struct registerset_test registerset_test_vector_array_bool_float[] =
2934 {SetInt},
2935 {SetBool},
2936 {SetFloat},
2937 {SetIntArray, 1, 0, 2},
2938 {SetIntArray, 1, 3, 5, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2939 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
2940 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000}},
2941 {SetBoolArray, 1, 0, 2},
2942 {SetBoolArray, 1, 3, 5, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2943 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
2944 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000}},
2945 {SetFloatArray, 0, 0, 2},
2946 {SetFloatArray, 0, 3, 5, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2947 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
2948 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
2949 {SetValue, 1, 0, 11},
2950 {SetValue, 1, 12, 23, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2951 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 8,
2952 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000}},
2953 {SetVector, 0, 0, 0, 4, {0x3f800000, 0x00000000, 0x3f800000},},
2954 {SetVectorArray},
2955 {SetVectorArray, 0, 1, 1, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2956 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
2957 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
2958 {SetMatrix, 0, 0, 0, 8,
2959 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
2960 {SetMatrixArray},
2961 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2962 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
2963 {SetMatrixTranspose, 0, 0, 0, 8,
2964 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
2965 {SetMatrixTransposeArray},
2966 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2967 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
2968 {SetMatrixPointerArray},
2969 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2970 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
2971 {SetMatrixTransposePointerArray},
2972 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2973 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
2976 static const struct registerset_constants registerset_constants_vector_array_int_float[] =
2978 {"vanf", {"vanf", D3DXRS_FLOAT4, 2, 2, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 2, 0, 24, NULL}, 89},
2979 {"vanf[0]", {"vanf", D3DXRS_FLOAT4, 2, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 89},
2980 {"vanf[1]", {"vanf", D3DXRS_FLOAT4, 3, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 93},
2983 static const struct registerset_test registerset_test_vector_array_int_float[] =
2985 {SetInt},
2986 {SetBool},
2987 {SetFloat},
2988 {SetIntArray, 1, 0, 2},
2989 {SetIntArray, 1, 3, 5, 4, {0x40000000, 0x40400000, 0x40800000}},
2990 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
2991 {0x40000000, 0x40400000, 0x40800000, 0x00000000, 0x40a00000, 0x00000000, 0x40e00000}},
2992 {SetBoolArray, 1, 0, 2},
2993 {SetBoolArray, 1, 3, 5, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2994 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
2995 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000}},
2996 {SetFloatArray, 2, 0, 2,},
2997 {SetFloatArray, 0, 3, 5, 4, {0x40000000, 0x00000000, 0x40800000}},
2998 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
2999 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40a00000, 0x40c00000, 0x40e00000}},
3000 {SetValue, 1, 0, 11},
3001 {SetValue, 1, 12, 23, 4, {0x40000000, 0x40400000, 0x40800000}},
3002 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 8,
3003 {0x40000000, 0x40400000, 0x40800000, 0x00000000, 0x40a00000, 0x00000000, 0x40e00000}},
3004 {SetVector, 0, 0, 0, 4, {0x40000000, 0x00000000, 0x40800000}},
3005 {SetVectorArray},
3006 {SetVectorArray, 0, 1, 1, 4, {0x40000000, 0x00000000, 0x40800000}},
3007 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
3008 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3009 {SetMatrix, 0, 0, 0, 8,
3010 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3011 {SetMatrixArray},
3012 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3013 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3014 {SetMatrixTranspose, 0, 0, 0, 8,
3015 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3016 {SetMatrixTransposeArray},
3017 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3018 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3019 {SetMatrixPointerArray},
3020 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3021 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3022 {SetMatrixTransposePointerArray},
3023 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3024 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3028 * fxc.exe /Tvs_3_0
3030 #if 0
3031 bool3x2 cb = {1, 0, 1, 1, 0, 1};
3032 int3x2 cn = {4, 5, 6, 7, 8, 9};
3033 float3x2 cf = {15.1, 15.2, 15.3, 15.4, 15.5, 15.6};
3034 bool3x2 cbf = {1, 1, 0, 1, 0, 1};
3035 int3x2 cnf = {30, 31, 33, 32, 34, 36};
3036 float4 main(float4 pos : POSITION) : POSITION
3038 float4 tmp = 0;
3039 int i;
3040 if (cb._32) for (i = 0; i < cn._31; i++) tmp.x += pos.z * cf._31 * cbf._32;
3041 else for (i = 0; i < cn._32; i++) tmp.y += pos.y * cf._32 * cnf._32;
3042 return tmp;
3044 #endif
3045 static const DWORD registerset_blob_column[] =
3047 0xfffe0300, 0x0066fffe, 0x42415443, 0x0000001c, 0x00000163, 0xfffe0300, 0x00000005, 0x0000001c,
3048 0x00000100, 0x0000015c, 0x00000080, 0x00000000, 0x00000006, 0x00000084, 0x00000094, 0x000000ac,
3049 0x00020002, 0x00000002, 0x00000084, 0x000000b0, 0x000000d0, 0x00000002, 0x00000002, 0x000000d4,
3050 0x000000e4, 0x00000104, 0x00000001, 0x00000006, 0x00000108, 0x00000118, 0x00000138, 0x00040002,
3051 0x00000002, 0x00000108, 0x0000013c, 0xab006263, 0x00010003, 0x00020003, 0x00000001, 0x00000000,
3052 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x00666263, 0x3f800000,
3053 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0xab006663,
3054 0x00030003, 0x00020003, 0x00000001, 0x00000000, 0x4171999a, 0x4174cccd, 0x41780000, 0x00000000,
3055 0x41733333, 0x41766666, 0x4179999a, 0x00000000, 0xab006e63, 0x00020003, 0x00020003, 0x00000001,
3056 0x00000000, 0x00000004, 0x00000006, 0x00000008, 0x00000000, 0x00000005, 0x00000007, 0x00000009,
3057 0x00000000, 0x00666e63, 0x41f00000, 0x42040000, 0x42080000, 0x00000000, 0x41f80000, 0x42000000,
3058 0x42100000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
3059 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
3060 0x05000051, 0xa00f0006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
3061 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x01000028, 0xe0e40805, 0x03000005, 0x80010000,
3062 0xa0aa0000, 0x90aa0000, 0x02000001, 0x80010001, 0xa0000006, 0x01000026, 0xf0e40004, 0x04000004,
3063 0x80010001, 0x80000000, 0xa0aa0003, 0x80000001, 0x00000027, 0x02000001, 0x80020001, 0xa0000006,
3064 0x0000002a, 0x03000005, 0x80010000, 0xa0aa0001, 0x90550000, 0x02000001, 0x80020001, 0xa0000006,
3065 0x01000026, 0xf0e40005, 0x04000004, 0x80020001, 0x80000000, 0xa0aa0005, 0x80550001, 0x00000027,
3066 0x02000001, 0x80010001, 0xa0000006, 0x0000002b, 0x02000001, 0xe0030000, 0x80e40001, 0x02000001,
3067 0xe00c0000, 0xa0000006, 0x0000ffff,
3070 static const struct registerset_constants registerset_constants_column_float[] =
3072 {"cf", {"cf", D3DXRS_FLOAT4, 0, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 57},
3075 static const struct registerset_test registerset_test_column_float[] =
3077 {SetInt},
3078 {SetBool},
3079 {SetFloat},
3080 {SetIntArray, 1, 0, 5},
3081 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3082 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000}},
3083 {SetBoolArray, 1, 0, 5},
3084 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3085 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3086 {SetFloatArray, 0, 0, 5},
3087 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
3088 {0x40000123, 0x40800123, 0x40c00123, 0x00000000, 0x00000000, 0x40a00123, 0x40e00123}},
3089 {SetValue, 0, 0, 23},
3090 {SetValue, 0, 24, REGISTER_OUTPUT_SIZE * 4, 8,
3091 {0x40000123, 0x40800123, 0x40c00123, 0x00000000, 0x00000000, 0x40a00123, 0x40e00123}},
3092 {SetVector},
3093 {SetVectorArray, 0, 0, 1},
3094 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
3095 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3096 {SetMatrix, 0, 0, 0, 8,
3097 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3098 {SetMatrixArray},
3099 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3100 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3101 {SetMatrixTranspose, 0, 0, 0, 8,
3102 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
3103 {SetMatrixTransposeArray},
3104 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3105 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
3106 {SetMatrixPointerArray},
3107 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3108 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3109 {SetMatrixTransposePointerArray},
3110 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3111 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
3114 static const struct registerset_constants registerset_constants_column_int[] =
3116 {"cn", {"cn", D3DXRS_INT4, 0, 6, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 70},
3119 static const struct registerset_test registerset_test_column_int[] =
3121 {SetInt},
3122 {SetBool},
3123 {SetFloat},
3124 {SetIntArray, 1, 0, 5},
3125 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3126 {0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3127 {SetBoolArray, 1, 0, 5},
3128 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3129 {0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3130 {SetFloatArray, 0, 0, 5},
3131 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
3132 {0x00000002, 0x00000004, 0x00000006, 0x00000000, 0x00000000, 0x00000005, 0x00000007}},
3133 {SetValue, 1, 0, 23},
3134 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 8,
3135 {0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3136 {SetVector},
3137 {SetVectorArray, 0, 0, 1},
3138 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
3139 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3140 {SetMatrix, 0, 0, 0, 8,
3141 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3142 {SetMatrixArray},
3143 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3144 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3145 {SetMatrixTranspose, 0, 0, 0, 8,
3146 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
3147 {SetMatrixTransposeArray},
3148 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3149 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
3150 {SetMatrixPointerArray},
3151 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3152 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3153 {SetMatrixTransposePointerArray},
3154 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3155 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
3158 static const struct registerset_constants registerset_constants_column_bool[] =
3160 {"cb", {"cb", D3DXRS_BOOL, 0, 6, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 37},
3163 static const struct registerset_test registerset_test_column_bool[] =
3165 {SetInt},
3166 {SetBool},
3167 {SetFloat},
3168 {SetIntArray, 1, 0, 5},
3169 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
3170 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3171 {SetBoolArray, 1, 0, 5},
3172 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
3173 {0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3174 {SetFloatArray, 0, 0, 5},
3175 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 6,
3176 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3177 {SetValue, 1, 0, 23},
3178 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 6,
3179 {0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3180 {SetVector},
3181 {SetVectorArray, 0, 0, 1},
3182 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 6,
3183 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3184 {SetMatrix, 0, 0, 0, 6,
3185 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3186 {SetMatrixArray},
3187 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
3188 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3189 {SetMatrixTranspose, 0, 0, 0, 6,
3190 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3191 {SetMatrixTransposeArray},
3192 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 6,
3193 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3194 {SetMatrixPointerArray},
3195 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
3196 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3197 {SetMatrixTransposePointerArray},
3198 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
3199 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3202 static const struct registerset_constants registerset_constants_column_int_float[] =
3204 {"cnf", {"cnf", D3DXRS_FLOAT4, 4, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 79},
3207 static const struct registerset_test registerset_test_column_int_float[] =
3209 {SetInt},
3210 {SetBool},
3211 {SetFloat},
3212 {SetIntArray, 1, 0, 5},
3213 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3214 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000}},
3215 {SetBoolArray, 1, 0, 5},
3216 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3217 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3218 {SetFloatArray, 0, 0, 5},
3219 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
3220 {0x40000000, 0x40800000, 0x40c00000, 0x00000000, 0x00000000, 0x40a00000, 0x40e00000}},
3221 {SetValue, 1, 0, 23},
3222 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 8,
3223 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000}},
3224 {SetVector},
3225 {SetVectorArray, 0, 0, 1},
3226 {SetValue, 0, 0, 23},
3227 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
3228 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3229 {SetMatrix, 0, 0, 0, 8,
3230 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3231 {SetMatrixArray},
3232 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3233 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3234 {SetMatrixTranspose, 0, 0, 0, 8,
3235 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3236 {SetMatrixTransposeArray},
3237 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3238 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3239 {SetMatrixPointerArray},
3240 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3241 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3242 {SetMatrixTransposePointerArray},
3243 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3244 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3247 static const struct registerset_constants registerset_constants_column_bool_float[] =
3249 {"cbf", {"cbf", D3DXRS_FLOAT4, 2, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 44},
3252 static const struct registerset_test registerset_test_column_bool_float[] =
3254 {SetInt},
3255 {SetBool},
3256 {SetFloat},
3257 {SetIntArray, 1, 0, 5},
3258 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3259 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3260 {SetBoolArray, 1, 0, 5},
3261 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3262 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3263 {SetFloatArray, 0, 0, 5},
3264 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
3265 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3266 {SetValue, 1, 0, 23},
3267 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 8,
3268 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3269 {SetVector},
3270 {SetVectorArray, 0, 0, 1},
3271 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
3272 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3273 {SetMatrix, 0, 0, 0, 8,
3274 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3275 {SetMatrixArray},
3276 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3277 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3278 {SetMatrixTranspose, 0, 0, 0, 8,
3279 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3280 {SetMatrixTransposeArray},
3281 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3282 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3283 {SetMatrixPointerArray},
3284 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3285 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3286 {SetMatrixTransposePointerArray},
3287 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3288 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3292 * fxc.exe /Tvs_3_0
3294 #if 0
3295 bool3x2 cab[2] = {1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1};
3296 int3x2 can[2] = {14, 15, 16, 71, 18, 19, 55, 63, 96, 96, 97, 13};
3297 float3x2 caf[2] = {1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 1.2, 1.3, 1.4};
3298 bool3x2 cabf[2] = {1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1};
3299 int3x2 canf[2] = {300, 301, 303, 302, 304, 306, 350, 365, 654, 612, 326, 999};
3300 float4 main(float4 pos : POSITION) : POSITION
3302 float4 tmp = 0;
3303 int i;
3304 if (cab[1]._32) for (i = 0; i < can[1]._31; i++) tmp.x += pos.z * caf[1]._31 * cabf[1]._32;
3305 else for (i = 0; i < can[1]._32; i++) tmp.y += pos.y * caf[1]._32 * canf[1]._32;
3306 return tmp;
3308 #endif
3309 static const DWORD registerset_blob_column_array[] =
3311 0xfffe0300, 0x0096fffe, 0x42415443, 0x0000001c, 0x00000223, 0xfffe0300, 0x00000005, 0x0000001c,
3312 0x00000100, 0x0000021c, 0x00000080, 0x00000000, 0x0000000c, 0x00000084, 0x00000094, 0x000000c4,
3313 0x00040002, 0x00000004, 0x000000cc, 0x000000dc, 0x0000011c, 0x00000002, 0x00000004, 0x00000120,
3314 0x00000130, 0x00000170, 0x00000001, 0x0000000c, 0x00000174, 0x00000184, 0x000001c4, 0x00080002,
3315 0x00000004, 0x000001cc, 0x000001dc, 0x00626163, 0x00010003, 0x00020003, 0x00000002, 0x00000000,
3316 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000,
3317 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x66626163, 0xababab00, 0x00010003, 0x00020003,
3318 0x00000002, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000,
3319 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000,
3320 0x3f800000, 0x00000000, 0x00666163, 0x00030003, 0x00020003, 0x00000002, 0x00000000, 0x3f8ccccd,
3321 0x40533333, 0x40b00000, 0x00000000, 0x400ccccd, 0x408ccccd, 0x40d33333, 0x00000000, 0x40f66666,
3322 0x411e6666, 0x3fa66666, 0x00000000, 0x410ccccd, 0x3f99999a, 0x3fb33333, 0x00000000, 0x006e6163,
3323 0x00020003, 0x00020003, 0x00000002, 0x00000000, 0x0000000e, 0x00000010, 0x00000012, 0x00000000,
3324 0x0000000f, 0x00000047, 0x00000013, 0x00000000, 0x00000037, 0x00000060, 0x00000061, 0x00000000,
3325 0x0000003f, 0x00000060, 0x0000000d, 0x00000000, 0x666e6163, 0xababab00, 0x00020003, 0x00020003,
3326 0x00000002, 0x00000000, 0x43960000, 0x43978000, 0x43980000, 0x00000000, 0x43968000, 0x43970000,
3327 0x43990000, 0x00000000, 0x43af0000, 0x44238000, 0x43a30000, 0x00000000, 0x43b68000, 0x44190000,
3328 0x4479c000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
3329 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
3330 0x05000051, 0xa00f000c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
3331 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x01000028, 0xe0e4080b, 0x03000005, 0x80010000,
3332 0xa0aa0002, 0x90aa0000, 0x02000001, 0x80010001, 0xa000000c, 0x01000026, 0xf0e4000a, 0x04000004,
3333 0x80010001, 0x80000000, 0xa0aa0007, 0x80000001, 0x00000027, 0x02000001, 0x80020001, 0xa000000c,
3334 0x0000002a, 0x03000005, 0x80010000, 0xa0aa0003, 0x90550000, 0x02000001, 0x80020001, 0xa000000c,
3335 0x01000026, 0xf0e4000b, 0x04000004, 0x80020001, 0x80000000, 0xa0aa000b, 0x80550001, 0x00000027,
3336 0x02000001, 0x80010001, 0xa000000c, 0x0000002b, 0x02000001, 0xe0030000, 0x80e40001, 0x02000001,
3337 0xe00c0000, 0xa000000c, 0x0000ffff,
3340 static const struct registerset_constants registerset_constants_column_array_float[] =
3342 {"caf", {"caf", D3DXRS_FLOAT4, 0, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 2, 2, 0, 48, NULL}, 76},
3343 {"caf[0]", {"caf", D3DXRS_FLOAT4, 0, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 76},
3344 {"caf[1]", {"caf", D3DXRS_FLOAT4, 2, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 84},
3347 static const struct registerset_test registerset_test_column_array_float[] =
3349 {SetInt},
3350 {SetBool},
3351 {SetFloat},
3352 {SetIntArray, 1, 0, 5},
3353 {SetIntArray, 1, 6, 11, 8,
3354 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000}},
3355 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3356 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000, 0x00000000,
3357 0x41000000, 0x41200000, 0x41400000, 0x00000000, 0x41100000, 0x41300000, 0x41500000}},
3358 {SetBoolArray, 1, 0, 5},
3359 {SetBoolArray, 1, 6, 11, 8,
3360 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3361 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3362 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
3363 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3364 {SetFloatArray, 0, 0, 5},
3365 {SetFloatArray, 0, 6, 11, 8,
3366 {0x40000123, 0x40800123, 0x40c00123, 0x00000000, 0x00000000, 0x40a00123, 0x40e00123}},
3367 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 16,
3368 {0x40000123, 0x40800123, 0x40c00123, 0x00000000, 0x00000000, 0x40a00123, 0x40e00123, 0x00000000,
3369 0x41000123, 0x41200123, 0x41400123, 0x00000000, 0x41100123, 0x41300123, 0x41500123}},
3370 {SetValue, 0, 0, 23},
3371 {SetValue, 0, 24, 47, 8,
3372 {0x40000123, 0x40800123, 0x40c00123, 0x00000000, 0x00000000, 0x40a00123, 0x40e00123}},
3373 {SetValue, 0, 48, REGISTER_OUTPUT_SIZE * 4, 16,
3374 {0x40000123, 0x40800123, 0x40c00123, 0x00000000, 0x00000000, 0x40a00123, 0x40e00123, 0x00000000,
3375 0x41000123, 0x41200123, 0x41400123, 0x00000000, 0x41100123, 0x41300123, 0x41500123}},
3376 {SetVector},
3377 {SetVectorArray, 0, 0, 1},
3378 {SetVectorArray, 0, 2, 3, 8,
3379 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3380 {SetVectorArray, 0, 4, REGISTER_OUTPUT_SIZE / 4, 16,
3381 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
3382 0x41600123, 0x41a00123, 0x00000000, 0x00000000, 0x41700123, 0x41b00123, 0x41f00123}},
3383 {SetMatrix, 0, 0, 0, 8,
3384 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3385 {SetMatrixArray},
3386 {SetMatrixArray, 0, 1, 1, 8,
3387 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3388 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3389 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
3390 0x41a00123, 0x00000000, 0x00000000, 0x00000000, 0x41b00123, 0x41f00123, 0x42300123}},
3391 {SetMatrixTranspose, 0, 0, 0, 8,
3392 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
3393 {SetMatrixTransposeArray},
3394 {SetMatrixTransposeArray, 0, 1, 1, 8,
3395 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
3396 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3397 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
3398 0x41a00123, 0x41b00123, 0x41c00123, 0x00000000, 0x00000000, 0x41f00123, 0x42000123}},
3399 {SetMatrixPointerArray},
3400 {SetMatrixPointerArray, 0, 1, 1, 8,
3401 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3402 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3403 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
3404 0x41900123, 0x41d00123, 0x42100123, 0x00000000, 0x41a00123, 0x00000000, 0x00000000}},
3405 {SetMatrixTransposePointerArray},
3406 {SetMatrixTransposePointerArray, 0, 1, 1, 8,
3407 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
3408 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3409 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
3410 0x41900123, 0x41a00123, 0x41b00123, 0x00000000, 0x41d00123, 0x00000000, 0x41f00123}},
3413 static const struct registerset_constants registerset_constants_column_array_int[] =
3415 {"can", {"can", D3DXRS_INT4, 0, 12, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 2, 0, 48, NULL}, 97},
3416 {"can[0]", {"can", D3DXRS_INT4, 0, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 97},
3417 {"can[1]", {"can", D3DXRS_INT4, 2, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 105},
3420 static const struct registerset_test registerset_test_column_array_int[] =
3422 {SetInt},
3423 {SetBool},
3424 {SetFloat},
3425 {SetIntArray, 1, 0, 5},
3426 {SetIntArray, 1, 6, 11, 8,
3427 {0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3428 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3429 {0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000003, 0x00000005, 0x00000007, 0x00000000,
3430 0x00000008, 0x0000000a, 0x0000000c, 0x00000000, 0x00000009, 0x0000000b, 0x0000000d}},
3431 {SetBoolArray, 1, 0, 5},
3432 {SetBoolArray, 1, 6, 11, 8,
3433 {0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3434 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3435 {0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000,
3436 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3437 {SetFloatArray, 0, 0, 5},
3438 {SetFloatArray, 0, 6, 11, 8,
3439 {0x00000002, 0x00000004, 0x00000006, 0x00000000, 0x00000000, 0x00000005, 0x00000007}},
3440 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 16,
3441 {0x00000002, 0x00000004, 0x00000006, 0x00000000, 0x00000000, 0x00000005, 0x00000007, 0x00000000,
3442 0x00000008, 0x0000000a, 0x0000000c, 0x00000000, 0x00000009, 0x0000000b, 0x0000000d}},
3443 {SetValue, 1, 0, 23},
3444 {SetValue, 1, 24, 47, 8,
3445 {0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3446 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 16,
3447 {0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000003, 0x00000005, 0x00000007, 0x00000000,
3448 0x00000008, 0x0000000a, 0x0000000c, 0x00000000, 0x00000009, 0x0000000b, 0x0000000d}},
3449 {SetVector},
3450 {SetVectorArray, 0, 0, 1},
3451 {SetVectorArray, 0, 2, 3, 8,
3452 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3453 {SetVectorArray, 0, 4, REGISTER_OUTPUT_SIZE / 4, 16,
3454 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b, 0x00000000,
3455 0x0000000e, 0x00000014, 0x00000000, 0x00000000, 0x0000000f, 0x00000016, 0x0000001e}},
3456 {SetMatrix, 0, 0, 0, 8,
3457 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3458 {SetMatrixArray},
3459 {SetMatrixArray, 0, 1, 1, 8,
3460 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3461 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3462 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b, 0x00000000,
3463 0x00000014, 0x00000000, 0x00000000, 0x00000000, 0x00000016, 0x0000001e, 0x0000002c}},
3464 {SetMatrixTranspose, 0, 0, 0, 8,
3465 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
3466 {SetMatrixTransposeArray},
3467 {SetMatrixTransposeArray, 0, 1, 1, 8,
3468 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
3469 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3470 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008, 0x00000000,
3471 0x00000014, 0x00000016, 0x00000018, 0x00000000, 0x00000000, 0x0000001e, 0x00000020}},
3472 {SetMatrixPointerArray},
3473 {SetMatrixPointerArray, 0, 1, 1, 8,
3474 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3475 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3476 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b, 0x00000000,
3477 0x00000012, 0x0000001a, 0x00000024, 0x00000000, 0x00000014, 0x00000000, 0x00000000}},
3478 {SetMatrixTransposePointerArray},
3479 {SetMatrixTransposePointerArray, 0, 1, 1, 8,
3480 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
3481 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3482 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008, 0x00000000,
3483 0x00000012, 0x00000014, 0x00000016, 0x00000000, 0x0000001a, 0x00000000, 0x0000001e}},
3486 static const struct registerset_constants registerset_constants_column_array_bool[] =
3488 {"cab", {"cab", D3DXRS_BOOL, 0, 12, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 2, 0, 48, NULL}, 37},
3489 {"cab[0]", {"cab", D3DXRS_BOOL, 0, 6, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 37},
3490 {"cab[1]", {"cab", D3DXRS_BOOL, 6, 6, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 43},
3493 static const struct registerset_test registerset_test_column_array_bool[] =
3495 {SetInt},
3496 {SetBool},
3497 {SetFloat},
3498 {SetIntArray, 1, 0, 5},
3499 {SetIntArray, 1, 6, 11, 6,
3500 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3501 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 12,
3502 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
3503 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3504 {SetBoolArray, 1, 0, 5},
3505 {SetBoolArray, 1, 6, 11, 6,
3506 {0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3507 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 12,
3508 {0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x00000005, 0x00000007, 0x00000008, 0x0000000a,
3509 0x0000000c, 0x00000009, 0x0000000b, 0x0000000d}},
3510 {SetFloatArray, 0, 0, 5},
3511 {SetFloatArray, 0, 6, 11, 6,
3512 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3513 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 12,
3514 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
3515 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3516 {SetValue, 1, 0, 23},
3517 {SetValue, 1, 24, 47, 6,
3518 {0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3519 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 12,
3520 {0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x00000005, 0x00000007, 0x00000008, 0x0000000a,
3521 0x0000000c, 0x00000009, 0x0000000b, 0x0000000d}},
3522 {SetVector},
3523 {SetVectorArray, 0, 0, 1},
3524 {SetVectorArray, 0, 2, 3, 6,
3525 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3526 {SetVectorArray, 0, 4, REGISTER_OUTPUT_SIZE / 4, 12,
3527 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
3528 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3529 {SetMatrix, 0, 0, 0, 6,
3530 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3531 {SetMatrixArray},
3532 {SetMatrixArray, 0, 1, 1, 6,
3533 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3534 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
3535 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000,
3536 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3537 {SetMatrixTranspose, 0, 0, 0, 6,
3538 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3539 {SetMatrixTransposeArray},
3540 {SetMatrixTransposeArray, 0, 1, 1, 6,
3541 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3542 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
3543 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
3544 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3545 {SetMatrixPointerArray},
3546 {SetMatrixPointerArray, 0, 1, 1, 6,
3547 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3548 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
3549 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
3550 0x00000001, 0x00000001, 0x00000000, 0x00000000}},
3551 {SetMatrixTransposePointerArray},
3552 {SetMatrixTransposePointerArray, 0, 1, 1, 6,
3553 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3554 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
3555 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
3556 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
3559 static const struct registerset_constants registerset_constants_column_array_int_float[] =
3561 {"canf", {"canf", D3DXRS_FLOAT4, 8, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 2, 0, 48, NULL}, 119},
3562 {"canf[0]", {"canf", D3DXRS_FLOAT4, 8, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 119},
3563 {"canf[1]", {"canf", D3DXRS_FLOAT4, 10, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 127},
3566 static const struct registerset_test registerset_test_column_array_int_float[] =
3568 {SetInt},
3569 {SetBool},
3570 {SetFloat},
3571 {SetIntArray, 1, 0, 5},
3572 {SetIntArray, 1, 6, 11, 8,
3573 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000}},
3574 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3575 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000, 0x00000000,
3576 0x41000000, 0x41200000, 0x41400000, 0x00000000, 0x41100000, 0x41300000, 0x41500000}},
3577 {SetBoolArray, 1, 0, 5},
3578 {SetBoolArray, 1, 6, 11, 8,
3579 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3580 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3581 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
3582 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3583 {SetFloatArray, 0, 0, 5},
3584 {SetFloatArray, 0, 6, 11, 8,
3585 {0x40000000, 0x40800000, 0x40c00000, 0x00000000, 0x00000000, 0x40a00000, 0x40e00000}},
3586 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 16,
3587 {0x40000000, 0x40800000, 0x40c00000, 0x00000000, 0x00000000, 0x40a00000, 0x40e00000, 0x00000000,
3588 0x41000000, 0x41200000, 0x41400000, 0x00000000, 0x41100000, 0x41300000, 0x41500000}},
3589 {SetValue, 1, 0, 23},
3590 {SetValue, 1, 24, 47, 8,
3591 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000}},
3592 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 16,
3593 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000, 0x00000000,
3594 0x41000000, 0x41200000, 0x41400000, 0x00000000, 0x41100000, 0x41300000, 0x41500000}},
3595 {SetVector},
3596 {SetVectorArray, 0, 0, 1},/*16*/
3597 {SetVectorArray, 0, 2, 3, 8,
3598 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3599 {SetVectorArray, 0, 4, REGISTER_OUTPUT_SIZE / 4, 16,
3600 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000, 0x00000000,
3601 0x41600000, 0x41a00000, 0x00000000, 0x00000000, 0x41700000, 0x41b00000, 0x41f00000}},
3602 {SetMatrix, 0, 0, 0, 8,
3603 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3604 {SetMatrixArray},
3605 {SetMatrixArray, 0, 1, 1, 8,
3606 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3607 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3608 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000, 0x00000000,
3609 0x41a00000, 0x00000000, 0x00000000, 0x00000000, 0x41b00000, 0x41f00000, 0x42300000}},
3610 {SetMatrixTranspose, 0, 0, 0, 8,
3611 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3612 {SetMatrixTransposeArray},
3613 {SetMatrixTransposeArray, 0, 1, 1, 8,
3614 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3615 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3616 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000, 0x00000000,
3617 0x41a00000, 0x41b00000, 0x41c00000, 0x00000000, 0x00000000, 0x41f00000, 0x42000000}},
3618 {SetMatrixPointerArray},
3619 {SetMatrixPointerArray, 0, 1, 1, 8,
3620 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3621 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3622 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000, 0x00000000,
3623 0x41900000, 0x41d00000, 0x42100000, 0x00000000, 0x41a00000, 0x00000000, 0x00000000}},
3624 {SetMatrixTransposePointerArray},
3625 {SetMatrixTransposePointerArray, 0, 1, 1, 8,
3626 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3627 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3628 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000, 0x00000000,
3629 0x41900000, 0x41a00000, 0x41b00000, 0x00000000, 0x41d00000, 0x00000000, 0x41f00000}},
3632 static const struct registerset_constants registerset_constants_column_array_bool_float[] =
3634 {"cabf", {"cabf", D3DXRS_FLOAT4, 4, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 2, 0, 48, NULL}, 55},
3635 {"cabf[0]", {"cabf", D3DXRS_FLOAT4, 4, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 55},
3636 {"cabf[1]", {"cabf", D3DXRS_FLOAT4, 6, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 63},
3639 static const struct registerset_test registerset_test_column_array_bool_float[] =
3641 {SetInt},
3642 {SetBool},
3643 {SetFloat},
3644 {SetIntArray, 1, 0, 5},
3645 {SetIntArray, 1, 6, 11, 8,
3646 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3647 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3648 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
3649 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3650 {SetBoolArray, 1, 0, 5},
3651 {SetBoolArray, 1, 6, 11, 8,
3652 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3653 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3654 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
3655 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3656 {SetFloatArray, 0, 0, 5},
3657 {SetFloatArray, 0, 6, 11, 8,
3658 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3659 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 16,
3660 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000,
3661 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3662 {SetValue, 1, 0, 23},
3663 {SetValue, 1, 24, 47, 8,
3664 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3665 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 16,
3666 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
3667 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3668 {SetVector},
3669 {SetVectorArray, 0, 0, 1},
3670 {SetVectorArray, 0, 2, 3, 8,
3671 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3672 {SetVectorArray, 0, 4, REGISTER_OUTPUT_SIZE / 4, 16,
3673 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000,
3674 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3675 {SetMatrix, 0, 0, 0, 8,
3676 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3677 {SetMatrixArray},
3678 {SetMatrixArray, 0, 1, 1, 8,
3679 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3680 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3681 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000,
3682 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3683 {SetMatrixTranspose, 0, 0, 0, 8,
3684 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3685 {SetMatrixTransposeArray},
3686 {SetMatrixTransposeArray, 0, 1, 1, 8,
3687 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3688 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3689 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
3690 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3691 {SetMatrixPointerArray},
3692 {SetMatrixPointerArray, 0, 1, 1, 8,
3693 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3694 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3695 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000,
3696 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000}},
3697 {SetMatrixTransposePointerArray},
3698 {SetMatrixTransposePointerArray, 0, 1, 1, 8,
3699 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3700 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3701 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
3702 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000}},
3706 * fxc.exe /Tvs_3_0
3708 #if 0
3709 row_major bool3x2 rb = {1, 1, 0, 0, 1, 1};
3710 row_major int3x2 rn = {80, 81, 82, 83, 84, 85};
3711 row_major float3x2 rf = {95.1, 95.2, 95.3, 95.4, 95.5, 95.6};
3712 row_major bool3x2 rbf = {1, 1, 1, 1, 0, 1};
3713 row_major int3x2 rnf = {37, 13, 98, 54, 77, 36};
3714 float4 main(float4 pos : POSITION) : POSITION
3716 float4 tmp = 0;
3717 int i;
3718 if (rb._32) for (i = 0; i < rn._31; i++) tmp.x += pos.z * rf._31 * rbf._32;
3719 else for (i = 0; i < rn._32; i++) tmp.y += pos.y * rf._32 * rnf._32;
3720 return tmp;
3722 #endif
3723 static const DWORD registerset_blob_row[] =
3725 0xfffe0300, 0x0076fffe, 0x42415443, 0x0000001c, 0x000001a3, 0xfffe0300, 0x00000005, 0x0000001c,
3726 0x00000100, 0x0000019c, 0x00000080, 0x00000000, 0x00000006, 0x00000084, 0x00000094, 0x000000ac,
3727 0x00030002, 0x00000003, 0x00000084, 0x000000b0, 0x000000e0, 0x00000002, 0x00000003, 0x000000e4,
3728 0x000000f4, 0x00000124, 0x00000001, 0x00000006, 0x00000128, 0x00000138, 0x00000168, 0x00060002,
3729 0x00000003, 0x00000128, 0x0000016c, 0xab006272, 0x00010002, 0x00020003, 0x00000001, 0x00000000,
3730 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0x00666272, 0x3f800000,
3731 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
3732 0x3f800000, 0x00000000, 0x00000000, 0xab006672, 0x00030002, 0x00020003, 0x00000001, 0x00000000,
3733 0x42be3333, 0x42be6666, 0x00000000, 0x00000000, 0x42be999a, 0x42becccd, 0x00000000, 0x00000000,
3734 0x42bf0000, 0x42bf3333, 0x00000000, 0x00000000, 0xab006e72, 0x00020002, 0x00020003, 0x00000001,
3735 0x00000000, 0x00000050, 0x00000051, 0x00000001, 0x00000000, 0x00000052, 0x00000053, 0x00000001,
3736 0x00000000, 0x00000054, 0x00000055, 0x00000001, 0x00000000, 0x00666e72, 0x42140000, 0x41500000,
3737 0x00000000, 0x00000000, 0x42c40000, 0x42580000, 0x00000000, 0x00000000, 0x429a0000, 0x42100000,
3738 0x00000000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
3739 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
3740 0x05000051, 0xa00f0009, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
3741 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x01000028, 0xe0e40805, 0x03000005, 0x80010000,
3742 0xa0000002, 0x90aa0000, 0x02000001, 0x80010001, 0xa0000009, 0x01000026, 0xf0e40004, 0x04000004,
3743 0x80010001, 0x80000000, 0xa0550005, 0x80000001, 0x00000027, 0x02000001, 0x80020001, 0xa0000009,
3744 0x0000002a, 0x03000005, 0x80010000, 0xa0550002, 0x90550000, 0x02000001, 0x80020001, 0xa0000009,
3745 0x01000026, 0xf0e40005, 0x04000004, 0x80020001, 0x80000000, 0xa0550008, 0x80550001, 0x00000027,
3746 0x02000001, 0x80010001, 0xa0000009, 0x0000002b, 0x02000001, 0xe0030000, 0x80e40001, 0x02000001,
3747 0xe00c0000, 0xa0000009, 0x0000ffff,
3750 static const struct registerset_constants registerset_constants_row_float[] =
3752 {"rf", {"rf", D3DXRS_FLOAT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 61},
3755 static const struct registerset_test registerset_test_row_float[] =
3757 {SetInt},
3758 {SetBool},
3759 {SetFloat},
3760 {SetIntArray, 1, 0, 5},
3761 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3762 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
3763 0x00000000, 0x40e00000}},
3764 {SetBoolArray, 1, 0, 5},
3765 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3766 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
3767 0x00000000, 0x3f800000}},
3768 {SetFloatArray, 0, 0, 5},
3769 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 12,
3770 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000, 0x00000000,
3771 0x40c00123, 0x40e00123}},
3772 {SetValue, 0, 0, 23},
3773 {SetValue, 0, 24, REGISTER_OUTPUT_SIZE * 4, 12,
3774 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000, 0x00000000,
3775 0x40c00123, 0x40e00123}},
3776 {SetVector},
3777 {SetVectorArray, 0, 0, 2},
3778 {SetVectorArray, 0, 3, REGISTER_OUTPUT_SIZE / 4, 12,
3779 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
3780 0x41200123, 0x41300123}},
3781 {SetMatrix, 0, 0, 0, 12,
3782 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
3783 0x41200123, 0x41300123}},
3784 {SetMatrixArray},
3785 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3786 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
3787 0x41200123, 0x41300123}},
3788 {SetMatrixTranspose, 0, 0, 0, 12,
3789 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
3790 0x40800123, 0x41000123}},
3791 {SetMatrixTransposeArray},
3792 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3793 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
3794 0x40800123, 0x41000123}},
3795 {SetMatrixPointerArray},
3796 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3797 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
3798 0x41200123, 0x41300123}},
3799 {SetMatrixTransposePointerArray},
3800 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3801 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
3802 0x40800123, 0x41000123}},
3805 static const struct registerset_constants registerset_constants_row_int[] =
3807 {"rn", {"rn", D3DXRS_INT4, 0, 6, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 78},
3810 static const struct registerset_test registerset_test_row_int[] =
3812 {SetInt},
3813 {SetBool},
3814 {SetFloat},
3815 {SetIntArray, 1, 0, 5},
3816 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3817 {0x00000002, 0x00000003, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
3818 0x00000000, 0x00000007, 0x00000001}},
3819 {SetBoolArray, 1, 0, 5},
3820 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3821 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000,
3822 0x00000000, 0x00000001, 0x00000001}},
3823 {SetFloatArray, 0, 0, 5},
3824 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 12,
3825 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
3826 0x00000006, 0x00000007, 0x00000001}},
3827 {SetValue, 1, 0, 23},
3828 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 12,
3829 {0x00000002, 0x00000003, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
3830 0x00000000, 0x00000007, 0x00000001}},
3831 {SetVector},
3832 {SetVectorArray, 0, 0, 2},
3833 {SetVectorArray, 0, 3, REGISTER_OUTPUT_SIZE / 4, 12,
3834 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
3835 0x0000000a, 0x0000000b, 0x00000001}},
3836 {SetMatrix, 0, 0, 0, 12,
3837 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
3838 0x0000000a, 0x0000000b, 0x00000001}},
3839 {SetMatrixArray},
3840 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3841 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
3842 0x0000000a, 0x0000000b, 0x00000001}},
3843 {SetMatrixTranspose, 0, 0, 0, 12,
3844 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
3845 0x00000004, 0x00000008, 0x00000001}},
3846 {SetMatrixTransposeArray},
3847 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3848 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
3849 0x00000004, 0x00000008, 0x00000001}},
3850 {SetMatrixPointerArray},
3851 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3852 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
3853 0x0000000a, 0x0000000b, 0x00000001}},
3854 {SetMatrixTransposePointerArray},
3855 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3856 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
3857 0x00000004, 0x00000008, 0x00000001}},
3860 static const struct registerset_constants registerset_constants_row_bool[] =
3862 {"rb", {"rb", D3DXRS_BOOL, 0, 6, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 37},
3865 static const struct registerset_test registerset_test_row_bool[] =
3867 {SetInt},
3868 {SetBool},
3869 {SetFloat},
3870 {SetIntArray, 0, 0, 5,},
3871 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
3872 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
3873 {SetBoolArray, 0, 0, 5},
3874 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
3875 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
3876 {SetFloatArray, 0, 0, 5},
3877 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 6,
3878 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3879 {SetValue, 0, 0, 23},
3880 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 6,
3881 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
3882 {SetVector},
3883 {SetVectorArray, 0, 0, 2},
3884 {SetVectorArray, 0, 3, REGISTER_OUTPUT_SIZE / 4, 6,
3885 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3886 {SetMatrix, 0, 0, 0, 6,
3887 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001},},
3888 {SetMatrixArray},
3889 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
3890 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3891 {SetMatrixTranspose, 0, 0, 0, 6,
3892 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3893 {SetMatrixTransposeArray},
3894 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
3895 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3896 {SetMatrixPointerArray},
3897 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
3898 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3899 {SetMatrixTransposePointerArray},
3900 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
3901 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3904 static const struct registerset_constants registerset_constants_row_int_float[] =
3906 {"rnf", {"rnf", D3DXRS_FLOAT4, 6, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 91},
3909 static const struct registerset_test registerset_test_row_int_float[] =
3911 {SetInt},
3912 {SetBool},
3913 {SetFloat},
3914 {SetIntArray, 1, 0, 5},
3915 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3916 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
3917 0x00000000, 0x40e00000}},
3918 {SetBoolArray, 1, 0, 5},
3919 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3920 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
3921 0x00000000, 0x3f800000}},
3922 {SetFloatArray, 0, 0, 5},
3923 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 12,
3924 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
3925 0x40c00000, 0x40e00000}},
3926 {SetValue, 1, 0, 23},
3927 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 12,
3928 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
3929 0x00000000, 0x40e00000}},
3930 {SetVector},
3931 {SetVectorArray, 0, 0, 2},
3932 {SetVectorArray, 0, 3, REGISTER_OUTPUT_SIZE / 4, 12,
3933 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
3934 0x41200000, 0x41300000}},
3935 {SetMatrix, 0, 0, 0, 12,
3936 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
3937 0x41200000, 0x41300000}},
3938 {SetMatrixArray},
3939 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3940 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
3941 0x41200000, 0x41300000}},
3942 {SetMatrixTranspose, 0, 0, 0, 12,
3943 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
3944 0x40800000, 0x41000000}},
3945 {SetMatrixTransposeArray},
3946 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3947 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
3948 0x40800000, 0x41000000}},
3949 {SetMatrixPointerArray},
3950 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3951 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
3952 0x41200000, 0x41300000}},
3953 {SetMatrixTransposePointerArray},
3954 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3955 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
3956 0x40800000, 0x41000000}},
3959 static const struct registerset_constants registerset_constants_row_bool_float[] =
3961 {"rbf", {"rbf", D3DXRS_FLOAT4, 3, 3, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 44},
3964 static const struct registerset_test registerset_test_row_bool_float[] =
3966 {SetInt},
3967 {SetBool},
3968 {SetFloat},
3969 {SetIntArray, 1, 0, 5},
3970 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3971 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
3972 0x00000000, 0x3f800000}},
3973 {SetBoolArray, 1, 0, 5},
3974 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3975 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
3976 0x00000000, 0x3f800000}},
3977 {SetFloatArray, 0, 0, 5},
3978 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 12,
3979 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
3980 0x3f800000, 0x3f800000}},
3981 {SetValue, 1, 0, 23},
3982 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 12,
3983 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
3984 0x00000000, 0x3f800000}},
3985 {SetVector},
3986 {SetVectorArray, 0, 0, 2},
3987 {SetVectorArray, 0, 3, REGISTER_OUTPUT_SIZE / 4, 12,
3988 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
3989 0x3f800000, 0x3f800000}},
3990 {SetMatrix, 0, 0, 0, 12,
3991 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
3992 0x3f800000, 0x3f800000}},
3993 {SetMatrixArray},
3994 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3995 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
3996 0x3f800000, 0x3f800000}},
3997 {SetMatrixTranspose, 0, 0, 0, 12,
3998 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
3999 0x3f800000, 0x3f800000}},
4000 {SetMatrixTransposeArray},
4001 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
4002 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
4003 0x3f800000, 0x3f800000}},
4004 {SetMatrixPointerArray},
4005 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
4006 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4007 0x3f800000, 0x3f800000}},
4008 {SetMatrixTransposePointerArray},
4009 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
4010 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
4011 0x3f800000, 0x3f800000}},
4015 * fxc.exe /Tvs_3_0
4017 #if 0
4018 row_major bool3x2 rab[2] = {1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1};
4019 row_major int3x2 ran[2] = {4, 5, 6, 1, 8, 1, 5, 3, 9, 6, 7, 3};
4020 row_major float3x2 raf[2] = {1.5, 2.8, 3.3, 4.9, 5.9, 6.8, 7.9, 8.5, 9.4, 1.3, 1.2, 1.1};
4021 row_major bool3x2 rabf[2] = {1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1};
4022 row_major int3x2 ranf[2] = {35, 40, 60, 80, 70, 56, 37, 13, 98, 54, 77, 36};
4023 float4 main(float4 pos : POSITION) : POSITION
4025 float4 tmp = 0;
4026 int i;
4027 if (rab[1]._32) for (i = 0; i < ran[1]._31; i++) tmp.x += pos.z * raf[1]._31 * rabf[1]._32;
4028 else for (i = 0; i < ran[1]._32; i++) tmp.y += pos.y * raf[1]._32 * ranf[1]._32;
4029 return tmp;
4031 #endif
4032 static const DWORD registerset_blob_row_array[] =
4034 0xfffe0300, 0x00b6fffe, 0x42415443, 0x0000001c, 0x000002a3, 0xfffe0300, 0x00000005, 0x0000001c,
4035 0x00000100, 0x0000029c, 0x00000080, 0x00000000, 0x0000000c, 0x00000084, 0x00000094, 0x000000c4,
4036 0x00060002, 0x00000006, 0x000000cc, 0x000000dc, 0x0000013c, 0x00000002, 0x00000006, 0x00000140,
4037 0x00000150, 0x000001b0, 0x00000001, 0x0000000c, 0x000001b4, 0x000001c4, 0x00000224, 0x000c0002,
4038 0x00000006, 0x0000022c, 0x0000023c, 0x00626172, 0x00010002, 0x00020003, 0x00000002, 0x00000000,
4039 0xffffffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
4040 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x66626172, 0xababab00, 0x00010002, 0x00020003,
4041 0x00000002, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000,
4042 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000,
4043 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000,
4044 0x00000000, 0x00000000, 0x00666172, 0x00030002, 0x00020003, 0x00000002, 0x00000000, 0x3fc00000,
4045 0x40333333, 0x00000000, 0x00000000, 0x40533333, 0x409ccccd, 0x00000000, 0x00000000, 0x40bccccd,
4046 0x40d9999a, 0x00000000, 0x00000000, 0x40fccccd, 0x41080000, 0x00000000, 0x00000000, 0x41166666,
4047 0x3fa66666, 0x00000000, 0x00000000, 0x3f99999a, 0x3f8ccccd, 0x00000000, 0x00000000, 0x006e6172,
4048 0x00020002, 0x00020003, 0x00000002, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
4049 0x00000006, 0x00000001, 0x00000001, 0x00000000, 0x00000008, 0x00000001, 0x00000001, 0x00000000,
4050 0x00000005, 0x00000003, 0x00000001, 0x00000000, 0x00000009, 0x00000006, 0x00000001, 0x00000000,
4051 0x00000007, 0x00000003, 0x00000001, 0x00000000, 0x666e6172, 0xababab00, 0x00020002, 0x00020003,
4052 0x00000002, 0x00000000, 0x420c0000, 0x42200000, 0x00000000, 0x00000000, 0x42700000, 0x42a00000,
4053 0x00000000, 0x00000000, 0x428c0000, 0x42600000, 0x00000000, 0x00000000, 0x42140000, 0x41500000,
4054 0x00000000, 0x00000000, 0x42c40000, 0x42580000, 0x00000000, 0x00000000, 0x429a0000, 0x42100000,
4055 0x00000000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4056 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4057 0x05000051, 0xa00f0012, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
4058 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x01000028, 0xe0e4080b, 0x03000005, 0x80010000,
4059 0xa0000005, 0x90aa0000, 0x02000001, 0x80010001, 0xa0000012, 0x01000026, 0xf0e4000a, 0x04000004,
4060 0x80010001, 0x80000000, 0xa055000b, 0x80000001, 0x00000027, 0x02000001, 0x80020001, 0xa0000012,
4061 0x0000002a, 0x03000005, 0x80010000, 0xa0550005, 0x90550000, 0x02000001, 0x80020001, 0xa0000012,
4062 0x01000026, 0xf0e4000b, 0x04000004, 0x80020001, 0x80000000, 0xa0550011, 0x80550001, 0x00000027,
4063 0x02000001, 0x80010001, 0xa0000012, 0x0000002b, 0x02000001, 0xe0030000, 0x80e40001, 0x02000001,
4064 0xe00c0000, 0xa0000012, 0x0000ffff,
4067 static const struct registerset_constants registerset_constants_row_array_float[] =
4069 {"raf", {"raf", D3DXRS_FLOAT4, 0, 6, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 2, 0, 48, NULL}, 84},
4070 {"raf[0]", {"raf", D3DXRS_FLOAT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 84},
4071 {"raf[1]", {"raf", D3DXRS_FLOAT4, 3, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 96},
4074 static const struct registerset_test registerset_test_row_array_float[] =
4076 {SetInt},
4077 {SetBool},
4078 {SetFloat},
4079 {SetIntArray, 1, 0, 5},
4080 {SetIntArray, 1, 6, 11, 12,
4081 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4082 0x00000000, 0x40e00000}},
4083 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4084 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4085 0x00000000, 0x40e00000, 0x00000000, 0x00000000, 0x41000000, 0x41100000, 0x00000000, 0x00000000,
4086 0x41200000, 0x41300000, 0x00000000, 0x00000000, 0x41400000, 0x41500000}},
4087 {SetBoolArray, 1, 0, 5},
4088 {SetBoolArray, 1, 6, 11, 12,
4089 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4090 0x00000000, 0x3f800000}},
4091 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4092 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4093 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4094 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4095 {SetFloatArray, 0, 0, 5},
4096 {SetFloatArray, 0, 6, 11, 12,
4097 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000, 0x00000000,
4098 0x40c00123, 0x40e00123}},
4099 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 24,
4100 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000, 0x00000000,
4101 0x40c00123, 0x40e00123, 0x00000000, 0x00000000, 0x41000123, 0x41100123, 0x00000000, 0x00000000,
4102 0x41200123, 0x41300123, 0x00000000, 0x00000000, 0x41400123, 0x41500123}},
4103 {SetValue, 0, 0, 23},
4104 {SetValue, 0, 24, 47, 12,
4105 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000, 0x00000000,
4106 0x40c00123, 0x40e00123}},
4107 {SetValue, 0, 48, REGISTER_OUTPUT_SIZE * 4, 24,
4108 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000, 0x00000000,
4109 0x40c00123, 0x40e00123, 0x00000000, 0x00000000, 0x41000123, 0x41100123, 0x00000000, 0x00000000,
4110 0x41200123, 0x41300123, 0x00000000, 0x00000000, 0x41400123, 0x41500123}},
4111 {SetVector},
4112 {SetVectorArray, 0, 0, 2},
4113 {SetVectorArray, 0, 3, 5, 12,
4114 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
4115 0x41200123, 0x41300123}},
4116 {SetVectorArray, 0, 6, REGISTER_OUTPUT_SIZE / 4, 24,
4117 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
4118 0x41200123, 0x41300123, 0x00000000, 0x00000000, 0x41600123, 0x41700123, 0x00000000, 0x00000000,
4119 0x41a00123, 0x41b00123, 0x00000000, 0x00000000, 0x00000000, 0x41f00123}},
4120 {SetMatrix, 0, 0, 0, 12,
4121 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
4122 0x41200123, 0x41300123}},
4123 {SetMatrixArray},
4124 {SetMatrixArray, 0, 1, 1, 12,
4125 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
4126 0x41200123, 0x41300123}},
4127 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4128 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
4129 0x41200123, 0x41300123, 0x00000000, 0x00000000, 0x41a00123, 0x41b00123, 0x00000000, 0x00000000,
4130 0x00000000, 0x41f00123, 0x00000000, 0x00000000, 0x00000000, 0x42300123}},
4131 {SetMatrixTranspose, 0, 0, 0, 12,
4132 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
4133 0x40800123, 0x41000123}},
4134 {SetMatrixTransposeArray},
4135 {SetMatrixTransposeArray, 0, 1, 1, 12,
4136 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
4137 0x40800123, 0x41000123}},
4138 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4139 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
4140 0x40800123, 0x41000123, 0x00000000, 0x00000000, 0x41a00123, 0x00000000, 0x00000000, 0x00000000,
4141 0x41b00123, 0x41f00123, 0x00000000, 0x00000000, 0x41c00123, 0x42000123}},
4142 {SetMatrixPointerArray},
4143 {SetMatrixPointerArray, 0, 1, 1, 12,
4144 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
4145 0x41200123, 0x41300123}},
4146 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4147 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
4148 0x41200123, 0x41300123, 0x00000000, 0x00000000, 0x41900123, 0x41a00123, 0x00000000, 0x00000000,
4149 0x41d00123, 0x00000000, 0x00000000, 0x00000000, 0x42100123, 0x00000000}},
4150 {SetMatrixTransposePointerArray},
4151 {SetMatrixTransposePointerArray, 0, 1, 1, 12,
4152 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
4153 0x40800123, 0x41000123}},
4154 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4155 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
4156 0x40800123, 0x41000123, 0x00000000, 0x00000000, 0x41900123, 0x41d00123, 0x00000000, 0x00000000,
4157 0x41a00123, 0x00000000, 0x00000000, 0x00000000, 0x41b00123, 0x41f00123}},
4160 static const struct registerset_constants registerset_constants_row_array_int[] =
4162 {"ran", {"ran", D3DXRS_INT4, 0, 12, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 2, 0, 48, NULL}, 113},
4163 {"ran[0]", {"ran", D3DXRS_INT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 113},
4164 {"ran[1]", {"ran", D3DXRS_INT4, 3, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 125},
4167 static const struct registerset_test registerset_test_row_array_int[] =
4169 {SetInt},
4170 {SetBool},
4171 {SetFloat},
4172 {SetIntArray, 1, 0, 5},
4173 {SetIntArray, 1, 6, 11, 12,
4174 {0x00000002, 0x00000003, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
4175 0x00000000, 0x00000007, 0x00000001}},
4176 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4177 {0x00000002, 0x00000003, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
4178 0x00000000, 0x00000007, 0x00000001, 0x00000000, 0x00000008, 0x00000009, 0x00000001, 0x00000000,
4179 0x0000000a, 0x0000000b, 0x00000001, 0x00000000, 0x0000000c, 0x0000000d, 0x00000001}},
4180 {SetBoolArray, 1, 0, 5},
4181 {SetBoolArray, 1, 6, 11, 12,
4182 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000,
4183 0x00000000, 0x00000001, 0x00000001}},
4184 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4185 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000,
4186 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000,
4187 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
4188 {SetFloatArray, 0, 0, 5},
4189 {SetFloatArray, 0, 6, 11, 12,
4190 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
4191 0x00000006, 0x00000007, 0x00000001}},
4192 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 24,
4193 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
4194 0x00000006, 0x00000007, 0x00000001, 0x00000000, 0x00000008, 0x00000009, 0x00000001, 0x00000000,
4195 0x0000000a, 0x0000000b, 0x00000001, 0x00000000, 0x0000000c, 0x0000000d, 0x00000001}},
4196 {SetValue, 1, 0, 23},
4197 {SetValue, 1, 24, 47, 12,
4198 {0x00000002, 0x00000003, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
4199 0x00000000, 0x00000007, 0x00000001}},
4200 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 24,
4201 {0x00000002, 0x00000003, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
4202 0x00000000, 0x00000007, 0x00000001, 0x00000000, 0x00000008, 0x00000009, 0x00000001, 0x00000000,
4203 0x0000000a, 0x0000000b, 0x00000001, 0x00000000, 0x0000000c, 0x0000000d, 0x00000001}},
4204 {SetVector},
4205 {SetVectorArray, 0, 0, 2},
4206 {SetVectorArray, 0, 3, 5, 12,
4207 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
4208 0x0000000a, 0x0000000b, 0x00000001}},
4209 {SetVectorArray, 0, 6, REGISTER_OUTPUT_SIZE / 4, 24,
4210 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
4211 0x0000000a, 0x0000000b, 0x00000001, 0x00000000, 0x0000000e, 0x0000000f, 0x00000001, 0x00000000,
4212 0x00000014, 0x00000016, 0x00000001, 0x00000000, 0x00000000, 0x0000001e, 0x00000001}},
4213 {SetMatrix, 0, 0, 0, 12,
4214 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
4215 0x0000000a, 0x0000000b, 0x00000001}},
4216 {SetMatrixArray},
4217 {SetMatrixArray, 0, 1, 1, 12,
4218 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
4219 0x0000000a, 0x0000000b, 0x00000001}},
4220 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4221 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
4222 0x0000000a, 0x0000000b, 0x00000001, 0x00000000, 0x00000014, 0x00000016, 0x00000001, 0x00000000,
4223 0x00000000, 0x0000001e, 0x00000001, 0x00000000, 0x00000000, 0x0000002c, 0x00000001}},
4224 {SetMatrixTranspose, 0, 0, 0, 12,
4225 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
4226 0x00000004, 0x00000008, 0x00000001}},
4227 {SetMatrixTransposeArray},
4228 {SetMatrixTransposeArray, 0, 1, 1, 12,
4229 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
4230 0x00000004, 0x00000008, 0x00000001}},
4231 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4232 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
4233 0x00000004, 0x00000008, 0x00000001, 0x00000000, 0x00000014, 0x00000000, 0x00000001, 0x00000000,
4234 0x00000016, 0x0000001e, 0x00000001, 0x00000000, 0x00000018, 0x00000020, 0x00000001}},
4235 {SetMatrixPointerArray},
4236 {SetMatrixPointerArray, 0, 1, 1, 12,
4237 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
4238 0x0000000a, 0x0000000b, 0x00000001}},
4239 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4240 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
4241 0x0000000a, 0x0000000b, 0x00000001, 0x00000000, 0x00000012, 0x00000014, 0x00000001, 0x00000000,
4242 0x0000001a, 0x00000000, 0x00000001, 0x00000000, 0x00000024, 0x00000000, 0x00000001}},
4243 {SetMatrixTransposePointerArray},
4244 {SetMatrixTransposePointerArray, 0, 1, 1, 12,
4245 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
4246 0x00000004, 0x00000008, 0x00000001}},
4247 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4248 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
4249 0x00000004, 0x00000008, 0x00000001, 0x00000000, 0x00000012, 0x0000001a, 0x00000001, 0x00000000,
4250 0x00000014, 0x00000000, 0x00000001, 0x00000000, 0x00000016, 0x0000001e, 0x00000001}},
4253 static const struct registerset_constants registerset_constants_row_array_bool[] =
4255 {"rab", {"rab", D3DXRS_BOOL, 0, 12, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 2, 0, 48, NULL}, 37},
4256 {"rab[0]", {"rab", D3DXRS_BOOL, 0, 6, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 37},
4257 {"rab[1]", {"rab", D3DXRS_BOOL, 6, 6, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 43},
4260 static const struct registerset_test registerset_test_row_array_bool[] =
4262 {SetInt},
4263 {SetBool},
4264 {SetFloat},
4265 {SetIntArray, 1, 0, 5,},
4266 {SetIntArray, 1, 6, 11, 6,
4267 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
4268 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 12,
4269 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001,
4270 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4271 {SetBoolArray, 1, 0, 5},
4272 {SetBoolArray, 1, 6, 11, 6,
4273 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
4274 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 12,
4275 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007, 0x00000008, 0x00000009,
4276 0x0000000a, 0x0000000b, 0x0000000c, 0x0000000d}},
4277 {SetFloatArray, 0, 0, 5},
4278 {SetFloatArray, 0, 6, 11, 6,
4279 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4280 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 12,
4281 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
4282 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4283 {SetValue, 1, 0, 23},
4284 {SetValue, 1, 24, 47, 6,
4285 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
4286 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 12,
4287 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007, 0x00000008, 0x00000009,
4288 0x0000000a, 0x0000000b, 0x0000000c, 0x0000000d}},
4289 {SetVector},
4290 {SetVectorArray, 0, 0, 2},
4291 {SetVectorArray, 0, 3, 5, 6,
4292 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4293 {SetVectorArray, 0, 6, REGISTER_OUTPUT_SIZE / 4, 12,
4294 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
4295 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
4296 {SetMatrix, 0, 0, 0, 6,
4297 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4298 {SetMatrixArray},
4299 {SetMatrixArray, 0, 1, 1, 6,
4300 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4301 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
4302 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
4303 0x00000000, 0x00000001, 0x00000000, 0x00000001}},
4304 {SetMatrixTranspose, 0, 0, 0, 6,
4305 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
4306 {SetMatrixTransposeArray},
4307 {SetMatrixTransposeArray, 0, 1, 1, 6,
4308 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
4309 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
4310 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000,
4311 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4312 {SetMatrixPointerArray},
4313 {SetMatrixPointerArray, 0, 1, 1, 6,
4314 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4315 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
4316 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
4317 0x00000001, 0x00000000, 0x00000001, 0x00000000}},
4318 {SetMatrixTransposePointerArray},
4319 {SetMatrixTransposePointerArray, 0, 1, 1, 6,
4320 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
4321 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
4322 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
4323 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
4326 static const struct registerset_constants registerset_constants_row_array_int_float[] =
4328 {"ranf", {"ranf", D3DXRS_FLOAT4, 12, 6, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 2, 0, 48, NULL}, 143},
4329 {"ranf[0]", {"ranf", D3DXRS_FLOAT4, 12, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 143},
4330 {"ranf[1]", {"ranf", D3DXRS_FLOAT4, 15, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 155},
4333 static const struct registerset_test registerset_test_row_array_int_float[] =
4335 {SetInt},
4336 {SetBool},
4337 {SetFloat},
4338 {SetIntArray, 1, 0, 5},
4339 {SetIntArray, 1, 6, 11, 12,
4340 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4341 0x00000000, 0x40e00000,}},
4342 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4343 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4344 0x00000000, 0x40e00000, 0x00000000, 0x00000000, 0x41000000, 0x41100000, 0x00000000, 0x00000000,
4345 0x41200000, 0x41300000, 0x00000000, 0x00000000, 0x41400000, 0x41500000}},
4346 {SetBoolArray, 1, 0, 5},
4347 {SetBoolArray, 1, 6, 11, 12,
4348 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4349 0x00000000, 0x3f800000}},
4350 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4351 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4352 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4353 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4354 {SetFloatArray, 0, 0, 5},
4355 {SetFloatArray, 0, 6, 11, 12,
4356 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4357 0x40c00000, 0x40e00000}},
4358 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 24,
4359 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4360 0x40c00000, 0x40e00000, 0x00000000, 0x00000000, 0x41000000, 0x41100000, 0x00000000, 0x00000000,
4361 0x41200000, 0x41300000, 0x00000000, 0x00000000, 0x41400000, 0x41500000}},
4362 {SetValue, 1, 0, 23},
4363 {SetValue, 1, 24, 47, 12,
4364 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4365 0x00000000, 0x40e00000}},
4366 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 24,
4367 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4368 0x00000000, 0x40e00000, 0x00000000, 0x00000000, 0x41000000, 0x41100000, 0x00000000, 0x00000000,
4369 0x41200000, 0x41300000, 0x00000000, 0x00000000, 0x41400000, 0x41500000}},
4370 {SetVector},
4371 {SetVectorArray, 0, 0, 2},
4372 {SetVectorArray, 0, 3, 5, 12,
4373 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
4374 0x41200000, 0x41300000}},
4375 {SetVectorArray, 0, 6, REGISTER_OUTPUT_SIZE / 4, 24,
4376 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
4377 0x41200000, 0x41300000, 0x00000000, 0x00000000, 0x41600000, 0x41700000, 0x00000000, 0x00000000,
4378 0x41a00000, 0x41b00000, 0x00000000, 0x00000000, 0x00000000, 0x41f00000}},
4379 {SetMatrix, 0, 0, 0, 12,
4380 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
4381 0x41200000, 0x41300000}},
4382 {SetMatrixArray},
4383 {SetMatrixArray, 0, 1, 1, 12,
4384 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
4385 0x41200000, 0x41300000}},
4386 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4387 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
4388 0x41200000, 0x41300000, 0x00000000, 0x00000000, 0x41a00000, 0x41b00000, 0x00000000, 0x00000000,
4389 0x00000000, 0x41f00000, 0x00000000, 0x00000000, 0x00000000, 0x42300000}},
4390 {SetMatrixTranspose, 0, 0, 0, 12,
4391 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
4392 0x40800000, 0x41000000}},
4393 {SetMatrixTransposeArray},
4394 {SetMatrixTransposeArray, 0, 1, 1, 12,
4395 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
4396 0x40800000, 0x41000000}},
4397 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4398 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
4399 0x40800000, 0x41000000, 0x00000000, 0x00000000, 0x41a00000, 0x00000000, 0x00000000, 0x00000000,
4400 0x41b00000, 0x41f00000, 0x00000000, 0x00000000, 0x41c00000, 0x42000000}},
4401 {SetMatrixPointerArray},
4402 {SetMatrixPointerArray, 0, 1, 1, 12,
4403 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
4404 0x41200000, 0x41300000}},
4405 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4406 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
4407 0x41200000, 0x41300000, 0x00000000, 0x00000000, 0x41900000, 0x41a00000, 0x00000000, 0x00000000,
4408 0x41d00000, 0x00000000, 0x00000000, 0x00000000, 0x42100000, 0x00000000}},
4409 {SetMatrixTransposePointerArray},
4410 {SetMatrixTransposePointerArray, 0, 1, 1, 12,
4411 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
4412 0x40800000, 0x41000000}},
4413 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4414 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
4415 0x40800000, 0x41000000, 0x00000000, 0x00000000, 0x41900000, 0x41d00000, 0x00000000, 0x00000000,
4416 0x41a00000, 0x00000000, 0x00000000, 0x00000000, 0x41b00000, 0x41f00000}},
4419 static const struct registerset_constants registerset_constants_row_array_bool_float[] =
4421 {"rabf", {"rabf", D3DXRS_FLOAT4, 6, 6, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 2, 0, 48, NULL}, 55},
4422 {"rabf[0]", {"rabf", D3DXRS_FLOAT4, 6, 3, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 55},
4423 {"rabf[1]", {"rabf", D3DXRS_FLOAT4, 9, 3, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 67},
4426 static const struct registerset_test registerset_test_row_array_bool_float[] =
4428 {SetInt},
4429 {SetBool},
4430 {SetFloat},
4431 {SetIntArray, 1, 0, 5},
4432 {SetIntArray, 1, 6, 11, 12,
4433 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4434 0x00000000, 0x3f800000}},
4435 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4436 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4437 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4438 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4439 {SetBoolArray, 1, 0, 5},
4440 {SetBoolArray, 1, 6, 11, 12,
4441 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4442 0x00000000, 0x3f800000}},
4443 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4444 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4445 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4446 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4447 {SetFloatArray, 0, 0, 5},
4448 {SetFloatArray, 0, 6, 11, 12,
4449 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4450 0x3f800000, 0x3f800000}},
4451 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 24,
4452 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4453 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4454 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4455 {SetValue, 1, 0, 23},
4456 {SetValue, 1, 24, 47, 12,
4457 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4458 0x00000000, 0x3f800000}},
4459 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 24,
4460 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4461 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4462 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4463 {SetVector},
4464 {SetVectorArray, 0, 0, 2},
4465 {SetVectorArray, 0, 3, 5, 12,
4466 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4467 0x3f800000, 0x3f800000}},
4468 {SetVectorArray, 0, 6, REGISTER_OUTPUT_SIZE / 4, 24,
4469 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4470 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4471 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
4472 {SetMatrix, 0, 0, 0, 12,
4473 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4474 0x3f800000, 0x3f800000}},
4475 {SetMatrixArray},
4476 {SetMatrixArray, 0, 1, 1, 12,
4477 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4478 0x3f800000, 0x3f800000}},
4479 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4480 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4481 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4482 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
4483 {SetMatrixTranspose, 0, 0, 0, 12,
4484 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
4485 0x3f800000, 0x3f800000}},
4486 {SetMatrixTransposeArray},
4487 {SetMatrixTransposeArray, 0, 1, 1, 12,
4488 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
4489 0x3f800000, 0x3f800000}},
4490 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4491 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
4492 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
4493 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4494 {SetMatrixPointerArray},
4495 {SetMatrixPointerArray, 0, 1, 1, 12,
4496 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4497 0x3f800000, 0x3f800000}},
4498 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4499 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4500 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4501 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000}},
4502 {SetMatrixTransposePointerArray},
4503 {SetMatrixTransposePointerArray, 0, 1, 1, 12,
4504 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
4505 0x3f800000, 0x3f800000}},
4506 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4507 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
4508 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4509 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4513 * fxc.exe /Tvs_3_0
4515 #if 0
4516 struct {bool b; bool3 vb;} sb = {1, 1, 0, 1};
4517 struct {int n; int3 vn;} sn = {11, 12, 13, 14};
4518 struct {float f; float3 vf;} sf = {1.1f, 2.2f, 3.3f, 4.4f};
4519 struct {int nf; int3 vnf;} snf = {31, 32, 33, 34};
4520 struct {bool bf; bool3 vbf;} sbf = {1, 0, 0, 1};
4521 float4 main(float4 pos : POSITION) : POSITION
4523 float4 tmp = 0;
4524 int i;
4525 if (sb.vb.z) for (i = 0; i < sn.n; i++) tmp.x += pos.z * sf.vf.x * snf.vnf.z;
4526 else for (i = 0; i < sn.vn.z; i++) tmp.y += pos.y * sf.vf.z * sbf.vbf.y;
4527 return tmp;
4529 #endif
4530 static const DWORD registerset_blob_struct[] =
4532 0xfffe0300, 0x00a2fffe, 0x42415443, 0x0000001c, 0x00000253, 0xfffe0300, 0x00000005, 0x0000001c,
4533 0x00000100, 0x0000024c, 0x00000080, 0x00000000, 0x00000004, 0x000000bc, 0x000000cc, 0x000000dc,
4534 0x00040002, 0x00000002, 0x000000f8, 0x00000108, 0x00000128, 0x00000002, 0x00000002, 0x00000164,
4535 0x00000174, 0x00000194, 0x00000001, 0x00000004, 0x000001d0, 0x000001e0, 0x00000200, 0x00020002,
4536 0x00000002, 0x0000021c, 0x0000022c, 0x62006273, 0xababab00, 0x00010000, 0x00010001, 0x00000001,
4537 0x00000000, 0xab006276, 0x00010001, 0x00030001, 0x00000001, 0x00000000, 0x00000083, 0x00000088,
4538 0x00000098, 0x0000009c, 0x00000005, 0x00040001, 0x00020001, 0x000000ac, 0xffffffff, 0xffffffff,
4539 0x00000000, 0xffffffff, 0x00666273, 0x76006662, 0xab006662, 0x000000e0, 0x00000088, 0x000000e3,
4540 0x0000009c, 0x00000005, 0x00040001, 0x00020001, 0x000000e8, 0x3f800000, 0x00000000, 0x00000000,
4541 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x66006673, 0xababab00, 0x00030000,
4542 0x00010001, 0x00000001, 0x00000000, 0xab006676, 0x00030001, 0x00030001, 0x00000001, 0x00000000,
4543 0x0000012b, 0x00000130, 0x00000140, 0x00000144, 0x00000005, 0x00040001, 0x00020001, 0x00000154,
4544 0x3f8ccccd, 0x00000000, 0x00000000, 0x00000000, 0x400ccccd, 0x40533333, 0x408ccccd, 0x00000000,
4545 0x6e006e73, 0xababab00, 0x00020000, 0x00010001, 0x00000001, 0x00000000, 0xab006e76, 0x00020001,
4546 0x00030001, 0x00000001, 0x00000000, 0x00000197, 0x0000019c, 0x000001ac, 0x000001b0, 0x00000005,
4547 0x00040001, 0x00020001, 0x000001c0, 0x0000000b, 0x00000000, 0x00000001, 0x00000000, 0x0000000c,
4548 0x0000000d, 0x0000000e, 0x00000000, 0x00666e73, 0x7600666e, 0xab00666e, 0x00000204, 0x0000019c,
4549 0x00000207, 0x000001b0, 0x00000005, 0x00040001, 0x00020001, 0x0000020c, 0x41f80000, 0x00000000,
4550 0x00000000, 0x00000000, 0x42000000, 0x42040000, 0x42080000, 0x00000000, 0x335f7376, 0x4d00305f,
4551 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
4552 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x05000051, 0xa00f0006, 0x00000000, 0x00000000,
4553 0x00000000, 0x00000000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000,
4554 0x01000028, 0xe0e40803, 0x03000005, 0x80010000, 0xa0000001, 0x90aa0000, 0x02000001, 0x80010001,
4555 0xa0000006, 0x01000026, 0xf0e40000, 0x04000004, 0x80010001, 0x80000000, 0xa0aa0003, 0x80000001,
4556 0x00000027, 0x02000001, 0x80020001, 0xa0000006, 0x0000002a, 0x03000005, 0x80010000, 0xa0aa0001,
4557 0x90550000, 0x02000001, 0x80020001, 0xa0000006, 0x01000026, 0xf0e40003, 0x04000004, 0x80020001,
4558 0x80000000, 0xa0550005, 0x80550001, 0x00000027, 0x02000001, 0x80010001, 0xa0000006, 0x0000002b,
4559 0x02000001, 0xe0030000, 0x80e40001, 0x02000001, 0xe00c0000, 0xa0000006, 0x0000ffff,
4562 static const struct registerset_constants registerset_constants_struct_float[] =
4564 {"sf", {"sf", D3DXRS_FLOAT4, 0, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 93},
4565 {"sf.f", {"f", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 93},
4566 {"sf.vf", {"vf", D3DXRS_FLOAT4, 1, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 97},
4569 static const struct registerset_test registerset_test_struct_float[] =
4571 {SetInt},
4572 {SetBool},
4573 {SetFloat},
4574 {SetIntArray, 1, 0, 3},
4575 {SetIntArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4576 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x40800000, 0x40a00000, 0x00000000}},
4577 {SetBoolArray, 1, 0, 3},
4578 {SetBoolArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4579 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
4580 {SetFloatArray, 0, 0, 3},
4581 {SetFloatArray, 0, 4, REGISTER_OUTPUT_SIZE, 8,
4582 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4583 {SetValue, 0, 0, 15},
4584 {SetValue, 0, 16, REGISTER_OUTPUT_SIZE * 4, 8,
4585 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4586 {SetVector, 0, 0, 0, 8,
4587 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4588 {SetVectorArray},
4589 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
4590 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4591 {SetMatrix, 0, 0, 0, 8,
4592 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4593 {SetMatrixArray},
4594 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4595 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4596 {SetMatrixTranspose, 0, 0, 0, 8,
4597 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4598 {SetMatrixTransposeArray},
4599 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4600 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4601 {SetMatrixPointerArray},
4602 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4603 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4604 {SetMatrixTransposePointerArray},
4605 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4606 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4609 static const struct registerset_constants registerset_constants_struct_int[] =
4611 {"sn", {"sn", D3DXRS_INT4, 0, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 120},
4612 {"sn.n", {"n", D3DXRS_INT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 120},
4613 {"sn.vn", {"vn", D3DXRS_INT4, 1, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 124},
4616 static const struct registerset_test registerset_test_struct_int[] =
4618 {SetInt},
4619 {SetBool},
4620 {SetFloat},
4621 {SetIntArray, 1, 0, 3},
4622 {SetIntArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4623 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000004, 0x00000005, 0x00000000}},
4624 {SetBoolArray, 1, 0, 3},
4625 {SetBoolArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4626 {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000}},
4627 {SetFloatArray, 0, 0, 3},
4628 {SetFloatArray, 0, 4, REGISTER_OUTPUT_SIZE, 8,
4629 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4630 {SetValue, 1, 0, 15},
4631 {SetValue, 1, 16, REGISTER_OUTPUT_SIZE * 4, 8,
4632 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000004, 0x00000005, 0x00000000}},
4633 {SetVector, 0, 0, 0, 8,
4634 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4635 {SetVectorArray},
4636 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
4637 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4638 {SetMatrix, 0, 0, 0, 8,
4639 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4640 {SetMatrixArray},
4641 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4642 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4643 {SetMatrixTranspose, 0, 0, 0, 8,
4644 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4645 {SetMatrixTransposeArray},
4646 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4647 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4648 {SetMatrixPointerArray},
4649 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4650 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4651 {SetMatrixTransposePointerArray},
4652 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4653 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4656 static const struct registerset_constants registerset_constants_struct_bool[] =
4658 {"sb", {"sb", D3DXRS_BOOL, 0, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 51},
4659 {"sb.b", {"b", D3DXRS_BOOL, 0, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 51},
4660 {"sb.vb", {"vb", D3DXRS_BOOL, 1, 3, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 52},
4663 static const struct registerset_test registerset_test_struct_bool[] =
4665 {SetInt},
4666 {SetBool},
4667 {SetFloat},
4668 {SetIntArray, 1, 0, 3},
4669 {SetIntArray, 1, 4, REGISTER_OUTPUT_SIZE, 4,
4670 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4671 {SetBoolArray, 1, 0, 3},
4672 {SetBoolArray, 1, 4, REGISTER_OUTPUT_SIZE, 4,
4673 {0x00000002, 0x00000003, 0x00000004, 0x00000005}},
4674 {SetFloatArray, 0, 0, 3},
4675 {SetFloatArray, 0, 4, REGISTER_OUTPUT_SIZE, 4,
4676 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
4677 {SetValue, 1, 0, 15},
4678 {SetValue, 1, 16, REGISTER_OUTPUT_SIZE * 4, 4,
4679 {0x00000002, 0x00000003, 0x00000004, 0x00000005}},
4680 {SetVector, 0, 0, 0, 4,
4681 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
4682 {SetVectorArray},
4683 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4,
4684 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
4685 {SetMatrix, 0, 0, 0, 4,
4686 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
4687 {SetMatrixArray},
4688 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
4689 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
4690 {SetMatrixTranspose, 0, 0, 0, 4,
4691 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4692 {SetMatrixTransposeArray},
4693 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
4694 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4695 {SetMatrixPointerArray},
4696 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
4697 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
4698 {SetMatrixTransposePointerArray},
4699 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
4700 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4703 static const struct registerset_constants registerset_constants_struct_int_float[] =
4705 {"snf", {"snf", D3DXRS_FLOAT4, 2, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 139},
4706 {"snf.nf", {"nf", D3DXRS_FLOAT4, 2, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 139},
4707 {"snf.vnf", {"vnf", D3DXRS_FLOAT4, 3, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 143},
4710 static const struct registerset_test registerset_test_struct_int_float[] =
4712 {SetInt},
4713 {SetBool},
4714 {SetFloat},
4715 {SetIntArray, 1, 0, 3},
4716 {SetIntArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4717 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x40800000, 0x40a00000, 0x00000000}},
4718 {SetBoolArray, 1, 0, 3},
4719 {SetBoolArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4720 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
4721 {SetFloatArray, 0, 0, 3},
4722 {SetFloatArray, 0, 4, REGISTER_OUTPUT_SIZE, 8,
4723 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
4724 {SetValue, 1, 0, 15},
4725 {SetValue, 1, 16, REGISTER_OUTPUT_SIZE * 4, 8,
4726 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x40800000, 0x40a00000, 0x00000000}},
4727 {SetVector, 0, 0, 0, 8,
4728 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
4729 {SetVectorArray},
4730 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
4731 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
4732 {SetMatrix, 0, 0, 0, 8,
4733 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
4734 {SetMatrixArray},
4735 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4736 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
4737 {SetMatrixTranspose, 0, 0, 0, 8,
4738 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4739 {SetMatrixTransposeArray},
4740 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4741 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4742 {SetMatrixPointerArray},
4743 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4744 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4745 {SetMatrixTransposePointerArray},
4746 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4747 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4750 static const struct registerset_constants registerset_constants_struct_bool_float[] =
4752 {"sbf", {"sbf", D3DXRS_FLOAT4, 4, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 66},
4753 {"sbf.bf", {"bf", D3DXRS_FLOAT4, 4, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 66},
4754 {"sbf.vbf", {"vbf", D3DXRS_FLOAT4, 5, 1, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 70},
4757 static const struct registerset_test registerset_test_struct_bool_float[] =
4759 {SetInt},
4760 {SetBool},
4761 {SetFloat},
4762 {SetIntArray, 1, 0, 3},
4763 {SetIntArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4764 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
4765 {SetBoolArray, 1, 0, 3},
4766 {SetBoolArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4767 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
4768 {SetFloatArray, 0, 0, 3},
4769 {SetFloatArray, 0, 4, REGISTER_OUTPUT_SIZE, 8,
4770 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
4771 {SetValue, 1, 0, 15},
4772 {SetValue, 1, 16, REGISTER_OUTPUT_SIZE * 4, 8,
4773 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
4774 {SetVector, 0, 0, 0, 8,
4775 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
4776 {SetVectorArray},
4777 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
4778 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
4779 {SetMatrix, 0, 0, 0, 8,
4780 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
4781 {SetMatrixArray},
4782 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4783 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
4784 {SetMatrixTranspose, 0, 0, 0, 8,
4785 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4786 {SetMatrixTransposeArray},
4787 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4788 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4789 {SetMatrixPointerArray},
4790 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4791 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4792 {SetMatrixTransposePointerArray},
4793 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4794 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4798 * fxc.exe /Tvs_3_0
4800 #if 0
4801 struct {bool b; bool3 vb;} sab[2] = {1, 1, 0, 1, 0, 1, 0, 1};
4802 struct {int n; int3 vn;} san[2] = {21, 22, 23, 24, 25, 26, 27, 28};
4803 struct {float f; float3 vf;} saf[2] = {1.1f, 2.1f, 3.1f, 4.1f, 5.1f, 6.1f, 7.1f, 8.1f};
4804 struct {int nf; int3 vnf;} sanf[2] = {41, 0, 43, 44, 41, 42, 43, 44};
4805 struct {bool bf; bool3 vbf;} sabf[2] = {1, 0, 0, 1, 1, 1, 0, 1};
4806 float4 main(float4 pos : POSITION) : POSITION
4808 float4 tmp = 0;
4809 int i;
4810 if (sab[1].vb.z) for (i = 0; i < san[1].n; i++) tmp.x += pos.z * saf[1].vf.x * sanf[1].vnf.z;
4811 else for (i = 0; i < san[1].vn.z; i++) tmp.y += pos.y * saf[1].vf.z * sabf[1].vbf.y;
4812 return tmp;
4814 #endif
4815 static const DWORD registerset_blob_struct_array[] =
4817 0xfffe0300, 0x00c6fffe, 0x42415443, 0x0000001c, 0x000002e3, 0xfffe0300, 0x00000005, 0x0000001c,
4818 0x00000100, 0x000002dc, 0x00000080, 0x00000000, 0x00000008, 0x000000bc, 0x000000cc, 0x000000ec,
4819 0x00080002, 0x00000004, 0x00000108, 0x00000118, 0x00000158, 0x00000002, 0x00000004, 0x00000194,
4820 0x000001a4, 0x000001e4, 0x00000001, 0x00000008, 0x00000220, 0x00000230, 0x00000270, 0x00040002,
4821 0x00000004, 0x0000028c, 0x0000029c, 0x00626173, 0xabab0062, 0x00010000, 0x00010001, 0x00000001,
4822 0x00000000, 0xab006276, 0x00010001, 0x00030001, 0x00000001, 0x00000000, 0x00000084, 0x00000088,
4823 0x00000098, 0x0000009c, 0x00000005, 0x00040001, 0x00020002, 0x000000ac, 0xffffffff, 0xffffffff,
4824 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x66626173, 0x00666200,
4825 0x00666276, 0x000000f1, 0x00000088, 0x000000f4, 0x0000009c, 0x00000005, 0x00040001, 0x00020002,
4826 0x000000f8, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000,
4827 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000,
4828 0x00000000, 0x00666173, 0xabab0066, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0xab006676,
4829 0x00030001, 0x00030001, 0x00000001, 0x00000000, 0x0000015c, 0x00000160, 0x00000170, 0x00000174,
4830 0x00000005, 0x00040001, 0x00020002, 0x00000184, 0x3f8ccccd, 0x00000000, 0x00000000, 0x00000000,
4831 0x40066666, 0x40466666, 0x40833333, 0x00000000, 0x40a33333, 0x00000000, 0x00000000, 0x00000000,
4832 0x40c33333, 0x40e33333, 0x4101999a, 0x00000000, 0x006e6173, 0xabab006e, 0x00020000, 0x00010001,
4833 0x00000001, 0x00000000, 0xab006e76, 0x00020001, 0x00030001, 0x00000001, 0x00000000, 0x000001e8,
4834 0x000001ec, 0x000001fc, 0x00000200, 0x00000005, 0x00040001, 0x00020002, 0x00000210, 0x00000015,
4835 0x00000000, 0x00000001, 0x00000000, 0x00000016, 0x00000017, 0x00000018, 0x00000000, 0x00000019,
4836 0x00000000, 0x00000001, 0x00000000, 0x0000001a, 0x0000001b, 0x0000001c, 0x00000000, 0x666e6173,
4837 0x00666e00, 0x00666e76, 0x00000275, 0x000001ec, 0x00000278, 0x00000200, 0x00000005, 0x00040001,
4838 0x00020002, 0x0000027c, 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x422c0000,
4839 0x42300000, 0x00000000, 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x42280000, 0x422c0000,
4840 0x42300000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4841 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4842 0x05000051, 0xa00f000c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
4843 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x01000028, 0xe0e40807, 0x03000005, 0x80010000,
4844 0xa0000003, 0x90aa0000, 0x02000001, 0x80010001, 0xa000000c, 0x01000026, 0xf0e40004, 0x04000004,
4845 0x80010001, 0x80000000, 0xa0aa0007, 0x80000001, 0x00000027, 0x02000001, 0x80020001, 0xa000000c,
4846 0x0000002a, 0x03000005, 0x80010000, 0xa0aa0003, 0x90550000, 0x02000001, 0x80020001, 0xa000000c,
4847 0x01000026, 0xf0e40007, 0x04000004, 0x80020001, 0x80000000, 0xa055000b, 0x80550001, 0x00000027,
4848 0x02000001, 0x80010001, 0xa000000c, 0x0000002b, 0x02000001, 0xe0030000, 0x80e40001, 0x02000001,
4849 0xe00c0000, 0xa000000c, 0x0000ffff,
4852 static const struct registerset_constants registerset_constants_struct_array_float[] =
4854 {"saf", {"saf", D3DXRS_FLOAT4, 0, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 2, 2, 32, NULL}, 105},
4855 {"saf[0]", {"saf", D3DXRS_FLOAT4, 0, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 105},
4856 {"saf[0].f", {"f", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 105},
4857 {"saf[0].vf", {"vf", D3DXRS_FLOAT4, 1, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 109},
4858 {"saf[1]", {"saf", D3DXRS_FLOAT4, 2, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 113},
4859 {"saf[1].f", {"f", D3DXRS_FLOAT4, 2, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 113},
4860 {"saf[1].vf", {"vf", D3DXRS_FLOAT4, 3, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 117},
4863 static const struct registerset_test registerset_test_struct_array_float[] =
4865 {SetInt},
4866 {SetBool},
4867 {SetFloat},
4868 {SetIntArray, 1, 0, 3},
4869 {SetIntArray, 1, 4, 7, 8,
4870 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x40800000, 0x40a00000, 0x00000000}},
4871 {SetIntArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
4872 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x41000000, 0x41100000, 0x00000000}},
4873 {SetBoolArray, 1, 0, 3},
4874 {SetBoolArray, 1, 4, 7, 8,
4875 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
4876 {SetBoolArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
4877 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
4878 {SetFloatArray, 0, 0, 3},
4879 {SetFloatArray, 0, 4, 7, 8,
4880 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4881 {SetFloatArray, 0, 8, REGISTER_OUTPUT_SIZE, 8,
4882 {0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x41000123, 0x41100123, 0x00000000}},
4883 {SetValue, 0, 0, 15},
4884 {SetValue, 0, 16, 31, 8,
4885 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4886 {SetValue, 0, 32, REGISTER_OUTPUT_SIZE * 4, 8,
4887 {0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x41000123, 0x41100123, 0x00000000}},
4888 {SetVector, 0, 0, 0, 8,
4889 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4890 {SetVectorArray},
4891 {SetVectorArray, 0, 1, 1, 8,
4892 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4893 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
4894 {0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x41000123, 0x41100123, 0x00000000}},
4895 {SetMatrix, 0, 0, 0, 8,
4896 {0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x41000123, 0x41100123, 0x00000000}},
4897 {SetMatrixArray},
4898 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4899 {0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x41000123, 0x41100123, 0x00000000}},
4900 {SetMatrixTranspose, 0, 0, 0, 8,
4901 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4902 {SetMatrixTransposeArray},
4903 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4904 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4905 {SetMatrixPointerArray},
4906 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8},
4907 {SetMatrixTransposePointerArray},
4908 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8},
4911 static const struct registerset_constants registerset_constants_struct_array_int[] =
4913 {"san", {"san", D3DXRS_INT4, 0, 8, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 2, 2, 32, NULL}, 140},
4914 {"san[0]", {"san", D3DXRS_INT4, 0, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 140},
4915 {"san[0].n", {"n", D3DXRS_INT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 140},
4916 {"san[0].vn", {"vn", D3DXRS_INT4, 1, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 144},
4917 {"san[1]", {"san", D3DXRS_INT4, 2, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 148},
4918 {"san[1].n", {"n", D3DXRS_INT4, 2, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 148},
4919 {"san[1].vn", {"vn", D3DXRS_INT4, 3, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 152},
4922 static const struct registerset_test registerset_test_struct_array_int[] =
4924 {SetInt},
4925 {SetBool},
4926 {SetFloat},
4927 {SetIntArray, 1, 0, 3},
4928 {SetIntArray, 1, 4, 7, 8,
4929 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000004, 0x00000005, 0x00000000}},
4930 {SetIntArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
4931 {0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000009, 0x00000000}},
4932 {SetBoolArray, 1, 0, 3},
4933 {SetBoolArray, 1, 4, 7, 8,
4934 {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000}},
4935 {SetBoolArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
4936 {0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000}},
4937 {SetFloatArray, 0, 0, 3},
4938 {SetFloatArray, 0, 4, 7, 8,
4939 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4940 {SetFloatArray, 0, 8, REGISTER_OUTPUT_SIZE, 8,
4941 {0x00000006, 0x00000000, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000009, 0x00000000}},
4942 {SetValue, 1, 0, 15},
4943 {SetValue, 1, 16, 31, 8,
4944 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000004, 0x00000005, 0x00000000}},
4945 {SetValue, 1, 32, REGISTER_OUTPUT_SIZE * 4, 8,
4946 {0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000009, 0x00000000}},
4947 {SetVector, 0, 0, 0, 8,
4948 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4949 {SetVectorArray},
4950 {SetVectorArray, 0, 1, 1, 8,
4951 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4952 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
4953 {0x00000006, 0x00000000, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000009, 0x00000000}},
4954 {SetMatrix, 0, 0, 0, 8,
4955 {0x00000006, 0x00000000, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000009, 0x00000000},},
4956 {SetMatrixArray},
4957 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4958 {0x00000006, 0x00000000, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000009, 0x00000000}},
4959 {SetMatrixTranspose, 0, 0, 0, 8,
4960 {0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4961 {SetMatrixTransposeArray},
4962 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4963 {0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4964 {SetMatrixPointerArray},
4965 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4966 {0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4967 {SetMatrixTransposePointerArray},
4968 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4969 {0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4972 static const struct registerset_constants registerset_constants_struct_array_bool[] =
4974 {"sab", {"sab", D3DXRS_BOOL, 0, 8, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 2, 2, 32, NULL}, 51},
4975 {"sab[0]", {"sab", D3DXRS_BOOL, 0, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 51},
4976 {"sab[0].b", {"b", D3DXRS_BOOL, 0, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 51},
4977 {"sab[0].vb", {"vb", D3DXRS_BOOL, 1, 3, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 52},
4978 {"sab[1]", {"sab", D3DXRS_BOOL, 4, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 55},
4979 {"sab[1].b", {"b", D3DXRS_BOOL, 4, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 55},
4980 {"sab[1].vb", {"vb", D3DXRS_BOOL, 5, 3, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 56},
4983 static const struct registerset_test registerset_test_struct_array_bool[] =
4985 {SetInt},
4986 {SetBool},
4987 {SetFloat},
4988 {SetIntArray, 1, 0, 3},
4989 {SetIntArray, 1, 4, 7, 4,
4990 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4991 {SetIntArray, 1, 8, REGISTER_OUTPUT_SIZE, 4,
4992 {0x00000000, 0x00000001, 0x00000001, 0x00000001}},
4993 {SetBoolArray, 1, 0, 3},
4994 {SetBoolArray, 1, 4, 7, 4,
4995 {0x00000002, 0x00000003, 0x00000004, 0x00000005}},
4996 {SetBoolArray, 1, 8, REGISTER_OUTPUT_SIZE, 4,
4997 {0x00000000, 0x00000007, 0x00000008, 0x00000009}},
4998 {SetFloatArray, 0, 0, 3},
4999 {SetFloatArray, 0, 4, 7, 4,
5000 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
5001 {SetFloatArray, 0, 8, REGISTER_OUTPUT_SIZE, 4,
5002 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5003 {SetValue, 1, 0, 15},
5004 {SetValue, 1, 16, 31, 4,
5005 {0x00000002, 0x00000003, 0x00000004, 0x00000005}},
5006 {SetValue, 1, 32, REGISTER_OUTPUT_SIZE * 4, 4,
5007 {0x00000000, 0x00000007, 0x00000008, 0x00000009}},
5008 {SetVector, 0, 0, 0, 4,
5009 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
5010 {SetVectorArray},
5011 {SetVectorArray, 0, 1, 1, 4,
5012 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
5013 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 4,
5014 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5015 {SetMatrix, 0, 0, 0, 4,
5016 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5017 {SetMatrixArray},
5018 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
5019 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5020 {SetMatrixTranspose, 0, 0, 0, 4,
5021 {0x00000000, 0x00000001, 0x00000001, 0x00000001}},
5022 {SetMatrixTransposeArray},
5023 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
5024 {0x00000000, 0x00000001, 0x00000001, 0x00000001}},
5025 {SetMatrixPointerArray},
5026 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
5027 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5028 {SetMatrixTransposePointerArray},
5029 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
5030 {0x00000000, 0x00000001, 0x00000001, 0x00000001}},
5033 static const struct registerset_constants registerset_constants_struct_array_int_float[] =
5035 {"sanf", {"sanf", D3DXRS_FLOAT4, 4, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 2, 2, 32, NULL}, 167},
5036 {"sanf[0]", {"sanf", D3DXRS_FLOAT4, 4, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 167},
5037 {"sanf[0].nf", {"nf", D3DXRS_FLOAT4, 4, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 167},
5038 {"sanf[0].vnf", {"vnf", D3DXRS_FLOAT4, 5, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 171},
5039 {"sanf[1]", {"sanf", D3DXRS_FLOAT4, 6, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 175},
5040 {"sanf[1].nf", {"nf", D3DXRS_FLOAT4, 6, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 175},
5041 {"sanf[1].vnf", {"vnf", D3DXRS_FLOAT4, 7, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 179},
5044 static const struct registerset_test registerset_test_struct_array_int_float[] =
5046 {SetInt},
5047 {SetBool},
5048 {SetFloat},
5049 {SetIntArray, 1, 0, 3},
5050 {SetIntArray, 1, 4, 7, 8,
5051 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x40800000, 0x40a00000, 0x00000000}},
5052 {SetIntArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
5053 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x41000000, 0x41100000, 0x00000000}},
5054 {SetBoolArray, 1, 0, 3},
5055 {SetBoolArray, 1, 4, 7, 8,
5056 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5057 {SetBoolArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
5058 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5059 {SetFloatArray, 0, 0, 3},
5060 {SetFloatArray, 0, 4, 7, 8,
5061 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
5062 {SetFloatArray, 0, 8, REGISTER_OUTPUT_SIZE, 8,
5063 {0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x41000000, 0x41100000, 0x00000000}},
5064 {SetValue, 1, 0, 15},
5065 {SetValue, 1, 16, 31, 8,
5066 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x40800000, 0x40a00000, 0x00000000}},
5067 {SetValue, 1, 32, REGISTER_OUTPUT_SIZE * 4, 8,
5068 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x41000000, 0x41100000, 0x00000000}},
5069 {SetVector, 0, 0, 0, 8,
5070 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
5071 {SetVectorArray},
5072 {SetVectorArray, 0, 1, 1, 8,
5073 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
5074 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
5075 {0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x41000000, 0x41100000, 0x00000000}},
5076 {SetMatrix, 0, 0, 0, 8,
5077 {0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x41000000, 0x41100000, 0x00000000}},
5078 {SetMatrixArray},
5079 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
5080 {0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x41000000, 0x41100000, 0x00000000}},
5081 {SetMatrixTranspose, 0, 0, 0, 8,
5082 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
5083 {SetMatrixTransposeArray},
5084 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
5085 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
5086 {SetMatrixPointerArray},
5087 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8},
5088 {SetMatrixTransposePointerArray},
5089 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8},
5092 static const struct registerset_constants registerset_constants_struct_array_bool_float[] =
5094 {"sabf", {"sabf", D3DXRS_FLOAT4, 8, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 2, 2, 32, NULL}, 70},
5095 {"sabf[0]", {"sabf", D3DXRS_FLOAT4, 8, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 70},
5096 {"sabf[0].bf", {"bf", D3DXRS_FLOAT4, 8, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 70},
5097 {"sabf[0].vbf", {"vbf", D3DXRS_FLOAT4, 9, 1, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 74},
5098 {"sabf[1]", {"sabf", D3DXRS_FLOAT4, 10, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 78},
5099 {"sabf[1].bf", {"bf", D3DXRS_FLOAT4, 10, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 78},
5100 {"sabf[1].vbf", {"vbf", D3DXRS_FLOAT4, 11, 1, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 82},
5103 static const struct registerset_test registerset_test_struct_array_bool_float[] =
5105 {SetInt},
5106 {SetBool},
5107 {SetFloat},
5108 {SetIntArray, 1, 0, 3},
5109 {SetIntArray, 1, 4, 7, 8,
5110 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5111 {SetIntArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
5112 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5113 {SetBoolArray, 1, 0, 3},
5114 {SetBoolArray, 1, 4, 7, 8,
5115 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5116 {SetBoolArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
5117 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5118 {SetFloatArray, 0, 0, 3},
5119 {SetFloatArray, 0, 4, 7, 8,
5120 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
5121 {SetFloatArray, 0, 8, REGISTER_OUTPUT_SIZE, 8,
5122 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5123 {SetValue, 1, 0, 15},
5124 {SetValue, 1, 16, 31, 8,
5125 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5126 {SetValue, 1, 32, REGISTER_OUTPUT_SIZE * 4, 8,
5127 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5128 {SetVector, 0, 0, 0, 8,
5129 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
5130 {SetVectorArray},
5131 {SetVectorArray, 0, 1, 1, 8,
5132 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
5133 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
5134 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5135 {SetMatrix, 0, 0, 0, 8,
5136 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5137 {SetMatrixArray},
5138 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
5139 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5140 {SetMatrixTranspose, 0, 0, 0, 8,
5141 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
5142 {SetMatrixTransposeArray},
5143 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
5144 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
5145 {SetMatrixPointerArray},
5146 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8},
5147 {SetMatrixTransposePointerArray},
5148 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8},
5152 * fxc.exe /Tvs_3_0
5154 #if 0
5155 struct {bool b; struct {bool b; bool3 vb;} s; bool b1;} ssb = {1, 1, 0, 1, 1, 0};
5156 struct {int n; struct {int n; int3 vn;} s; int n1;} ssn = {71, 72, 73, 74, 75, 76};
5157 struct {float f; struct {float f; float3 vf;} s; float f1;} ssf = {1.1f, 2.1f, 3.1f, 4.1f, 5.1f, 6.1f};
5158 struct {int nf; struct {int nf; int3 vnf;} s; int nf1;} ssnf = {41, 0, 43, 44, 41, 42};
5159 struct {bool bf; struct {bool bf; bool3 vbf;} s; bool bf1;} ssbf = {1, 0, 0, 1, 1, 0};
5160 float4 main(float4 pos : POSITION) : POSITION
5162 float4 tmp = 0;
5163 int i;
5164 if (ssb.b1) for (i = 0; i < ssn.n1; i++) tmp.x += pos.z * ssf.f1 * ssnf.nf1;
5165 else for (i = 0; i < ssn.s.vn.z; i++) tmp.y += pos.y * ssf.s.vf.z * ssbf.bf1;
5166 return tmp;
5168 #endif
5169 static const DWORD registerset_blob_struct_struct[] =
5171 0xfffe0300, 0x00fcfffe, 0x42415443, 0x0000001c, 0x000003bb, 0xfffe0300, 0x00000005, 0x0000001c,
5172 0x00000100, 0x000003b4, 0x00000080, 0x00000000, 0x00000006, 0x000000ec, 0x000000fc, 0x00000114,
5173 0x00080002, 0x00000004, 0x0000015c, 0x0000016c, 0x000001ac, 0x00000002, 0x00000004, 0x00000214,
5174 0x00000224, 0x00000264, 0x00000001, 0x00000006, 0x000002cc, 0x000002dc, 0x0000031c, 0x00040002,
5175 0x00000004, 0x00000364, 0x00000374, 0x00627373, 0xabab0062, 0x00010000, 0x00010001, 0x00000001,
5176 0x00000000, 0x62760073, 0xababab00, 0x00010001, 0x00030001, 0x00000001, 0x00000000, 0x00000084,
5177 0x00000088, 0x0000009a, 0x000000a0, 0x00000005, 0x00040001, 0x00020001, 0x000000b0, 0xab003162,
5178 0x00000084, 0x00000088, 0x00000098, 0x000000c0, 0x000000d0, 0x00000088, 0x00000005, 0x00060001,
5179 0x00030001, 0x000000d4, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000,
5180 0x66627373, 0x00666200, 0x00666276, 0x00000119, 0x00000088, 0x0000011c, 0x000000a0, 0x00000005,
5181 0x00040001, 0x00020001, 0x00000120, 0x00316662, 0x00000119, 0x00000088, 0x00000098, 0x00000130,
5182 0x00000140, 0x00000088, 0x00000005, 0x00060001, 0x00030001, 0x00000144, 0x3f800000, 0x00000000,
5183 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000,
5184 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00667373, 0xabab0066,
5185 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0xab006676, 0x00030001, 0x00030001, 0x00000001,
5186 0x00000000, 0x000001b0, 0x000001b4, 0x000001c4, 0x000001c8, 0x00000005, 0x00040001, 0x00020001,
5187 0x000001d8, 0xab003166, 0x000001b0, 0x000001b4, 0x00000098, 0x000001e8, 0x000001f8, 0x000001b4,
5188 0x00000005, 0x00060001, 0x00030001, 0x000001fc, 0x3f8ccccd, 0x00000000, 0x00000000, 0x00000000,
5189 0x40066666, 0x00000000, 0x00000000, 0x00000000, 0x40466666, 0x40833333, 0x40a33333, 0x00000000,
5190 0x40c33333, 0x00000000, 0x00000000, 0x00000000, 0x006e7373, 0xabab006e, 0x00020000, 0x00010001,
5191 0x00000001, 0x00000000, 0xab006e76, 0x00020001, 0x00030001, 0x00000001, 0x00000000, 0x00000268,
5192 0x0000026c, 0x0000027c, 0x00000280, 0x00000005, 0x00040001, 0x00020001, 0x00000290, 0xab00316e,
5193 0x00000268, 0x0000026c, 0x00000098, 0x000002a0, 0x000002b0, 0x0000026c, 0x00000005, 0x00060001,
5194 0x00030001, 0x000002b4, 0x00000047, 0x00000000, 0x00000001, 0x00000000, 0x00000048, 0x00000000,
5195 0x00000001, 0x00000000, 0x00000049, 0x0000004a, 0x0000004b, 0x00000000, 0x0000004c, 0x00000000,
5196 0x00000001, 0x00000000, 0x666e7373, 0x00666e00, 0x00666e76, 0x00000321, 0x0000026c, 0x00000324,
5197 0x00000280, 0x00000005, 0x00040001, 0x00020001, 0x00000328, 0x0031666e, 0x00000321, 0x0000026c,
5198 0x00000098, 0x00000338, 0x00000348, 0x0000026c, 0x00000005, 0x00060001, 0x00030001, 0x0000034c,
5199 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5200 0x422c0000, 0x42300000, 0x42240000, 0x00000000, 0x42280000, 0x00000000, 0x00000000, 0x00000000,
5201 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
5202 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x05000051, 0xa00f000c,
5203 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f,
5204 0x80000000, 0xe00f0000, 0x01000028, 0xe0e40805, 0x03000005, 0x80010000, 0xa0000003, 0x90aa0000,
5205 0x02000001, 0x80010001, 0xa000000c, 0x01000026, 0xf0e40005, 0x04000004, 0x80010001, 0x80000000,
5206 0xa0000007, 0x80000001, 0x00000027, 0x02000001, 0x80020001, 0xa000000c, 0x0000002a, 0x03000005,
5207 0x80010000, 0xa0aa0002, 0x90550000, 0x02000001, 0x80020001, 0xa000000c, 0x01000026, 0xf0e40004,
5208 0x04000004, 0x80020001, 0x80000000, 0xa000000b, 0x80550001, 0x00000027, 0x02000001, 0x80010001,
5209 0xa000000c, 0x0000002b, 0x02000001, 0xe0030000, 0x80e40001, 0x02000001, 0xe00c0000, 0xa000000c,
5210 0x0000ffff,
5213 static const struct registerset_constants registerset_constants_struct_struct_float[] =
5215 {"ssf", {"ssf", D3DXRS_FLOAT4, 0, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 6, 1, 3, 24, NULL}, 137},
5216 {"ssf.f", {"f", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 137},
5217 {"ssf.s", {"s", D3DXRS_FLOAT4, 1, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 141},
5218 {"ssf.s.f", {"f", D3DXRS_FLOAT4, 1, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 141},
5219 {"ssf.s.vf", {"vf", D3DXRS_FLOAT4, 2, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 145},
5220 {"ssf.f1", {"f1", D3DXRS_FLOAT4, 3, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 149},
5223 static const struct registerset_test registerset_test_struct_struct_float[] =
5225 {SetInt},
5226 {SetBool},
5227 {SetFloat},
5228 {SetIntArray, 1, 0, 5},
5229 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5230 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x00000000, 0x00000000, 0x00000000,
5231 0x40800000, 0x40a00000, 0x00000000, 0x00000000, 0x40e00000}},
5232 {SetBoolArray, 1, 0, 5},
5233 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5234 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
5235 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000}},
5236 {SetFloatArray, 0, 0, 5},
5237 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 16,
5238 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5239 0x40800123, 0x40a00123, 0x40c00123, 0x00000000, 0x40e00123}},
5240 {SetValue, 0, 0, 23},
5241 {SetValue, 0, 24, REGISTER_OUTPUT_SIZE * 4, 16,
5242 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5243 0x40800123, 0x40a00123, 0x40c00123, 0x00000000, 0x40e00123}},
5244 {SetVector},
5245 {SetVectorArray, 0, 0, 1},
5246 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 16,
5247 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5248 0x40800123, 0x40a00123, 0x40c00123, 0x00000000, 0x40e00123}},
5249 {SetMatrix, 0, 0, 0, 16,
5250 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5251 0x40800123, 0x40a00123, 0x40c00123, 0x00000000, 0x40e00123}},
5252 {SetMatrixArray},
5253 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16,
5254 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5255 0x40800123, 0x40a00123, 0x40c00123, 0x00000000, 0x40e00123}},
5256 {SetMatrixTranspose, 0, 0, 0, 16, {0x40000123}},
5257 {SetMatrixTransposeArray},
5258 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x40000123}},
5259 {SetMatrixPointerArray},
5260 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x40000123}},
5261 {SetMatrixTransposePointerArray},
5262 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x40000123}},
5265 static const struct registerset_constants registerset_constants_struct_struct_int[] =
5267 {"ssn", {"ssn", D3DXRS_INT4, 0, 6, D3DXPC_STRUCT, D3DXPT_VOID, 1, 6, 1, 3, 24, NULL}, 183},
5268 {"ssn.n", {"n", D3DXRS_INT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 183},
5269 {"ssn.s", {"s", D3DXRS_INT4, 1, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 187},
5270 {"ssn.s.n", {"n", D3DXRS_INT4, 1, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 187},
5271 {"ssn.s.vn", {"vn", D3DXRS_INT4, 2, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 191},
5272 {"ssn.n1", {"n1", D3DXRS_INT4, 3, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 195},
5275 static const struct registerset_test registerset_test_struct_struct_int[] =
5277 {SetInt},
5278 {SetBool},
5279 {SetFloat},
5280 {SetIntArray, 1, 0, 5},
5281 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5282 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000000, 0x00000001, 0x00000000,
5283 0x00000004, 0x00000005, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000001}},
5284 {SetBoolArray, 1, 0, 5},
5285 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5286 {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000000,
5287 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000001}},
5288 {SetFloatArray, 0, 0, 5},
5289 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 16,
5290 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5291 0x00000004, 0x00000005, 0x00000006, 0x00000000, 0x00000007, 0x00000000, 0x00000001}},
5292 {SetValue, 1, 0, 23},
5293 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 16,
5294 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000000, 0x00000001, 0x00000000,
5295 0x00000004, 0x00000005, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000001}},
5296 {SetVector},
5297 {SetVectorArray, 0, 0, 1},
5298 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 16,
5299 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5300 0x00000004, 0x00000005, 0x00000006, 0x00000000, 0x00000007, 0x00000000, 0x00000001}},
5301 {SetMatrix, 0, 0, 0, 16,
5302 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5303 0x00000004, 0x00000005, 0x00000006, 0x00000000, 0x00000007, 0x00000000, 0x00000001}},
5304 {SetMatrixArray},
5305 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16,
5306 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5307 0x00000004, 0x00000005, 0x00000006, 0x00000000, 0x00000007, 0x00000000, 0x00000001}},
5308 {SetMatrixTranspose, 0, 0, 0, 16,
5309 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5310 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
5311 {SetMatrixTransposeArray},
5312 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16,
5313 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5314 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
5315 {SetMatrixPointerArray},
5316 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16,
5317 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5318 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
5319 {SetMatrixTransposePointerArray},
5320 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16,
5321 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5322 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
5325 static const struct registerset_constants registerset_constants_struct_struct_bool[] =
5327 {"ssb", {"ssb", D3DXRS_BOOL, 0, 6, D3DXPC_STRUCT, D3DXPT_VOID, 1, 6, 1, 3, 24, NULL}, 63},
5328 {"ssb.b", {"b", D3DXRS_BOOL, 0, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 63},
5329 {"ssb.s", {"s", D3DXRS_BOOL, 1, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 64},
5330 {"ssb.s.b", {"b", D3DXRS_BOOL, 1, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 64},
5331 {"ssb.s.vb", {"vb", D3DXRS_BOOL, 2, 3, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 65},
5332 {"ssb.b1", {"b1", D3DXRS_BOOL, 5, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 68},
5335 static const struct registerset_test registerset_test_struct_struct_bool[] =
5337 {SetInt},
5338 {SetBool},
5339 {SetFloat},
5340 {SetIntArray, 1, 0, 5},
5341 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
5342 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
5343 {SetBoolArray, 1, 0, 5},
5344 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
5345 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
5346 {SetFloatArray, 0, 0, 5},
5347 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 6,
5348 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5349 {SetValue, 1, 0, 23},
5350 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 6,
5351 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
5352 {SetVector},
5353 {SetVectorArray, 0, 0, 1},
5354 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 6,
5355 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5356 {SetMatrix, 0, 0, 0, 6,
5357 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5358 {SetMatrixArray},
5359 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
5360 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5361 {SetMatrixTranspose, 0, 0, 0, 6,
5362 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
5363 {SetMatrixTransposeArray},
5364 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
5365 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
5366 {SetMatrixPointerArray},
5367 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
5368 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5369 {SetMatrixTransposePointerArray},
5370 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
5371 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
5374 static const struct registerset_constants registerset_constants_struct_struct_int_float[] =
5376 {"ssnf", {"ssnf", D3DXRS_FLOAT4, 4, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 6, 1, 3, 24, NULL}, 221},
5377 {"ssnf.nf", {"nf", D3DXRS_FLOAT4, 4, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 221},
5378 {"ssnf.s", {"s", D3DXRS_FLOAT4, 5, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 225},
5379 {"ssnf.s.nf", {"nf", D3DXRS_FLOAT4, 5, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 225},
5380 {"ssnf.s.vnf", {"vnf", D3DXRS_FLOAT4, 6, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 229},
5381 {"ssnf.nf1", {"nf1", D3DXRS_FLOAT4, 7, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 233},
5384 static const struct registerset_test registerset_test_struct_struct_int_float[] =
5386 {SetInt},
5387 {SetBool},
5388 {SetFloat},
5389 {SetIntArray, 1, 0, 5},
5390 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5391 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x00000000, 0x00000000, 0x00000000,
5392 0x40800000, 0x40a00000, 0x00000000, 0x00000000, 0x40e00000}},
5393 {SetBoolArray, 1, 0, 5},
5394 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5395 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
5396 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000}},
5397 {SetFloatArray, 0, 0, 5},
5398 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 16,
5399 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5400 0x40800000, 0x40a00000, 0x40c00000, 0x00000000, 0x40e00000}},
5401 {SetValue, 1, 0, 23},
5402 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 16,
5403 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x00000000, 0x00000000, 0x00000000,
5404 0x40800000, 0x40a00000, 0x00000000, 0x00000000, 0x40e00000}},
5405 {SetVector},
5406 {SetVectorArray, 0, 0, 1},
5407 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 16,
5408 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5409 0x40800000, 0x40a00000, 0x40c00000, 0x00000000, 0x40e00000}},
5410 {SetMatrix, 0, 0, 0, 16,
5411 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5412 0x40800000, 0x40a00000, 0x40c00000, 0x00000000, 0x40e00000}},
5413 {SetMatrixArray},
5414 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16,
5415 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5416 0x40800000, 0x40a00000, 0x40c00000, 0x00000000, 0x40e00000}},
5417 {SetMatrixTranspose, 0, 0, 0, 16, {0x40000000}},
5418 {SetMatrixTransposeArray},
5419 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x40000000}},
5420 {SetMatrixPointerArray},
5421 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x40000000}},
5422 {SetMatrixTransposePointerArray},
5423 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x40000000}},
5426 static const struct registerset_constants registerset_constants_struct_struct_bool_float[] =
5428 {"ssbf", {"ssbf", D3DXRS_FLOAT4, 8, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 6, 1, 3, 24, NULL}, 91},
5429 {"ssbf.bf", {"bf", D3DXRS_FLOAT4, 8, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 91},
5430 {"ssbf.s", {"s", D3DXRS_FLOAT4, 9, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 95},
5431 {"ssbf.s.bf", {"bf", D3DXRS_FLOAT4, 9, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 95},
5432 {"ssbf.s.vbf", {"vbf", D3DXRS_FLOAT4, 10, 1, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 99},
5433 {"ssbf.bf1", {"bf1", D3DXRS_FLOAT4, 11, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 103},
5436 static const struct registerset_test registerset_test_struct_struct_bool_float[] =
5438 {SetInt},
5439 {SetBool},
5440 {SetFloat},
5441 {SetIntArray, 1, 0, 5},
5442 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5443 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
5444 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000}},
5445 {SetBoolArray, 1, 0, 5},
5446 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5447 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
5448 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000}},
5449 {SetFloatArray, 0, 0, 5},
5450 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 16,
5451 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5452 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000}},
5453 {SetValue, 1, 0, 23},
5454 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 16,
5455 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
5456 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000}},
5457 {SetVector},
5458 {SetVectorArray, 0, 0, 1},
5459 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 16,
5460 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5461 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000}},
5462 {SetMatrix, 0, 0, 0, 16,
5463 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5464 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000}},
5465 {SetMatrixArray},
5466 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16,
5467 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5468 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000}},
5469 {SetMatrixTranspose, 0, 0, 0, 16, {0x3f800000}},
5470 {SetMatrixTransposeArray},
5471 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x3f800000}},
5472 {SetMatrixPointerArray},
5473 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x3f800000}},
5474 {SetMatrixTransposePointerArray},
5475 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x3f800000}},
5479 * fxc.exe /Tvs_3_0
5481 #if 0
5482 row_major int3x2 ran[2] = {4, 5, 6, 1, 8, 1, 2, 3, 4, 7, 9, 1};
5483 float4 main(float4 pos : POSITION) : POSITION
5485 float4 tmp = 0;
5486 int k;
5487 for (k = 0; k < ran[1]._21; k++)
5488 tmp.y += pos.y + tmp.x;
5489 return tmp;
5491 #endif
5492 static const DWORD registerset_blob_special_int[] =
5494 0xfffe0300, 0x0038fffe, 0x42415443, 0x0000001c, 0x000000ab, 0xfffe0300, 0x00000001, 0x0000001c,
5495 0x00000100, 0x000000a4, 0x00000030, 0x00000001, 0x00000009, 0x00000034, 0x00000044, 0x006e6172,
5496 0x00020002, 0x00020003, 0x00000002, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
5497 0x00000006, 0x00000001, 0x00000001, 0x00000000, 0x00000008, 0x00000001, 0x00000001, 0x00000000,
5498 0x00000002, 0x00000003, 0x00000001, 0x00000000, 0x00000004, 0x00000007, 0x00000001, 0x00000000,
5499 0x00000009, 0x00000001, 0x00000001, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73,
5500 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
5501 0x332e3235, 0x00313131, 0x05000051, 0xa00f0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5502 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x02000001, 0x80010000,
5503 0xa0000000, 0x01000026, 0xf0e40008, 0x03000002, 0x80010000, 0x80000000, 0x90550000, 0x00000027,
5504 0x02000001, 0xe0020000, 0x80000000, 0x02000001, 0xe00d0000, 0xa0000000, 0x0000ffff,
5507 static const struct registerset_constants registerset_constants_special_int[] =
5509 {"ran", {"ran", D3DXRS_INT4, 0, 9, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 2, 0, 48, NULL}, 17},
5510 {"ran[0]", {"ran", D3DXRS_INT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 17},
5511 {"ran[1]", {"ran", D3DXRS_INT4, 3, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 29},
5515 * fxc.exe /Tvs_3_0
5517 #if 0
5518 float3 vaf[10];
5519 float4 main(float4 pos : POSITION) : POSITION
5521 float4 tmp = 0;
5522 tmp.y += pos.y + vaf[8].x;
5523 return tmp;
5525 #endif
5526 static const DWORD registerset_blob_bigvec[] =
5528 0xfffe0300, 0x0020fffe, 0x42415443, 0x0000001c, 0x0000004b, 0xfffe0300, 0x00000001, 0x0000001c,
5529 0x00000100, 0x00000044, 0x00000030, 0x00000002, 0x00000009, 0x00000034, 0x00000000, 0x00666176,
5530 0x00030001, 0x00030001, 0x0000000a, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73,
5531 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
5532 0x332e3235, 0x00313131, 0x05000051, 0xa00f0009, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5533 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x03000002, 0xe0020000,
5534 0xa0000008, 0x90550000, 0x02000001, 0xe00d0000, 0xa0000009, 0x0000ffff,
5537 static const struct registerset_constants registerset_constants_bigvec_float[] =
5539 {"vaf", {"vaf", D3DXRS_FLOAT4, 0, 9, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 10, 0, 120, NULL}, 0},
5540 {"vaf[0]", {"vaf", D3DXRS_FLOAT4, 0, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5541 {"vaf[1]", {"vaf", D3DXRS_FLOAT4, 1, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5542 {"vaf[2]", {"vaf", D3DXRS_FLOAT4, 2, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5543 {"vaf[3]", {"vaf", D3DXRS_FLOAT4, 3, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5544 {"vaf[4]", {"vaf", D3DXRS_FLOAT4, 4, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5545 {"vaf[5]", {"vaf", D3DXRS_FLOAT4, 5, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5546 {"vaf[6]", {"vaf", D3DXRS_FLOAT4, 6, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5547 {"vaf[7]", {"vaf", D3DXRS_FLOAT4, 7, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5548 {"vaf[8]", {"vaf", D3DXRS_FLOAT4, 8, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5549 {"vaf[9]", {"vaf", D3DXRS_FLOAT4, 9, 0, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5552 static const struct registerset_test registerset_test_bigvec_float[] =
5554 {SetMatrix, 0, 0, 0, 16,
5555 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
5556 0x41200123, 0x41300123, 0x41400123, 0x00000000, 0x41600123, 0x41700123, 0x41800123}},
5557 {SetMatrixArray},
5558 {SetMatrixArray, 0, 1, 1, 16,
5559 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
5560 0x41200123, 0x41300123, 0x41400123, 0x00000000, 0x41600123, 0x41700123, 0x41800123}},
5561 {SetMatrixArray, 0, 2, 2, 32,
5562 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
5563 0x41200123, 0x41300123, 0x41400123, 0x00000000, 0x41600123, 0x41700123, 0x41800123, 0x00000000,
5564 0x41a00123, 0x41b00123, 0x41c00123, 0x00000000, 0x00000000, 0x41f00123, 0x42000123, 0x00000000,
5565 0x00000000, 0x42300123, 0x42400123, 0x00000000, 0x42600123, 0x42700123, 0x42800123}},
5566 {SetMatrixArray, 0, 3, REGISTER_OUTPUT_SIZE / 16, 36,
5567 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
5568 0x41200123, 0x41300123, 0x41400123, 0x00000000, 0x41600123, 0x41700123, 0x41800123, 0x00000000,
5569 0x41a00123, 0x41b00123, 0x41c00123, 0x00000000, 0x00000000, 0x41f00123, 0x42000123, 0x00000000,
5570 0x00000000, 0x42300123, 0x42400123, 0x00000000, 0x42600123, 0x42700123, 0x42800123, 0x00000000,
5571 0x43000123, 0x43100123, 0x43200123}},
5572 {SetMatrixTranspose, 0, 0, 0, 16,
5573 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
5574 0x40800123, 0x41000123, 0x41400123, 0x00000000, 0x40a00123, 0x41100123, 0x41500123}},
5575 {SetMatrixTransposeArray},
5576 {SetMatrixTransposeArray, 0, 1, 1, 16,
5577 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
5578 0x40800123, 0x41000123, 0x41400123, 0x00000000, 0x40a00123, 0x41100123, 0x41500123}},
5579 {SetMatrixTransposeArray, 0, 2, 2, 32,
5580 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
5581 0x40800123, 0x41000123, 0x41400123, 0x00000000, 0x40a00123, 0x41100123, 0x41500123, 0x00000000,
5582 0x41a00123, 0x00000000, 0x00000000, 0x00000000, 0x41b00123, 0x41f00123, 0x42300123, 0x00000000,
5583 0x41c00123, 0x42000123, 0x42400123, 0x00000000, 0x41d00123, 0x42100123, 0x42500123}},
5584 {SetMatrixTransposeArray, 0, 3, REGISTER_OUTPUT_SIZE / 16, 36,
5585 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
5586 0x40800123, 0x41000123, 0x41400123, 0x00000000, 0x40a00123, 0x41100123, 0x41500123, 0x00000000,
5587 0x41a00123, 0x00000000, 0x00000000, 0x00000000, 0x41b00123, 0x41f00123, 0x42300123, 0x00000000,
5588 0x41c00123, 0x42000123, 0x42400123, 0x00000000, 0x41d00123, 0x42100123, 0x42500123, 0x00000000,
5589 0x43000123, 0x43400123, 0x43800123}},
5590 {SetMatrixPointerArray},
5591 {SetMatrixPointerArray, 0, 1, 1, 16,
5592 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
5593 0x41200123, 0x41300123, 0x41400123, 0x00000000, 0x41600123, 0x41700123, 0x41800123}},
5594 {SetMatrixPointerArray, 0, 2, 2, 32,
5595 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
5596 0x41200123, 0x41300123, 0x41400123, 0x00000000, 0x41600123, 0x41700123, 0x41800123, 0x00000000,
5597 0x41900123, 0x41a00123, 0x41b00123, 0x00000000, 0x41d00123, 0x00000000, 0x41f00123, 0x00000000,
5598 0x42100123, 0x00000000, 0x42300123, 0x00000000, 0x42500123, 0x42600123, 0x42700123}},
5599 {SetMatrixPointerArray, 0, 3, REGISTER_OUTPUT_SIZE / 16, 36,
5600 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
5601 0x41200123, 0x41300123, 0x41400123, 0x00000000, 0x41600123, 0x41700123, 0x41800123, 0x00000000,
5602 0x41900123, 0x41a00123, 0x41b00123, 0x00000000, 0x41d00123, 0x00000000, 0x41f00123, 0x00000000,
5603 0x42100123, 0x00000000, 0x42300123, 0x00000000, 0x42500123, 0x42600123, 0x42700123, 0x00000000,
5604 0x42800123, 0x42900123, 0x43000123}},
5605 {SetMatrixTransposePointerArray},
5606 {SetMatrixTransposePointerArray, 0, 1, 1, 16,
5607 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
5608 0x40800123, 0x41000123, 0x41400123, 0x00000000, 0x40a00123, 0x41100123, 0x41500123}},
5609 {SetMatrixTransposePointerArray, 0, 2, 2, 32,
5610 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
5611 0x40800123, 0x41000123, 0x41400123, 0x00000000, 0x40a00123, 0x41100123, 0x41500123, 0x00000000,
5612 0x41900123, 0x41d00123, 0x42100123, 0x00000000, 0x41a00123, 0x00000000, 0x00000000, 0x00000000,
5613 0x41b00123, 0x41f00123, 0x42300123, 0x00000000, 0x41c00123, 0x42000123, 0x42400123}},
5614 {SetMatrixTransposePointerArray, 0, 3, REGISTER_OUTPUT_SIZE / 16, 36,
5615 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
5616 0x40800123, 0x41000123, 0x41400123, 0x00000000, 0x40a00123, 0x41100123, 0x41500123, 0x00000000,
5617 0x41900123, 0x41d00123, 0x42100123, 0x00000000, 0x41a00123, 0x00000000, 0x00000000, 0x00000000,
5618 0x41b00123, 0x41f00123, 0x42300123, 0x00000000, 0x41c00123, 0x42000123, 0x42400123, 0x00000000,
5619 0x42800123, 0x43200123, 0x43600123}},
5623 * fxc.exe /Tvs_3_0
5625 #if 0
5626 float4x4 cf = {1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8};
5627 float f = 33.33;
5628 float4 main(float4 pos : POSITION) : POSITION
5630 float4 tmp = 0;
5631 tmp.y += cf._22;
5632 tmp.z = f;
5633 return tmp;
5635 #endif
5636 static const DWORD registerset_blob_matrix_column_clamp[] =
5638 0xfffe0300, 0x003efffe, 0x42415443, 0x0000001c, 0x000000c3, 0xfffe0300, 0x00000002, 0x0000001c,
5639 0x00000100, 0x000000bc, 0x00000044, 0x00000002, 0x00000002, 0x00000048, 0x00000058, 0x00000098,
5640 0x00020002, 0x00000001, 0x0000009c, 0x000000ac, 0xab006663, 0x00030003, 0x00040004, 0x00000001,
5641 0x00000000, 0x3f8ccccd, 0x40b00000, 0x411e6666, 0x3fc00000, 0x400ccccd, 0x40d33333, 0x3f99999a,
5642 0x3fcccccd, 0x40533333, 0x40f66666, 0x3fa66666, 0x3fd9999a, 0x408ccccd, 0x410ccccd, 0x3fb33333,
5643 0x3fe66666, 0xabab0066, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0x420551ec, 0x00000000,
5644 0x00000000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
5645 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
5646 0x05000051, 0xa00f0003, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
5647 0xe00f0000, 0x02000001, 0x80020000, 0xa0550001, 0x03000005, 0xe00b0000, 0x80550000, 0xa0240003,
5648 0x02000001, 0xe0040000, 0xa0000002, 0x0000ffff,
5651 static const struct registerset_constants registerset_constants_matrix_column_clamp[] =
5653 {"cf", {"cf", D3DXRS_FLOAT4, 0, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 4, 4, 1, 0, 64, NULL}, 0},
5654 {"f", {"f", D3DXRS_FLOAT4, 2, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 0},
5657 static const struct registerset_test registerset_test_matrix_column_clamp[] =
5659 {SetMatrix, 0, 0, 0, 8,
5660 {0x40000123, 0x40c00123, 0x41200123, 0x41600123, 0x00000000, 0x40e00123, 0x41300123, 0x41700123}},
5663 static const struct
5665 const char *name;
5666 const char *var;
5667 UINT start;
5668 D3DXREGISTER_SET regset;
5669 const DWORD *blob;
5670 const struct registerset_test *tests;
5671 UINT test_count;
5672 const struct registerset_constants *constants;
5673 UINT constant_count;
5675 registerset_data[] =
5677 /* scalar */
5678 {"float", "f", 0, D3DXRS_FLOAT4, registerset_blob_scalar, registerset_test_scalar_float,
5679 sizeof(registerset_test_scalar_float) / sizeof(*registerset_test_scalar_float),
5680 registerset_constants_scalar_float,
5681 sizeof(registerset_constants_scalar_float) / sizeof(*registerset_constants_scalar_float)},
5682 {"int", "n", 0, D3DXRS_INT4, registerset_blob_scalar, registerset_test_scalar_int,
5683 sizeof(registerset_test_scalar_int) / sizeof(*registerset_test_scalar_int),
5684 registerset_constants_scalar_int,
5685 sizeof(registerset_constants_scalar_int) / sizeof(*registerset_constants_scalar_int)},
5686 {"int float", "nf", 4, D3DXRS_FLOAT4, registerset_blob_scalar, registerset_test_scalar_int_float,
5687 sizeof(registerset_test_scalar_int_float) / sizeof(*registerset_test_scalar_int_float),
5688 registerset_constants_scalar_int_float,
5689 sizeof(registerset_constants_scalar_int_float) / sizeof(*registerset_constants_scalar_int_float)},
5690 {"bool float", "bf", 8, D3DXRS_FLOAT4, registerset_blob_scalar, registerset_test_scalar_bool_float,
5691 sizeof(registerset_test_scalar_bool_float) / sizeof(*registerset_test_scalar_bool_float),
5692 registerset_constants_scalar_bool_float,
5693 sizeof(registerset_constants_scalar_bool_float) / sizeof(*registerset_constants_scalar_bool_float)},
5694 {"bool", "b", 0, D3DXRS_BOOL, registerset_blob_scalar, registerset_test_scalar_bool,
5695 sizeof(registerset_test_scalar_bool) / sizeof(*registerset_test_scalar_bool),
5696 registerset_constants_scalar_bool,
5697 sizeof(registerset_constants_scalar_bool) / sizeof(*registerset_constants_scalar_bool)},
5698 /* scalar array */
5699 {"float [2]", "af", 0, D3DXRS_FLOAT4, registerset_blob_scalar_array, registerset_test_scalar_array_float,
5700 sizeof(registerset_test_scalar_array_float) / sizeof(*registerset_test_scalar_array_float),
5701 registerset_constants_scalar_array_float,
5702 sizeof(registerset_constants_scalar_array_float) / sizeof(*registerset_constants_scalar_array_float)},
5703 {"int [2]", "an", 0, D3DXRS_INT4, registerset_blob_scalar_array, registerset_test_scalar_array_int,
5704 sizeof(registerset_test_scalar_array_int) / sizeof(*registerset_test_scalar_array_int),
5705 registerset_constants_scalar_array_int,
5706 sizeof(registerset_constants_scalar_array_int) / sizeof(*registerset_constants_scalar_array_int)},
5707 {"bool [2]", "ab", 0, D3DXRS_BOOL, registerset_blob_scalar_array, registerset_test_scalar_array_bool,
5708 sizeof(registerset_test_scalar_array_bool) / sizeof(*registerset_test_scalar_array_bool),
5709 registerset_constants_scalar_array_bool,
5710 sizeof(registerset_constants_scalar_array_bool) / sizeof(*registerset_constants_scalar_array_bool)},
5711 {"int float [2]", "anf", 8, D3DXRS_FLOAT4, registerset_blob_scalar_array,
5712 registerset_test_scalar_array_int_float,
5713 sizeof(registerset_test_scalar_array_int_float) / sizeof(*registerset_test_scalar_array_int_float),
5714 registerset_constants_scalar_array_int_float,
5715 sizeof(registerset_constants_scalar_array_int_float) / sizeof(*registerset_constants_scalar_array_int_float)},
5716 {"bool float [2]", "abf", 16, D3DXRS_FLOAT4, registerset_blob_scalar_array,
5717 registerset_test_scalar_array_bool_float,
5718 sizeof(registerset_test_scalar_array_bool_float) / sizeof(*registerset_test_scalar_array_bool_float),
5719 registerset_constants_scalar_array_bool_float,
5720 sizeof(registerset_constants_scalar_array_bool_float) / sizeof(*registerset_constants_scalar_array_bool_float)},
5721 /* vector */
5722 {"float 3", "vf", 0, D3DXRS_FLOAT4, registerset_blob_vector, registerset_test_vector_float,
5723 sizeof(registerset_test_vector_float) / sizeof(*registerset_test_vector_float),
5724 registerset_constants_vector_float,
5725 sizeof(registerset_constants_vector_float) / sizeof(*registerset_constants_vector_float)},
5726 {"int 3", "vn", 0, D3DXRS_INT4, registerset_blob_vector, registerset_test_vector_int,
5727 sizeof(registerset_test_vector_int) / sizeof(*registerset_test_vector_int),
5728 registerset_constants_vector_int,
5729 sizeof(registerset_constants_vector_int) / sizeof(*registerset_constants_vector_int)},
5730 {"bool 3", "vb", 0, D3DXRS_BOOL, registerset_blob_vector, registerset_test_vector_bool,
5731 sizeof(registerset_test_vector_bool) / sizeof(*registerset_test_vector_bool),
5732 registerset_constants_vector_bool,
5733 sizeof(registerset_constants_vector_bool) / sizeof(*registerset_constants_vector_bool)},
5734 {"bool float 3", "vbf", 8, D3DXRS_FLOAT4, registerset_blob_vector, registerset_test_vector_bool_float,
5735 sizeof(registerset_test_vector_bool_float) / sizeof(*registerset_test_vector_bool_float),
5736 registerset_constants_vector_bool_float,
5737 sizeof(registerset_constants_vector_bool_float) / sizeof(*registerset_constants_vector_bool_float)},
5738 {"int float 3", "vnf", 4, D3DXRS_FLOAT4, registerset_blob_vector, registerset_test_vector_int_float,
5739 sizeof(registerset_test_vector_int_float) / sizeof(*registerset_test_vector_int_float),
5740 registerset_constants_vector_int_float,
5741 sizeof(registerset_constants_vector_int_float) / sizeof(*registerset_constants_vector_int_float)},
5742 /* vector array */
5743 {"float 3 [2]", "vaf", 0, D3DXRS_FLOAT4, registerset_blob_vector_array, registerset_test_vector_array_float,
5744 sizeof(registerset_test_vector_array_float) / sizeof(*registerset_test_vector_array_float),
5745 registerset_constants_vector_array_float,
5746 sizeof(registerset_constants_vector_array_float) / sizeof(*registerset_constants_vector_array_float)},
5747 {"int 3 [2]", "van", 0, D3DXRS_INT4, registerset_blob_vector_array, registerset_test_vector_array_int,
5748 sizeof(registerset_test_vector_array_int) / sizeof(*registerset_test_vector_array_int),
5749 registerset_constants_vector_array_int,
5750 sizeof(registerset_constants_vector_array_int) / sizeof(*registerset_constants_vector_array_int)},
5751 {"bool 3 [2]", "vab", 0, D3DXRS_BOOL, registerset_blob_vector_array, registerset_test_vector_array_bool,
5752 sizeof(registerset_test_vector_array_bool) / sizeof(*registerset_test_vector_array_bool),
5753 registerset_constants_vector_array_bool,
5754 sizeof(registerset_constants_vector_array_bool) / sizeof(*registerset_constants_vector_array_bool)},
5755 {"bool float 3 [2]", "vabf", 16, D3DXRS_FLOAT4, registerset_blob_vector_array,
5756 registerset_test_vector_array_bool_float,
5757 sizeof(registerset_test_vector_array_bool_float) / sizeof(*registerset_test_vector_array_bool_float),
5758 registerset_constants_vector_array_bool_float,
5759 sizeof(registerset_constants_vector_array_bool_float) / sizeof(*registerset_constants_vector_array_bool_float)},
5760 {"int float 3 [2]", "vanf", 8, D3DXRS_FLOAT4, registerset_blob_vector_array,
5761 registerset_test_vector_array_int_float,
5762 sizeof(registerset_test_vector_array_int_float) / sizeof(*registerset_test_vector_array_int_float),
5763 registerset_constants_vector_array_int_float,
5764 sizeof(registerset_constants_vector_array_int_float) / sizeof(*registerset_constants_vector_array_int_float)},
5765 /* matrix column */
5766 {"float c3x2", "cf", 0, D3DXRS_FLOAT4, registerset_blob_column, registerset_test_column_float,
5767 sizeof(registerset_test_column_float) / sizeof(*registerset_test_column_float),
5768 registerset_constants_column_float,
5769 sizeof(registerset_constants_column_float) / sizeof(*registerset_constants_column_float)},
5770 {"int c3x2", "cn", 0, D3DXRS_INT4, registerset_blob_column, registerset_test_column_int,
5771 sizeof(registerset_test_column_int) / sizeof(*registerset_test_column_int),
5772 registerset_constants_column_int,
5773 sizeof(registerset_constants_column_int) / sizeof(*registerset_constants_column_int)},
5774 {"bool c3x2", "cb", 0, D3DXRS_BOOL, registerset_blob_column, registerset_test_column_bool,
5775 sizeof(registerset_test_column_bool) / sizeof(*registerset_test_column_bool),
5776 registerset_constants_column_bool,
5777 sizeof(registerset_constants_column_bool) / sizeof(*registerset_constants_column_bool)},
5778 {"bool float c3x2", "cbf", 8, D3DXRS_FLOAT4, registerset_blob_column,
5779 registerset_test_column_bool_float,
5780 sizeof(registerset_test_column_bool_float) / sizeof(*registerset_test_column_bool_float),
5781 registerset_constants_column_bool_float,
5782 sizeof(registerset_constants_column_bool_float) / sizeof(*registerset_constants_column_bool_float)},
5783 {"int float c3x2", "cnf", 16, D3DXRS_FLOAT4, registerset_blob_column,
5784 registerset_test_column_int_float,
5785 sizeof(registerset_test_column_int_float) / sizeof(*registerset_test_column_int_float),
5786 registerset_constants_column_int_float,
5787 sizeof(registerset_constants_column_int_float) / sizeof(*registerset_constants_column_int_float)},
5788 /* matrix column array */
5789 {"float c3x2 [2]", "caf", 0, D3DXRS_FLOAT4, registerset_blob_column_array, registerset_test_column_array_float,
5790 sizeof(registerset_test_column_array_float) / sizeof(*registerset_test_column_array_float),
5791 registerset_constants_column_array_float,
5792 sizeof(registerset_constants_column_array_float) / sizeof(*registerset_constants_column_array_float)},
5793 {"int c3x2 [2]", "can", 0, D3DXRS_INT4, registerset_blob_column_array, registerset_test_column_array_int,
5794 sizeof(registerset_test_column_array_int) / sizeof(*registerset_test_column_array_int),
5795 registerset_constants_column_array_int,
5796 sizeof(registerset_constants_column_array_int) / sizeof(*registerset_constants_column_array_int)},
5797 {"bool c3x2 [2]", "cab", 0, D3DXRS_BOOL, registerset_blob_column_array, registerset_test_column_array_bool,
5798 sizeof(registerset_test_column_array_bool) / sizeof(*registerset_test_column_array_bool),
5799 registerset_constants_column_array_bool,
5800 sizeof(registerset_constants_column_array_bool) / sizeof(*registerset_constants_column_array_bool)},
5801 {"bool float c3x2 [2]", "cabf", 16, D3DXRS_FLOAT4, registerset_blob_column_array,
5802 registerset_test_column_array_bool_float,
5803 sizeof(registerset_test_column_array_bool_float) / sizeof(*registerset_test_column_array_bool_float),
5804 registerset_constants_column_array_bool_float,
5805 sizeof(registerset_constants_column_array_bool_float) / sizeof(*registerset_constants_column_array_bool_float)},
5806 {"int float c3x2 [2]", "canf", 32, D3DXRS_FLOAT4, registerset_blob_column_array,
5807 registerset_test_column_array_int_float,
5808 sizeof(registerset_test_column_array_int_float) / sizeof(*registerset_test_column_array_int_float),
5809 registerset_constants_column_array_int_float,
5810 sizeof(registerset_constants_column_array_int_float) / sizeof(*registerset_constants_column_array_int_float)},
5811 /* matrix row */
5812 {"float r3x2", "rf", 0, D3DXRS_FLOAT4, registerset_blob_row, registerset_test_row_float,
5813 sizeof(registerset_test_row_float) / sizeof(*registerset_test_row_float),
5814 registerset_constants_row_float,
5815 sizeof(registerset_constants_row_float) / sizeof(*registerset_constants_row_float)},
5816 {"int r3x2", "rn", 0, D3DXRS_INT4, registerset_blob_row, registerset_test_row_int,
5817 sizeof(registerset_test_row_int) / sizeof(*registerset_test_row_int),
5818 registerset_constants_row_int,
5819 sizeof(registerset_constants_row_int) / sizeof(*registerset_constants_row_int)},
5820 {"bool r3x2", "rb", 0, D3DXRS_BOOL, registerset_blob_row, registerset_test_row_bool,
5821 sizeof(registerset_test_row_bool) / sizeof(*registerset_test_row_bool),
5822 registerset_constants_row_bool,
5823 sizeof(registerset_constants_row_bool) / sizeof(*registerset_constants_row_bool)},
5824 {"bool float r3x2", "rbf", 12, D3DXRS_FLOAT4, registerset_blob_row,
5825 registerset_test_row_bool_float,
5826 sizeof(registerset_test_row_bool_float) / sizeof(*registerset_test_row_bool_float),
5827 registerset_constants_row_bool_float,
5828 sizeof(registerset_constants_row_bool_float) / sizeof(*registerset_constants_row_bool_float)},
5829 {"int float r3x2", "rnf", 24, D3DXRS_FLOAT4, registerset_blob_row,
5830 registerset_test_row_int_float,
5831 sizeof(registerset_test_row_int_float) / sizeof(*registerset_test_row_int_float),
5832 registerset_constants_row_int_float,
5833 sizeof(registerset_constants_row_int_float) / sizeof(*registerset_constants_row_int_float)},
5834 /* matrix row array */
5835 {"float 3x2 [2]", "raf", 0, D3DXRS_FLOAT4, registerset_blob_row_array, registerset_test_row_array_float,
5836 sizeof(registerset_test_row_array_float) / sizeof(*registerset_test_row_array_float),
5837 registerset_constants_row_array_float,
5838 sizeof(registerset_constants_row_array_float) / sizeof(*registerset_constants_row_array_float)},
5839 {"int 3x2 [2]", "ran", 0, D3DXRS_INT4, registerset_blob_row_array, registerset_test_row_array_int,
5840 sizeof(registerset_test_row_array_int) / sizeof(*registerset_test_row_array_int),
5841 registerset_constants_row_array_int,
5842 sizeof(registerset_constants_row_array_int) / sizeof(*registerset_constants_row_array_int)},
5843 {"bool 3x2 [2]", "rab", 0, D3DXRS_BOOL, registerset_blob_row_array, registerset_test_row_array_bool,
5844 sizeof(registerset_test_row_array_bool) / sizeof(*registerset_test_row_array_bool),
5845 registerset_constants_row_array_bool,
5846 sizeof(registerset_constants_row_array_bool) / sizeof(*registerset_constants_row_array_bool)},
5847 {"bool float 3x2 [2]", "rabf", 24, D3DXRS_FLOAT4, registerset_blob_row_array,
5848 registerset_test_row_array_bool_float,
5849 sizeof(registerset_test_row_array_bool_float) / sizeof(*registerset_test_row_array_bool_float),
5850 registerset_constants_row_array_bool_float,
5851 sizeof(registerset_constants_row_array_bool_float) / sizeof(*registerset_constants_row_array_bool_float)},
5852 {"int float 3x2 [2]", "ranf", 48, D3DXRS_FLOAT4, registerset_blob_row_array,
5853 registerset_test_row_array_int_float,
5854 sizeof(registerset_test_row_array_int_float) / sizeof(*registerset_test_row_array_int_float),
5855 registerset_constants_row_array_int_float,
5856 sizeof(registerset_constants_row_array_int_float) / sizeof(*registerset_constants_row_array_int_float)},
5857 /* struct */
5858 {"struct float", "sf", 0, D3DXRS_FLOAT4, registerset_blob_struct, registerset_test_struct_float,
5859 sizeof(registerset_test_struct_float) / sizeof(*registerset_test_struct_float),
5860 registerset_constants_struct_float,
5861 sizeof(registerset_constants_struct_float) / sizeof(*registerset_constants_struct_float)},
5862 {"struct int", "sn", 0, D3DXRS_INT4, registerset_blob_struct, registerset_test_struct_int,
5863 sizeof(registerset_test_struct_int) / sizeof(*registerset_test_struct_int),
5864 registerset_constants_struct_int,
5865 sizeof(registerset_constants_struct_int) / sizeof(*registerset_constants_struct_int)},
5866 {"struct bool", "sb", 0, D3DXRS_BOOL, registerset_blob_struct, registerset_test_struct_bool,
5867 sizeof(registerset_test_struct_bool) / sizeof(*registerset_test_struct_bool),
5868 registerset_constants_struct_bool,
5869 sizeof(registerset_constants_struct_bool) / sizeof(*registerset_constants_struct_bool)},
5870 {"struct bool float", "sbf", 16, D3DXRS_FLOAT4, registerset_blob_struct,
5871 registerset_test_struct_bool_float,
5872 sizeof(registerset_test_struct_bool_float) / sizeof(*registerset_test_struct_bool_float),
5873 registerset_constants_struct_bool_float,
5874 sizeof(registerset_constants_struct_bool_float) / sizeof(*registerset_constants_struct_bool_float)},
5875 {"struct int float", "snf", 8, D3DXRS_FLOAT4, registerset_blob_struct,
5876 registerset_test_struct_int_float,
5877 sizeof(registerset_test_struct_int_float) / sizeof(*registerset_test_struct_int_float),
5878 registerset_constants_struct_int_float,
5879 sizeof(registerset_constants_struct_int_float) / sizeof(*registerset_constants_struct_int_float)},
5880 /* struct array */
5881 {"struct float [2]", "saf", 0, D3DXRS_FLOAT4, registerset_blob_struct_array, registerset_test_struct_array_float,
5882 sizeof(registerset_test_struct_array_float) / sizeof(*registerset_test_struct_array_float),
5883 registerset_constants_struct_array_float,
5884 sizeof(registerset_constants_struct_array_float) / sizeof(*registerset_constants_struct_array_float)},
5885 {"struct int [2]", "san", 0, D3DXRS_INT4, registerset_blob_struct_array, registerset_test_struct_array_int,
5886 sizeof(registerset_test_struct_array_int) / sizeof(*registerset_test_struct_array_int),
5887 registerset_constants_struct_array_int,
5888 sizeof(registerset_constants_struct_array_int) / sizeof(*registerset_constants_struct_array_int)},
5889 {"struct bool [2]", "sab", 0, D3DXRS_BOOL, registerset_blob_struct_array, registerset_test_struct_array_bool,
5890 sizeof(registerset_test_struct_array_bool) / sizeof(*registerset_test_struct_array_bool),
5891 registerset_constants_struct_array_bool,
5892 sizeof(registerset_constants_struct_array_bool) / sizeof(*registerset_constants_struct_array_bool)},
5893 {"struct bool float [2]", "sabf", 32, D3DXRS_FLOAT4, registerset_blob_struct_array,
5894 registerset_test_struct_array_bool_float,
5895 sizeof(registerset_test_struct_array_bool_float) / sizeof(*registerset_test_struct_array_bool_float),
5896 registerset_constants_struct_array_bool_float,
5897 sizeof(registerset_constants_struct_array_bool_float) / sizeof(*registerset_constants_struct_array_bool_float)},
5898 {"struct int float [2]", "sanf", 16, D3DXRS_FLOAT4, registerset_blob_struct_array,
5899 registerset_test_struct_array_int_float,
5900 sizeof(registerset_test_struct_array_int_float) / sizeof(*registerset_test_struct_array_int_float),
5901 registerset_constants_struct_array_int_float,
5902 sizeof(registerset_constants_struct_array_int_float) / sizeof(*registerset_constants_struct_array_int_float)},
5903 /* struct struct */
5904 {"struct struct float", "ssf", 0, D3DXRS_FLOAT4, registerset_blob_struct_struct, registerset_test_struct_struct_float,
5905 sizeof(registerset_test_struct_struct_float) / sizeof(*registerset_test_struct_struct_float),
5906 registerset_constants_struct_struct_float,
5907 sizeof(registerset_constants_struct_struct_float) / sizeof(*registerset_constants_struct_struct_float)},
5908 {"struct struct int", "ssn", 0, D3DXRS_INT4, registerset_blob_struct_struct, registerset_test_struct_struct_int,
5909 sizeof(registerset_test_struct_struct_int) / sizeof(*registerset_test_struct_struct_int),
5910 registerset_constants_struct_struct_int,
5911 sizeof(registerset_constants_struct_struct_int) / sizeof(*registerset_constants_struct_struct_int)},
5912 {"struct struct bool", "ssb", 0, D3DXRS_BOOL, registerset_blob_struct_struct, registerset_test_struct_struct_bool,
5913 sizeof(registerset_test_struct_struct_bool) / sizeof(*registerset_test_struct_struct_bool),
5914 registerset_constants_struct_struct_bool,
5915 sizeof(registerset_constants_struct_struct_bool) / sizeof(*registerset_constants_struct_struct_bool)},
5916 {"struct struct bool float", "ssbf", 32, D3DXRS_FLOAT4, registerset_blob_struct_struct,
5917 registerset_test_struct_struct_bool_float,
5918 sizeof(registerset_test_struct_struct_bool_float) / sizeof(*registerset_test_struct_struct_bool_float),
5919 registerset_constants_struct_struct_bool_float,
5920 sizeof(registerset_constants_struct_struct_bool_float) / sizeof(*registerset_constants_struct_struct_bool_float)},
5921 {"struct struct int float", "ssnf", 16, D3DXRS_FLOAT4, registerset_blob_struct_struct,
5922 registerset_test_struct_struct_int_float,
5923 sizeof(registerset_test_struct_struct_int_float) / sizeof(*registerset_test_struct_struct_int_float),
5924 registerset_constants_struct_struct_int_float,
5925 sizeof(registerset_constants_struct_struct_int_float) / sizeof(*registerset_constants_struct_struct_int_float)},
5926 /* special */
5927 {"int ran", "ran", 0, D3DXRS_INT4, registerset_blob_special_int, NULL, 0,
5928 registerset_constants_special_int,
5929 sizeof(registerset_constants_special_int) / sizeof(*registerset_constants_special_int)},
5930 {"bigvec", "vaf", 0, D3DXRS_FLOAT4, registerset_blob_bigvec, registerset_test_bigvec_float,
5931 sizeof(registerset_test_bigvec_float) / sizeof(*registerset_test_bigvec_float),
5932 registerset_constants_bigvec_float,
5933 sizeof(registerset_constants_bigvec_float) / sizeof(*registerset_constants_bigvec_float)},
5934 {"cf", "cf", 0, D3DXRS_FLOAT4, registerset_blob_matrix_column_clamp,
5935 registerset_test_matrix_column_clamp,
5936 sizeof(registerset_test_matrix_column_clamp) / sizeof(*registerset_test_matrix_column_clamp),
5937 registerset_constants_matrix_column_clamp,
5938 sizeof(registerset_constants_matrix_column_clamp) / sizeof(*registerset_constants_matrix_column_clamp)},
5941 static void registerset_clear(IDirect3DDevice9 *device)
5943 DWORD zero[1024];
5944 HRESULT hr;
5946 memset(zero, 0xde, 4096);
5948 hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 0, (FLOAT*)zero, 256);
5949 ok(hr == D3D_OK, "Clear failed, got %08x, expected %08x\n", hr, D3D_OK);
5951 hr = IDirect3DDevice9_SetPixelShaderConstantF(device, 0, (FLOAT*)zero, 224);
5952 ok(hr == D3D_OK, "Clear failed, got %08x, expected %08x\n", hr, D3D_OK);
5954 hr = IDirect3DDevice9_SetVertexShaderConstantB(device, 0, (BOOL*)zero, 16);
5955 ok(hr == D3D_OK, "Clear failed, got %08x, expected %08x\n", hr, D3D_OK);
5957 hr = IDirect3DDevice9_SetPixelShaderConstantB(device, 0, (BOOL*)zero, 16);
5958 ok(hr == D3D_OK, "Clear failed, got %08x, expected %08x\n", hr, D3D_OK);
5960 hr = IDirect3DDevice9_SetVertexShaderConstantI(device, 0, (INT*)zero, 16);
5961 ok(hr == D3D_OK, "Clear failed, got %08x, expected %08x\n", hr, D3D_OK);
5963 hr = IDirect3DDevice9_SetPixelShaderConstantI(device, 0, (INT*)zero, 16);
5964 ok(hr == D3D_OK, "Clear failed, got %08x, expected %08x\n", hr, D3D_OK);
5967 static UINT registerset_compare(IDirect3DDevice9 *device, BOOL is_vs, D3DXREGISTER_SET regset,
5968 UINT start, UINT in_count, const DWORD *expected)
5970 DWORD ret[1024] = {0};
5971 HRESULT hr;
5972 UINT count = 1024, i, err = 0;
5974 memset(ret, 0xde, 4096);
5976 /* get shader constants */
5977 switch (regset)
5979 case D3DXRS_BOOL:
5980 count = 16;
5981 if (is_vs) hr = IDirect3DDevice9_GetVertexShaderConstantB(device, 0, (BOOL*)ret, 16);
5982 else hr = IDirect3DDevice9_GetPixelShaderConstantB(device, 0, (BOOL*)ret, 16);
5983 ok(hr == D3D_OK, "Get*ShaderConstantB failed, got %08x\n", hr);
5984 break;
5986 case D3DXRS_INT4:
5987 count = 256;
5988 if (is_vs) hr = IDirect3DDevice9_GetVertexShaderConstantI(device, 0, (INT*)ret, 16);
5989 else hr = IDirect3DDevice9_GetPixelShaderConstantI(device, 0, (INT*)ret, 16);
5990 ok(hr == D3D_OK, "Get*ShaderConstantI failed, got %08x\n", hr);
5991 break;
5993 case D3DXRS_FLOAT4:
5994 if (is_vs) hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 0, (FLOAT*)ret, 256);
5995 else
5997 count = 896;
5998 hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 0, (FLOAT*)ret, 224);
6000 ok(hr == D3D_OK, "Get*ShaderConstantF failed, got %08x\n", hr);
6001 break;
6003 default:
6004 ok(0, "This should not happen!\n");
6005 break;
6008 /* compare shader constants */
6009 for (i = 0; i < count; ++i)
6011 DWORD value = 0xdededede;
6012 if (i >= start && i < start + in_count) value = expected[i - start];
6014 ok(ret[i] == value, "Get*ShaderConstant failed, %u got 0x%x(%f) expected 0x%x(%f)\n", i,
6015 ret[i], ((FLOAT *)ret)[i], value, *((FLOAT *)&value));
6016 if (ret[i] != value) err++;
6019 return err;
6022 static UINT registerset_compare_all(IDirect3DDevice9 *device, BOOL is_vs, D3DXREGISTER_SET regset,
6023 UINT start, UINT in_count, const DWORD *expected)
6025 D3DXREGISTER_SET regsets[] = {D3DXRS_BOOL, D3DXRS_INT4, D3DXRS_FLOAT4};
6026 UINT err = 0, i;
6028 for (i = 0; i < sizeof(regsets) / sizeof(*regsets); i++)
6030 if (regset == regsets[i])
6031 err += registerset_compare(device, is_vs, regset, start, in_count, expected);
6032 else
6033 err += registerset_compare(device, is_vs, regsets[i], 0, 0, NULL);
6035 err += registerset_compare(device, !is_vs, regsets[i], 0, 0, NULL);
6038 return err;
6041 static HRESULT registerset_apply(ID3DXConstantTable *ctable, IDirect3DDevice9 *device, D3DXHANDLE constant,
6042 UINT index, DWORD count, enum Type type)
6044 const DWORD *in = registerset_test_input[index];
6045 const D3DXMATRIX *inp[REGISTER_OUTPUT_SIZE / 16];
6046 unsigned int i;
6048 /* overlap, to see the difference between Array and PointerArray */
6049 for (i = 0; i < REGISTER_OUTPUT_SIZE / 16; i++)
6051 inp[i] = (D3DXMATRIX *)&in[i * 15];
6054 switch (type)
6056 case SetInt:
6057 return ID3DXConstantTable_SetInt(ctable, device, constant, *((INT *)in));
6058 case SetFloat:
6059 return ID3DXConstantTable_SetFloat(ctable, device, constant, *((FLOAT *)in));
6060 case SetBool:
6061 return ID3DXConstantTable_SetBool(ctable, device, constant, *((BOOL *)in));
6062 case SetIntArray:
6063 return ID3DXConstantTable_SetIntArray(ctable, device, constant, (INT *)in, count);
6064 case SetBoolArray:
6065 return ID3DXConstantTable_SetBoolArray(ctable, device, constant, (BOOL *)in, count);
6066 case SetFloatArray:
6067 return ID3DXConstantTable_SetFloatArray(ctable, device, constant, (FLOAT *)in, count);
6068 case SetMatrix:
6069 return ID3DXConstantTable_SetMatrix(ctable, device, constant, (D3DXMATRIX *)in);
6070 case SetMatrixTranspose:
6071 return ID3DXConstantTable_SetMatrixTranspose(ctable, device, constant, (D3DXMATRIX *)in);
6072 case SetMatrixArray:
6073 return ID3DXConstantTable_SetMatrixArray(ctable, device, constant, (D3DXMATRIX *)in, count);
6074 case SetMatrixTransposeArray:
6075 return ID3DXConstantTable_SetMatrixTransposeArray(ctable, device, constant, (D3DXMATRIX *)in, count);
6076 case SetVector:
6077 return ID3DXConstantTable_SetVector(ctable, device, constant, (D3DXVECTOR4 *)in);
6078 case SetVectorArray:
6079 return ID3DXConstantTable_SetVectorArray(ctable, device, constant, (D3DXVECTOR4 *)in, count);
6080 case SetValue:
6081 return ID3DXConstantTable_SetValue(ctable, device, constant, in, count);
6082 case SetMatrixPointerArray:
6083 return ID3DXConstantTable_SetMatrixPointerArray(ctable, device, constant, inp, count);
6084 case SetMatrixTransposePointerArray:
6085 return ID3DXConstantTable_SetMatrixTransposePointerArray(ctable, device, constant, inp, count);
6088 ok(0, "This should not happen!\n");
6089 return D3D_OK;
6092 static void test_registerset(void)
6094 UINT k;
6095 HWND wnd;
6096 IDirect3D9 *d3d;
6097 IDirect3DDevice9 *device;
6098 D3DPRESENT_PARAMETERS d3dpp;
6099 HRESULT hr;
6100 ULONG count;
6101 D3DCAPS9 caps;
6103 if (!(wnd = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
6104 640, 480, NULL, NULL, NULL, NULL)))
6106 skip("Couldn't create application window\n");
6107 return;
6109 if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
6111 skip("Couldn't create IDirect3D9 object\n");
6112 DestroyWindow(wnd);
6113 return;
6116 ZeroMemory(&d3dpp, sizeof(d3dpp));
6117 d3dpp.Windowed = TRUE;
6118 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
6119 hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &device);
6120 if (FAILED(hr))
6122 skip("Failed to create IDirect3DDevice9 object %#x\n", hr);
6123 IDirect3D9_Release(d3d);
6124 DestroyWindow(wnd);
6125 return;
6128 hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
6129 ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
6130 if (caps.VertexShaderVersion < D3DVS_VERSION(3, 0)
6131 || caps.PixelShaderVersion < D3DPS_VERSION(3, 0))
6133 skip("Skipping: Test requires VS >= 3 and PS >= 3.\n");
6134 IDirect3DDevice9_Release(device);
6135 IDirect3D9_Release(d3d);
6136 DestroyWindow(wnd);
6137 return;
6140 for (k = 0; k < sizeof(registerset_data) / sizeof(*registerset_data); ++k)
6142 const char *tablename = registerset_data[k].name;
6143 const char *name = registerset_data[k].var;
6144 ID3DXConstantTable *ctable;
6145 D3DXCONSTANTTABLE_DESC tdesc;
6146 D3DXHANDLE constant;
6147 UINT i;
6148 BOOL is_vs;
6149 DWORD *ctab;
6151 hr = D3DXGetShaderConstantTable(registerset_data[k].blob, &ctable);
6152 ok(hr == D3D_OK, "D3DXGetShaderConstantTable \"%s\" failed, got %08x, expected %08x\n", tablename, hr, D3D_OK);
6154 hr = ID3DXConstantTable_GetDesc(ctable, &tdesc);
6155 ok(hr == D3D_OK, "GetDesc \"%s\" failed, got %08x, expected %08x\n", tablename, hr, D3D_OK);
6157 ctab = ID3DXConstantTable_GetBufferPointer(ctable);
6158 ok(ctab[0] == registerset_data[k].blob[3], "ID3DXConstantTable_GetBufferPointer failed\n");
6160 is_vs = (tdesc.Version & 0xFFFF0000) == 0xFFFE0000;
6162 for (i = 0; i < registerset_data[k].constant_count; ++i)
6164 const char *fullname = registerset_data[k].constants[i].fullname;
6165 const D3DXCONSTANT_DESC *expected_desc = &registerset_data[k].constants[i].desc;
6166 D3DXCONSTANT_DESC desc;
6167 UINT nr = 0;
6168 UINT ctaboffset = registerset_data[k].constants[i].ctaboffset;
6170 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, fullname);
6171 ok(constant != NULL, "GetConstantByName \"%s\" failed\n", fullname);
6173 hr = ID3DXConstantTable_GetConstantDesc(ctable, constant, &desc, &nr);
6174 ok(hr == D3D_OK, "GetConstantDesc \"%s\" failed, got %08x, expected %08x\n", fullname, hr, D3D_OK);
6176 ok(!strcmp(expected_desc->Name, desc.Name), "GetConstantDesc \"%s\" failed, got \"%s\", expected \"%s\"\n",
6177 fullname, desc.Name, expected_desc->Name);
6178 ok(expected_desc->RegisterSet == desc.RegisterSet, "GetConstantDesc \"%s\" failed, got %#x, expected %#x\n",
6179 fullname, desc.RegisterSet, expected_desc->RegisterSet);
6180 ok(expected_desc->RegisterIndex == desc.RegisterIndex,
6181 "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6182 fullname, desc.RegisterIndex, expected_desc->RegisterIndex);
6183 ok(expected_desc->RegisterCount == desc.RegisterCount,
6184 "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6185 fullname, desc.RegisterCount, expected_desc->RegisterCount);
6186 ok(expected_desc->Class == desc.Class, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6187 fullname, desc.Class, expected_desc->Class);
6188 ok(expected_desc->Type == desc.Type, "GetConstantDesc \"%s\" failed, got %#x, expected %#x\n",
6189 fullname, desc.Type, expected_desc->Type);
6190 ok(expected_desc->Rows == desc.Rows, "GetConstantDesc \"%s\" failed, got %#x, expected %#x\n",
6191 fullname, desc.Rows, expected_desc->Rows);
6192 ok(expected_desc->Columns == desc.Columns, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6193 fullname, desc.Columns, expected_desc->Columns);
6194 ok(expected_desc->Elements == desc.Elements, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6195 fullname, desc.Elements, expected_desc->Elements);
6196 ok(expected_desc->StructMembers == desc.StructMembers,
6197 "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6198 fullname, desc.StructMembers, expected_desc->StructMembers);
6199 ok(expected_desc->Bytes == desc.Bytes, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6200 fullname, desc.Bytes, expected_desc->Bytes);
6201 if (ctaboffset)
6203 ok(ctaboffset == (DWORD *)desc.DefaultValue - ctab,
6204 "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6205 fullname, (UINT)((DWORD *)desc.DefaultValue - ctab), ctaboffset);
6209 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, name);
6210 ok(constant != NULL, "GetConstantByName \"%s\" \"%s\" failed\n", tablename, name);
6212 for (i = 0; i < registerset_data[k].test_count; ++i)
6214 const struct registerset_test *test = &registerset_data[k].tests[i];
6215 UINT ret;
6217 registerset_clear(device);
6219 hr = registerset_apply(ctable, device, constant, test->in_index, test->in_count_min, test->type);
6220 ok(hr == D3D_OK, "Set* \"%s\" index %u, count %u failed, got %x, expected %x\n", tablename, i,
6221 test->in_count_min, hr, D3D_OK);
6223 ret = registerset_compare_all(device, is_vs, registerset_data[k].regset,
6224 registerset_data[k].start, test->out_count, test->out);
6225 ok(ret == 0, "Get*ShaderConstant \"%s\" index %u, count %u failed\n", tablename, i, test->in_count_min);
6227 if (test->in_count_max > test->in_count_min)
6229 registerset_clear(device);
6231 hr = registerset_apply(ctable, device, constant, test->in_index, test->in_count_max, test->type);
6232 ok(hr == D3D_OK, "Set* \"%s\" index %u, count %u failed, got %x, expected %x\n", tablename, i,
6233 test->in_count_max, hr, D3D_OK);
6235 ret = registerset_compare_all(device, is_vs, registerset_data[k].regset,
6236 registerset_data[k].start, test->out_count, test->out);
6237 ok(ret == 0, "Get*ShaderConstant \"%s\" index %u, count %u failed\n", tablename, i, test->in_count_max);
6241 count = ID3DXConstantTable_Release(ctable);
6242 ok(count == 0, "Release \"%s\" failed, got %u, expected %u\n", tablename, count, 0);
6245 /* Release resources */
6246 count = IDirect3DDevice9_Release(device);
6247 ok(count == 0, "The Direct3D device reference count was %u, should be 0\n", count);
6249 count = IDirect3D9_Release(d3d);
6250 ok(count == 0, "The Direct3D object referenct count was %u, should be 0\n", count);
6252 if (wnd) DestroyWindow(wnd);
6256 * For D3DXRS_INT4 (int_count, ints[]):
6257 * Native seems to just set the following shader blob up to the register count, which in bad cases is up
6258 * to 4 times larger than the actual correct value. This explanes where the "bogus" values for these cases
6259 * come from. Somehow they forgot that the registers are INT4 and not INT.
6261 static const struct
6263 const char *name;
6264 const DWORD *blob;
6265 unsigned int float_count;
6266 unsigned int int_count;
6267 unsigned int bool_count;
6268 const DWORD floats[1024];
6269 const DWORD ints[256];
6270 const DWORD bools[16];
6272 registerset_defaults_data[] =
6274 {"scalar", registerset_blob_scalar, 12, 4, 1,
6275 {0x40a33333, 0x00000000, 0x00000000, 0x00000000, 0x41300000, 0x00000000, 0x00000000, 0x00000000,
6276 0x3f800000, 0x00000000, 0x00000000, 0x00000000},
6277 {0x00000008, 0x00000000, 0x00000001},
6278 {0xffffffff}},
6279 {"scalar array", registerset_blob_scalar_array, 24, 8, 2,
6280 {0x40466666, 0x00000000, 0x00000000, 0x00000000, 0x404ccccd, 0x00000000, 0x00000000, 0x00000000,
6281 0x41600000, 0x00000000, 0x00000000, 0x00000000, 0x41700000, 0x00000000, 0x00000000, 0x00000000,
6282 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000},
6283 {0x00000020, 0x00000000, 0x00000001, 0x00000000, 0x00000021, 0x00000000, 0x00000001, 0x00000000},
6284 {0xffffffff, 0x00000000}},
6285 {"vector", registerset_blob_vector, 12, 12, 3,
6286 {0x40a33333, 0x40a66666, 0x40a9999a, 0x00000000, 0x41300000, 0x42aa0000, 0x42780000, 0x00000000,
6287 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000},
6288 {0x00000007, 0x00000008, 0x00000009, 0x00000000, 0x00666e76, 0x41300000, 0x42aa0000, 0x42780000,
6289 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369},
6290 {0xffffffff, 0x00000000, 0xffffffff}},
6291 {"vector array", registerset_blob_vector_array, 24, 24, 6,
6292 {0x425c6666, 0x425ccccd, 0x425d3333, 0x00000000, 0x425d999a, 0x425e0000, 0x425e6666, 0x00000000,
6293 0x43020000, 0x430c0000, 0x43160000, 0x00000000, 0x43200000, 0x432a0000, 0x43340000, 0x00000000,
6294 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000},
6295 {0x00000046, 0x00000050, 0x0000005a, 0x00000000, 0x00000064, 0x0000006e, 0x00000078, 0x00000000,
6296 0x666e6176, 0xababab00, 0x00020001, 0x00030001, 0x00000002, 0x00000000, 0x43020000, 0x430c0000,
6297 0x43160000, 0x00000000, 0x43200000, 0x432a0000, 0x43340000, 0x00000000, 0x335f7376, 0x4d00305f},
6298 {0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff}},
6299 {"column", registerset_blob_column, 24, 24, 6,
6300 {0x4171999a, 0x4174cccd, 0x41780000, 0x00000000, 0x41733333, 0x41766666, 0x4179999a, 0x00000000,
6301 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
6302 0x41f00000, 0x42040000, 0x42080000, 0x00000000, 0x41f80000, 0x42000000, 0x42100000, 0x00000000},
6303 {0x00000004, 0x00000006, 0x00000008, 0x00000000, 0x00000005, 0x00000007, 0x00000009, 0x00000000,
6304 0x00666e63, 0x41f00000, 0x42040000, 0x42080000, 0x00000000, 0x41f80000, 0x42000000, 0x42100000,
6305 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c},
6306 {0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff}},
6307 {"column array", registerset_blob_column_array, 48, 48, 12,
6308 {0x3f8ccccd, 0x40533333, 0x40b00000, 0x00000000, 0x400ccccd, 0x408ccccd, 0x40d33333, 0x00000000,
6309 0x40f66666, 0x411e6666, 0x3fa66666, 0x00000000, 0x410ccccd, 0x3f99999a, 0x3fb33333, 0x00000000,
6310 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
6311 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
6312 0x43960000, 0x43978000, 0x43980000, 0x00000000, 0x43968000, 0x43970000, 0x43990000, 0x00000000,
6313 0x43af0000, 0x44238000, 0x43a30000, 0x00000000, 0x43b68000, 0x44190000, 0x4479c000, 0x00000000},
6314 {0x0000000e, 0x00000010, 0x00000012, 0x00000000, 0x0000000f, 0x00000047, 0x00000013, 0x00000000,
6315 0x00000037, 0x00000060, 0x00000061, 0x00000000, 0x0000003f, 0x00000060, 0x0000000d, 0x00000000,
6316 0x666e6163, 0xababab00, 0x00020003, 0x00020003, 0x00000002, 0x00000000, 0x43960000, 0x43978000,
6317 0x43980000, 0x00000000, 0x43968000, 0x43970000, 0x43990000, 0x00000000, 0x43af0000, 0x44238000,
6318 0x43a30000, 0x00000000, 0x43b68000, 0x44190000, 0x4479c000, 0x00000000, 0x335f7376, 0x4d00305f,
6319 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970},
6320 {0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000,
6321 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff}},
6322 {"row", registerset_blob_row, 36, 24, 6,
6323 {0x42be3333, 0x42be6666, 0x00000000, 0x00000000, 0x42be999a, 0x42becccd, 0x00000000, 0x00000000,
6324 0x42bf0000, 0x42bf3333, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
6325 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
6326 0x42140000, 0x41500000, 0x00000000, 0x00000000, 0x42c40000, 0x42580000, 0x00000000, 0x00000000,
6327 0x429a0000, 0x42100000, 0x00000000, 0x00000000},
6328 {0x00000050, 0x00000051, 0x00000001, 0x00000000, 0x00000052, 0x00000053, 0x00000001, 0x00000000,
6329 0x00000054, 0x00000055, 0x00000001, 0x00000000, 0x00666e72, 0x42140000, 0x41500000, 0x00000000,
6330 0x00000000, 0x42c40000, 0x42580000, 0x00000000, 0x00000000, 0x429a0000, 0x42100000, 0x00000000},
6331 {0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff}},
6332 {"row array", registerset_blob_row_array, 72, 48, 12,
6333 {0x3fc00000, 0x40333333, 0x00000000, 0x00000000, 0x40533333, 0x409ccccd, 0x00000000, 0x00000000,
6334 0x40bccccd, 0x40d9999a, 0x00000000, 0x00000000, 0x40fccccd, 0x41080000, 0x00000000, 0x00000000,
6335 0x41166666, 0x3fa66666, 0x00000000, 0x00000000, 0x3f99999a, 0x3f8ccccd, 0x00000000, 0x00000000,
6336 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
6337 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
6338 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
6339 0x420c0000, 0x42200000, 0x00000000, 0x00000000, 0x42700000, 0x42a00000, 0x00000000, 0x00000000,
6340 0x428c0000, 0x42600000, 0x00000000, 0x00000000, 0x42140000, 0x41500000, 0x00000000, 0x00000000,
6341 0x42c40000, 0x42580000, 0x00000000, 0x00000000, 0x429a0000, 0x42100000, 0x00000000, 0x00000000},
6342 {0x00000004, 0x00000005, 0x00000001, 0x00000000, 0x00000006, 0x00000001, 0x00000001, 0x00000000,
6343 0x00000008, 0x00000001, 0x00000001, 0x00000000, 0x00000005, 0x00000003, 0x00000001, 0x00000000,
6344 0x00000009, 0x00000006, 0x00000001, 0x00000000, 0x00000007, 0x00000003, 0x00000001, 0x00000000,
6345 0x666e6172, 0xababab00, 0x00020002, 0x00020003, 0x00000002, 0x00000000, 0x420c0000, 0x42200000,
6346 0x00000000, 0x00000000, 0x42700000, 0x42a00000, 0x00000000, 0x00000000, 0x428c0000, 0x42600000,
6347 0x00000000, 0x00000000, 0x42140000, 0x41500000, 0x00000000, 0x00000000, 0x42c40000, 0x42580000},
6348 {0xffffffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
6349 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff}},
6350 {"struct", registerset_blob_struct, 24, 16, 4,
6351 {0x3f8ccccd, 0x00000000, 0x00000000, 0x00000000, 0x400ccccd, 0x40533333, 0x408ccccd, 0x00000000,
6352 0x41f80000, 0x00000000, 0x00000000, 0x00000000, 0x42000000, 0x42040000, 0x42080000, 0x00000000,
6353 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000},
6354 {0x0000000b, 0x00000000, 0x00000001, 0x00000000, 0x0000000c, 0x0000000d, 0x0000000e, 0x00000000,
6355 0x00666e73, 0x7600666e, 0xab00666e, 0x00000204, 0x0000019c, 0x00000207, 0x000001b0, 0x00000005},
6356 {0xffffffff, 0xffffffff, 0x00000000, 0xffffffff}},
6357 {"struct array", registerset_blob_struct_array, 48, 32, 8,
6358 {0x3f8ccccd, 0x00000000, 0x00000000, 0x00000000, 0x40066666, 0x40466666, 0x40833333, 0x00000000,
6359 0x40a33333, 0x00000000, 0x00000000, 0x00000000, 0x40c33333, 0x40e33333, 0x4101999a, 0x00000000,
6360 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x422c0000, 0x42300000, 0x00000000,
6361 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x42280000, 0x422c0000, 0x42300000, 0x00000000,
6362 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000,
6363 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000},
6364 {0x00000015, 0x00000000, 0x00000001, 0x00000000, 0x00000016, 0x00000017, 0x00000018, 0x00000000,
6365 0x00000019, 0x00000000, 0x00000001, 0x00000000, 0x0000001a, 0x0000001b, 0x0000001c, 0x00000000,
6366 0x666e6173, 0x00666e00, 0x00666e76, 0x00000275, 0x000001ec, 0x00000278, 0x00000200, 0x00000005,
6367 0x00040001, 0x00020002, 0x0000027c, 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
6368 {0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff}},
6369 {"struct struct", registerset_blob_struct_struct, 48, 24, 6,
6370 {0x3f8ccccd, 0x00000000, 0x00000000, 0x00000000, 0x40066666, 0x00000000, 0x00000000, 0x00000000,
6371 0x40466666, 0x40833333, 0x40a33333, 0x00000000, 0x40c33333, 0x00000000, 0x00000000, 0x00000000,
6372 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6373 0x422c0000, 0x42300000, 0x42240000, 0x00000000, 0x42280000, 0x00000000, 0x00000000, 0x00000000,
6374 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6375 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
6376 {0x00000047, 0x00000000, 0x00000001, 0x00000000, 0x00000048, 0x00000000, 0x00000001, 0x00000000,
6377 0x00000049, 0x0000004a, 0x0000004b, 0x00000000, 0x0000004c, 0x00000000, 0x00000001, 0x00000000,
6378 0x666e7373, 0x00666e00, 0x00666e76, 0x00000321, 0x0000026c, 0x00000324, 0x00000280, 0x00000005},
6379 {0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000}},
6380 {"int ran", registerset_blob_special_int, 0, 36, 0,
6381 {0x00000000},
6382 {0x00000004, 0x00000005, 0x00000001, 0x00000000, 0x00000006, 0x00000001, 0x00000001, 0x00000000,
6383 0x00000008, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0x00000003, 0x00000001, 0x00000000,
6384 0x00000004, 0x00000007, 0x00000001, 0x00000000, 0x00000009, 0x00000001, 0x00000001, 0x00000000,
6385 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
6386 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932},
6387 {0x00000000}},
6388 /* DefaultValue = NULL */
6389 {"big vector", registerset_blob_bigvec},
6390 {"matrix column clamp", registerset_blob_matrix_column_clamp, 12, 0, 0,
6391 {0x3f8ccccd, 0x40b00000, 0x411e6666, 0x3fc00000, 0x400ccccd, 0x40d33333, 0x3f99999a, 0x3fcccccd,
6392 0x420551ec, 0x00000000, 0x00000000, 0x00000000},
6393 {0x00000000},
6394 {0x00000000}},
6397 static void test_registerset_defaults(void)
6399 UINT k;
6400 HWND wnd;
6401 IDirect3D9 *d3d;
6402 IDirect3DDevice9 *device;
6403 D3DPRESENT_PARAMETERS d3dpp;
6404 HRESULT hr;
6405 ULONG count;
6406 D3DCAPS9 caps;
6408 if (!(wnd = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
6409 640, 480, NULL, NULL, NULL, NULL)))
6411 skip("Couldn't create application window\n");
6412 return;
6414 if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
6416 skip("Couldn't create IDirect3D9 object\n");
6417 DestroyWindow(wnd);
6418 return;
6421 ZeroMemory(&d3dpp, sizeof(d3dpp));
6422 d3dpp.Windowed = TRUE;
6423 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
6424 hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &device);
6425 if (FAILED(hr))
6427 skip("Failed to create IDirect3DDevice9 object %#x\n", hr);
6428 IDirect3D9_Release(d3d);
6429 DestroyWindow(wnd);
6430 return;
6433 hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
6434 ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
6435 if (caps.VertexShaderVersion < D3DVS_VERSION(3, 0)
6436 || caps.PixelShaderVersion < D3DPS_VERSION(3, 0))
6438 skip("Skipping: Test requires VS >= 3 and PS >= 3.\n");
6439 IDirect3DDevice9_Release(device);
6440 IDirect3D9_Release(d3d);
6441 DestroyWindow(wnd);
6442 return;
6445 for (k = 0; k < sizeof(registerset_defaults_data) / sizeof(*registerset_defaults_data); ++k)
6447 const char *tablename = registerset_defaults_data[k].name;
6448 ID3DXConstantTable *ctable;
6449 D3DXCONSTANTTABLE_DESC tdesc;
6450 BOOL is_vs;
6451 UINT ret;
6453 hr = D3DXGetShaderConstantTable(registerset_defaults_data[k].blob, &ctable);
6454 ok(hr == D3D_OK, "D3DXGetShaderConstantTable \"%s\" failed, got %08x, expected %08x\n", tablename, hr, D3D_OK);
6456 hr = ID3DXConstantTable_GetDesc(ctable, &tdesc);
6457 ok(hr == D3D_OK, "GetDesc \"%s\" failed, got %08x, expected %08x\n", tablename, hr, D3D_OK);
6459 is_vs = (tdesc.Version & 0xFFFF0000) == 0xFFFE0000;
6461 registerset_clear(device);
6463 hr = ID3DXConstantTable_SetDefaults(ctable, device);
6464 ok(hr == D3D_OK, "SetDefaults \"%s\" failed, got %08x, expected %08x\n", tablename, hr, D3D_OK);
6466 ret = registerset_compare(device, is_vs, D3DXRS_FLOAT4, 0, registerset_defaults_data[k].float_count,
6467 registerset_defaults_data[k].floats);
6468 ok(ret == 0, "Get*ShaderConstantF \"%s\" failed\n", tablename);
6470 ret = registerset_compare(device, is_vs, D3DXRS_INT4, 0, registerset_defaults_data[k].int_count,
6471 registerset_defaults_data[k].ints);
6472 ok(ret == 0, "Get*ShaderConstantI \"%s\" failed\n", tablename);
6474 ret = registerset_compare(device, is_vs, D3DXRS_BOOL, 0, registerset_defaults_data[k].bool_count,
6475 registerset_defaults_data[k].bools);
6476 ok(ret == 0, "Get*ShaderConstantB \"%s\" failed\n", tablename);
6478 count = ID3DXConstantTable_Release(ctable);
6479 ok(count == 0, "Release \"%s\" failed, got %u, expected %u\n", tablename, count, 0);
6482 /* Release resources */
6483 count = IDirect3DDevice9_Release(device);
6484 ok(count == 0, "The Direct3D device reference count was %u, should be 0\n", count);
6486 count = IDirect3D9_Release(d3d);
6487 ok(count == 0, "The Direct3D object referenct count was %u, should be 0\n", count);
6489 if (wnd) DestroyWindow(wnd);
6492 START_TEST(shader)
6494 test_get_shader_size();
6495 test_get_shader_version();
6496 test_find_shader_comment();
6497 test_get_shader_constant_table_ex();
6498 test_constant_tables();
6499 test_setting_constants();
6500 test_get_sampler_index();
6501 test_get_shader_samplers();
6502 test_get_shader_constant_variables();
6503 test_registerset();
6504 test_registerset_defaults();