mshtml: Implement MarkupServices_ParseString.
[wine.git] / dlls / d3dx9_36 / tests / shader.c
blob2b40abef53ca1c17d9b79a395ac58b2c2286281c
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%08lx, 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%08lx, 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%08lx, 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 %lx, expected %lx (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 %lx, 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 %lx, 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 %lx, 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 %lx, 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 %lx, 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 %lx, 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 %lx, 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 %lx, expected %lx (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 %lx, 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 %lx, 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 %lx, 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 %lx, 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 D3DXCONSTANT_DESC constant_desc_save;
407 ID3DXConstantTable *constant_table;
408 D3DXCONSTANT_DESC constant_desc;
409 D3DXCONSTANTTABLE_DESC desc;
410 D3DXHANDLE constant;
411 HRESULT hr;
412 void *data;
413 DWORD size;
414 UINT nb;
416 constant_table = (ID3DXConstantTable *)0xdeadbeef;
417 hr = D3DXGetShaderConstantTableEx(NULL, 0, &constant_table);
418 ok(hr == D3DERR_INVALIDCALL, "Got result %lx, expected %lx (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
419 ok(constant_table == NULL, "D3DXGetShaderConstantTableEx() failed, got %p\n", constant_table);
421 constant_table = (ID3DXConstantTable *)0xdeadbeef;
422 hr = D3DXGetShaderConstantTableEx(shader_zero, 0, &constant_table);
423 ok(hr == D3D_OK, "Got result %lx, expected %lx (D3D_OK)\n", hr, D3D_OK);
424 ok(constant_table == NULL, "D3DXGetShaderConstantTableEx() failed, got %p\n", constant_table);
426 constant_table = (ID3DXConstantTable *)0xdeadbeef;
427 hr = D3DXGetShaderConstantTableEx(shader_invalid, 0, &constant_table);
428 ok(hr == D3D_OK, "Got result %lx, expected %lx (D3D_OK)\n", hr, D3D_OK);
429 ok(constant_table == NULL, "D3DXGetShaderConstantTableEx() failed, got %p\n", constant_table);
431 constant_table = (ID3DXConstantTable *)0xdeadbeef;
432 hr = D3DXGetShaderConstantTableEx(shader_empty, 0, &constant_table);
433 ok(hr == D3DXERR_INVALIDDATA, "Got result %lx, expected %x (D3DXERR_INVALIDDATA)\n", hr, D3DXERR_INVALIDDATA);
434 ok(constant_table == NULL, "D3DXGetShaderConstantTableEx() failed, got %p\n", constant_table);
436 /* No CTAB data */
437 constant_table = (ID3DXConstantTable *)0xdeadbeef;
438 hr = D3DXGetShaderConstantTableEx(simple_ps, 0, &constant_table);
439 ok(hr == D3DXERR_INVALIDDATA, "Got result %lx, expected %x (D3DXERR_INVALIDDATA)\n", hr, D3DXERR_INVALIDDATA);
440 ok(constant_table == NULL, "D3DXGetShaderConstantTableEx() failed, got %p\n", constant_table);
442 /* With invalid CTAB data */
443 hr = D3DXGetShaderConstantTableEx(shader_with_invalid_ctab, 0, &constant_table);
444 ok(hr == D3DXERR_INVALIDDATA || broken(hr == D3D_OK), /* winxp 64-bit, w2k3 64-bit */
445 "Got result %lx, expected %x (D3DXERR_INVALIDDATA)\n", hr, D3DXERR_INVALIDDATA);
446 if (constant_table) ID3DXConstantTable_Release(constant_table);
448 hr = D3DXGetShaderConstantTableEx(simple_fx, 0, &constant_table);
449 ok(hr == D3D_OK, "Got result %lx, expected 0 (D3D_OK).\n", hr);
450 ok(!constant_table, "D3DXGetShaderConstantTableEx() returned a non-NULL constant table.\n");
452 hr = D3DXGetShaderConstantTableEx(simple_tx, 0, &constant_table);
453 ok(hr == D3D_OK, "Got result %lx, expected 0 (D3D_OK).\n", hr);
454 ok(!constant_table, "D3DXGetShaderConstantTableEx() returned a non-NULL constant table.\n");
456 hr = D3DXGetShaderConstantTableEx(shader_with_ctab, 0, &constant_table);
457 ok(hr == D3D_OK, "Got result %lx, expected 0 (D3D_OK)\n", hr);
458 ok(constant_table != NULL, "D3DXGetShaderConstantTableEx() failed, got NULL\n");
460 size = ID3DXConstantTable_GetBufferSize(constant_table);
461 ok(size == 28, "Unexpected size %lu.\n", size);
463 data = ID3DXConstantTable_GetBufferPointer(constant_table);
464 ok(!memcmp(data, shader_with_ctab + 6, size), "Retrieved wrong CTAB data\n");
466 hr = ID3DXConstantTable_GetDesc(constant_table, NULL);
467 ok(hr == D3DERR_INVALIDCALL, "Got result %lx, expected %lx (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
469 hr = ID3DXConstantTable_GetDesc(constant_table, &desc);
470 ok(hr == D3D_OK, "Got result %lx, expected 0 (D3D_OK)\n", hr);
471 ok(desc.Creator == (const char *)data + 0x10, "Got result %p, expected %p\n",
472 desc.Creator, (const char *)data + 0x10);
473 ok(desc.Version == D3DVS_VERSION(3, 0), "Got result %lx, expected %x\n", desc.Version, D3DVS_VERSION(3, 0));
474 ok(desc.Constants == 0, "Unexpected Constants %u.\n", desc.Constants);
476 ID3DXConstantTable_Release(constant_table);
478 hr = D3DXGetShaderConstantTableEx(shader_with_ctab_constants, 0, &constant_table);
479 ok(hr == D3D_OK, "Got result %lx, expected 0 (D3D_OK)\n", hr);
480 ok(constant_table != NULL, "D3DXGetShaderConstantTableEx() failed, got NULL\n");
482 /* Test GetDesc */
483 hr = ID3DXConstantTable_GetDesc(constant_table, &desc);
484 ok(hr == D3D_OK, "Got result %lx, expected 0 (D3D_OK)\n", hr);
485 ok(!strcmp(desc.Creator, "Wine project"), "Got result '%s', expected 'Wine project'\n", desc.Creator);
486 ok(desc.Version == D3DVS_VERSION(3, 0), "Got result %lx, expected %x\n", desc.Version, D3DVS_VERSION(3, 0));
487 ok(desc.Constants == 3, "Got result %x, expected 3\n", desc.Constants);
489 /* Test GetConstant */
490 constant = ID3DXConstantTable_GetConstant(constant_table, NULL, 0);
491 ok(constant != NULL, "No constant found\n");
492 hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &constant_desc, &nb);
493 ok(hr == D3D_OK, "Got result %lx, expected 0 (D3D_OK)\n", hr);
494 ok(!strcmp(constant_desc.Name, "Constant1"), "Got result '%s', expected 'Constant1'\n",
495 constant_desc.Name);
496 ok(constant_desc.Class == D3DXPC_VECTOR, "Got result %x, expected %u (D3DXPC_VECTOR)\n",
497 constant_desc.Class, D3DXPC_VECTOR);
498 ok(constant_desc.Type == D3DXPT_FLOAT, "Got result %x, expected %u (D3DXPT_FLOAT)\n",
499 constant_desc.Type, D3DXPT_FLOAT);
500 ok(constant_desc.Rows == 1, "Got result %x, expected 1\n", constant_desc.Rows);
501 ok(constant_desc.Columns == 4, "Got result %x, expected 4\n", constant_desc.Columns);
503 constant = ID3DXConstantTable_GetConstant(constant_table, NULL, 1);
504 ok(constant != NULL, "No constant found\n");
505 hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &constant_desc, &nb);
506 ok(hr == D3D_OK, "Got result %lx, expected 0 (D3D_OK)\n", hr);
507 ok(!strcmp(constant_desc.Name, "Constant2"), "Got result '%s', expected 'Constant2'\n",
508 constant_desc.Name);
509 ok(constant_desc.Class == D3DXPC_MATRIX_COLUMNS, "Got result %x, expected %u (D3DXPC_MATRIX_COLUMNS)\n",
510 constant_desc.Class, D3DXPC_MATRIX_COLUMNS);
511 ok(constant_desc.Type == D3DXPT_FLOAT, "Got result %x, expected %u (D3DXPT_FLOAT)\n",
512 constant_desc.Type, D3DXPT_FLOAT);
513 ok(constant_desc.Rows == 4, "Got result %x, expected 1\n", constant_desc.Rows);
514 ok(constant_desc.Columns == 4, "Got result %x, expected 4\n", constant_desc.Columns);
516 constant = ID3DXConstantTable_GetConstant(constant_table, NULL, 2);
517 ok(constant != NULL, "No constant found\n");
518 hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &constant_desc, &nb);
519 ok(hr == D3D_OK, "Got result %lx, expected 0 (D3D_OK)\n", hr);
520 ok(!strcmp(constant_desc.Name, "Constant3"), "Got result '%s', expected 'Constant3'\n",
521 constant_desc.Name);
522 ok(constant_desc.Class == D3DXPC_MATRIX_COLUMNS, "Got result %x, expected %u (D3DXPC_MATRIX_COLUMNS)\n",
523 constant_desc.Class, D3DXPC_MATRIX_COLUMNS);
524 ok(constant_desc.Type == D3DXPT_FLOAT, "Got result %x, expected %u (D3DXPT_FLOAT)\n",
525 constant_desc.Type, D3DXPT_FLOAT);
526 ok(constant_desc.Rows == 4, "Got result %x, expected 1\n", constant_desc.Rows);
527 ok(constant_desc.Columns == 4, "Got result %x, expected 4\n", constant_desc.Columns);
528 constant_desc_save = constant_desc; /* For GetConstantDesc test */
530 constant = ID3DXConstantTable_GetConstant(constant_table, NULL, 3);
531 ok(constant == NULL, "Got result %p, expected NULL\n", constant);
533 /* Test GetConstantByName */
534 constant = ID3DXConstantTable_GetConstantByName(constant_table, NULL, "Constant unknown");
535 ok(constant == NULL, "Got result %p, expected NULL\n", constant);
536 constant = ID3DXConstantTable_GetConstantByName(constant_table, NULL, "Constant3");
537 ok(constant != NULL, "No constant found\n");
538 hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &constant_desc, &nb);
539 ok(hr == D3D_OK, "Got result %lx, expected 0 (D3D_OK)\n", hr);
540 ok(!memcmp(&constant_desc, &constant_desc_save, sizeof(D3DXCONSTANT_DESC)), "Got different constant data\n");
542 /* Test GetConstantDesc */
543 constant = ID3DXConstantTable_GetConstant(constant_table, NULL, 0);
544 ok(constant != NULL, "No constant found\n");
545 hr = ID3DXConstantTable_GetConstantDesc(constant_table, NULL, &constant_desc, &nb);
546 ok(hr == D3DERR_INVALIDCALL, "Got result %lx, expected %lx (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
547 hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, NULL, &nb);
548 ok(hr == D3D_OK, "Got result %lx, expected 0 (D3D_OK)\n", hr);
549 hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &constant_desc, NULL);
550 ok(hr == D3D_OK, "Got result %lx, expected 0 (D3D_OK)\n", hr);
551 hr = ID3DXConstantTable_GetConstantDesc(constant_table, "Constant unknown", &constant_desc, &nb);
552 ok(hr == D3DERR_INVALIDCALL, "Got result %lx, expected %lx (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
553 hr = ID3DXConstantTable_GetConstantDesc(constant_table, "Constant3", &constant_desc, &nb);
554 ok(hr == D3D_OK, "Got result %lx, expected 0 (D3D_OK)\n", hr);
555 ok(!memcmp(&constant_desc, &constant_desc_save, sizeof(D3DXCONSTANT_DESC)), "Got different constant data\n");
557 ID3DXConstantTable_Release(constant_table);
559 hr = D3DXGetShaderConstantTableEx(shader_with_ctab_constants, D3DXCONSTTABLE_LARGEADDRESSAWARE, &constant_table);
560 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
561 ok(!!constant_table, "Unexpected constant table %p.\n", constant_table);
563 hr = ID3DXConstantTable_GetDesc(constant_table, &desc);
564 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
565 ok(!strcmp(desc.Creator, "Wine project"), "Unexpected Creator %s.\n", debugstr_a(desc.Creator));
566 ok(desc.Version == D3DVS_VERSION(3, 0), "Unexpected Version %#lx.\n", desc.Version);
567 ok(desc.Constants == 3, "Unexpected Constants %u.\n", desc.Constants);
569 constant = ID3DXConstantTable_GetConstant(constant_table, NULL, 0);
570 ok(!!constant, "No constant found.\n");
571 hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &constant_desc, &nb);
572 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
573 ok(!strcmp(constant_desc.Name, "Constant1"), "Unexpected Name %s.\n", debugstr_a(constant_desc.Name));
574 ok(constant_desc.Class == D3DXPC_VECTOR, "Unexpected Class %u.\n", constant_desc.Class);
575 ok(constant_desc.Type == D3DXPT_FLOAT, "Unexpected Type %u.\n", constant_desc.Type);
576 ok(constant_desc.Rows == 1, "Unexpected Rows %u.\n", constant_desc.Rows);
577 ok(constant_desc.Columns == 4, "Unexpected Columns %u.\n", constant_desc.Columns);
579 if (0)
581 /* Native d3dx crashes with this. */
582 hr = ID3DXConstantTable_GetConstantDesc(constant_table, "Constant3", &constant_desc, &nb);
585 ID3DXConstantTable_Release(constant_table);
587 hr = D3DXGetShaderConstantTableEx(fx_shader_with_ctab, 0, &constant_table);
588 ok(hr == D3D_OK, "Got result %lx, expected 0 (D3D_OK).\n", hr);
589 ok(!constant_table, "D3DXGetShaderConstantTableEx() returned a non-NULL constant table.\n");
592 static void test_constant_table(const char *test_name, const DWORD *ctable_fn,
593 const D3DXCONSTANT_DESC *expecteds, UINT count)
595 UINT i;
596 ID3DXConstantTable *ctable;
598 HRESULT res;
600 /* Get the constant table from the shader itself */
601 res = D3DXGetShaderConstantTable(ctable_fn, &ctable);
602 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed on %s: got %08lx\n", test_name, res);
604 for (i = 0; i < count; i++)
606 const D3DXCONSTANT_DESC *expected = &expecteds[i];
607 D3DXHANDLE const_handle;
608 D3DXCONSTANT_DESC actual;
609 UINT pCount = 1;
611 const_handle = ID3DXConstantTable_GetConstantByName(ctable, NULL, expected->Name);
613 res = ID3DXConstantTable_GetConstantDesc(ctable, const_handle, &actual, &pCount);
614 ok(SUCCEEDED(res), "%s in %s: ID3DXConstantTable_GetConstantDesc returned %08lx\n", expected->Name,
615 test_name, res);
616 ok(pCount == 1, "%s in %s: Got more or less descriptions: %d\n", expected->Name, test_name, pCount);
618 ok(strcmp(actual.Name, expected->Name) == 0,
619 "%s in %s: Got different names: Got %s, expected %s\n", expected->Name,
620 test_name, actual.Name, expected->Name);
621 ok(actual.RegisterSet == expected->RegisterSet,
622 "%s in %s: Got different register sets: Got %d, expected %d\n",
623 expected->Name, test_name, actual.RegisterSet, expected->RegisterSet);
624 ok(actual.RegisterIndex == expected->RegisterIndex,
625 "%s in %s: Got different register indices: Got %d, expected %d\n",
626 expected->Name, test_name, actual.RegisterIndex, expected->RegisterIndex);
627 ok(actual.RegisterCount == expected->RegisterCount,
628 "%s in %s: Got different register counts: Got %d, expected %d\n",
629 expected->Name, test_name, actual.RegisterCount, expected->RegisterCount);
630 ok(actual.Class == expected->Class,
631 "%s in %s: Got different classes: Got %d, expected %d\n", expected->Name,
632 test_name, actual.Class, expected->Class);
633 ok(actual.Type == expected->Type,
634 "%s in %s: Got different types: Got %d, expected %d\n", expected->Name,
635 test_name, actual.Type, expected->Type);
636 ok(actual.Rows == expected->Rows && actual.Columns == expected->Columns,
637 "%s in %s: Got different dimensions: Got (%d, %d), expected (%d, %d)\n",
638 expected->Name, test_name, actual.Rows, actual.Columns, expected->Rows,
639 expected->Columns);
640 ok(actual.Elements == expected->Elements,
641 "%s in %s: Got different element count: Got %d, expected %d\n",
642 expected->Name, test_name, actual.Elements, expected->Elements);
643 ok(actual.StructMembers == expected->StructMembers,
644 "%s in %s: Got different struct member count: Got %d, expected %d\n",
645 expected->Name, test_name, actual.StructMembers, expected->StructMembers);
646 ok(actual.Bytes == expected->Bytes,
647 "%s in %s: Got different byte count: Got %d, expected %d\n",
648 expected->Name, test_name, actual.Bytes, expected->Bytes);
650 if (!expected->DefaultValue)
652 ok(actual.DefaultValue == NULL,
653 "%s in %s: Got different default value: expected NULL\n",
654 expected->Name, test_name);
656 else
658 ok(actual.DefaultValue != NULL,
659 "%s in %s: Got different default value: expected non-NULL\n",
660 expected->Name, test_name);
661 ok(memcmp(actual.DefaultValue, expected->DefaultValue, expected->Bytes) == 0,
662 "%s in %s: Got different default value\n", expected->Name, test_name);
666 /* Finally, release the constant table */
667 ID3DXConstantTable_Release(ctable);
670 static void test_constant_tables(void)
672 test_constant_table("test_basic", ctab_basic, ctab_basic_expected,
673 ARRAY_SIZE(ctab_basic_expected));
674 test_constant_table("test_matrices", ctab_matrices, ctab_matrices_expected,
675 ARRAY_SIZE(ctab_matrices_expected));
676 test_constant_table("test_matrices2", ctab_matrices2, ctab_matrices2_expected,
677 ARRAY_SIZE(ctab_matrices2_expected));
678 test_constant_table("test_arrays", ctab_arrays, ctab_arrays_expected,
679 ARRAY_SIZE(ctab_arrays_expected));
680 test_constant_table("test_default_values", ctab_with_default_values, ctab_with_default_values_expected,
681 ARRAY_SIZE(ctab_with_default_values_expected));
682 test_constant_table("test_samplers", ctab_samplers, ctab_samplers_expected,
683 ARRAY_SIZE(ctab_samplers_expected));
686 static void test_setting_basic_table(IDirect3DDevice9 *device)
688 static const D3DXMATRIX mvp = {{{
689 0.514f, 0.626f, 0.804f, 0.786f,
690 0.238f, 0.956f, 0.374f, 0.483f,
691 0.109f, 0.586f, 0.900f, 0.255f,
692 0.898f, 0.411f, 0.932f, 0.275f}}};
693 static const D3DXVECTOR4 f4 = {0.350f, 0.526f, 0.925f, 0.021f};
694 static const float f = 0.12543f;
695 static const int i = 321;
696 static const D3DXMATRIX *matrix_pointer[] = {&mvp};
698 ID3DXConstantTable *ctable;
700 HRESULT res;
701 float out[16];
702 ULONG refcnt;
704 /* Get the constant table from the shader itself */
705 res = D3DXGetShaderConstantTable(ctab_basic, &ctable);
706 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got 0x%08lx\n", res);
708 /* Set constants */
709 res = ID3DXConstantTable_SetMatrix(ctable, device, "mvp", &mvp);
710 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable mvp: got 0x%08lx\n", res);
712 res = ID3DXConstantTable_SetInt(ctable, device, "i", i + 1);
713 ok(res == D3D_OK, "ID3DXConstantTable_SetInt failed on variable i: got 0x%08lx\n", res);
715 /* Check that setting i again will overwrite the previous value */
716 res = ID3DXConstantTable_SetInt(ctable, device, "i", i);
717 ok(res == D3D_OK, "ID3DXConstantTable_SetInt failed on variable i: got 0x%08lx\n", res);
719 res = ID3DXConstantTable_SetFloat(ctable, device, "f", f);
720 ok(res == D3D_OK, "ID3DXConstantTable_SetFloat failed on variable f: got 0x%08lx\n", res);
722 res = ID3DXConstantTable_SetVector(ctable, device, "f4", &f4);
723 ok(res == D3D_OK, "ID3DXConstantTable_SetVector failed on variable f4: got 0x%08lx\n", res);
725 /* Get constants back and validate */
726 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
727 ok(out[0] == mvp._11 && out[4] == mvp._12 && out[8] == mvp._13 && out[12] == mvp._14,
728 "The first row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
729 out[0], out[4], out[8], out[12], mvp._11, mvp._12, mvp._13, mvp._14);
730 ok(out[1] == mvp._21 && out[5] == mvp._22 && out[9] == mvp._23 && out[13] == mvp._24,
731 "The second row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
732 out[1], out[5], out[9], out[13], mvp._21, mvp._22, mvp._23, mvp._24);
733 ok(out[2] == mvp._31 && out[6] == mvp._32 && out[10] == mvp._33 && out[14] == mvp._34,
734 "The third row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
735 out[2], out[6], out[10], out[14], mvp._31, mvp._32, mvp._33, mvp._34);
736 ok(out[3] == mvp._41 && out[7] == mvp._42 && out[11] == mvp._43 && out[15] == mvp._44,
737 "The fourth row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
738 out[3], out[7], out[11], out[15], mvp._41, mvp._42, mvp._43, mvp._44);
740 IDirect3DDevice9_GetVertexShaderConstantF(device, 4, out, 1);
741 ok(out[0] == (float)i && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
742 "The variable i was not set correctly, out={%f, %f, %f, %f}, should be {%d, 0.0, 0.0, 0.0}\n",
743 out[0], out[1], out[2], out[3], i);
745 IDirect3DDevice9_GetVertexShaderConstantF(device, 6, out, 1);
746 ok(out[0] == f && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
747 "The variable f was not set correctly, out={%f, %f, %f, %f}, should be {%f, 0.0, 0.0, 0.0}\n",
748 out[0], out[1], out[2], out[3], f);
750 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
751 ok(memcmp(out, &f4, sizeof(f4)) == 0,
752 "The variable f4 was not set correctly, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
753 out[0], out[1], out[2], out[3], f4.x, f4.y, f4.z, f4.w);
755 /* Finally test using a set* function for one type to set a variable of another type (should succeed) */
756 res = ID3DXConstantTable_SetVector(ctable, device, "f", &f4);
757 ok(res == D3D_OK, "ID3DXConstantTable_SetVector failed on variable f: 0x%08lx\n", res);
759 IDirect3DDevice9_GetVertexShaderConstantF(device, 6, out, 1);
760 ok(out[0] == f4.x && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
761 "The variable f was not set correctly by ID3DXConstantTable_SetVector, got %f, should be %f\n",
762 out[0], f4.x);
764 memset(out, 0, sizeof(out));
765 IDirect3DDevice9_SetVertexShaderConstantF(device, 6, out, 1);
766 res = ID3DXConstantTable_SetMatrix(ctable, device, "f", &mvp);
767 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable f: 0x%08lx\n", res);
769 IDirect3DDevice9_GetVertexShaderConstantF(device, 6, out, 1);
770 ok(out[0] == mvp._11 && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
771 "The variable f was not set correctly by ID3DXConstantTable_SetMatrix, got %f, should be %f\n",
772 out[0], mvp._11);
774 /* Clear registers */
775 memset(out, 0, sizeof(out));
776 IDirect3DDevice9_SetVertexShaderConstantF(device, 0, out, 4);
777 IDirect3DDevice9_SetVertexShaderConstantF(device, 6, out, 1);
778 IDirect3DDevice9_SetVertexShaderConstantF(device, 7, out, 1);
780 /* SetVector shouldn't change the value of a matrix constant */
781 res = ID3DXConstantTable_SetVector(ctable, device, "mvp", &f4);
782 ok(res == D3D_OK, "ID3DXConstantTable_SetVector failed on variable f: 0x%08lx\n", res);
784 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
785 ok(out[0] == 0.0f && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f
786 && out[4] == 0.0f && out[5] == 0.0f && out[6] == 0.0f && out[7] == 0.0f
787 && out[8] == 0.0f && out[9] == 0.0f && out[10] == 0.0f && out[11] == 0.0f
788 && out[12] == 0.0f && out[13] == 0.0f && out[14] == 0.0f && out[15] == 0.0f,
789 "The variable mvp was not set correctly by ID3DXConstantTable_SetVector, "
790 "got {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f %f; %f, %f, %f, %f}, "
791 "should be all 0.0f\n",
792 out[0], out[1], out[2], out[3],
793 out[4], out[5], out[6], out[7],
794 out[8], out[9], out[10], out[11],
795 out[12], out[13], out[14], out[15]);
797 res = ID3DXConstantTable_SetFloat(ctable, device, "mvp", f);
798 ok(res == D3D_OK, "ID3DXConstantTable_SetFloat failed on variable mvp: 0x%08lx\n", res);
800 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
801 ok(out[0] == 0.0f && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f
802 && out[4] == 0.0f && out[5] == 0.0f && out[6] == 0.0f && out[7] == 0.0f
803 && out[8] == 0.0f && out[9] == 0.0f && out[10] == 0.0f && out[11] == 0.0f
804 && out[12] == 0.0f && out[13] == 0.0f && out[14] == 0.0f && out[15] == 0.0f,
805 "The variable mvp was not set correctly by ID3DXConstantTable_SetFloat, "
806 "got {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f %f; %f, %f, %f, %f}, "
807 "should be all 0.0f\n",
808 out[0], out[1], out[2], out[3],
809 out[4], out[5], out[6], out[7],
810 out[8], out[9], out[10], out[11],
811 out[12], out[13], out[14], out[15]);
813 res = ID3DXConstantTable_SetFloat(ctable, device, "f4", f);
814 ok(res == D3D_OK, "ID3DXConstantTable_SetFloat failed on variable f4: 0x%08lx\n", res);
816 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
817 ok(out[0] == 0.0f && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
818 "The variable f4 was not set correctly by ID3DXConstantTable_SetFloat, "
819 "got {%f, %f, %f, %f}, should be all 0.0f\n",
820 out[0], out[1], out[2], out[3]);
822 res = ID3DXConstantTable_SetMatrixTranspose(ctable, device, "f", &mvp);
823 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTranspose failed on variable f: 0x%08lx\n", res);
825 IDirect3DDevice9_GetVertexShaderConstantF(device, 6, out, 1);
826 ok(out[0] == mvp._11 && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
827 "The variable f was not set correctly by ID3DXConstantTable_SetMatrixTranspose, got %f, should be %f\n",
828 out[0], mvp._11);
830 res = ID3DXConstantTable_SetMatrixTranspose(ctable, device, "f4", &mvp);
831 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTranspose failed on variable f4: 0x%08lx\n", res);
833 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
834 ok(out[0] == mvp._11 && out[1] == mvp._21 && out[2] == mvp._31 && out[3] == mvp._41,
835 "The variable f4 was not set correctly by ID3DXConstantTable_SetMatrixTranspose, "
836 "got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
837 out[0], out[1], out[2], out[3],
838 mvp._11, mvp._21, mvp._31, mvp._41);
840 memset(out, 0, sizeof(out));
841 IDirect3DDevice9_SetVertexShaderConstantF(device, 6, out, 1);
842 res = ID3DXConstantTable_SetMatrixPointerArray(ctable, device, "f", matrix_pointer, 1);
843 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixPointerArray failed on variable f: got %#lx\n", res);
845 IDirect3DDevice9_GetVertexShaderConstantF(device, 6, out, 1);
846 ok(out[0] == mvp._11 && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
847 "The variable f was not set correctly by ID3DXConstantTable_SetMatrixPointerArray, "
848 "got %f, should be %f\n",
849 out[0], mvp._11);
851 res = ID3DXConstantTable_SetMatrixPointerArray(ctable, device, "f4", matrix_pointer, 1);
852 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixPointerArray failed on variable f4: got %#lx\n", res);
854 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
855 ok(out[0] == mvp._11 && out[1] == mvp._12 && out[2] == mvp._13 && out[3] == mvp._14,
856 "The variable f4 was not set correctly by ID3DXConstantTable_SetMatrixPointerArray, "
857 "got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
858 out[0], out[1], out[2], out[3],
859 mvp._11, mvp._12, mvp._13, mvp._14);
861 memset(out, 0, sizeof(out));
862 IDirect3DDevice9_SetVertexShaderConstantF(device, 6, out, 1);
863 res = ID3DXConstantTable_SetMatrixTransposePointerArray(ctable, device, "f", matrix_pointer, 1);
864 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTransposePointerArray failed on variable f: got %#lx\n", res);
866 IDirect3DDevice9_GetVertexShaderConstantF(device, 6, out, 1);
867 ok(out[0] == mvp._11 && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
868 "The variable f was not set correctly by ID3DXConstantTable_SetMatrixTransposePointerArray, "
869 "got %f, should be %f\n",
870 out[0], mvp._11);
872 res = ID3DXConstantTable_SetMatrixTransposePointerArray(ctable, device, "f4", matrix_pointer, 1);
873 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTransposePointerArray failed on variable f4: got %#lx\n", res);
875 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
876 ok(out[0] == mvp._11 && out[1] == mvp._21 && out[2] == mvp._31 && out[3] == mvp._41,
877 "The variable f4 was not set correctly by ID3DXConstantTable_SetMatrixTransposePointerArray, "
878 "got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
879 out[0], out[1], out[2], out[3],
880 mvp._11, mvp._21, mvp._31, mvp._41);
882 refcnt = ID3DXConstantTable_Release(ctable);
883 ok(refcnt == 0, "The constant table reference count was %lu, should be 0\n", refcnt);
886 static void test_setting_matrices_table(IDirect3DDevice9 *device)
888 static const D3DXMATRIX fmatrix =
889 {{{2.001f, 1.502f, 9.003f, 1.004f,
890 5.005f, 3.006f, 3.007f, 6.008f,
891 9.009f, 5.010f, 7.011f, 1.012f,
892 5.013f, 5.014f, 5.015f, 9.016f}}};
893 static const D3DXMATRIX *matrix_pointer[] = {&fmatrix};
895 ID3DXConstantTable *ctable;
897 HRESULT res;
898 float out[32];
900 res = D3DXGetShaderConstantTable(ctab_matrices, &ctable);
901 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %#lx\n", res);
903 res = ID3DXConstantTable_SetMatrix(ctable, device, "imatrix2x3", &fmatrix);
904 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable imatrix2x3: got %#lx\n", res);
906 res = ID3DXConstantTable_SetMatrix(ctable, device, "fmatrix3x1", &fmatrix);
907 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable fmatrix3x1: got %#lx\n", res);
909 IDirect3DDevice9_GetVertexShaderConstantF(device, 4, out, 2);
910 ok(out[0] == (int)fmatrix._11 && out[1] == (int)fmatrix._12 && out[2] == (int)fmatrix._13
911 && out[3] == 0
912 && out[4] == (int)fmatrix._21 && out[5] == (int)fmatrix._22 && out[6] == (int)fmatrix._23
913 && out[7] == 0,
914 "The variable imatrix2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f}, "
915 "should be {%d, %d, %d, %d; %d, %d, %d, %d}\n",
916 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
917 (int)fmatrix._11, (int)fmatrix._12, (int)fmatrix._13, 0,
918 (int)fmatrix._21, (int)fmatrix._22, (int)fmatrix._23, 0);
920 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
921 ok(out[0] == fmatrix._11 && out[1] == fmatrix._21 && out[2] == fmatrix._31 && out[3] == 0.0f,
922 "The variable fmatrix3x1 was not set correctly, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
923 out[0], out[1], out[2], out[3],
924 fmatrix._11, fmatrix._21, fmatrix._31, 0.0f);
926 ID3DXConstantTable_Release(ctable);
928 res = D3DXGetShaderConstantTable(ctab_matrices2, &ctable);
929 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %#lx\n", res);
931 /* SetMatrix */
932 res = ID3DXConstantTable_SetMatrix(ctable, device, "c2x3", &fmatrix);
933 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable c2x3: got %#lx\n", res);
935 res = ID3DXConstantTable_SetMatrix(ctable, device, "r2x3", &fmatrix);
936 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable r2x3: got %#lx\n", res);
938 res = ID3DXConstantTable_SetMatrix(ctable, device, "c3x2", &fmatrix);
939 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable c3x2: got %#lx\n", res);
941 res = ID3DXConstantTable_SetMatrix(ctable, device, "r3x2", &fmatrix);
942 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable r3x2: got %#lx\n", res);
944 res = ID3DXConstantTable_SetMatrix(ctable, device, "c3x3", &fmatrix);
945 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable c3x3: got %#lx\n", res);
947 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 3);
948 ok(out[0] == fmatrix._11 && out[1] == fmatrix._21 && out[2] == 0.0f && out[3] == 0.0f
949 && out[4] == fmatrix._12 && out[5] == fmatrix._22 && out[6] == 0.0f && out[7] == 0.0f
950 && out[8] == fmatrix._13 && out[9] == fmatrix._23 && out[10] == 0.0f && out[11] == 0.0f,
951 "The variable c2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
952 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
953 out[0], out[1], out[2], out[3],
954 out[4], out[5], out[6], out[7],
955 out[8], out[9], out[10], out[11],
956 fmatrix._11, fmatrix._21, 0.0f, 0.0f,
957 fmatrix._12, fmatrix._22, 0.0f, 0.0f,
958 fmatrix._13, fmatrix._23, 0.0f, 0.0f);
960 res = ID3DXConstantTable_SetMatrix(ctable, device, "r4x4", &fmatrix);
961 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable r4x4: got %#lx\n", res);
963 IDirect3DDevice9_GetVertexShaderConstantF(device, 15, out, 2);
964 ok(out[0] == fmatrix._11 && out[1] == fmatrix._12 && out[2] == fmatrix._13 && out[3] == 0.0f
965 && out[4] == fmatrix._21 && out[5] == fmatrix._22 && out[6] == fmatrix._23 && out[7] == 0.0f,
966 "The variable r2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f}, "
967 "should be {%f, %f, %f, %f; %f, %f, %f, %f}\n",
968 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
969 fmatrix._11, fmatrix._12, fmatrix._13, 0.0f,
970 fmatrix._21, fmatrix._22, fmatrix._23, 0.0f);
972 IDirect3DDevice9_GetVertexShaderConstantF(device, 13, out, 2);
973 ok(out[0] == fmatrix._11 && out[1] == fmatrix._21 && out[2] == fmatrix._31 && out[3] == 0.0f
974 && out[4] == fmatrix._12 && out[5] == fmatrix._22 && out[6] == fmatrix._32 && out[7] == 0.0f,
975 "The variable c3x2 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f}, "
976 "should be {%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],
978 fmatrix._11, fmatrix._21, fmatrix._31, 0.0f,
979 fmatrix._12, fmatrix._22, fmatrix._32, 0.0f);
981 IDirect3DDevice9_GetVertexShaderConstantF(device, 4, out, 3);
982 ok(out[0] == fmatrix._11 && out[1] == fmatrix._12 && out[2] == 0.0f && out[3] == 0.0f
983 && out[4] == fmatrix._21 && out[5] == fmatrix._22 && out[6] == 0.0f && out[7] == 0.0f
984 && out[8] == fmatrix._31 && out[9] == fmatrix._32 && out[10] == 0.0f && out[11] == 0.0f,
985 "The variable r3x2 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
986 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
987 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7], out[8], out[9], out[10], out[11],
988 fmatrix._11, fmatrix._12, 0.0f, 0.0f,
989 fmatrix._21, fmatrix._22, 0.0f, 0.0f,
990 fmatrix._31, fmatrix._32, 0.0f, 0.0f);
992 IDirect3DDevice9_GetVertexShaderConstantF(device, 10, out, 3);
993 ok(out[0] == fmatrix._11 && out[1] == fmatrix._21 && out[2] == fmatrix._31 && out[3] == 0.0f
994 && out[4] == fmatrix._12 && out[5] == fmatrix._22 && out[6] == fmatrix._32 && out[7] == 0.0f
995 && out[8] == fmatrix._13 && out[9] == fmatrix._23 && out[10] == fmatrix._33 && out[11] == 0.0f,
996 "The variable c3x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
997 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
998 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7], out[8], out[9], out[10], out[11],
999 fmatrix._11, fmatrix._21, fmatrix._31, 0.0f,
1000 fmatrix._12, fmatrix._22, fmatrix._32, 0.0f,
1001 fmatrix._13, fmatrix._23, fmatrix._33, 0.0f);
1003 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
1004 ok(out[0] == fmatrix._11 && out[1] == fmatrix._12 && out[2] == fmatrix._13 && out[3] == fmatrix._14
1005 && out[4] == fmatrix._21 && out[5] == fmatrix._22 && out[6] == fmatrix._23 && out[7] == fmatrix._24
1006 && out[8] == fmatrix._31 && out[9] == fmatrix._32 && out[10] == fmatrix._33 && out[11] == fmatrix._34
1007 && out[12] == fmatrix._41 && out[13] == fmatrix._42 && out[14] == fmatrix._43 && out[15] == fmatrix._44,
1008 "The variable r4x4 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
1009 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
1010 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1011 out[8], out[9], out[10], out[11], out[12], out[13], out[14], out[15],
1012 fmatrix._11, fmatrix._12, fmatrix._13, fmatrix._14,
1013 fmatrix._21, fmatrix._22, fmatrix._23, fmatrix._24,
1014 fmatrix._31, fmatrix._32, fmatrix._33, fmatrix._34,
1015 fmatrix._41, fmatrix._42, fmatrix._43, fmatrix._44);
1017 /* SetMatrixTranspose */
1018 res = ID3DXConstantTable_SetMatrixTranspose(ctable, device, "c2x3", &fmatrix);
1019 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTranspose failed on variable c2x3: got %#lx\n", res);
1021 res = ID3DXConstantTable_SetMatrixTranspose(ctable, device, "r2x3", &fmatrix);
1022 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTranspose failed on variable r2x3: got %#lx\n", res);
1024 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 3);
1025 ok(out[0] == fmatrix._11 && out[1] == fmatrix._12 && out[2] == 0.0f && out[3] == 0.0f
1026 && out[4] == fmatrix._21 && out[5] == fmatrix._22 && out[6] == 0.0f && out[7] == 0.0f
1027 && out[8] == fmatrix._31 && out[9] == fmatrix._32 && out[10] == 0.0f && out[11] == 0.0f,
1028 "The variable c2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
1029 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
1030 out[0], out[1], out[2], out[3],
1031 out[4], out[5], out[6], out[7],
1032 out[8], out[9], out[10], out[11],
1033 fmatrix._11, fmatrix._12, 0.0f, 0.0f,
1034 fmatrix._21, fmatrix._22, 0.0f, 0.0f,
1035 fmatrix._31, fmatrix._32, 0.0f, 0.0f);
1037 IDirect3DDevice9_GetVertexShaderConstantF(device, 15, out, 2);
1038 ok(out[0] == fmatrix._11 && out[1] == fmatrix._21 && out[2] == fmatrix._31 && out[3] == 0.0f
1039 && out[4] == fmatrix._12 && out[5] == fmatrix._22 && out[6] == fmatrix._32 && out[7] == 0.0f,
1040 "The variable r2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f}, "
1041 "should be {%f, %f, %f, %f; %f, %f, %f, %f}\n",
1042 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1043 fmatrix._11, fmatrix._21, fmatrix._31, 0.0f,
1044 fmatrix._12, fmatrix._22, fmatrix._32, 0.0f);
1046 /* SetMatrixPointerArray */
1047 res = ID3DXConstantTable_SetMatrixPointerArray(ctable, device, "c2x3", matrix_pointer, 1);
1048 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixPointerArray failed on variable c2x3: got %#lx\n", res);
1050 res = ID3DXConstantTable_SetMatrixPointerArray(ctable, device, "r2x3", matrix_pointer, 1);
1051 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixPointerArray failed on variable r2x3: got %#lx\n", res);
1053 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 3);
1054 ok(out[0] == fmatrix._11 && out[1] == fmatrix._21 && out[2] == 0.0f && out[3] == 0.0f
1055 && out[4] == fmatrix._12 && out[5] == fmatrix._22 && out[6] == 0.0f && out[7] == 0.0f
1056 && out[8] == fmatrix._13 && out[9] == fmatrix._23 && out[10] == 0.0f && out[11] == 0.0f,
1057 "The variable c2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
1058 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
1059 out[0], out[1], out[2], out[3],
1060 out[4], out[5], out[6], out[7],
1061 out[8], out[9], out[10], out[11],
1062 fmatrix._11, fmatrix._21, 0.0f, 0.0f,
1063 fmatrix._12, fmatrix._22, 0.0f, 0.0f,
1064 fmatrix._13, fmatrix._23, 0.0f, 0.0f);
1066 IDirect3DDevice9_GetVertexShaderConstantF(device, 15, out, 2);
1067 ok(out[0] == fmatrix._11 && out[1] == fmatrix._12 && out[2] == fmatrix._13 && out[3] == 0.0f
1068 && out[4] == fmatrix._21 && out[5] == fmatrix._22 && out[6] == fmatrix._23 && out[7] == 0.0f,
1069 "The variable r2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f}, "
1070 "should be {%f, %f, %f, %f; %f, %f, %f, %f}\n",
1071 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1072 fmatrix._11, fmatrix._12, fmatrix._13, 0.0f,
1073 fmatrix._21, fmatrix._22, fmatrix._23, 0.0f);
1075 /* SetMatrixTransposePointerArray */
1076 res = ID3DXConstantTable_SetMatrixTransposePointerArray(ctable, device, "c2x3", matrix_pointer, 1);
1077 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTransposePointerArray failed on variable c2x3: got %#lx\n", res);
1079 res = ID3DXConstantTable_SetMatrixTransposePointerArray(ctable, device, "r2x3", matrix_pointer, 1);
1080 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTransposePointerArray failed on variable r2x3: got %#lx\n", res);
1082 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 3);
1083 ok(out[0] == fmatrix._11 && out[1] == fmatrix._12 && out[2] == 0.0f && out[3] == 0.0f
1084 && out[4] == fmatrix._21 && out[5] == fmatrix._22 && out[6] == 0.0f && out[7] == 0.0f
1085 && out[8] == fmatrix._31 && out[9] == fmatrix._32 && out[10] == 0.0f && out[11] == 0.0f,
1086 "The variable c2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
1087 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
1088 out[0], out[1], out[2], out[3],
1089 out[4], out[5], out[6], out[7],
1090 out[8], out[9], out[10], out[11],
1091 fmatrix._11, fmatrix._12, 0.0f, 0.0f,
1092 fmatrix._21, fmatrix._22, 0.0f, 0.0f,
1093 fmatrix._31, fmatrix._32, 0.0f, 0.0f);
1095 IDirect3DDevice9_GetVertexShaderConstantF(device, 15, out, 2);
1096 ok(out[0] == fmatrix._11 && out[1] == fmatrix._21 && out[2] == fmatrix._31 && out[3] == 0.0f
1097 && out[4] == fmatrix._12 && out[5] == fmatrix._22 && out[6] == fmatrix._32 && out[7] == 0.0f,
1098 "The variable r2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f}, "
1099 "should be {%f, %f, %f, %f; %f, %f, %f, %f}\n",
1100 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1101 fmatrix._11, fmatrix._21, fmatrix._31, 0.0f,
1102 fmatrix._12, fmatrix._22, fmatrix._32, 0.0f);
1104 ID3DXConstantTable_Release(ctable);
1107 static void test_setting_arrays_table(IDirect3DDevice9 *device)
1109 static const float farray[8] = {
1110 0.005f, 0.745f, 0.973f, 0.264f,
1111 0.010f, 0.020f, 0.030f, 0.040f};
1112 static const D3DXMATRIX fmtxarray[2] = {
1113 {{{0.001f, 0.002f, 0.003f, 0.004f,
1114 0.005f, 0.006f, 0.007f, 0.008f,
1115 0.009f, 0.010f, 0.011f, 0.012f,
1116 0.013f, 0.014f, 0.015f, 0.016f}}},
1117 {{{0.010f, 0.020f, 0.030f, 0.040f,
1118 0.050f, 0.060f, 0.070f, 0.080f,
1119 0.090f, 0.100f, 0.110f, 0.120f,
1120 0.130f, 0.140f, 0.150f, 0.160f}}}};
1121 static const int iarray[4] = {1, 2, 3, 4};
1122 static const D3DXVECTOR4 fvecarray[2] = {
1123 {0.745f, 0.997f, 0.353f, 0.237f},
1124 {0.060f, 0.455f, 0.333f, 0.983f}};
1125 static BOOL barray[4] = {FALSE, 100, TRUE, TRUE};
1127 ID3DXConstantTable *ctable;
1129 HRESULT res;
1130 float out[32];
1131 ULONG refcnt;
1133 /* Clear registers */
1134 memset(out, 0, sizeof(out));
1135 IDirect3DDevice9_SetVertexShaderConstantF(device, 8, out, 4);
1136 IDirect3DDevice9_SetVertexShaderConstantF(device, 12, out, 4);
1138 /* Get the constant table from the shader */
1139 res = D3DXGetShaderConstantTable(ctab_arrays, &ctable);
1140 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got 0x%08lx\n", res);
1142 /* Set constants */
1144 /* Make sure that we cannot set registers that do not belong to this constant */
1145 res = ID3DXConstantTable_SetFloatArray(ctable, device, "farray", farray, 8);
1146 ok(res == D3D_OK, "ID3DXConstantTable_SetFloatArray failed: got 0x%08lx\n", res);
1148 IDirect3DDevice9_GetVertexShaderConstantF(device, 8, out, 8);
1149 ok(out[0] == farray[0] && out[4] == farray[1] && out[8] == farray[2] && out[12] == farray[3],
1150 "The in-bounds elements of the array were not set, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1151 out[0], out[4], out[8], out[12], farray[0], farray[1], farray[2], farray[3]);
1152 ok(out[16] == 0.0f && out[20] == 0.0f && out[24] == 0.0f && out[28] == 0.0f,
1153 "The excess elements of the array were set, out={%f, %f, %f, %f}, should be all 0.0f\n",
1154 out[16], out[20], out[24], out[28]);
1156 /* ivecarray takes up only 1 register, but a matrix takes up 4, so no elements should be set */
1157 res = ID3DXConstantTable_SetMatrix(ctable, device, "ivecarray", &fmtxarray[0]);
1158 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed: got 0x%08lx\n", res);
1160 IDirect3DDevice9_GetVertexShaderConstantF(device, 18, out, 4);
1161 ok(out[0] == 0.0f && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
1162 "The array was set, out={%f, %f, %f, %f}, should be all 0.0f\n", out[0], out[1], out[2], out[3]);
1164 /* Try setting an integer array to an array declared as a float array */
1165 res = ID3DXConstantTable_SetIntArray(ctable, device, "farray", iarray, 4);
1166 ok(res == D3D_OK, "ID3DXConstantTable_SetIntArray failed: got 0x%08lx\n", res);
1168 IDirect3DDevice9_GetVertexShaderConstantF(device, 8, out, 4);
1169 ok(out[0] == iarray[0] && out[4] == iarray[1] && out[8] == iarray[2] && out[12] == iarray[3],
1170 "SetIntArray did not properly set a float array: out={%f, %f, %f, %f}, should be {%d, %d, %d, %d}\n",
1171 out[0], out[4], out[8], out[12], iarray[0], iarray[1], iarray[2], iarray[3]);
1173 res = ID3DXConstantTable_SetFloatArray(ctable, device, "farray", farray, 4);
1174 ok(res == D3D_OK, "ID3DXConstantTable_SetFloatArray failed: got x0%08lx\n", res);
1176 res = ID3DXConstantTable_SetVectorArray(ctable, device, "fvecarray", fvecarray, 2);
1177 ok(res == D3D_OK, "ID3DXConstantTable_SetVectorArray failed: got 0x%08lx\n", res);
1179 res = ID3DXConstantTable_SetMatrixArray(ctable, device, "fmtxarray", fmtxarray, 2);
1180 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixArray failed: got 0x%08lx\n", res);
1182 res = ID3DXConstantTable_SetBoolArray(ctable, device, "barray", barray, 2);
1183 ok(res == D3D_OK, "ID3DXConstantTable_SetBoolArray failed: got 0x%08lx\n", res);
1185 /* Read back constants */
1186 IDirect3DDevice9_GetVertexShaderConstantF(device, 8, out, 4);
1187 ok(out[0] == farray[0] && out[4] == farray[1] && out[8] == farray[2] && out[12] == farray[3],
1188 "The variable farray was not set correctly, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1189 out[0], out[4], out[8], out[12], farray[0], farray[1], farray[2], farray[3]);
1191 IDirect3DDevice9_GetVertexShaderConstantF(device, 12, out, 2);
1192 ok(out[0] == fvecarray[0].x && out[1] == fvecarray[0].y && out[2] == fvecarray[0].z && out[3] == fvecarray[0].w &&
1193 out[4] == fvecarray[1].x && out[5] == fvecarray[1].y && out[6] == fvecarray[1].z && out[7] == fvecarray[1].w,
1194 "The variable fvecarray was not set correctly, out={{%f, %f, %f, %f}, {%f, %f, %f, %f}}, should be "
1195 "{{%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],
1196 fvecarray[0].x, fvecarray[0].y, fvecarray[0].z, fvecarray[0].w, fvecarray[1].x, fvecarray[1].y,
1197 fvecarray[1].z, fvecarray[1].w);
1199 IDirect3DDevice9_GetVertexShaderConstantF(device, 14, out, 2);
1200 ok(out[0] == 0.0f && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f
1201 && out[4] == 1.0f && out[5] == 0.0f && out[6] == 0.0f && out[7] == 0.0f,
1202 "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",
1203 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1204 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f);
1206 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 8);
1207 /* Just check a few elements in each matrix to make sure fmtxarray was set row-major */
1208 ok(out[0] == fmtxarray[0]._11 && out[1] == fmtxarray[0]._12 && out[2] == fmtxarray[0]._13 && out[3] == fmtxarray[0]._14,
1209 "The variable fmtxarray was not set row-major, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1210 out[0], out[1], out[2], out[3], fmtxarray[0]._11, fmtxarray[0]._12, fmtxarray[0]._13, fmtxarray[0]._14);
1211 ok(out[16] == fmtxarray[1]._11 && out[17] == fmtxarray[1]._12 && out[18] == fmtxarray[1]._13 && out[19] == fmtxarray[1]._14,
1212 "The variable fmtxarray was not set row-major, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1213 out[16], out[17], out[18], out[19], fmtxarray[1]._11, fmtxarray[1]._12, fmtxarray[1]._13, fmtxarray[1]._14);
1215 refcnt = ID3DXConstantTable_Release(ctable);
1216 ok(refcnt == 0, "The constant table reference count was %lu, should be 0\n", refcnt);
1219 static void test_SetDefaults(IDirect3DDevice9 *device)
1221 static const D3DXMATRIX mvp = {{{
1222 0.51f, 0.62f, 0.80f, 0.78f,
1223 0.23f, 0.95f, 0.37f, 0.48f,
1224 0.10f, 0.58f, 0.90f, 0.25f,
1225 0.89f, 0.41f, 0.93f, 0.27f}}};
1226 static const D3DXVECTOR4 f4 = {0.2f, 0.4f, 0.8f, 1.2f};
1228 float out[16];
1230 HRESULT res;
1231 ID3DXConstantTable *ctable;
1233 res = D3DXGetShaderConstantTable(ctab_basic, &ctable);
1234 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %08lx\n", res);
1236 res = ID3DXConstantTable_SetVector(ctable, device, "f4", &f4);
1237 ok(res == D3D_OK, "ID3DXConstantTable_SetVector failed: got %08lx\n", res);
1239 res = ID3DXConstantTable_SetMatrix(ctable, device, "mvp", &mvp);
1240 ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed: got %08lx\n", res);
1242 res = ID3DXConstantTable_SetDefaults(ctable, device);
1243 ok(res == D3D_OK, "ID3dXConstantTable_SetDefaults failed: got %08lx\n", res);
1245 /* SetDefaults doesn't change constants without default values */
1246 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
1247 ok(out[0] == mvp._11 && out[4] == mvp._12 && out[8] == mvp._13 && out[12] == mvp._14,
1248 "The first row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1249 out[0], out[4], out[8], out[12], mvp._11, mvp._12, mvp._13, mvp._14);
1250 ok(out[1] == mvp._21 && out[5] == mvp._22 && out[9] == mvp._23 && out[13] == mvp._24,
1251 "The second row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1252 out[1], out[5], out[9], out[13], mvp._21, mvp._22, mvp._23, mvp._24);
1253 ok(out[2] == mvp._31 && out[6] == mvp._32 && out[10] == mvp._33 && out[14] == mvp._34,
1254 "The third row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1255 out[2], out[6], out[10], out[14], mvp._31, mvp._32, mvp._33, mvp._34);
1256 ok(out[3] == mvp._41 && out[7] == mvp._42 && out[11] == mvp._43 && out[15] == mvp._44,
1257 "The fourth row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1258 out[3], out[7], out[11], out[15], mvp._41, mvp._42, mvp._43, mvp._44);
1260 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
1261 ok(memcmp(out, &f4, sizeof(f4)) == 0,
1262 "The variable f4 was not set correctly, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1263 out[0], out[1], out[2], out[3], f4.x, f4.y, f4.z, f4.w);
1265 ID3DXConstantTable_Release(ctable);
1267 res = D3DXGetShaderConstantTable(ctab_with_default_values, &ctable);
1268 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %08lx\n", res);
1270 res = ID3DXConstantTable_SetDefaults(ctable, device);
1271 ok(res == D3D_OK, "ID3DXConstantTable_SetDefaults failed: got %08lx\n", res);
1273 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
1274 ok(memcmp(out, mat4_default_value, sizeof(mat4_default_value)) == 0,
1275 "The variable mat4 was not set correctly to default value\n");
1277 IDirect3DDevice9_GetVertexShaderConstantF(device, 4, out, 4);
1278 ok(memcmp(out, mat3_default_value, sizeof(mat3_default_value)) == 0,
1279 "The variable mat3 was not set correctly to default value\n");
1281 IDirect3DDevice9_GetVertexShaderConstantF(device, 8, out, 3);
1282 ok(memcmp(out, arr_default_value, sizeof(arr_default_value)) == 0,
1283 "The variable array was not set correctly to default value\n");
1285 IDirect3DDevice9_GetVertexShaderConstantF(device, 11, out, 1);
1286 ok(memcmp(out, vec4_default_value, sizeof(vec4_default_value)) == 0,
1287 "The variable vec4 was not set correctly to default value\n");
1289 IDirect3DDevice9_GetVertexShaderConstantF(device, 12, out, 1);
1290 ok(memcmp(out, flt_default_value, sizeof(flt_default_value)) == 0,
1291 "The variable flt was not set correctly to default value\n");
1293 ID3DXConstantTable_Release(ctable);
1296 static void test_SetValue(IDirect3DDevice9 *device)
1298 static const D3DXMATRIX mvp = {{{
1299 0.51f, 0.62f, 0.80f, 0.78f,
1300 0.23f, 0.95f, 0.37f, 0.48f,
1301 0.10f, 0.58f, 0.90f, 0.25f,
1302 0.89f, 0.41f, 0.93f, 0.27f}}};
1303 static const D3DXVECTOR4 f4 = {0.2f, 0.4f, 0.8f, 1.2f};
1304 static const FLOAT arr[] = {0.33f, 0.55f, 0.96f, 1.00f,
1305 1.00f, 1.00f, 1.00f, 1.00f,
1306 1.00f, 1.00f, 1.00f, 1.00f};
1307 static int imatrix[] = {1, 2, 3, 4, 5, 6};
1308 static float fmatrix[] = {1.1f, 2.2f, 3.3f, 4.4f};
1309 static BOOL barray[] = {TRUE, FALSE};
1310 static float fvecarray[] = {9.1f, 9.2f, 9.3f, 9.4f, 9.5f, 9.6f, 9.7f, 9.8f};
1311 static float farray[] = {2.2f, 3.3f};
1313 static const float def[16] = {5.5f, 5.5f, 5.5f, 5.5f,
1314 5.5f, 5.5f, 5.5f, 5.5f,
1315 5.5f, 5.5f, 5.5f, 5.5f,
1316 5.5f, 5.5f, 5.5f, 5.5f};
1317 float out[16];
1319 HRESULT res;
1320 ID3DXConstantTable *ctable;
1322 res = D3DXGetShaderConstantTable(ctab_basic, &ctable);
1323 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %08lx\n", res);
1325 IDirect3DDevice9_SetVertexShaderConstantF(device, 7, def, 1);
1327 /* SetValue called with 0 bytes size doesn't change value */
1328 res = ID3DXConstantTable_SetValue(ctable, device, "f4", &f4, 0);
1329 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08lx\n", res);
1331 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
1332 ok(memcmp(out, def, sizeof(f4)) == 0,
1333 "The variable f4 was not set correctly, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1334 out[0], out[1], out[2], out[3], def[0], def[1], def[2], def[3]);
1336 res = ID3DXConstantTable_SetValue(ctable, device, "f4", &f4, sizeof(f4));
1337 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08lx\n", res);
1339 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
1340 ok(memcmp(out, &f4, sizeof(f4)) == 0,
1341 "The variable f4 was not set correctly, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1342 out[0], out[1], out[2], out[3], f4.x, f4.y, f4.z, f4.w);
1344 IDirect3DDevice9_SetVertexShaderConstantF(device, 0, def, 4);
1346 /* SetValue called with size smaller than constant size doesn't change value */
1347 res = ID3DXConstantTable_SetValue(ctable, device, "mvp", &mvp, sizeof(mvp) / 2);
1348 ok(res == D3D_OK, "ID3DXConstantTable_SetValue returned %08lx\n", res);
1350 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
1351 ok(memcmp(out, def, sizeof(def)) == 0,
1352 "The variable mvp was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
1353 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
1354 out[0], out[4], out[ 8], out[12],
1355 out[1], out[5], out[ 9], out[13],
1356 out[2], out[6], out[10], out[14],
1357 out[3], out[7], out[11], out[15],
1358 def[0], def[4], def[ 8], def[12],
1359 def[1], def[5], def[ 9], def[13],
1360 def[2], def[6], def[10], def[14],
1361 def[3], def[7], def[11], def[15]);
1363 res = ID3DXConstantTable_SetValue(ctable, device, "mvp", &mvp, sizeof(mvp));
1364 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08lx\n", res);
1366 IDirect3DDevice9_GetVertexShaderConstantF(device, 0, out, 4);
1367 ok(out[0] == mvp._11 && out[4] == mvp._12 && out[8] == mvp._13 && out[12] == mvp._14,
1368 "The first row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1369 out[0], out[4], out[8], out[12], mvp._11, mvp._12, mvp._13, mvp._14);
1370 ok(out[1] == mvp._21 && out[5] == mvp._22 && out[9] == mvp._23 && out[13] == mvp._24,
1371 "The second row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1372 out[1], out[5], out[9], out[13], mvp._21, mvp._22, mvp._23, mvp._24);
1373 ok(out[2] == mvp._31 && out[6] == mvp._32 && out[10] == mvp._33 && out[14] == mvp._34,
1374 "The third row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1375 out[2], out[6], out[10], out[14], mvp._31, mvp._32, mvp._33, mvp._34);
1376 ok(out[3] == mvp._41 && out[7] == mvp._42 && out[11] == mvp._43 && out[15] == mvp._44,
1377 "The fourth row of mvp was not set correctly, got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1378 out[3], out[7], out[11], out[15], mvp._41, mvp._42, mvp._43, mvp._44);
1380 ID3DXConstantTable_Release(ctable);
1382 res = D3DXGetShaderConstantTable(ctab_with_default_values, &ctable);
1383 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %08lx\n", res);
1385 res = ID3DXConstantTable_SetValue(ctable, device, "arr", arr, sizeof(arr));
1386 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08lx\n", res);
1388 IDirect3DDevice9_GetVertexShaderConstantF(device, 8, out, 3);
1389 ok(out[0] == arr[0] && out[4] == arr[1] && out[8] == arr[2]
1390 && out[1] == 0 && out[2] == 0 && out[3] == 0 && out[5] == 0 && out[6] == 0 && out[7] == 0
1391 && out[9] == 0 && out[10] == 0 && out[11] == 0,
1392 "The variable arr was not set correctly, out={%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f}, "
1393 "should be {0.33, 0, 0, 0, 0.55, 0, 0, 0, 0.96, 0, 0, 0}\n",
1394 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7], out[8], out[9], out[10], out[11]);
1396 ID3DXConstantTable_Release(ctable);
1398 res = D3DXGetShaderConstantTable(ctab_matrices, &ctable);
1399 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %08lx\n", res);
1401 res = ID3DXConstantTable_SetValue(ctable, device, "fmatrix3x1", fmatrix, sizeof(fmatrix));
1402 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08lx\n", res);
1404 res = ID3DXConstantTable_SetValue(ctable, device, "imatrix2x3", imatrix, sizeof(imatrix));
1405 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08lx\n", res);
1407 IDirect3DDevice9_GetVertexShaderConstantF(device, 4, out, 2);
1408 ok(out[0] == imatrix[0] && out[1] == imatrix[1] && out[2] == imatrix[2] && out[3] == 0.0f
1409 && out[4] == imatrix[3] && out[5] == imatrix[4] && out[6] == imatrix[5] && out[7] == 0.0f,
1410 "The variable imatrix2x3 was not set correctly, out={%f, %f, %f, %f, %f, %f, %f, %f}, "
1411 "should be {%d, %d, %d, 0, %d, %d, %d, 0}\n",
1412 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1413 imatrix[0], imatrix[1], imatrix[2], imatrix[3], imatrix[4], imatrix[5]);
1415 IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 2);
1416 ok(out[0] == fmatrix[0] && out[1] == fmatrix[1] && out[2] == fmatrix[2] && out[3] == 0.0f,
1417 "The variable fmatrix3x1 was not set correctly, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
1418 out[0], out[1] ,out[2], out[4],
1419 fmatrix[0], fmatrix[1], fmatrix[2], 0.0f);
1421 ID3DXConstantTable_Release(ctable);
1423 res = D3DXGetShaderConstantTable(ctab_arrays, &ctable);
1424 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %08lx\n", res);
1426 res = ID3DXConstantTable_SetValue(ctable, device, "barray", barray, sizeof(barray));
1427 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08lx\n", res);
1429 res = ID3DXConstantTable_SetValue(ctable, device, "fvecarray", fvecarray, sizeof(fvecarray));
1430 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08lx\n", res);
1432 IDirect3DDevice9_SetVertexShaderConstantF(device, 8, def, 4);
1433 res = ID3DXConstantTable_SetValue(ctable, device, "farray", farray, sizeof(farray));
1434 ok(res == D3D_OK, "ID3DXConstantTable_SetValue failed: got %08lx\n", res);
1436 /* 2 elements of farray were set */
1437 IDirect3DDevice9_GetVertexShaderConstantF(device, 8, out, 4);
1438 ok(out[0] == farray[0] && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f
1439 && out[4] == farray[1] && out[5] == 0.0f && out[6] == 0.0f && out[7] == 0.0f
1440 && out[8] == def[8] && out[9] == def[9] && out[10] == def[10] && out[11] == def[11]
1441 && out[12] == def[12] && out[13] == def[13] && out[14] == def[14] && out[15] == def[15],
1442 "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}, "
1443 "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
1444 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1445 out[8], out[9], out[10], out[11], out[12], out[13], out[14], out[15],
1446 farray[0], 0.0f, 0.0f, 0.0f,
1447 farray[1], 0.0f, 0.0f, 0.0f,
1448 def[8], def[9], def[10], def[11],
1449 def[12], def[13], def[14], def[15]);
1451 IDirect3DDevice9_GetVertexShaderConstantF(device, 12, out, 2);
1452 ok(out[0] == fvecarray[0] && out[1] == fvecarray[1] && out[2] == fvecarray[2] && out[3] == fvecarray[3]
1453 && out[4] == fvecarray[4] && out[5] == fvecarray[5] && out[6] == fvecarray[6] && out[7] == fvecarray[7],
1454 "The variable fvecarray was not set correctly, out ={%f, %f, %f, %f, %f, %f, %f, %f}, "
1455 "should be {%f, %f, %f, %f, %f, %f, %f, %f}\n",
1456 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1457 fvecarray[0], fvecarray[1], fvecarray[2], fvecarray[3], fvecarray[4], fvecarray[5], fvecarray[6], fvecarray[7]);
1459 IDirect3DDevice9_GetVertexShaderConstantF(device, 14, out, 2);
1460 ok(out[0] == 1.0f && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f
1461 && out[4] == 0.0f && out[5] == 0.0f && out[6] == 0.0f && out[7] == 0.0f,
1462 "The variable barray was not set correctly, out={%f, %f, %f, %f, %f, %f, %f, %f}, "
1463 "should be {%f, %f, %f, %f, %f, %f, %f, %f}\n",
1464 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
1465 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
1467 ID3DXConstantTable_Release(ctable);
1470 static void test_setting_constants(void)
1472 HWND wnd;
1473 IDirect3D9 *d3d;
1474 IDirect3DDevice9 *device;
1475 D3DPRESENT_PARAMETERS d3dpp;
1476 HRESULT hr;
1477 ULONG refcnt;
1479 if (!(wnd = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
1480 640, 480, NULL, NULL, NULL, NULL)))
1482 skip("Couldn't create application window\n");
1483 return;
1485 if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
1487 skip("Couldn't create IDirect3D9 object\n");
1488 DestroyWindow(wnd);
1489 return;
1492 ZeroMemory(&d3dpp, sizeof(d3dpp));
1493 d3dpp.Windowed = TRUE;
1494 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
1495 hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &device);
1496 if (FAILED(hr))
1498 skip("Failed to create IDirect3DDevice9 object %#lx\n", hr);
1499 IDirect3D9_Release(d3d);
1500 DestroyWindow(wnd);
1501 return;
1504 test_setting_basic_table(device);
1505 test_setting_matrices_table(device);
1506 test_setting_arrays_table(device);
1507 test_SetDefaults(device);
1508 test_SetValue(device);
1510 /* Release resources */
1511 refcnt = IDirect3DDevice9_Release(device);
1512 ok(refcnt == 0, "The Direct3D device reference count was %lu, should be 0\n", refcnt);
1514 refcnt = IDirect3D9_Release(d3d);
1515 ok(refcnt == 0, "The Direct3D object reference count was %lu, should be 0\n", refcnt);
1517 if (wnd) DestroyWindow(wnd);
1520 static void test_get_sampler_index(void)
1522 ID3DXConstantTable *ctable;
1524 HRESULT res;
1525 UINT index;
1527 ULONG refcnt;
1529 res = D3DXGetShaderConstantTable(ctab_samplers, &ctable);
1530 ok(res == D3D_OK, "D3DXGetShaderConstantTable failed on ctab_samplers: got %08lx\n", res);
1532 index = ID3DXConstantTable_GetSamplerIndex(ctable, "sampler1");
1533 ok(index == 0, "ID3DXConstantTable_GetSamplerIndex returned wrong index: Got %d, expected 0\n", index);
1535 index = ID3DXConstantTable_GetSamplerIndex(ctable, "sampler2");
1536 ok(index == 3, "ID3DXConstantTable_GetSamplerIndex returned wrong index: Got %d, expected 3\n", index);
1538 index = ID3DXConstantTable_GetSamplerIndex(ctable, "nonexistent");
1539 ok(index == -1, "ID3DXConstantTable_GetSamplerIndex found nonexistent sampler: Got %d\n",
1540 index);
1542 index = ID3DXConstantTable_GetSamplerIndex(ctable, "notsampler");
1543 ok(index == -1, "ID3DXConstantTable_GetSamplerIndex succeeded on non-sampler constant: Got %d\n",
1544 index);
1546 refcnt = ID3DXConstantTable_Release(ctable);
1547 ok(refcnt == 0, "The ID3DXConstantTable reference count was %lu, should be 0\n", refcnt);
1551 * fxc.exe /Tps_3_0
1553 #if 0
1554 sampler s;
1555 sampler1D s1D;
1556 sampler2D s2D;
1557 sampler3D s3D;
1558 samplerCUBE scube;
1559 float4 init;
1560 float4 main(float3 tex : TEXCOORD0) : COLOR
1562 float4 tmp = init;
1563 tmp = tmp + tex1D(s1D, tex.x);
1564 tmp = tmp + tex1D(s1D, tex.y);
1565 tmp = tmp + tex3D(s3D, tex.xyz);
1566 tmp = tmp + tex1D(s, tex.x);
1567 tmp = tmp + tex2D(s2D, tex.xy);
1568 tmp = tmp + texCUBE(scube, tex.xyz);
1569 return tmp;
1571 #endif
1572 static const DWORD get_shader_samplers_blob[] =
1574 0xffff0300, /* ps_3_0 */
1575 0x0054fffe, FCC_CTAB, /* CTAB comment */
1576 0x0000001c, 0x0000011b, 0xffff0300, 0x00000006, 0x0000001c, 0x00000100, /* Header */
1577 0x00000114,
1578 0x00000094, 0x00000002, 0x00000001, 0x0000009c, 0x00000000, /* Constant 1 desc (init) */
1579 0x000000ac, 0x00040003, 0x00000001, 0x000000b0, 0x00000000, /* Constant 2 desc (s) */
1580 0x000000c0, 0x00000003, 0x00000001, 0x000000c4, 0x00000000, /* Constant 3 desc (s1D) */
1581 0x000000d4, 0x00010003, 0x00000001, 0x000000d8, 0x00000000, /* Constant 4 desc (s2D) */
1582 0x000000e8, 0x00030003, 0x00000001, 0x000000ec, 0x00000000, /* Constant 5 desc (s3D) */
1583 0x000000fc, 0x00020003, 0x00000001, 0x00000104, 0x00000000, /* Constant 6 desc (scube) */
1584 0x74696e69, 0xababab00, /* Constant 1 name */
1585 0x00030001, 0x00040001, 0x00000001, 0x00000000, /* Constant 1 type desc */
1586 0xabab0073, /* Constant 2 name */
1587 0x000c0004, 0x00010001, 0x00000001, 0x00000000, /* Constant 2 type desc */
1588 0x00443173, /* Constant 3 name */
1589 0x000b0004, 0x00010001, 0x00000001, 0x00000000, /* Constant 3 type desc */
1590 0x00443273, /* Constant 4 name */
1591 0x000c0004, 0x00010001, 0x00000001, 0x00000000, /* Constant 4 type desc */
1592 0x00443373, /* Constant 5 name */
1593 0x000d0004, 0x00010001, 0x00000001, 0x00000000, /* Constant 5 type desc */
1594 0x62756373, 0xabab0065, /* Constant 6 name */
1595 0x000e0004, 0x00010001, 0x00000001, 0x00000000, /* Constant 6 type desc */
1596 0x335f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, /* Target/Creator name string */
1597 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
1598 0x332e3235, 0x00313131,
1599 0x0200001f, 0x80000005, 0x90070000, 0x0200001f, 0x90000000, 0xa00f0800, /* shader */
1600 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x98000000, 0xa00f0802,
1601 0x0200001f, 0xa0000000, 0xa00f0803, 0x0200001f, 0x90000000, 0xa00f0804,
1602 0x03000042, 0x800f0000, 0x90e40000, 0xa0e40800, 0x03000002, 0x800f0000,
1603 0x80e40000, 0xa0e40000, 0x03000042, 0x800f0001, 0x90550000, 0xa0e40800,
1604 0x03000002, 0x800f0000, 0x80e40000, 0x80e40001, 0x03000042, 0x800f0001,
1605 0x90e40000, 0xa0e40803, 0x03000002, 0x800f0000, 0x80e40000, 0x80e40001,
1606 0x03000042, 0x800f0001, 0x90e40000, 0xa0e40804, 0x03000002, 0x800f0000,
1607 0x80e40000, 0x80e40001, 0x03000042, 0x800f0001, 0x90e40000, 0xa0e40801,
1608 0x03000002, 0x800f0000, 0x80e40000, 0x80e40001, 0x03000042, 0x800f0001,
1609 0x90e40000, 0xa0e40802, 0x03000002, 0x800f0800, 0x80e40000, 0x80e40001,
1610 0x0000ffff, /* END */
1613 static void test_get_shader_samplers(void)
1615 const char *samplers[16] = {NULL}; /* maximum number of sampler registers v/ps 3.0 = 16 */
1616 const char *sampler_orig;
1617 UINT count = 2;
1618 HRESULT hr;
1620 if (0)
1622 /* crashes if bytecode is NULL */
1623 hr = D3DXGetShaderSamplers(NULL, NULL, &count);
1624 ok(hr == D3D_OK, "D3DXGetShaderSamplers failed, got %lx, expected %lx\n", hr, D3D_OK);
1627 hr = D3DXGetShaderSamplers(get_shader_samplers_blob, NULL, NULL);
1628 ok(hr == D3D_OK, "D3DXGetShaderSamplers failed, got %lx, expected %lx\n", hr, D3D_OK);
1630 samplers[5] = "dummy";
1632 hr = D3DXGetShaderSamplers(get_shader_samplers_blob, samplers, NULL);
1633 ok(hr == D3D_OK, "D3DXGetShaderSamplers failed, got %lx, expected %lx\n", hr, D3D_OK);
1635 /* check that sampler points to shader blob */
1636 sampler_orig = (const char *)&get_shader_samplers_blob[0x2e];
1637 ok(sampler_orig == samplers[0], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[0], sampler_orig);
1639 sampler_orig = (const char *)&get_shader_samplers_blob[0x33];
1640 ok(sampler_orig == samplers[1], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[1], sampler_orig);
1642 sampler_orig = (const char *)&get_shader_samplers_blob[0x38];
1643 ok(sampler_orig == samplers[2], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[2], sampler_orig);
1645 sampler_orig = (const char *)&get_shader_samplers_blob[0x3d];
1646 ok(sampler_orig == samplers[3], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[3], sampler_orig);
1648 sampler_orig = (const char *)&get_shader_samplers_blob[0x42];
1649 ok(sampler_orig == samplers[4], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[4], sampler_orig);
1651 ok(!strcmp(samplers[5], "dummy"), "D3DXGetShaderSamplers failed, got \"%s\", expected \"%s\"\n", samplers[5], "dummy");
1653 /* reset samplers */
1654 memset(samplers, 0, sizeof(samplers));
1655 samplers[5] = "dummy";
1657 hr = D3DXGetShaderSamplers(get_shader_samplers_blob, NULL, &count);
1658 ok(hr == D3D_OK, "D3DXGetShaderSamplers failed, got %lx, expected %lx\n", hr, D3D_OK);
1659 ok(count == 5, "D3DXGetShaderSamplers failed, got %u, expected %u\n", count, 5);
1661 hr = D3DXGetShaderSamplers(get_shader_samplers_blob, samplers, &count);
1662 ok(hr == D3D_OK, "D3DXGetShaderSamplers failed, got %lx, expected %lx\n", hr, D3D_OK);
1663 ok(count == 5, "D3DXGetShaderSamplers failed, got %u, expected %u\n", count, 5);
1665 /* check that sampler points to shader blob */
1666 sampler_orig = (const char *)&get_shader_samplers_blob[0x2e];
1667 ok(sampler_orig == samplers[0], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[0], sampler_orig);
1669 sampler_orig = (const char *)&get_shader_samplers_blob[0x33];
1670 ok(sampler_orig == samplers[1], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[1], sampler_orig);
1672 sampler_orig = (const char *)&get_shader_samplers_blob[0x38];
1673 ok(sampler_orig == samplers[2], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[2], sampler_orig);
1675 sampler_orig = (const char *)&get_shader_samplers_blob[0x3d];
1676 ok(sampler_orig == samplers[3], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[3], sampler_orig);
1678 sampler_orig = (const char *)&get_shader_samplers_blob[0x42];
1679 ok(sampler_orig == samplers[4], "D3DXGetShaderSamplers failed, got %p, expected %p\n", samplers[4], sampler_orig);
1681 ok(!strcmp(samplers[5], "dummy"), "D3DXGetShaderSamplers failed, got \"%s\", expected \"%s\"\n", samplers[5], "dummy");
1683 /* check without ctab */
1684 hr = D3DXGetShaderSamplers(simple_vs, samplers, &count);
1685 ok(hr == D3D_OK, "D3DXGetShaderSamplers failed, got %lx, expected %lx\n", hr, D3D_OK);
1686 ok(count == 0, "D3DXGetShaderSamplers failed, got %u, expected %u\n", count, 0);
1688 /* check invalid ctab */
1689 hr = D3DXGetShaderSamplers(shader_with_invalid_ctab, samplers, &count);
1690 ok(hr == D3D_OK, "D3DXGetShaderSamplers failed, got %lx, expected %lx\n", hr, D3D_OK);
1691 ok(count == 0, "D3DXGetShaderSamplers failed, got %u, expected %u\n", count, 0);
1695 * fxc.exe /Tvs_3_0
1697 #if 0
1698 float f = {1.1f}, f_2[2] = {2.1f, 2.2f};
1699 struct {float f; int i;} s = {3.1f, 31},
1700 s_2[2] = {{4.1f, 41}, {4.2f, 42}},
1701 s_3[3] = {{5.1f, 51}, {5.2f, 52}, {5.3f, 53}};
1702 struct {int i1; int i2; float2 f_2; row_major float3x1 r[2];}
1703 p[2] = {{11, 12, {13.1, 14.1}, {{3.11, 3.21, 3.31}, {3.41, 3.51, 3.61}}},
1704 {15, 16, {17.1, 18.1}, {{4.11, 4.21, 4.31}, {4.41, 4.51, 4.61}}}};
1705 int i[1] = {6};
1706 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}};
1707 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}};
1708 float3 v[2] = {{2.11, 2.21, 2.31}, {2.41, 2.51, 2.61}};
1709 row_major float3x1 r31[2] = {{3.11, 3.21, 3.31}, {3.41, 3.51, 3.61}};
1710 row_major float1x3 r13[2] = {{4.11, 4.21, 4.31}, {4.41, 4.51, 4.61}};
1711 float4 main(float4 pos : POSITION) : POSITION
1713 float4 tmp = 0.0f;
1714 tmp.zyw = v[1] + r13[1] + r31[1] + p[1].r[1];
1715 tmp.x += f * f_2[1] * pos.x * p[1].f_2.y;
1716 tmp.y += s.f * pos.y * s_2[0].i;
1717 tmp.z += s_3[0].f * pos.z * s_3[2].f * i[0] * f23[1]._11 * f32[1]._32;
1718 return tmp;
1720 #endif
1721 static const DWORD test_get_shader_constant_variables_blob[] =
1723 0xfffe0300, 0x0185fffe, 0x42415443, 0x0000001c, 0x000005df, 0xfffe0300, 0x0000000c, 0x0000001c,
1724 0x00000100, 0x000005d8, 0x0000010c, 0x002d0002, 0x00000001, 0x00000110, 0x00000120, 0x00000130,
1725 0x001d0002, 0x00000004, 0x00000134, 0x00000144, 0x000001a4, 0x00210002, 0x00000004, 0x000001a8,
1726 0x000001b8, 0x000001f8, 0x00250002, 0x00000002, 0x000001fc, 0x0000020c, 0x0000022c, 0x002f0002,
1727 0x00000001, 0x00000230, 0x00000240, 0x00000250, 0x00000002, 0x00000012, 0x000002b0, 0x000002c0,
1728 0x000003e0, 0x002b0002, 0x00000002, 0x000003e4, 0x000003f4, 0x00000414, 0x00120002, 0x00000006,
1729 0x00000418, 0x00000428, 0x00000488, 0x002e0002, 0x00000001, 0x000004ac, 0x000004bc, 0x000004dc,
1730 0x00270002, 0x00000002, 0x000004e0, 0x000004f0, 0x00000530, 0x00180002, 0x00000005, 0x00000534,
1731 0x00000544, 0x000005a4, 0x00290002, 0x00000002, 0x000005a8, 0x000005b8, 0xabab0066, 0x00030000,
1732 0x00010001, 0x00000001, 0x00000000, 0x3f8ccccd, 0x00000000, 0x00000000, 0x00000000, 0x00333266,
1733 0x00030003, 0x00030002, 0x00000002, 0x00000000, 0x3de147ae, 0x3ed1eb85, 0x00000000, 0x00000000,
1734 0x3e570a3d, 0x3f028f5c, 0x00000000, 0x00000000, 0x3e9eb852, 0x3f1c28f6, 0x00000000, 0x00000000,
1735 0x3df5c28f, 0x3ed70a3d, 0x00000000, 0x00000000, 0x3e6147ae, 0x3f051eb8, 0x00000000, 0x00000000,
1736 0x3ea3d70a, 0x3f1eb852, 0x00000000, 0x00000000, 0x00323366, 0x00030003, 0x00020003, 0x00000002,
1737 0x00000000, 0x3f8e147b, 0x3fa7ae14, 0x3fc147ae, 0x00000000, 0x3f9ae148, 0x3fb47ae1, 0x3fce147b,
1738 0x00000000, 0x3f8f5c29, 0x3fa8f5c3, 0x3fc28f5c, 0x00000000, 0x3f9c28f6, 0x3fb5c28f, 0x3fcf5c29,
1739 0x00000000, 0x00325f66, 0x00030000, 0x00010001, 0x00000002, 0x00000000, 0x40066666, 0x00000000,
1740 0x00000000, 0x00000000, 0x400ccccd, 0x00000000, 0x00000000, 0x00000000, 0xabab0069, 0x00020000,
1741 0x00010001, 0x00000001, 0x00000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x31690070,
1742 0xababab00, 0x00020000, 0x00010001, 0x00000001, 0x00000000, 0xab003269, 0x00030001, 0x00020001,
1743 0x00000001, 0x00000000, 0xabab0072, 0x00030002, 0x00010003, 0x00000002, 0x00000000, 0x00000252,
1744 0x00000258, 0x00000268, 0x00000258, 0x000001f8, 0x0000026c, 0x0000027c, 0x00000280, 0x00000005,
1745 0x000a0001, 0x00040002, 0x00000290, 0x41300000, 0x00000000, 0x00000000, 0x00000000, 0x41400000,
1746 0x00000000, 0x00000000, 0x00000000, 0x4151999a, 0x4161999a, 0x00000000, 0x00000000, 0x40470a3d,
1747 0x00000000, 0x00000000, 0x00000000, 0x404d70a4, 0x00000000, 0x00000000, 0x00000000, 0x4053d70a,
1748 0x00000000, 0x00000000, 0x00000000, 0x405a3d71, 0x00000000, 0x00000000, 0x00000000, 0x4060a3d7,
1749 0x00000000, 0x00000000, 0x00000000, 0x40670a3d, 0x00000000, 0x00000000, 0x00000000, 0x41700000,
1750 0x00000000, 0x00000000, 0x00000000, 0x41800000, 0x00000000, 0x00000000, 0x00000000, 0x4188cccd,
1751 0x4190cccd, 0x00000000, 0x00000000, 0x4083851f, 0x00000000, 0x00000000, 0x00000000, 0x4086b852,
1752 0x00000000, 0x00000000, 0x00000000, 0x4089eb85, 0x00000000, 0x00000000, 0x00000000, 0x408d1eb8,
1753 0x00000000, 0x00000000, 0x00000000, 0x409051ec, 0x00000000, 0x00000000, 0x00000000, 0x4093851f,
1754 0x00000000, 0x00000000, 0x00000000, 0x00333172, 0x00030002, 0x00030001, 0x00000002, 0x00000000,
1755 0x4083851f, 0x4086b852, 0x4089eb85, 0x00000000, 0x408d1eb8, 0x409051ec, 0x4093851f, 0x00000000,
1756 0x00313372, 0x00030002, 0x00010003, 0x00000002, 0x00000000, 0x40470a3d, 0x00000000, 0x00000000,
1757 0x00000000, 0x404d70a4, 0x00000000, 0x00000000, 0x00000000, 0x4053d70a, 0x00000000, 0x00000000,
1758 0x00000000, 0x405a3d71, 0x00000000, 0x00000000, 0x00000000, 0x4060a3d7, 0x00000000, 0x00000000,
1759 0x00000000, 0x40670a3d, 0x00000000, 0x00000000, 0x00000000, 0xabab0073, 0x00030000, 0x00010001,
1760 0x00000001, 0x00000000, 0x0000010c, 0x0000048c, 0x0000022c, 0x00000258, 0x00000005, 0x00020001,
1761 0x00020001, 0x0000049c, 0x40466666, 0x00000000, 0x00000000, 0x00000000, 0x41f80000, 0x00000000,
1762 0x00000000, 0x00000000, 0x00325f73, 0x00000005, 0x00020001, 0x00020002, 0x0000049c, 0x40833333,
1763 0x00000000, 0x00000000, 0x00000000, 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x40866666,
1764 0x00000000, 0x00000000, 0x00000000, 0x42280000, 0x00000000, 0x00000000, 0x00000000, 0x00335f73,
1765 0x00000005, 0x00020001, 0x00020003, 0x0000049c, 0x40a33333, 0x00000000, 0x00000000, 0x00000000,
1766 0x424c0000, 0x00000000, 0x00000000, 0x00000000, 0x40a66666, 0x00000000, 0x00000000, 0x00000000,
1767 0x42500000, 0x00000000, 0x00000000, 0x00000000, 0x40a9999a, 0x00000000, 0x00000000, 0x00000000,
1768 0x42540000, 0x00000000, 0x00000000, 0x00000000, 0xabab0076, 0x00030001, 0x00030001, 0x00000002,
1769 0x00000000, 0x40070a3d, 0x400d70a4, 0x4013d70a, 0x00000000, 0x401a3d71, 0x4020a3d7, 0x40270a3d,
1770 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
1771 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0200001f,
1772 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x02000001, 0x80070000, 0xa0e4002a,
1773 0x03000002, 0x80070000, 0x80e40000, 0xa0e4002c, 0x03000002, 0x80040000, 0x80aa0000, 0xa0000017,
1774 0x03000002, 0xe0080000, 0x80aa0000, 0xa0000011, 0x02000001, 0x80010001, 0xa000002d, 0x03000005,
1775 0x80040000, 0x80000001, 0xa0000026, 0x03000005, 0x80040000, 0x80aa0000, 0x90000000, 0x03000005,
1776 0xe0010000, 0x80aa0000, 0xa055000b, 0x03000002, 0x80020000, 0x80550000, 0xa0000016, 0x03000002,
1777 0x80010000, 0x80000000, 0xa0000015, 0x03000002, 0x80010000, 0x80000000, 0xa000000f, 0x03000002,
1778 0x80020000, 0x80550000, 0xa0000010, 0x03000005, 0x80040000, 0xa000002e, 0x90550000, 0x04000004,
1779 0xe0020000, 0x80aa0000, 0xa0000028, 0x80550000, 0x03000005, 0x80020000, 0xa0000018, 0x90aa0000,
1780 0x03000005, 0x80020000, 0x80550000, 0xa000001c, 0x03000005, 0x80020000, 0x80550000, 0xa000002f,
1781 0x03000005, 0x80020000, 0x80550000, 0xa0000020, 0x04000004, 0xe0040000, 0x80550000, 0xa0aa0024,
1782 0x80000000, 0x0000ffff,
1785 const struct
1787 const char *fullname;
1788 D3DXCONSTANT_DESC desc;
1789 UINT ctaboffset;
1791 test_get_shader_constant_variables_data[] =
1793 {"f", {"f", D3DXRS_FLOAT4, 45, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 72},
1794 {"f23", {"f23", D3DXRS_FLOAT4, 29, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 2, 3, 2, 0, 48, NULL}, 81},
1795 {"f23[0]", {"f23", D3DXRS_FLOAT4, 29, 3, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 2, 3, 1, 0, 24, NULL}, 81},
1796 {"f23[1]", {"f23", D3DXRS_FLOAT4, 32, 1, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 2, 3, 1, 0, 24, NULL}, 93},
1797 {"f32", {"f32", D3DXRS_FLOAT4, 33, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 2, 2, 0, 48, NULL}, 110},
1798 {"f32[0]", {"f32", D3DXRS_FLOAT4, 33, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 110},
1799 {"f32[1]", {"f32", D3DXRS_FLOAT4, 35, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 118},
1800 {"f_2", {"f_2", D3DXRS_FLOAT4, 37, 2, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 2, 0, 8, NULL}, 131},
1801 {"f_2[0]", {"f_2", D3DXRS_FLOAT4, 37, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 131},
1802 {"f_2[1]", {"f_2", D3DXRS_FLOAT4, 38, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 135},
1803 {"i", {"i", D3DXRS_FLOAT4, 47, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 144},
1804 {"i[0]", {"i", D3DXRS_FLOAT4, 47, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 144},
1805 {"p", {"p", D3DXRS_FLOAT4, 0, 18, D3DXPC_STRUCT, D3DXPT_VOID, 1, 10, 2, 4, 80, NULL}, 176},
1806 {"p[0]", {"p", D3DXRS_FLOAT4, 0, 9, D3DXPC_STRUCT, D3DXPT_VOID, 1, 10, 1, 4, 40, NULL}, 176},
1807 {"p[0].i1", {"i1", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 176},
1808 {"p[0].i2", {"i2", D3DXRS_FLOAT4, 1, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 180},
1809 {"p[0].f_2", {"f_2", D3DXRS_FLOAT4, 2, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 2, 1, 0, 8, NULL}, 184},
1810 {"p[0].r", {"r", D3DXRS_FLOAT4, 3, 6, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 2, 0, 24, NULL}, 188},
1811 {"p[0].r[0]", {"r", D3DXRS_FLOAT4, 3, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}, 188},
1812 {"p[0].r[1]", {"r", D3DXRS_FLOAT4, 6, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}, 200},
1813 {"p[1]", {"p", D3DXRS_FLOAT4, 9, 9, D3DXPC_STRUCT, D3DXPT_VOID, 1, 10, 1, 4, 40, NULL}, 212},
1814 {"p[1].i1", {"i1", D3DXRS_FLOAT4, 9, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 212},
1815 {"p[1].i2", {"i2", D3DXRS_FLOAT4, 10, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 216},
1816 {"p[1].f_2", {"f_2", D3DXRS_FLOAT4, 11, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 2, 1, 0, 8, NULL}, 220},
1817 {"p[1].r", {"r", D3DXRS_FLOAT4, 12, 6, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 2, 0, 24, NULL}, 224},
1818 {"p[1].r[0]", {"r", D3DXRS_FLOAT4, 12, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}, 224},
1819 {"p[1].r[1]", {"r", D3DXRS_FLOAT4, 15, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}, 236},
1820 {"r13", {"r13", D3DXRS_FLOAT4, 43, 2, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 2, 0, 24, NULL}, 253},
1821 {"r13[0]", {"r13", D3DXRS_FLOAT4, 43, 1, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 253},
1822 {"r13[1]", {"r13", D3DXRS_FLOAT4, 44, 1, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 257},
1823 {"r31", {"r31", D3DXRS_FLOAT4, 18, 6, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 2, 0, 24, NULL}, 266},
1824 {"r31[0]", {"r31", D3DXRS_FLOAT4, 18, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}, 266},
1825 {"r31[1]", {"r31", D3DXRS_FLOAT4, 21, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}, 278},
1826 {"s", {"s", D3DXRS_FLOAT4, 46, 1, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 1, 2, 8, NULL}, 303},
1827 {"s.f", {"f", D3DXRS_FLOAT4, 46, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 303},
1828 {"s.i", {"i", D3DXRS_FLOAT4, 47, 0, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 307},
1829 {"s_2", {"s_2", D3DXRS_FLOAT4, 39, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 2, 2, 16, NULL}, 316},
1830 {"s_2[0]", {"s_2", D3DXRS_FLOAT4, 39, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 1, 2, 8, NULL}, 316},
1831 {"s_2[0].f", {"f", D3DXRS_FLOAT4, 39, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 316},
1832 {"s_2[0].i", {"i", D3DXRS_FLOAT4, 40, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 320},
1833 {"s_2[1]", {"s_2", D3DXRS_FLOAT4, 41, 0, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 1, 2, 8, NULL}, 324},
1834 {"s_2[1].f", {"f", D3DXRS_FLOAT4, 41, 0, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 324},
1835 {"s_2[1].i", {"i", D3DXRS_FLOAT4, 41, 0, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 328},
1836 {"s_3", {"s_3", D3DXRS_FLOAT4, 24, 5, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 3, 2, 24, NULL}, 337},
1837 {"s_3[0]", {"s_3", D3DXRS_FLOAT4, 24, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 1, 2, 8, NULL}, 337},
1838 {"s_3[0].f", {"f", D3DXRS_FLOAT4, 24, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 337},
1839 {"s_3[0].i", {"i", D3DXRS_FLOAT4, 25, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 341},
1840 {"s_3[1]", {"s_3", D3DXRS_FLOAT4, 26, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 1, 2, 8, NULL}, 345},
1841 {"s_3[1].f", {"f", D3DXRS_FLOAT4, 26, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 345},
1842 {"s_3[1].i", {"i", D3DXRS_FLOAT4, 27, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 349},
1843 {"s_3[2]", {"s_3", D3DXRS_FLOAT4, 28, 1, D3DXPC_STRUCT, D3DXPT_VOID, 1, 2, 1, 2, 8, NULL}, 353},
1844 {"s_3[2].f", {"f", D3DXRS_FLOAT4, 28, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 353},
1845 {"s_3[2].i", {"i", D3DXRS_FLOAT4, 29, 0, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 357},
1846 {"v", {"v", D3DXRS_FLOAT4, 41, 2, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 2, 0, 24, NULL}, 366},
1847 {"v[0]", {"v", D3DXRS_FLOAT4, 41, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 366},
1848 {"v[1]", {"v", D3DXRS_FLOAT4, 42, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 370},
1851 static void test_get_shader_constant_variables(void)
1853 ID3DXConstantTable *ctable;
1854 HRESULT hr;
1855 ULONG count;
1856 UINT i;
1857 UINT nr = 1;
1858 D3DXHANDLE constant, element;
1859 D3DXCONSTANT_DESC desc;
1860 DWORD *ctab;
1862 hr = D3DXGetShaderConstantTable(test_get_shader_constant_variables_blob, &ctable);
1863 ok(hr == D3D_OK, "D3DXGetShaderConstantTable failed, got %08lx, expected %08lx\n", hr, D3D_OK);
1865 ctab = ID3DXConstantTable_GetBufferPointer(ctable);
1866 ok(ctab[0] == test_get_shader_constant_variables_blob[3], "ID3DXConstantTable_GetBufferPointer failed\n");
1868 for (i = 0; i < ARRAY_SIZE(test_get_shader_constant_variables_data); ++i)
1870 const char *fullname = test_get_shader_constant_variables_data[i].fullname;
1871 const D3DXCONSTANT_DESC *expected_desc = &test_get_shader_constant_variables_data[i].desc;
1872 UINT ctaboffset = test_get_shader_constant_variables_data[i].ctaboffset;
1874 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, fullname);
1875 ok(constant != NULL, "GetConstantByName \"%s\" failed\n", fullname);
1877 hr = ID3DXConstantTable_GetConstantDesc(ctable, constant, &desc, &nr);
1878 ok(hr == D3D_OK, "GetConstantDesc \"%s\" failed, got %08lx, expected %08lx\n", fullname, hr, D3D_OK);
1880 ok(!strcmp(expected_desc->Name, desc.Name), "GetConstantDesc \"%s\" failed, got \"%s\", expected \"%s\"\n",
1881 fullname, desc.Name, expected_desc->Name);
1882 ok(expected_desc->RegisterSet == desc.RegisterSet, "GetConstantDesc \"%s\" failed, got %#x, expected %#x\n",
1883 fullname, desc.RegisterSet, expected_desc->RegisterSet);
1884 ok(expected_desc->RegisterIndex == desc.RegisterIndex, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1885 fullname, desc.RegisterIndex, expected_desc->RegisterIndex);
1886 ok(expected_desc->RegisterCount == desc.RegisterCount, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1887 fullname, desc.RegisterCount, expected_desc->RegisterCount);
1888 ok(expected_desc->Class == desc.Class, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1889 fullname, desc.Class, expected_desc->Class);
1890 ok(expected_desc->Type == desc.Type, "GetConstantDesc \"%s\" failed, got %#x, expected %#x\n",
1891 fullname, desc.Type, expected_desc->Type);
1892 ok(expected_desc->Rows == desc.Rows, "GetConstantDesc \"%s\" failed, got %#x, expected %#x\n",
1893 fullname, desc.Rows, expected_desc->Rows);
1894 ok(expected_desc->Columns == desc.Columns, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1895 fullname, desc.Columns, expected_desc->Columns);
1896 ok(expected_desc->Elements == desc.Elements, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1897 fullname, desc.Elements, expected_desc->Elements);
1898 ok(expected_desc->StructMembers == desc.StructMembers, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1899 fullname, desc.StructMembers, expected_desc->StructMembers);
1900 ok(expected_desc->Bytes == desc.Bytes, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1901 fullname, desc.Bytes, expected_desc->Bytes);
1902 ok(ctaboffset == (DWORD *)desc.DefaultValue - ctab, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
1903 fullname, (UINT)((DWORD *)desc.DefaultValue - ctab), ctaboffset);
1906 element = ID3DXConstantTable_GetConstantElement(ctable, NULL, 0);
1907 ok(element == NULL, "GetConstantElement failed\n");
1909 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "i");
1910 ok(constant != NULL, "GetConstantByName failed\n");
1912 element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "i[0]");
1913 ok(constant == element, "GetConstantByName failed, got %p, expected %p\n", element, constant);
1915 element = ID3DXConstantTable_GetConstantElement(ctable, "i", 0);
1916 ok(element == constant, "GetConstantElement failed, got %p, expected %p\n", element, constant);
1918 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f");
1919 ok(constant != NULL, "GetConstantByName failed\n");
1921 element = ID3DXConstantTable_GetConstant(ctable, NULL, 0);
1922 ok(element == constant, "GetConstant failed, got %p, expected %p\n", element, constant);
1924 element = ID3DXConstantTable_GetConstant(ctable, "invalid", 0);
1925 ok(element == NULL, "GetConstant failed\n");
1927 element = ID3DXConstantTable_GetConstant(ctable, "f", 0);
1928 ok(element == NULL, "GetConstant failed\n");
1930 element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f[0]");
1931 ok(constant == element, "GetConstantByName failed, got %p, expected %p\n", element, constant);
1933 element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f[1]");
1934 ok(NULL == element, "GetConstantByName failed\n");
1936 element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f[0][0]");
1937 ok(constant == element, "GetConstantByName failed, got %p, expected %p\n", element, constant);
1939 element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f.");
1940 ok(element == NULL, "GetConstantByName failed\n");
1942 element = ID3DXConstantTable_GetConstantElement(ctable, "f", 0);
1943 ok(element == constant, "GetConstantElement failed, got %p, expected %p\n", element, constant);
1945 element = ID3DXConstantTable_GetConstantElement(ctable, "f", 1);
1946 ok(element == NULL, "GetConstantElement failed\n");
1948 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f_2[0]");
1949 ok(constant != NULL, "GetConstantByName failed\n");
1951 element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f_2");
1952 ok(element != constant, "GetConstantByName failed, got %p, expected %p\n", element, constant);
1954 element = ID3DXConstantTable_GetConstantElement(ctable, "f_2", 0);
1955 ok(element == constant, "GetConstantElement failed, got %p, expected %p\n", element, constant);
1957 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f_2[1]");
1958 ok(constant != NULL, "GetConstantByName failed\n");
1960 element = ID3DXConstantTable_GetConstantElement(ctable, "f_2", 1);
1961 ok(element == constant, "GetConstantElement failed, got %p, expected %p\n", element, constant);
1963 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "s_2[0].f");
1964 ok(constant != NULL, "GetConstantByName failed\n");
1966 element = ID3DXConstantTable_GetConstant(ctable, "s_2[0]", 0);
1967 ok(element == constant, "GetConstant failed, got %p, expected %p\n", element, constant);
1969 element = ID3DXConstantTable_GetConstantByName(ctable, "s_2[0]", "f");
1970 ok(element == constant, "GetConstantByName failed, got %p, expected %p\n", element, constant);
1972 element = ID3DXConstantTable_GetConstantByName(ctable, "s_2[0]", "invalid");
1973 ok(element == NULL, "GetConstantByName failed\n");
1975 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "s_2[0]");
1976 ok(constant != NULL, "GetConstantByName failed\n");
1978 element = ID3DXConstantTable_GetConstantElement(ctable, "s_2[0]", 0);
1979 ok(constant == element, "GetConstantByName failed, got %p, expected %p\n", element, constant);
1981 count = ID3DXConstantTable_Release(ctable);
1982 ok(count == 0, "Release failed, got %lu, expected %u\n", count, 0);
1985 #define REGISTER_OUTPUT_SIZE 48
1987 enum Type {SetFloat, SetInt, SetBool, SetIntArray, SetBoolArray, SetFloatArray, SetMatrix,
1988 SetMatrixTranspose, SetMatrixArray, SetMatrixTransposeArray, SetVector, SetVectorArray,
1989 SetValue, SetMatrixPointerArray, SetMatrixTransposePointerArray};
1991 struct registerset_test
1993 enum Type type;
1994 UINT in_index;
1995 UINT in_count_min;
1996 UINT in_count_max;
1997 UINT out_count;
1998 DWORD out[REGISTER_OUTPUT_SIZE];
2001 struct registerset_constants
2003 const char *fullname;
2004 D3DXCONSTANT_DESC desc;
2005 UINT ctaboffset;
2008 static const DWORD registerset_test_input[][REGISTER_OUTPUT_SIZE] =
2010 /* float */
2011 {0x40000123, 0x00000000, 0x40800123, 0x40a00123,
2012 0x40c00123, 0x40e00123, 0x41000123, 0x41100123,
2013 0x41200123, 0x41300123, 0x41400123, 0x41500123,
2014 0x41600123, 0x41700123, 0x41800123, 0x41900123,
2015 0x41a00123, 0x41b00123, 0x41c00123, 0x41d00123,
2016 0x00000000, 0x41f00123, 0x42000123, 0x42100123,
2017 0x00000000, 0x42300123, 0x42400123, 0x42500123,
2018 0x42600123, 0x42700123, 0x42800123, 0x42900123,
2019 0x43000123, 0x43100123, 0x43200123, 0x43300123,
2020 0x43400123, 0x43500123, 0x43600123, 0x43700123,
2021 0x43800123, 0x43900123, 0x43a00123, 0x43b00123,
2022 0x43c00123, 0x43d00123, 0x43e00123, 0x43f00123},
2023 /* int */
2024 {0x00000002, 0x00000003, 0x00000004, 0x00000005,
2025 0x00000000, 0x00000007, 0x00000008, 0x00000009,
2026 0x0000000a, 0x0000000b, 0x0000000c, 0x0000000d,
2027 0x0000000e, 0x0000000f, 0x00000010, 0x00000011,
2028 0x00000012, 0x00000000, 0x00000000, 0x00000015,
2029 0x00000016, 0x00000017, 0x00000018, 0x00000019,
2030 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d,
2031 0x0000001e, 0x0000001f, 0x00000020, 0x00000021,
2032 0x00000022, 0x00000023, 0x00000024, 0x00000025,
2033 0x00000026, 0x00000027, 0x00000028, 0x00000029,
2034 0x0000002a, 0x0000002b, 0x0000002c, 0x0000002d,
2035 0x0000002e, 0x0000002f, 0x00000030, 0x00000031},
2039 * fxc.exe /Tvs_3_0
2041 #if 0
2042 bool b = 1;
2043 int n = 8;
2044 float f = 5.1;
2045 int nf = 11;
2046 bool bf = 1;
2047 float4 main(float4 pos : POSITION) : POSITION
2049 float4 tmp = 0;
2050 int i;
2051 if (b) for (i = 0; i < n; i++) tmp.x += pos.z * f * nf;
2052 else for (i = 0; i < n; i++) tmp.y += pos.y * f * bf;
2053 return tmp;
2055 #endif
2056 static const DWORD registerset_blob_scalar[] =
2058 0xfffe0300, 0x0051fffe, 0x42415443, 0x0000001c, 0x0000010f, 0xfffe0300, 0x00000005, 0x0000001c,
2059 0x00000100, 0x00000108, 0x00000080, 0x00000000, 0x00000001, 0x00000084, 0x00000094, 0x00000098,
2060 0x00020002, 0x00000001, 0x00000084, 0x0000009c, 0x000000ac, 0x00000002, 0x00000001, 0x000000b0,
2061 0x000000c0, 0x000000d0, 0x00000001, 0x00000001, 0x000000d4, 0x000000e4, 0x000000f4, 0x00010002,
2062 0x00000001, 0x000000d4, 0x000000f8, 0xabab0062, 0x00010000, 0x00010001, 0x00000001, 0x00000000,
2063 0xffffffff, 0xab006662, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0xabab0066, 0x00030000,
2064 0x00010001, 0x00000001, 0x00000000, 0x40a33333, 0x00000000, 0x00000000, 0x00000000, 0xabab006e,
2065 0x00020000, 0x00010001, 0x00000001, 0x00000000, 0x00000008, 0x00000000, 0x00000001, 0x00000000,
2066 0xab00666e, 0x41300000, 0x00000000, 0x00000000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369,
2067 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
2068 0x392e3932, 0x332e3235, 0x00313131, 0x05000051, 0xa00f0003, 0x00000000, 0x00000000, 0x00000000,
2069 0x00000000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x01000028,
2070 0xe0e40800, 0x03000005, 0x80010000, 0xa0000000, 0x90aa0000, 0x02000001, 0x80010001, 0xa0000003,
2071 0x01000026, 0xf0e40000, 0x04000004, 0x80010001, 0x80000000, 0xa0000001, 0x80000001, 0x00000027,
2072 0x02000001, 0x80020001, 0xa0000003, 0x0000002a, 0x03000005, 0x80010000, 0xa0000000, 0x90550000,
2073 0x02000001, 0x80020001, 0xa0000003, 0x01000026, 0xf0e40000, 0x04000004, 0x80020001, 0x80000000,
2074 0xa0000002, 0x80550001, 0x00000027, 0x02000001, 0x80010001, 0xa0000003, 0x0000002b, 0x02000001,
2075 0xe0030000, 0x80e40001, 0x02000001, 0xe00c0000, 0xa0000003, 0x0000ffff,
2078 static const struct registerset_constants registerset_constants_scalar_float[] =
2080 {"f", {"f", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 48},
2083 static const struct registerset_test registerset_test_scalar_float[] =
2085 {SetFloat, 0, 0, 0, 4, {0x40000123}},
2086 {SetInt, 1, 0, 0, 4, {0x40000000}},
2087 {SetBool, 1, 0, 0, 4, {0x3f800000}},
2088 {SetIntArray},
2089 {SetIntArray, 1, 1, REGISTER_OUTPUT_SIZE, 4, {0x40000000}},
2090 {SetBoolArray},
2091 {SetBoolArray, 1, 1, REGISTER_OUTPUT_SIZE, 4, {0x3f800000}},
2092 {SetFloatArray},
2093 {SetFloatArray, 0, 1, REGISTER_OUTPUT_SIZE, 4, {0x40000123}},
2094 {SetValue, 0, 0, 3},
2095 {SetValue, 0, 4, REGISTER_OUTPUT_SIZE * 4, 4, {0x40000123}},
2096 {SetVector, 0, 0, 0, 4, {0x40000123}},
2097 {SetVectorArray},
2098 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4, {0x40000123}},
2099 {SetMatrix, 0, 0, 0, 4, {0x40000123},},
2100 {SetMatrixArray},
2101 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123}},
2102 {SetMatrixTranspose, 0, 0, 0, 4, {0x40000123},},
2103 {SetMatrixTransposeArray},
2104 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123}},
2105 {SetMatrixPointerArray},
2106 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123}},
2107 {SetMatrixTransposePointerArray},
2108 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123}},
2111 static const struct registerset_constants registerset_constants_scalar_int[] =
2113 {"n", {"n", D3DXRS_INT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 57},
2116 static const struct registerset_test registerset_test_scalar_int[] =
2118 {SetFloat, 0, 0, 0, 4,
2119 {0x00000002, 0x00000000, 0x00000001}},
2120 {SetInt, 1, 0, 0, 4,
2121 {0x00000002, 0x00000000, 0x00000001}},
2122 {SetBool, 1, 0, 0, 4,
2123 {0x00000001, 0x00000000, 0x00000001}},
2124 {SetIntArray},
2125 {SetIntArray, 1, 1, REGISTER_OUTPUT_SIZE, 4,
2126 {0x00000002, 0x00000000, 0x00000001}},
2127 {SetBoolArray},
2128 {SetBoolArray, 1, 1, REGISTER_OUTPUT_SIZE, 4,
2129 {0x00000001, 0x00000000, 0x00000001}},
2130 {SetFloatArray},
2131 {SetFloatArray, 0, 1, REGISTER_OUTPUT_SIZE, 4,
2132 {0x00000002, 0x00000000, 0x00000001}},
2133 {SetValue, 1, 0, 3},
2134 {SetValue, 1, 4, REGISTER_OUTPUT_SIZE * 4, 4,
2135 {0x00000002, 0x00000000, 0x00000001}},
2136 {SetVector, 0, 0, 0, 4,
2137 {0x00000002, 0x00000000, 0x00000001},},
2138 {SetVectorArray},
2139 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4,
2140 {0x00000002, 0x00000000, 0x00000001}},
2141 {SetMatrix, 0, 0, 0, 4,
2142 {0x00000002, 0x00000000, 0x00000001}},
2143 {SetMatrixArray},
2144 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
2145 {0x00000002, 0x00000000, 0x00000001}},
2146 {SetMatrixTranspose, 0, 0, 0, 4,
2147 {0x00000002, 0x00000000, 0x00000001}},
2148 {SetMatrixTransposeArray},
2149 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
2150 {0x00000002, 0x00000000, 0x00000001}},
2151 {SetMatrixPointerArray},
2152 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
2153 {0x00000002, 0x00000000, 0x00000001}},
2154 {SetMatrixTransposePointerArray},
2155 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
2156 {0x00000002, 0x00000000, 0x00000001}},
2159 static const struct registerset_constants registerset_constants_scalar_int_float[] =
2161 {"nf", {"nf", D3DXRS_FLOAT4, 1, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 62},
2164 static const struct registerset_test registerset_test_scalar_int_float[] =
2166 {SetFloat, 0, 0, 0, 4, {0x40000000}},
2167 {SetInt, 1, 0, 0, 4, {0x40000000}},
2168 {SetBool, 1, 0, 0, 4, {0x3f800000}},
2169 {SetIntArray},
2170 {SetIntArray, 1, 1, REGISTER_OUTPUT_SIZE, 4, {0x40000000}},
2171 {SetBoolArray},
2172 {SetBoolArray, 1, 1, REGISTER_OUTPUT_SIZE, 4, {0x3f800000}},
2173 {SetFloatArray},
2174 {SetFloatArray, 0, 1, REGISTER_OUTPUT_SIZE, 4, {0x40000000}},
2175 {SetValue, 1, 0, 3},
2176 {SetValue, 1, 4, REGISTER_OUTPUT_SIZE * 4, 4, {0x40000000}},
2177 {SetVector, 0, 0, 0, 4, {0x40000000}},
2178 {SetVectorArray},
2179 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4, {0x40000000}},
2180 {SetMatrix, 0, 0, 0, 4, {0x40000000}},
2181 {SetMatrixArray},
2182 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000}},
2183 {SetMatrixTranspose, 0, 0, 0, 4, {0x40000000}},
2184 {SetMatrixTransposeArray},
2185 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000}},
2186 {SetMatrixPointerArray},
2187 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000}},
2188 {SetMatrixTransposePointerArray},
2189 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000}},
2192 static const struct registerset_constants registerset_constants_scalar_bool_float[] =
2194 {"bf", {"bf", D3DXRS_FLOAT4, 2, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 39},
2197 static const struct registerset_test registerset_test_scalar_bool_float[] =
2199 {SetFloat, 0, 0, 0, 4, {0x3f800000}},
2200 {SetInt, 1, 0, 0, 4, {0x3f800000}},
2201 {SetBool, 1, 0, 0, 4, {0x3f800000}},
2202 {SetIntArray},
2203 {SetIntArray, 1, 1, REGISTER_OUTPUT_SIZE, 4, {0x3f800000}},
2204 {SetBoolArray},
2205 {SetBoolArray, 1, 1, REGISTER_OUTPUT_SIZE, 4, {0x3f800000}},
2206 {SetFloatArray},
2207 {SetFloatArray, 0, 1, REGISTER_OUTPUT_SIZE, 4, {0x3f800000}},
2208 {SetValue, 1, 0, 3},
2209 {SetValue, 1, 4, REGISTER_OUTPUT_SIZE * 4, 4, {0x3f800000}},
2210 {SetVector, 0, 0, 0, 4, {0x3f800000}},
2211 {SetVectorArray},
2212 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4, {0x3f800000}},
2213 {SetMatrix, 0, 0, 0, 4, {0x3f800000}},
2214 {SetMatrixArray},
2215 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000}},
2216 {SetMatrixTranspose, 0, 0, 0, 4, {0x3f800000}},
2217 {SetMatrixTransposeArray},
2218 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000}},
2219 {SetMatrixPointerArray},
2220 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000}},
2221 {SetMatrixTransposePointerArray},
2222 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000}},
2225 static const struct registerset_constants registerset_constants_scalar_bool[] =
2227 {"b", {"b", D3DXRS_BOOL, 0, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 37},
2230 static const struct registerset_test registerset_test_scalar_bool[] =
2232 {SetFloat, 0, 0, 0, 1, {0x00000001}},
2233 {SetInt, 1, 0, 0, 1, {0x00000001}},
2234 {SetBool, 1, 0, 0, 1, {0x00000002}},
2235 {SetIntArray},
2236 {SetIntArray, 1, 1, REGISTER_OUTPUT_SIZE, 1, {0x00000001}},
2237 {SetBoolArray},
2238 {SetBoolArray, 1, 1, REGISTER_OUTPUT_SIZE, 1, {0x00000002}},
2239 {SetFloatArray},
2240 {SetFloatArray, 0, 1, REGISTER_OUTPUT_SIZE, 1, {0x00000001}},
2241 {SetValue, 1, 0, 3},
2242 {SetValue, 1, 4, REGISTER_OUTPUT_SIZE * 4, 1, {0x00000002}},
2243 {SetVector, 0, 0, 0, 1, {0x00000001}},
2244 {SetVectorArray},
2245 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 1, {0x00000001}},
2246 {SetMatrix, 0, 0, 0, 1, {0x00000001}},
2247 {SetMatrixArray},
2248 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 1, {0x00000001}},
2249 {SetMatrixTranspose, 0, 0, 0, 1, {0x00000001}},
2250 {SetMatrixTransposeArray},
2251 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 1, {0x00000001}},
2252 {SetMatrixPointerArray},
2253 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 1, {0x00000001}},
2254 {SetMatrixTransposePointerArray},
2255 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 1, {0x00000001}},
2259 * fxc.exe /Tvs_3_0
2261 #if 0
2262 bool ab[2] = {1, 0};
2263 int an[2] = {32, 33};
2264 float af[2] = {3.1, 3.2};
2265 int anf[2] = {14, 15};
2266 bool abf[2] = {1, 1};
2267 float4 main(float4 pos : POSITION) : POSITION
2269 float4 tmp = 0;
2270 int i;
2271 if (ab[1]) for (i = 0; i < an[1]; i++) tmp.x += pos.z * af[0] * anf[1];
2272 else for (i = 0; i < an[0]; i++) tmp.y += pos.y * af[1] * abf[1];
2273 return tmp;
2275 #endif
2276 static const DWORD registerset_blob_scalar_array[] =
2278 0xfffe0300, 0x006afffe, 0x42415443, 0x0000001c, 0x00000173, 0xfffe0300, 0x00000005, 0x0000001c,
2279 0x00000100, 0x0000016c, 0x00000080, 0x00000000, 0x00000002, 0x00000084, 0x00000094, 0x0000009c,
2280 0x00040002, 0x00000002, 0x000000a0, 0x000000b0, 0x000000d0, 0x00000002, 0x00000002, 0x000000d4,
2281 0x000000e4, 0x00000104, 0x00000001, 0x00000002, 0x00000108, 0x00000118, 0x00000138, 0x00020002,
2282 0x00000002, 0x0000013c, 0x0000014c, 0xab006261, 0x00010000, 0x00010001, 0x00000002, 0x00000000,
2283 0xffffffff, 0x00000000, 0x00666261, 0x00010000, 0x00010001, 0x00000002, 0x00000000, 0x3f800000,
2284 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0xab006661,
2285 0x00030000, 0x00010001, 0x00000002, 0x00000000, 0x40466666, 0x00000000, 0x00000000, 0x00000000,
2286 0x404ccccd, 0x00000000, 0x00000000, 0x00000000, 0xab006e61, 0x00020000, 0x00010001, 0x00000002,
2287 0x00000000, 0x00000020, 0x00000000, 0x00000001, 0x00000000, 0x00000021, 0x00000000, 0x00000001,
2288 0x00000000, 0x00666e61, 0x00020000, 0x00010001, 0x00000002, 0x00000000, 0x41600000, 0x00000000,
2289 0x00000000, 0x00000000, 0x41700000, 0x00000000, 0x00000000, 0x00000000, 0x335f7376, 0x4d00305f,
2290 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
2291 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x05000051, 0xa00f0006, 0x00000000, 0x00000000,
2292 0x00000000, 0x00000000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000,
2293 0x01000028, 0xe0e40801, 0x03000005, 0x80010000, 0xa0000000, 0x90aa0000, 0x02000001, 0x80010001,
2294 0xa0000006, 0x01000026, 0xf0e40001, 0x04000004, 0x80010001, 0x80000000, 0xa0000003, 0x80000001,
2295 0x00000027, 0x02000001, 0x80020001, 0xa0000006, 0x0000002a, 0x03000005, 0x80010000, 0xa0000001,
2296 0x90550000, 0x02000001, 0x80020001, 0xa0000006, 0x01000026, 0xf0e40000, 0x04000004, 0x80020001,
2297 0x80000000, 0xa0000005, 0x80550001, 0x00000027, 0x02000001, 0x80010001, 0xa0000006, 0x0000002b,
2298 0x02000001, 0xe0030000, 0x80e40001, 0x02000001, 0xe00c0000, 0xa0000006, 0x0000ffff,
2301 static const struct registerset_constants registerset_constants_scalar_array_float[] =
2303 {"af", {"af", D3DXRS_FLOAT4, 0, 2, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 2, 0, 8, NULL}, 57},
2304 {"af[0]", {"af", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 57},
2305 {"af[1]", {"af", D3DXRS_FLOAT4, 1, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 61},
2308 static const struct registerset_test registerset_test_scalar_array_float[] =
2310 {SetFloat, 0, 0, 0, 4, {0x40000123}},
2311 {SetInt, 1, 0, 0, 4, {0x40000000}},
2312 {SetBool, 1, 0, 0, 4, {0x3f800000}},
2313 {SetIntArray},
2314 {SetIntArray, 1, 1, 1, 4, {0x40000000}},
2315 {SetIntArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2316 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000}},
2317 {SetBoolArray},
2318 {SetBoolArray, 1, 1, 1, 4, {0x3f800000}},
2319 {SetBoolArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2320 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2321 {SetFloatArray},
2322 {SetFloatArray, 0, 1, 1, 4, {0x40000123}},
2323 {SetFloatArray, 0, 2, REGISTER_OUTPUT_SIZE, 8,
2324 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2325 {SetValue, 0, 0, 3},
2326 {SetValue, 0, 4, 7, 4, {0x40000123}},
2327 {SetValue, 0, 8, REGISTER_OUTPUT_SIZE * 4, 8,
2328 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2329 {SetVector, 0, 0, 0, 8,
2330 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2331 {SetVectorArray},
2332 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
2333 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2334 {SetMatrix, 0, 0, 0, 8,
2335 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2336 {SetMatrixArray},
2337 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2338 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2339 {SetMatrixTranspose, 0, 0, 0, 8,
2340 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123}},
2341 {SetMatrixTransposeArray},
2342 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2343 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123}},
2344 {SetMatrixPointerArray},
2345 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2346 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2347 {SetMatrixTransposePointerArray},
2348 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2349 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123}},
2352 static const struct registerset_constants registerset_constants_scalar_array_int[] =
2354 {"an", {"an", D3DXRS_INT4, 0, 2, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 2, 0, 8, NULL}, 70},
2355 {"an[0]", {"an", D3DXRS_INT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 70},
2356 {"an[1]", {"an", D3DXRS_INT4, 1, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 74},
2359 static const struct registerset_test registerset_test_scalar_array_int[] =
2361 {SetFloat, 0, 0, 0, 4, {0x00000002, 0x00000000, 0x00000001}},
2362 {SetInt, 1, 0, 0, 4, {0x00000002, 0x00000000, 0x00000001}},
2363 {SetBool, 1, 0, 0, 4, {0x00000001, 0x00000000, 0x00000001}},
2364 {SetIntArray},
2365 {SetIntArray, 1, 1, 1, 4, {0x00000002, 0x00000000, 0x00000001}},
2366 {SetIntArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2367 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000000, 0x00000001}},
2368 {SetBoolArray},
2369 {SetBoolArray, 1, 1, 1, 4, {0x00000001, 0x00000000, 0x00000001}},
2370 {SetBoolArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2371 {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001}},
2372 {SetFloatArray},
2373 {SetFloatArray, 0, 1, 1, 4, {0x00000002, 0x00000000, 0x00000001}},
2374 {SetFloatArray, 0, 2, REGISTER_OUTPUT_SIZE, 8,
2375 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
2376 {SetValue, 1, 0, 3},
2377 {SetValue, 1, 4, 7, 4, {0x00000002, 0x00000000, 0x00000001}},
2378 {SetValue, 1, 8, REGISTER_OUTPUT_SIZE * 4, 8,
2379 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000000, 0x00000001}},
2380 {SetVector, 0, 0, 0, 8,
2381 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
2382 {SetVectorArray},
2383 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
2384 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
2385 {SetMatrix, 0, 0, 0, 8,
2386 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
2387 {SetMatrixArray},
2388 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2389 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
2390 {SetMatrixTranspose, 0, 0, 0, 8,
2391 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000000, 0x00000001}},
2392 {SetMatrixTransposeArray},
2393 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2394 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000000, 0x00000001}},
2395 {SetMatrixPointerArray},
2396 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2397 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
2398 {SetMatrixTransposePointerArray},
2399 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2400 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000000, 0x00000001}},
2403 static const struct registerset_constants registerset_constants_scalar_array_bool[] =
2405 {"ab", {"ab", D3DXRS_BOOL, 0, 2, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 2, 0, 8, NULL}, 37},
2406 {"ab[0]", {"ab", D3DXRS_BOOL, 0, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 37},
2407 {"ab[1]", {"ab", D3DXRS_BOOL, 1, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 38},
2410 static const struct registerset_test registerset_test_scalar_array_bool[] =
2412 {SetFloat, 0, 0, 0, 1, {0x00000001}},
2413 {SetInt, 1, 0, 0, 1, {0x00000001}},
2414 {SetBool, 1, 0, 0, 1, {0x00000002}},
2415 {SetIntArray},
2416 {SetIntArray, 1, 1, 1, 1, {0x00000001}},
2417 {SetIntArray, 1, 2, REGISTER_OUTPUT_SIZE, 2, {0x00000001, 0x00000001}},
2418 {SetBoolArray},
2419 {SetBoolArray, 1, 1, 1, 1, {0x00000002}},
2420 {SetBoolArray, 1, 2, REGISTER_OUTPUT_SIZE, 2, {0x00000002, 0x00000003}},
2421 {SetFloatArray},
2422 {SetFloatArray, 0, 1, 1, 1, {0x00000001}},
2423 {SetFloatArray, 0, 2, REGISTER_OUTPUT_SIZE, 2, {0x00000001, 0x00000000}},
2424 {SetValue, 1, 0, 3},
2425 {SetValue, 1, 4, 7, 1, {0x00000002}},
2426 {SetValue, 1, 8, REGISTER_OUTPUT_SIZE * 4, 2, {0x00000002, 0x00000003}},
2427 {SetVector, 0, 0, 0, 2, {0x00000001, 0x00000000}},
2428 {SetVectorArray},
2429 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 2, {0x00000001, 0x00000000}},
2430 {SetMatrix, 0, 0, 0, 2, {0x00000001, 0x00000000}},
2431 {SetMatrixArray},
2432 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 2, {0x00000001, 0x00000000}},
2433 {SetMatrixTranspose, 0, 0, 0, 2, {0x00000001, 0x00000001}},
2434 {SetMatrixTransposeArray},
2435 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 2, {0x00000001, 0x00000001}},
2436 {SetMatrixPointerArray},
2437 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 2, {0x00000001, 0x00000000}},
2438 {SetMatrixTransposePointerArray},
2439 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 2, {0x00000001, 0x00000001}},
2442 static const struct registerset_constants registerset_constants_scalar_array_bool_float[] =
2444 {"abf", {"abf", D3DXRS_FLOAT4, 4, 2, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 2, 0, 8, NULL}, 44},
2445 {"abf[0]", {"abf", D3DXRS_FLOAT4, 4, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 44},
2446 {"abf[1]", {"abf", D3DXRS_FLOAT4, 5, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 48},
2449 static const struct registerset_test registerset_test_scalar_array_bool_float[] =
2451 {SetFloat, 0, 0, 0, 4, {0x3f800000}},
2452 {SetInt, 1, 0, 0, 4, {0x3f800000}},
2453 {SetBool, 1, 0, 0, 4, {0x3f800000}},
2454 {SetIntArray},
2455 {SetIntArray, 1, 1, 1, 4, {0x3f800000}},
2456 {SetIntArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2457 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2458 {SetBoolArray},
2459 {SetBoolArray, 1, 1, 1, 4, {0x3f800000}},
2460 {SetBoolArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2461 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2462 {SetFloatArray},
2463 {SetFloatArray, 0, 1, 1, 4, {0x3f800000}},
2464 {SetFloatArray, 0, 2, REGISTER_OUTPUT_SIZE, 8,
2465 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2466 {SetValue, 1, 0, 3},
2467 {SetValue, 1, 4, 7, 4, {0x3f800000}},
2468 {SetValue, 1, 8, REGISTER_OUTPUT_SIZE * 4, 8,
2469 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2470 {SetVector, 0, 0, 0, 8,
2471 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2472 {SetVectorArray},
2473 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
2474 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2475 {SetMatrix, 0, 0, 0, 8,
2476 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2477 {SetVectorArray},
2478 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2479 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2480 {SetMatrixTranspose, 0, 0, 0, 8,
2481 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2482 {SetMatrixTransposeArray},
2483 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2484 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2485 {SetMatrixPointerArray},
2486 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2487 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2488 {SetMatrixTransposePointerArray},
2489 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2490 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2493 static const struct registerset_constants registerset_constants_scalar_array_int_float[] =
2495 {"anf", {"anf", D3DXRS_FLOAT4, 2, 2, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 2, 0, 8, NULL}, 83},
2496 {"anf[0]", {"anf", D3DXRS_FLOAT4, 2, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 83},
2497 {"anf[1]", {"anf", D3DXRS_FLOAT4, 3, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 87},
2500 static const struct registerset_test registerset_test_scalar_array_int_float[] =
2502 {SetFloat, 0, 0, 0, 4, {0x40000000}},
2503 {SetInt, 1, 0, 0, 4, {0x40000000}},
2504 {SetBool, 1, 0, 0, 4, {0x3f800000}},
2505 {SetIntArray},
2506 {SetIntArray, 1, 1, 1, 4, {0x40000000}},
2507 {SetIntArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2508 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000}},
2509 {SetBoolArray},
2510 {SetBoolArray, 1, 1, 1, 4, {0x3f800000}},
2511 {SetBoolArray, 1, 2, REGISTER_OUTPUT_SIZE, 8,
2512 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
2513 {SetFloatArray},
2514 {SetFloatArray, 0, 1, 1, 4, {0x40000000}},
2515 {SetFloatArray, 0, 2, REGISTER_OUTPUT_SIZE, 8,
2516 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2517 {SetValue, 1, 0, 3},
2518 {SetValue, 1, 4, 7, 4, {0x40000000}},
2519 {SetValue, 1, 8, REGISTER_OUTPUT_SIZE * 4, 8,
2520 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000}},
2521 {SetVector, 0, 0, 0, 8,
2522 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2523 {SetVectorArray},
2524 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
2525 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2526 {SetMatrix, 0, 0, 0, 8,
2527 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2528 {SetMatrixArray},
2529 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2530 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2531 {SetMatrixTranspose, 0, 0, 0, 8,
2532 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000}},
2533 {SetMatrixTransposeArray},
2534 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2535 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000}},
2536 {SetMatrixPointerArray},
2537 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2538 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
2539 {SetMatrixTransposePointerArray},
2540 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2541 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000}},
2545 * fxc.exe /Tvs_3_0
2547 #if 0
2548 bool3 vb = {1, 0, 1};
2549 int3 vn = {7, 8, 9};
2550 float3 vf = {5.1, 5.2, 5.3};
2551 int3 vnf = {11, 85, 62};
2552 bool3 vbf = {1, 1, 1};
2553 float4 main(float4 pos : POSITION) : POSITION
2555 float4 tmp = 0;
2556 int i;
2557 if (vb.z) for (i = 0; i < vn.z; i++) tmp.x += pos.z * vf.z * vnf.z;
2558 else for (i = 0; i < vn.y; i++) tmp.y += pos.y * vf.y * vbf.z;
2559 return tmp;
2561 #endif
2562 static const DWORD registerset_blob_vector[] =
2564 0xfffe0300, 0x0053fffe, 0x42415443, 0x0000001c, 0x00000117, 0xfffe0300, 0x00000005, 0x0000001c,
2565 0x00000100, 0x00000110, 0x00000080, 0x00000000, 0x00000003, 0x00000084, 0x00000094, 0x000000a0,
2566 0x00020002, 0x00000001, 0x00000084, 0x000000a4, 0x000000b4, 0x00000002, 0x00000001, 0x000000b8,
2567 0x000000c8, 0x000000d8, 0x00000001, 0x00000003, 0x000000dc, 0x000000ec, 0x000000fc, 0x00010002,
2568 0x00000001, 0x000000dc, 0x00000100, 0xab006276, 0x00010001, 0x00030001, 0x00000001, 0x00000000,
2569 0xffffffff, 0x00000000, 0xffffffff, 0x00666276, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
2570 0xab006676, 0x00030001, 0x00030001, 0x00000001, 0x00000000, 0x40a33333, 0x40a66666, 0x40a9999a,
2571 0x00000000, 0xab006e76, 0x00020001, 0x00030001, 0x00000001, 0x00000000, 0x00000007, 0x00000008,
2572 0x00000009, 0x00000000, 0x00666e76, 0x41300000, 0x42aa0000, 0x42780000, 0x00000000, 0x335f7376,
2573 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
2574 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x05000051, 0xa00f0003, 0x00000000,
2575 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000,
2576 0xe00f0000, 0x01000028, 0xe0e40802, 0x03000005, 0x80010000, 0xa0aa0000, 0x90aa0000, 0x02000001,
2577 0x80010001, 0xa0000003, 0x01000026, 0xf0e40002, 0x04000004, 0x80010001, 0x80000000, 0xa0aa0001,
2578 0x80000001, 0x00000027, 0x02000001, 0x80020001, 0xa0000003, 0x0000002a, 0x03000005, 0x80010000,
2579 0xa0550000, 0x90550000, 0x02000001, 0x80020001, 0xa0000003, 0x01000026, 0xf0e40001, 0x04000004,
2580 0x80020001, 0x80000000, 0xa0aa0002, 0x80550001, 0x00000027, 0x02000001, 0x80010001, 0xa0000003,
2581 0x0000002b, 0x02000001, 0xe0030000, 0x80e40001, 0x02000001, 0xe00c0000, 0xa0000003, 0x0000ffff,
2584 static const struct registerset_constants registerset_constants_vector_float[] =
2586 {"vf", {"vf", D3DXRS_FLOAT4, 0, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 50},
2589 static const struct registerset_test registerset_test_vector_float[] =
2591 {SetInt},
2592 {SetBool},
2593 {SetFloat},
2594 {SetIntArray, 1, 0, 2},
2595 {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x40000000, 0x40400000, 0x40800000}},
2596 {SetBoolArray, 1, 0, 2},
2597 {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2598 {SetFloatArray, 0, 0, 2},
2599 {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 4, {0x40000123, 0x00000000, 0x40800123}},
2600 {SetValue, 0, 0, 11},
2601 {SetValue, 0, 12, REGISTER_OUTPUT_SIZE * 4, 4, {0x40000123, 0x00000000, 0x40800123}},
2602 {SetVector, 0, 0, 0, 4, {0x40000123, 0x00000000, 0x40800123}},
2603 {SetVectorArray},
2604 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4, {0x40000123, 0x00000000, 0x40800123}},
2605 {SetMatrix, 0, 0, 0, 4, {0x40000123, 0x00000000, 0x40800123}},
2606 {SetMatrixArray},
2607 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123, 0x00000000, 0x40800123}},
2608 {SetMatrixTranspose, 0, 0, 0, 4, {0x40000123, 0x40c00123, 0x41200123}},
2609 {SetMatrixTransposeArray},
2610 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123, 0x40c00123, 0x41200123}},
2611 {SetMatrixPointerArray},
2612 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123, 0x00000000, 0x40800123}},
2613 {SetMatrixTransposePointerArray},
2614 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000123, 0x40c00123, 0x41200123}},
2617 static const struct registerset_constants registerset_constants_vector_int[] =
2619 {"vn", {"vn", D3DXRS_INT4, 0, 3, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 59},
2622 static const struct registerset_test registerset_test_vector_int[] =
2624 {SetInt},
2625 {SetBool},
2626 {SetFloat},
2627 {SetIntArray, 1, 0, 2},
2628 {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x00000002, 0x00000003, 0x00000004}},
2629 {SetBoolArray, 1, 0, 2},
2630 {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x00000001, 0x00000001, 0x00000001}},
2631 {SetFloatArray, 0, 0, 2},
2632 {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 4, {0x00000002, 0x00000000, 0x00000004}},
2633 {SetValue, 1, 0, 11},
2634 {SetValue, 1, 12, REGISTER_OUTPUT_SIZE * 4, 4, {0x00000002, 0x00000003, 0x00000004}},
2635 {SetVector, 0, 0, 0, 4, {0x00000002, 0x00000000, 0x00000004}},
2636 {SetVectorArray},
2637 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4, {0x00000002, 0x00000000, 0x00000004}},
2638 {SetMatrix, 0, 0, 0, 4, {0x00000002, 0x00000000, 0x00000004}},
2639 {SetMatrixArray},
2640 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x00000002, 0x00000000, 0x00000004}},
2641 {SetMatrixTranspose, 0, 0, 0, 4, {0x00000002, 0x00000006, 0x0000000a}},
2642 {SetMatrixTransposeArray},
2643 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x00000002, 0x00000006, 0x0000000a}},
2644 {SetMatrixPointerArray},
2645 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x00000002, 0x00000000, 0x00000004}},
2646 {SetMatrixTransposePointerArray},
2647 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x00000002, 0x00000006, 0x0000000a}},
2650 static const struct registerset_constants registerset_constants_vector_bool[] =
2652 {"vb", {"vb", D3DXRS_BOOL, 0, 3, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 37},
2655 static const struct registerset_test registerset_test_vector_bool[] =
2657 {SetInt},
2658 {SetBool},
2659 {SetFloat},
2660 {SetIntArray, 1, 0, 2},
2661 {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 3, {0x00000001, 0x00000001, 0x00000001}},
2662 {SetBoolArray, 1, 0, 2},
2663 {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 3, {0x00000002, 0x00000003, 0x00000004}},
2664 {SetFloatArray, 0, 0, 2},
2665 {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 3, {0x00000001, 0x00000000, 0x00000001}},
2666 {SetValue, 1, 0, 11},
2667 {SetValue, 1, 12, REGISTER_OUTPUT_SIZE * 4, 3, {0x00000002, 0x00000003, 0x00000004}},
2668 {SetVector, 0, 0, 0, 3, {0x00000001, 0x00000000, 0x00000001}},
2669 {SetVectorArray},
2670 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 3, {0x00000001, 0x00000000, 0x00000001}},
2671 {SetMatrix, 0, 0, 0, 3, {0x00000001, 0x00000000, 0x00000001}},
2672 {SetMatrixArray},
2673 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000000, 0x00000001}},
2674 {SetMatrixTranspose, 0, 0, 0, 3, {0x00000001, 0x00000001, 0x00000001}},
2675 {SetMatrixTransposeArray},
2676 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000001, 0x00000001}},
2677 {SetMatrixPointerArray},
2678 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000000, 0x00000001}},
2679 {SetMatrixTransposePointerArray},
2680 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 3, {0x00000001, 0x00000001, 0x00000001}},
2683 static const struct registerset_constants registerset_constants_vector_bool_float[] =
2685 {"vbf", {"vbf", D3DXRS_FLOAT4, 2, 1, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 41},
2688 static const struct registerset_test registerset_test_vector_bool_float[] =
2690 {SetInt},
2691 {SetBool},
2692 {SetFloat},
2693 {SetIntArray, 1, 0, 2},
2694 {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2695 {SetBoolArray, 1, 0, 2},
2696 {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2697 {SetFloatArray, 0, 0, 2},
2698 {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2699 {SetValue, 1, 0, 11},
2700 {SetValue, 1, 12, REGISTER_OUTPUT_SIZE * 4, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2701 {SetVector, 0, 0, 0, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2702 {SetVectorArray},
2703 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2704 {SetMatrix, 0, 0, 0, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2705 {SetMatrixArray},
2706 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2707 {SetMatrixTranspose, 0, 0, 0, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2708 {SetMatrixTransposeArray},
2709 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2710 {SetMatrixPointerArray},
2711 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2712 {SetMatrixTransposePointerArray},
2713 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2716 static const struct registerset_constants registerset_constants_vector_int_float[] =
2718 {"vnf", {"vnf", D3DXRS_FLOAT4, 1, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 64},
2721 static const struct registerset_test registerset_test_vector_int_float[] =
2723 {SetInt},
2724 {SetBool},
2725 {SetFloat},
2726 {SetIntArray, 1, 0, 2},
2727 {SetIntArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x40000000, 0x40400000, 0x40800000}},
2728 {SetBoolArray, 1, 0, 2},
2729 {SetBoolArray, 1, 3, REGISTER_OUTPUT_SIZE, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2730 {SetFloatArray, 0, 0, 2},
2731 {SetFloatArray, 0, 3, REGISTER_OUTPUT_SIZE, 4, {0x40000000, 0x00000000, 0x40800000}},
2732 {SetValue, 1, 0, 11},
2733 {SetValue, 1, 12, REGISTER_OUTPUT_SIZE * 4, 4, {0x40000000, 0x40400000, 0x40800000}},
2734 {SetVector, 0, 0, 0, 4, {0x40000000, 0x00000000, 0x40800000}},
2735 {SetVectorArray},
2736 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4, {0x40000000, 0x00000000, 0x40800000}},
2737 {SetMatrix, 0, 0, 0, 4, {0x40000000, 0x00000000, 0x40800000}},
2738 {SetMatrixArray},
2739 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000, 0x00000000, 0x40800000}},
2740 {SetMatrixTranspose, 0, 0, 0, 4, {0x40000000, 0x40c00000, 0x41200000}},
2741 {SetMatrixTransposeArray},
2742 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000, 0x40c00000, 0x41200000}},
2743 {SetMatrixPointerArray},
2744 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000, 0x00000000, 0x40800000}},
2745 {SetMatrixTransposePointerArray},
2746 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4, {0x40000000, 0x40c00000, 0x41200000}},
2750 * fxc.exe /Tvs_3_0
2752 #if 0
2753 bool3 vab[2] = {1, 0, 1, 1, 0, 1};
2754 int3 van[2] = {70, 80, 90, 100, 110, 120};
2755 float3 vaf[2] = {55.1, 55.2, 55.3, 55.4, 55.5, 55.6};
2756 int3 vanf[2] = {130, 140, 150, 160, 170, 180};
2757 bool3 vabf[2] = {1, 1, 1, 1, 1, 1};
2758 float4 main(float4 pos : POSITION) : POSITION
2760 float4 tmp = 0;
2761 int i;
2762 if (vab[1].z) for (i = 0; i < van[1].z; i++) tmp.x += pos.z * vaf[1].z * vanf[1].z;
2763 else for (i = 0; i < van[1].y; i++) tmp.y += pos.y * vaf[0].y * vabf[1].z;
2764 return tmp;
2766 #endif
2767 static const DWORD registerset_blob_vector_array[] =
2769 0xfffe0300, 0x0070fffe, 0x42415443, 0x0000001c, 0x0000018b, 0xfffe0300, 0x00000005, 0x0000001c,
2770 0x00000100, 0x00000184, 0x00000080, 0x00000000, 0x00000006, 0x00000084, 0x00000094, 0x000000ac,
2771 0x00040002, 0x00000002, 0x000000b4, 0x000000c4, 0x000000e4, 0x00000002, 0x00000002, 0x000000e8,
2772 0x000000f8, 0x00000118, 0x00000001, 0x00000006, 0x0000011c, 0x0000012c, 0x0000014c, 0x00020002,
2773 0x00000002, 0x00000154, 0x00000164, 0x00626176, 0x00010001, 0x00030001, 0x00000002, 0x00000000,
2774 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x66626176, 0xababab00,
2775 0x00010001, 0x00030001, 0x00000002, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
2776 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00666176, 0x00030001, 0x00030001, 0x00000002,
2777 0x00000000, 0x425c6666, 0x425ccccd, 0x425d3333, 0x00000000, 0x425d999a, 0x425e0000, 0x425e6666,
2778 0x00000000, 0x006e6176, 0x00020001, 0x00030001, 0x00000002, 0x00000000, 0x00000046, 0x00000050,
2779 0x0000005a, 0x00000000, 0x00000064, 0x0000006e, 0x00000078, 0x00000000, 0x666e6176, 0xababab00,
2780 0x00020001, 0x00030001, 0x00000002, 0x00000000, 0x43020000, 0x430c0000, 0x43160000, 0x00000000,
2781 0x43200000, 0x432a0000, 0x43340000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73,
2782 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
2783 0x332e3235, 0x00313131, 0x05000051, 0xa00f0006, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2784 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x01000028, 0xe0e40805,
2785 0x03000005, 0x80010000, 0xa0aa0001, 0x90aa0000, 0x02000001, 0x80010001, 0xa0000006, 0x01000026,
2786 0xf0e40005, 0x04000004, 0x80010001, 0x80000000, 0xa0aa0003, 0x80000001, 0x00000027, 0x02000001,
2787 0x80020001, 0xa0000006, 0x0000002a, 0x03000005, 0x80010000, 0xa0550000, 0x90550000, 0x02000001,
2788 0x80020001, 0xa0000006, 0x01000026, 0xf0e40004, 0x04000004, 0x80020001, 0x80000000, 0xa0aa0005,
2789 0x80550001, 0x00000027, 0x02000001, 0x80010001, 0xa0000006, 0x0000002b, 0x02000001, 0xe0030000,
2790 0x80e40001, 0x02000001, 0xe00c0000, 0xa0000006, 0x0000ffff,
2793 static const struct registerset_constants registerset_constants_vector_array_float[] =
2795 {"vaf", {"vaf", D3DXRS_FLOAT4, 0, 2, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 2, 0, 24, NULL}, 62},
2796 {"vaf[0]", {"vaf", D3DXRS_FLOAT4, 0, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 62},
2797 {"vaf[1]", {"vaf", D3DXRS_FLOAT4, 1, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 66},
2800 static const struct registerset_test registerset_test_vector_array_float[] =
2802 {SetInt},
2803 {SetBool},
2804 {SetFloat},
2805 {SetIntArray, 1, 0, 2},
2806 {SetIntArray, 1, 3, 5, 4, {0x40000000, 0x40400000, 0x40800000}},
2807 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
2808 {0x40000000, 0x40400000, 0x40800000, 0x00000000, 0x40a00000, 0x00000000, 0x40e00000}},
2809 {SetBoolArray, 1, 0, 2},
2810 {SetBoolArray, 1, 3, 5, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2811 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
2812 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000}},
2813 {SetFloatArray, 0, 0, 2},
2814 {SetFloatArray, 0, 3, 5, 4, {0x40000123, 0x00000000, 0x40800123}},
2815 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
2816 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40a00123, 0x40c00123, 0x40e00123}},
2817 {SetValue, 0, 0, 11},
2818 {SetValue, 0, 12, 23, 4, {0x40000123, 0x00000000, 0x40800123}},
2819 {SetValue, 0, 24, REGISTER_OUTPUT_SIZE * 4, 8,
2820 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40a00123, 0x40c00123, 0x40e00123}},
2821 {SetVector, 0, 0, 0, 4, {0x40000123, 0x00000000, 0x40800123}},
2822 {SetVectorArray},
2823 {SetVectorArray, 0, 1, 1, 4, {0x40000123, 0x00000000, 0x40800123}},
2824 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
2825 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
2826 {SetMatrix, 0, 0, 0, 8,
2827 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
2828 {SetMatrixArray},
2829 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2830 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
2831 {SetMatrixTranspose, 0, 0, 0, 8,
2832 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
2833 {SetMatrixTransposeArray},
2834 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2835 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
2836 {SetMatrixPointerArray},
2837 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2838 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
2839 {SetMatrixTransposePointerArray},
2840 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2841 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
2844 static const struct registerset_constants registerset_constants_vector_array_int[] =
2846 {"van", {"van", D3DXRS_INT4, 0, 6, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 2, 0, 24, NULL}, 75},
2847 {"van[0]", {"van", D3DXRS_INT4, 0, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 75},
2848 {"van[1]", {"van", D3DXRS_INT4, 1, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 79},
2851 static const struct registerset_test registerset_test_vector_array_int[] =
2853 {SetInt},
2854 {SetBool},
2855 {SetFloat},
2856 {SetIntArray, 1, 0, 2},
2857 {SetIntArray, 1, 3, 5, 4, {0x00000002, 0x00000003, 0x00000004}},
2858 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
2859 {0x00000002, 0x00000003, 0x00000004, 0x00000000, 0x00000005, 0x00000000, 0x00000007}},
2860 {SetBoolArray, 1, 0, 2},
2861 {SetBoolArray, 1, 3, 5, 4, {0x00000001, 0x00000001, 0x00000001}},
2862 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
2863 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001}},
2864 {SetFloatArray, 0, 0, 2},
2865 {SetFloatArray, 0, 3, 5, 4, {0x00000002, 0x00000000, 0x00000004}},
2866 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
2867 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000005, 0x00000006, 0x00000007}},
2868 {SetValue, 1, 0, 11},
2869 {SetValue, 1, 12, 23, 4, {0x00000002, 0x00000003, 0x00000004}},
2870 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 8,
2871 {0x00000002, 0x00000003, 0x00000004, 0x00000000, 0x00000005, 0x00000000, 0x00000007}},
2872 {SetVector, 0, 0, 0, 4, {0x00000002, 0x00000000, 0x00000004}},
2873 {SetVectorArray, 0, 0, 0},
2874 {SetVectorArray, 0, 1, 1, 4, {0x00000002, 0x00000000, 0x00000004}},
2875 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
2876 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
2877 {SetMatrix, 0, 0, 0, 8,
2878 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
2879 {SetMatrixArray},
2880 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2881 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
2882 {SetMatrixTranspose, 0, 0, 0, 8,
2883 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
2884 {SetMatrixTransposeArray},
2885 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2886 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
2887 {SetMatrixPointerArray},
2888 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2889 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
2890 {SetMatrixTransposePointerArray},
2891 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2892 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
2895 static const struct registerset_constants registerset_constants_vector_array_bool[] =
2897 {"vab", {"vab", D3DXRS_BOOL, 0, 6, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 2, 0, 24, NULL}, 37},
2898 {"vab[0]", {"vab", D3DXRS_BOOL, 0, 3, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 37},
2899 {"vab[1]", {"vab", D3DXRS_BOOL, 3, 3, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 40},
2902 static const struct registerset_test registerset_test_vector_array_bool[] =
2904 {SetInt},
2905 {SetBool},
2906 {SetFloat},
2907 {SetIntArray, 1, 0, 2},
2908 {SetIntArray, 1, 3, 5, 3, {0x00000001, 0x00000001, 0x00000001}},
2909 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
2910 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
2911 {SetBoolArray, 1, 0},
2912 {SetBoolArray, 1, 3, 5, 3, {0x00000002, 0x00000003, 0x00000004}},
2913 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
2914 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
2915 {SetFloatArray, 0, 0, 2},
2916 {SetFloatArray, 0, 3, 5, 3, {0x00000001, 0x00000000, 0x00000001}},
2917 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 6,
2918 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
2919 {SetValue, 1, 0, 11},
2920 {SetValue, 1, 12, 23, 3, {0x00000002, 0x00000003, 0x00000004}},
2921 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 6,
2922 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
2923 {SetVector, 0, 0, 0, 3, {0x00000001, 0x00000000, 0x00000001}},
2924 {SetVectorArray},
2925 {SetVectorArray, 0, 1, 1, 3, {0x00000001, 0x00000000, 0x00000001}},
2926 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 6,
2927 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
2928 {SetMatrix, 0, 0, 0, 6,
2929 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
2930 {SetMatrixArray},
2931 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
2932 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
2933 {SetMatrixTranspose, 0, 0, 0, 6,
2934 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
2935 {SetMatrixTransposeArray},
2936 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
2937 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
2938 {SetMatrixPointerArray},
2939 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
2940 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
2941 {SetMatrixTransposePointerArray},
2942 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
2943 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
2946 static const struct registerset_constants registerset_constants_vector_array_bool_float[] =
2948 {"vabf", {"vabf", D3DXRS_FLOAT4, 4, 2, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 2, 0, 24, NULL}, 49},
2949 {"vabf[0]", {"vabf", D3DXRS_FLOAT4, 4, 1, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 49},
2950 {"vabf[1]", {"vabf", D3DXRS_FLOAT4, 5, 1, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 53},
2953 static const struct registerset_test registerset_test_vector_array_bool_float[] =
2955 {SetInt},
2956 {SetBool},
2957 {SetFloat},
2958 {SetIntArray, 1, 0, 2},
2959 {SetIntArray, 1, 3, 5, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2960 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
2961 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000}},
2962 {SetBoolArray, 1, 0, 2},
2963 {SetBoolArray, 1, 3, 5, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2964 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
2965 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000}},
2966 {SetFloatArray, 0, 0, 2},
2967 {SetFloatArray, 0, 3, 5, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2968 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
2969 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
2970 {SetValue, 1, 0, 11},
2971 {SetValue, 1, 12, 23, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
2972 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 8,
2973 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000}},
2974 {SetVector, 0, 0, 0, 4, {0x3f800000, 0x00000000, 0x3f800000},},
2975 {SetVectorArray},
2976 {SetVectorArray, 0, 1, 1, 4, {0x3f800000, 0x00000000, 0x3f800000}},
2977 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
2978 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
2979 {SetMatrix, 0, 0, 0, 8,
2980 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
2981 {SetMatrixArray},
2982 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2983 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
2984 {SetMatrixTranspose, 0, 0, 0, 8,
2985 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
2986 {SetMatrixTransposeArray},
2987 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2988 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
2989 {SetMatrixPointerArray},
2990 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2991 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
2992 {SetMatrixTransposePointerArray},
2993 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
2994 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
2997 static const struct registerset_constants registerset_constants_vector_array_int_float[] =
2999 {"vanf", {"vanf", D3DXRS_FLOAT4, 2, 2, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 2, 0, 24, NULL}, 89},
3000 {"vanf[0]", {"vanf", D3DXRS_FLOAT4, 2, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 89},
3001 {"vanf[1]", {"vanf", D3DXRS_FLOAT4, 3, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 93},
3004 static const struct registerset_test registerset_test_vector_array_int_float[] =
3006 {SetInt},
3007 {SetBool},
3008 {SetFloat},
3009 {SetIntArray, 1, 0, 2},
3010 {SetIntArray, 1, 3, 5, 4, {0x40000000, 0x40400000, 0x40800000}},
3011 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3012 {0x40000000, 0x40400000, 0x40800000, 0x00000000, 0x40a00000, 0x00000000, 0x40e00000}},
3013 {SetBoolArray, 1, 0, 2},
3014 {SetBoolArray, 1, 3, 5, 4, {0x3f800000, 0x3f800000, 0x3f800000}},
3015 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3016 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000}},
3017 {SetFloatArray, 2, 0, 2,},
3018 {SetFloatArray, 0, 3, 5, 4, {0x40000000, 0x00000000, 0x40800000}},
3019 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
3020 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40a00000, 0x40c00000, 0x40e00000}},
3021 {SetValue, 1, 0, 11},
3022 {SetValue, 1, 12, 23, 4, {0x40000000, 0x40400000, 0x40800000}},
3023 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 8,
3024 {0x40000000, 0x40400000, 0x40800000, 0x00000000, 0x40a00000, 0x00000000, 0x40e00000}},
3025 {SetVector, 0, 0, 0, 4, {0x40000000, 0x00000000, 0x40800000}},
3026 {SetVectorArray},
3027 {SetVectorArray, 0, 1, 1, 4, {0x40000000, 0x00000000, 0x40800000}},
3028 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
3029 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3030 {SetMatrix, 0, 0, 0, 8,
3031 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3032 {SetMatrixArray},
3033 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3034 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3035 {SetMatrixTranspose, 0, 0, 0, 8,
3036 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3037 {SetMatrixTransposeArray},
3038 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3039 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3040 {SetMatrixPointerArray},
3041 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3042 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3043 {SetMatrixTransposePointerArray},
3044 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3045 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3049 * fxc.exe /Tvs_3_0
3051 #if 0
3052 bool3x2 cb = {1, 0, 1, 1, 0, 1};
3053 int3x2 cn = {4, 5, 6, 7, 8, 9};
3054 float3x2 cf = {15.1, 15.2, 15.3, 15.4, 15.5, 15.6};
3055 bool3x2 cbf = {1, 1, 0, 1, 0, 1};
3056 int3x2 cnf = {30, 31, 33, 32, 34, 36};
3057 float4 main(float4 pos : POSITION) : POSITION
3059 float4 tmp = 0;
3060 int i;
3061 if (cb._32) for (i = 0; i < cn._31; i++) tmp.x += pos.z * cf._31 * cbf._32;
3062 else for (i = 0; i < cn._32; i++) tmp.y += pos.y * cf._32 * cnf._32;
3063 return tmp;
3065 #endif
3066 static const DWORD registerset_blob_column[] =
3068 0xfffe0300, 0x0066fffe, 0x42415443, 0x0000001c, 0x00000163, 0xfffe0300, 0x00000005, 0x0000001c,
3069 0x00000100, 0x0000015c, 0x00000080, 0x00000000, 0x00000006, 0x00000084, 0x00000094, 0x000000ac,
3070 0x00020002, 0x00000002, 0x00000084, 0x000000b0, 0x000000d0, 0x00000002, 0x00000002, 0x000000d4,
3071 0x000000e4, 0x00000104, 0x00000001, 0x00000006, 0x00000108, 0x00000118, 0x00000138, 0x00040002,
3072 0x00000002, 0x00000108, 0x0000013c, 0xab006263, 0x00010003, 0x00020003, 0x00000001, 0x00000000,
3073 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x00666263, 0x3f800000,
3074 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0xab006663,
3075 0x00030003, 0x00020003, 0x00000001, 0x00000000, 0x4171999a, 0x4174cccd, 0x41780000, 0x00000000,
3076 0x41733333, 0x41766666, 0x4179999a, 0x00000000, 0xab006e63, 0x00020003, 0x00020003, 0x00000001,
3077 0x00000000, 0x00000004, 0x00000006, 0x00000008, 0x00000000, 0x00000005, 0x00000007, 0x00000009,
3078 0x00000000, 0x00666e63, 0x41f00000, 0x42040000, 0x42080000, 0x00000000, 0x41f80000, 0x42000000,
3079 0x42100000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
3080 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
3081 0x05000051, 0xa00f0006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
3082 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x01000028, 0xe0e40805, 0x03000005, 0x80010000,
3083 0xa0aa0000, 0x90aa0000, 0x02000001, 0x80010001, 0xa0000006, 0x01000026, 0xf0e40004, 0x04000004,
3084 0x80010001, 0x80000000, 0xa0aa0003, 0x80000001, 0x00000027, 0x02000001, 0x80020001, 0xa0000006,
3085 0x0000002a, 0x03000005, 0x80010000, 0xa0aa0001, 0x90550000, 0x02000001, 0x80020001, 0xa0000006,
3086 0x01000026, 0xf0e40005, 0x04000004, 0x80020001, 0x80000000, 0xa0aa0005, 0x80550001, 0x00000027,
3087 0x02000001, 0x80010001, 0xa0000006, 0x0000002b, 0x02000001, 0xe0030000, 0x80e40001, 0x02000001,
3088 0xe00c0000, 0xa0000006, 0x0000ffff,
3091 static const struct registerset_constants registerset_constants_column_float[] =
3093 {"cf", {"cf", D3DXRS_FLOAT4, 0, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 57},
3096 static const struct registerset_test registerset_test_column_float[] =
3098 {SetInt},
3099 {SetBool},
3100 {SetFloat},
3101 {SetIntArray, 1, 0, 5},
3102 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3103 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000}},
3104 {SetBoolArray, 1, 0, 5},
3105 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3106 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3107 {SetFloatArray, 0, 0, 5},
3108 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
3109 {0x40000123, 0x40800123, 0x40c00123, 0x00000000, 0x00000000, 0x40a00123, 0x40e00123}},
3110 {SetValue, 0, 0, 23},
3111 {SetValue, 0, 24, REGISTER_OUTPUT_SIZE * 4, 8,
3112 {0x40000123, 0x40800123, 0x40c00123, 0x00000000, 0x00000000, 0x40a00123, 0x40e00123}},
3113 {SetVector},
3114 {SetVectorArray, 0, 0, 1},
3115 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
3116 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3117 {SetMatrix, 0, 0, 0, 8,
3118 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3119 {SetMatrixArray},
3120 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3121 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3122 {SetMatrixTranspose, 0, 0, 0, 8,
3123 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
3124 {SetMatrixTransposeArray},
3125 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3126 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
3127 {SetMatrixPointerArray},
3128 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3129 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3130 {SetMatrixTransposePointerArray},
3131 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3132 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
3135 static const struct registerset_constants registerset_constants_column_int[] =
3137 {"cn", {"cn", D3DXRS_INT4, 0, 6, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 70},
3140 static const struct registerset_test registerset_test_column_int[] =
3142 {SetInt},
3143 {SetBool},
3144 {SetFloat},
3145 {SetIntArray, 1, 0, 5},
3146 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3147 {0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3148 {SetBoolArray, 1, 0, 5},
3149 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3150 {0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3151 {SetFloatArray, 0, 0, 5},
3152 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
3153 {0x00000002, 0x00000004, 0x00000006, 0x00000000, 0x00000000, 0x00000005, 0x00000007}},
3154 {SetValue, 1, 0, 23},
3155 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 8,
3156 {0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3157 {SetVector},
3158 {SetVectorArray, 0, 0, 1},
3159 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
3160 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3161 {SetMatrix, 0, 0, 0, 8,
3162 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3163 {SetMatrixArray},
3164 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3165 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3166 {SetMatrixTranspose, 0, 0, 0, 8,
3167 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
3168 {SetMatrixTransposeArray},
3169 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3170 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
3171 {SetMatrixPointerArray},
3172 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3173 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3174 {SetMatrixTransposePointerArray},
3175 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3176 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
3179 static const struct registerset_constants registerset_constants_column_bool[] =
3181 {"cb", {"cb", D3DXRS_BOOL, 0, 6, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 37},
3184 static const struct registerset_test registerset_test_column_bool[] =
3186 {SetInt},
3187 {SetBool},
3188 {SetFloat},
3189 {SetIntArray, 1, 0, 5},
3190 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
3191 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3192 {SetBoolArray, 1, 0, 5},
3193 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
3194 {0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3195 {SetFloatArray, 0, 0, 5},
3196 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 6,
3197 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3198 {SetValue, 1, 0, 23},
3199 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 6,
3200 {0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3201 {SetVector},
3202 {SetVectorArray, 0, 0, 1},
3203 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 6,
3204 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3205 {SetMatrix, 0, 0, 0, 6,
3206 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3207 {SetMatrixArray},
3208 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
3209 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3210 {SetMatrixTranspose, 0, 0, 0, 6,
3211 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3212 {SetMatrixTransposeArray},
3213 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 6,
3214 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3215 {SetMatrixPointerArray},
3216 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
3217 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3218 {SetMatrixTransposePointerArray},
3219 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
3220 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3223 static const struct registerset_constants registerset_constants_column_int_float[] =
3225 {"cnf", {"cnf", D3DXRS_FLOAT4, 4, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 79},
3228 static const struct registerset_test registerset_test_column_int_float[] =
3230 {SetInt},
3231 {SetBool},
3232 {SetFloat},
3233 {SetIntArray, 1, 0, 5},
3234 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3235 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000}},
3236 {SetBoolArray, 1, 0, 5},
3237 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3238 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3239 {SetFloatArray, 0, 0, 5},
3240 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
3241 {0x40000000, 0x40800000, 0x40c00000, 0x00000000, 0x00000000, 0x40a00000, 0x40e00000}},
3242 {SetValue, 1, 0, 23},
3243 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 8,
3244 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000}},
3245 {SetVector},
3246 {SetVectorArray, 0, 0, 1},
3247 {SetValue, 0, 0, 23},
3248 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
3249 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3250 {SetMatrix, 0, 0, 0, 8,
3251 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3252 {SetMatrixArray},
3253 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3254 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3255 {SetMatrixTranspose, 0, 0, 0, 8,
3256 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3257 {SetMatrixTransposeArray},
3258 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3259 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3260 {SetMatrixPointerArray},
3261 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3262 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3263 {SetMatrixTransposePointerArray},
3264 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3265 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3268 static const struct registerset_constants registerset_constants_column_bool_float[] =
3270 {"cbf", {"cbf", D3DXRS_FLOAT4, 2, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 44},
3273 static const struct registerset_test registerset_test_column_bool_float[] =
3275 {SetInt},
3276 {SetBool},
3277 {SetFloat},
3278 {SetIntArray, 1, 0, 5},
3279 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3280 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3281 {SetBoolArray, 1, 0, 5},
3282 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 8,
3283 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3284 {SetFloatArray, 0, 0, 5},
3285 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 8,
3286 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3287 {SetValue, 1, 0, 23},
3288 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 8,
3289 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3290 {SetVector},
3291 {SetVectorArray, 0, 0, 1},
3292 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
3293 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3294 {SetMatrix, 0, 0, 0, 8,
3295 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3296 {SetMatrixArray},
3297 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3298 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3299 {SetMatrixTranspose, 0, 0, 0, 8,
3300 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3301 {SetMatrixTransposeArray},
3302 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3303 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3304 {SetMatrixPointerArray},
3305 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3306 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3307 {SetMatrixTransposePointerArray},
3308 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
3309 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3313 * fxc.exe /Tvs_3_0
3315 #if 0
3316 bool3x2 cab[2] = {1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1};
3317 int3x2 can[2] = {14, 15, 16, 71, 18, 19, 55, 63, 96, 96, 97, 13};
3318 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};
3319 bool3x2 cabf[2] = {1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1};
3320 int3x2 canf[2] = {300, 301, 303, 302, 304, 306, 350, 365, 654, 612, 326, 999};
3321 float4 main(float4 pos : POSITION) : POSITION
3323 float4 tmp = 0;
3324 int i;
3325 if (cab[1]._32) for (i = 0; i < can[1]._31; i++) tmp.x += pos.z * caf[1]._31 * cabf[1]._32;
3326 else for (i = 0; i < can[1]._32; i++) tmp.y += pos.y * caf[1]._32 * canf[1]._32;
3327 return tmp;
3329 #endif
3330 static const DWORD registerset_blob_column_array[] =
3332 0xfffe0300, 0x0096fffe, 0x42415443, 0x0000001c, 0x00000223, 0xfffe0300, 0x00000005, 0x0000001c,
3333 0x00000100, 0x0000021c, 0x00000080, 0x00000000, 0x0000000c, 0x00000084, 0x00000094, 0x000000c4,
3334 0x00040002, 0x00000004, 0x000000cc, 0x000000dc, 0x0000011c, 0x00000002, 0x00000004, 0x00000120,
3335 0x00000130, 0x00000170, 0x00000001, 0x0000000c, 0x00000174, 0x00000184, 0x000001c4, 0x00080002,
3336 0x00000004, 0x000001cc, 0x000001dc, 0x00626163, 0x00010003, 0x00020003, 0x00000002, 0x00000000,
3337 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000,
3338 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x66626163, 0xababab00, 0x00010003, 0x00020003,
3339 0x00000002, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000,
3340 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000,
3341 0x3f800000, 0x00000000, 0x00666163, 0x00030003, 0x00020003, 0x00000002, 0x00000000, 0x3f8ccccd,
3342 0x40533333, 0x40b00000, 0x00000000, 0x400ccccd, 0x408ccccd, 0x40d33333, 0x00000000, 0x40f66666,
3343 0x411e6666, 0x3fa66666, 0x00000000, 0x410ccccd, 0x3f99999a, 0x3fb33333, 0x00000000, 0x006e6163,
3344 0x00020003, 0x00020003, 0x00000002, 0x00000000, 0x0000000e, 0x00000010, 0x00000012, 0x00000000,
3345 0x0000000f, 0x00000047, 0x00000013, 0x00000000, 0x00000037, 0x00000060, 0x00000061, 0x00000000,
3346 0x0000003f, 0x00000060, 0x0000000d, 0x00000000, 0x666e6163, 0xababab00, 0x00020003, 0x00020003,
3347 0x00000002, 0x00000000, 0x43960000, 0x43978000, 0x43980000, 0x00000000, 0x43968000, 0x43970000,
3348 0x43990000, 0x00000000, 0x43af0000, 0x44238000, 0x43a30000, 0x00000000, 0x43b68000, 0x44190000,
3349 0x4479c000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
3350 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
3351 0x05000051, 0xa00f000c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
3352 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x01000028, 0xe0e4080b, 0x03000005, 0x80010000,
3353 0xa0aa0002, 0x90aa0000, 0x02000001, 0x80010001, 0xa000000c, 0x01000026, 0xf0e4000a, 0x04000004,
3354 0x80010001, 0x80000000, 0xa0aa0007, 0x80000001, 0x00000027, 0x02000001, 0x80020001, 0xa000000c,
3355 0x0000002a, 0x03000005, 0x80010000, 0xa0aa0003, 0x90550000, 0x02000001, 0x80020001, 0xa000000c,
3356 0x01000026, 0xf0e4000b, 0x04000004, 0x80020001, 0x80000000, 0xa0aa000b, 0x80550001, 0x00000027,
3357 0x02000001, 0x80010001, 0xa000000c, 0x0000002b, 0x02000001, 0xe0030000, 0x80e40001, 0x02000001,
3358 0xe00c0000, 0xa000000c, 0x0000ffff,
3361 static const struct registerset_constants registerset_constants_column_array_float[] =
3363 {"caf", {"caf", D3DXRS_FLOAT4, 0, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 2, 2, 0, 48, NULL}, 76},
3364 {"caf[0]", {"caf", D3DXRS_FLOAT4, 0, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 76},
3365 {"caf[1]", {"caf", D3DXRS_FLOAT4, 2, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 84},
3368 static const struct registerset_test registerset_test_column_array_float[] =
3370 {SetInt},
3371 {SetBool},
3372 {SetFloat},
3373 {SetIntArray, 1, 0, 5},
3374 {SetIntArray, 1, 6, 11, 8,
3375 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000}},
3376 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3377 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000, 0x00000000,
3378 0x41000000, 0x41200000, 0x41400000, 0x00000000, 0x41100000, 0x41300000, 0x41500000}},
3379 {SetBoolArray, 1, 0, 5},
3380 {SetBoolArray, 1, 6, 11, 8,
3381 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3382 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3383 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
3384 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3385 {SetFloatArray, 0, 0, 5},
3386 {SetFloatArray, 0, 6, 11, 8,
3387 {0x40000123, 0x40800123, 0x40c00123, 0x00000000, 0x00000000, 0x40a00123, 0x40e00123}},
3388 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 16,
3389 {0x40000123, 0x40800123, 0x40c00123, 0x00000000, 0x00000000, 0x40a00123, 0x40e00123, 0x00000000,
3390 0x41000123, 0x41200123, 0x41400123, 0x00000000, 0x41100123, 0x41300123, 0x41500123}},
3391 {SetValue, 0, 0, 23},
3392 {SetValue, 0, 24, 47, 8,
3393 {0x40000123, 0x40800123, 0x40c00123, 0x00000000, 0x00000000, 0x40a00123, 0x40e00123}},
3394 {SetValue, 0, 48, REGISTER_OUTPUT_SIZE * 4, 16,
3395 {0x40000123, 0x40800123, 0x40c00123, 0x00000000, 0x00000000, 0x40a00123, 0x40e00123, 0x00000000,
3396 0x41000123, 0x41200123, 0x41400123, 0x00000000, 0x41100123, 0x41300123, 0x41500123}},
3397 {SetVector},
3398 {SetVectorArray, 0, 0, 1},
3399 {SetVectorArray, 0, 2, 3, 8,
3400 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3401 {SetVectorArray, 0, 4, REGISTER_OUTPUT_SIZE / 4, 16,
3402 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
3403 0x41600123, 0x41a00123, 0x00000000, 0x00000000, 0x41700123, 0x41b00123, 0x41f00123}},
3404 {SetMatrix, 0, 0, 0, 8,
3405 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3406 {SetMatrixArray},
3407 {SetMatrixArray, 0, 1, 1, 8,
3408 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3409 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3410 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
3411 0x41a00123, 0x00000000, 0x00000000, 0x00000000, 0x41b00123, 0x41f00123, 0x42300123}},
3412 {SetMatrixTranspose, 0, 0, 0, 8,
3413 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
3414 {SetMatrixTransposeArray},
3415 {SetMatrixTransposeArray, 0, 1, 1, 8,
3416 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
3417 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3418 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
3419 0x41a00123, 0x41b00123, 0x41c00123, 0x00000000, 0x00000000, 0x41f00123, 0x42000123}},
3420 {SetMatrixPointerArray},
3421 {SetMatrixPointerArray, 0, 1, 1, 8,
3422 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123}},
3423 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3424 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
3425 0x41900123, 0x41d00123, 0x42100123, 0x00000000, 0x41a00123, 0x00000000, 0x00000000}},
3426 {SetMatrixTransposePointerArray},
3427 {SetMatrixTransposePointerArray, 0, 1, 1, 8,
3428 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123}},
3429 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3430 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
3431 0x41900123, 0x41a00123, 0x41b00123, 0x00000000, 0x41d00123, 0x00000000, 0x41f00123}},
3434 static const struct registerset_constants registerset_constants_column_array_int[] =
3436 {"can", {"can", D3DXRS_INT4, 0, 12, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 2, 0, 48, NULL}, 97},
3437 {"can[0]", {"can", D3DXRS_INT4, 0, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 97},
3438 {"can[1]", {"can", D3DXRS_INT4, 2, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 105},
3441 static const struct registerset_test registerset_test_column_array_int[] =
3443 {SetInt},
3444 {SetBool},
3445 {SetFloat},
3446 {SetIntArray, 1, 0, 5},
3447 {SetIntArray, 1, 6, 11, 8,
3448 {0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3449 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3450 {0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000003, 0x00000005, 0x00000007, 0x00000000,
3451 0x00000008, 0x0000000a, 0x0000000c, 0x00000000, 0x00000009, 0x0000000b, 0x0000000d}},
3452 {SetBoolArray, 1, 0, 5},
3453 {SetBoolArray, 1, 6, 11, 8,
3454 {0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3455 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3456 {0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000,
3457 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3458 {SetFloatArray, 0, 0, 5},
3459 {SetFloatArray, 0, 6, 11, 8,
3460 {0x00000002, 0x00000004, 0x00000006, 0x00000000, 0x00000000, 0x00000005, 0x00000007}},
3461 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 16,
3462 {0x00000002, 0x00000004, 0x00000006, 0x00000000, 0x00000000, 0x00000005, 0x00000007, 0x00000000,
3463 0x00000008, 0x0000000a, 0x0000000c, 0x00000000, 0x00000009, 0x0000000b, 0x0000000d}},
3464 {SetValue, 1, 0, 23},
3465 {SetValue, 1, 24, 47, 8,
3466 {0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3467 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 16,
3468 {0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000003, 0x00000005, 0x00000007, 0x00000000,
3469 0x00000008, 0x0000000a, 0x0000000c, 0x00000000, 0x00000009, 0x0000000b, 0x0000000d}},
3470 {SetVector},
3471 {SetVectorArray, 0, 0, 1},
3472 {SetVectorArray, 0, 2, 3, 8,
3473 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3474 {SetVectorArray, 0, 4, REGISTER_OUTPUT_SIZE / 4, 16,
3475 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b, 0x00000000,
3476 0x0000000e, 0x00000014, 0x00000000, 0x00000000, 0x0000000f, 0x00000016, 0x0000001e}},
3477 {SetMatrix, 0, 0, 0, 8,
3478 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3479 {SetMatrixArray},
3480 {SetMatrixArray, 0, 1, 1, 8,
3481 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3482 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3483 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b, 0x00000000,
3484 0x00000014, 0x00000000, 0x00000000, 0x00000000, 0x00000016, 0x0000001e, 0x0000002c}},
3485 {SetMatrixTranspose, 0, 0, 0, 8,
3486 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
3487 {SetMatrixTransposeArray},
3488 {SetMatrixTransposeArray, 0, 1, 1, 8,
3489 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
3490 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3491 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008, 0x00000000,
3492 0x00000014, 0x00000016, 0x00000018, 0x00000000, 0x00000000, 0x0000001e, 0x00000020}},
3493 {SetMatrixPointerArray},
3494 {SetMatrixPointerArray, 0, 1, 1, 8,
3495 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b}},
3496 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3497 {0x00000002, 0x00000006, 0x0000000a, 0x00000000, 0x00000000, 0x00000007, 0x0000000b, 0x00000000,
3498 0x00000012, 0x0000001a, 0x00000024, 0x00000000, 0x00000014, 0x00000000, 0x00000000}},
3499 {SetMatrixTransposePointerArray},
3500 {SetMatrixTransposePointerArray, 0, 1, 1, 8,
3501 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008}},
3502 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3503 {0x00000002, 0x00000000, 0x00000004, 0x00000000, 0x00000006, 0x00000007, 0x00000008, 0x00000000,
3504 0x00000012, 0x00000014, 0x00000016, 0x00000000, 0x0000001a, 0x00000000, 0x0000001e}},
3507 static const struct registerset_constants registerset_constants_column_array_bool[] =
3509 {"cab", {"cab", D3DXRS_BOOL, 0, 12, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 2, 0, 48, NULL}, 37},
3510 {"cab[0]", {"cab", D3DXRS_BOOL, 0, 6, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 37},
3511 {"cab[1]", {"cab", D3DXRS_BOOL, 6, 6, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 43},
3514 static const struct registerset_test registerset_test_column_array_bool[] =
3516 {SetInt},
3517 {SetBool},
3518 {SetFloat},
3519 {SetIntArray, 1, 0, 5},
3520 {SetIntArray, 1, 6, 11, 6,
3521 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3522 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 12,
3523 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
3524 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3525 {SetBoolArray, 1, 0, 5},
3526 {SetBoolArray, 1, 6, 11, 6,
3527 {0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3528 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 12,
3529 {0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x00000005, 0x00000007, 0x00000008, 0x0000000a,
3530 0x0000000c, 0x00000009, 0x0000000b, 0x0000000d}},
3531 {SetFloatArray, 0, 0, 5},
3532 {SetFloatArray, 0, 6, 11, 6,
3533 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3534 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 12,
3535 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
3536 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3537 {SetValue, 1, 0, 23},
3538 {SetValue, 1, 24, 47, 6,
3539 {0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x00000005, 0x00000007}},
3540 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 12,
3541 {0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x00000005, 0x00000007, 0x00000008, 0x0000000a,
3542 0x0000000c, 0x00000009, 0x0000000b, 0x0000000d}},
3543 {SetVector},
3544 {SetVectorArray, 0, 0, 1},
3545 {SetVectorArray, 0, 2, 3, 6,
3546 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3547 {SetVectorArray, 0, 4, REGISTER_OUTPUT_SIZE / 4, 12,
3548 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
3549 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3550 {SetMatrix, 0, 0, 0, 6,
3551 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3552 {SetMatrixArray},
3553 {SetMatrixArray, 0, 1, 1, 6,
3554 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3555 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
3556 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000,
3557 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3558 {SetMatrixTranspose, 0, 0, 0, 6,
3559 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3560 {SetMatrixTransposeArray},
3561 {SetMatrixTransposeArray, 0, 1, 1, 6,
3562 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3563 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
3564 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
3565 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3566 {SetMatrixPointerArray},
3567 {SetMatrixPointerArray, 0, 1, 1, 6,
3568 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
3569 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
3570 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
3571 0x00000001, 0x00000001, 0x00000000, 0x00000000}},
3572 {SetMatrixTransposePointerArray},
3573 {SetMatrixTransposePointerArray, 0, 1, 1, 6,
3574 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3575 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
3576 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
3577 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
3580 static const struct registerset_constants registerset_constants_column_array_int_float[] =
3582 {"canf", {"canf", D3DXRS_FLOAT4, 8, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 2, 0, 48, NULL}, 119},
3583 {"canf[0]", {"canf", D3DXRS_FLOAT4, 8, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 119},
3584 {"canf[1]", {"canf", D3DXRS_FLOAT4, 10, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 127},
3587 static const struct registerset_test registerset_test_column_array_int_float[] =
3589 {SetInt},
3590 {SetBool},
3591 {SetFloat},
3592 {SetIntArray, 1, 0, 5},
3593 {SetIntArray, 1, 6, 11, 8,
3594 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000}},
3595 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3596 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000, 0x00000000,
3597 0x41000000, 0x41200000, 0x41400000, 0x00000000, 0x41100000, 0x41300000, 0x41500000}},
3598 {SetBoolArray, 1, 0, 5},
3599 {SetBoolArray, 1, 6, 11, 8,
3600 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3601 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3602 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
3603 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3604 {SetFloatArray, 0, 0, 5},
3605 {SetFloatArray, 0, 6, 11, 8,
3606 {0x40000000, 0x40800000, 0x40c00000, 0x00000000, 0x00000000, 0x40a00000, 0x40e00000}},
3607 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 16,
3608 {0x40000000, 0x40800000, 0x40c00000, 0x00000000, 0x00000000, 0x40a00000, 0x40e00000, 0x00000000,
3609 0x41000000, 0x41200000, 0x41400000, 0x00000000, 0x41100000, 0x41300000, 0x41500000}},
3610 {SetValue, 1, 0, 23},
3611 {SetValue, 1, 24, 47, 8,
3612 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000}},
3613 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 16,
3614 {0x40000000, 0x40800000, 0x00000000, 0x00000000, 0x40400000, 0x40a00000, 0x40e00000, 0x00000000,
3615 0x41000000, 0x41200000, 0x41400000, 0x00000000, 0x41100000, 0x41300000, 0x41500000}},
3616 {SetVector},
3617 {SetVectorArray, 0, 0, 1},/*16*/
3618 {SetVectorArray, 0, 2, 3, 8,
3619 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3620 {SetVectorArray, 0, 4, REGISTER_OUTPUT_SIZE / 4, 16,
3621 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000, 0x00000000,
3622 0x41600000, 0x41a00000, 0x00000000, 0x00000000, 0x41700000, 0x41b00000, 0x41f00000}},
3623 {SetMatrix, 0, 0, 0, 8,
3624 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3625 {SetMatrixArray},
3626 {SetMatrixArray, 0, 1, 1, 8,
3627 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3628 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3629 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000, 0x00000000,
3630 0x41a00000, 0x00000000, 0x00000000, 0x00000000, 0x41b00000, 0x41f00000, 0x42300000}},
3631 {SetMatrixTranspose, 0, 0, 0, 8,
3632 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3633 {SetMatrixTransposeArray},
3634 {SetMatrixTransposeArray, 0, 1, 1, 8,
3635 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3636 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3637 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000, 0x00000000,
3638 0x41a00000, 0x41b00000, 0x41c00000, 0x00000000, 0x00000000, 0x41f00000, 0x42000000}},
3639 {SetMatrixPointerArray},
3640 {SetMatrixPointerArray, 0, 1, 1, 8,
3641 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000}},
3642 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3643 {0x40000000, 0x40c00000, 0x41200000, 0x00000000, 0x00000000, 0x40e00000, 0x41300000, 0x00000000,
3644 0x41900000, 0x41d00000, 0x42100000, 0x00000000, 0x41a00000, 0x00000000, 0x00000000}},
3645 {SetMatrixTransposePointerArray},
3646 {SetMatrixTransposePointerArray, 0, 1, 1, 8,
3647 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000}},
3648 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3649 {0x40000000, 0x00000000, 0x40800000, 0x00000000, 0x40c00000, 0x40e00000, 0x41000000, 0x00000000,
3650 0x41900000, 0x41a00000, 0x41b00000, 0x00000000, 0x41d00000, 0x00000000, 0x41f00000}},
3653 static const struct registerset_constants registerset_constants_column_array_bool_float[] =
3655 {"cabf", {"cabf", D3DXRS_FLOAT4, 4, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 2, 0, 48, NULL}, 55},
3656 {"cabf[0]", {"cabf", D3DXRS_FLOAT4, 4, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 55},
3657 {"cabf[1]", {"cabf", D3DXRS_FLOAT4, 6, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 63},
3660 static const struct registerset_test registerset_test_column_array_bool_float[] =
3662 {SetInt},
3663 {SetBool},
3664 {SetFloat},
3665 {SetIntArray, 1, 0, 5},
3666 {SetIntArray, 1, 6, 11, 8,
3667 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3668 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3669 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
3670 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3671 {SetBoolArray, 1, 0, 5},
3672 {SetBoolArray, 1, 6, 11, 8,
3673 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3674 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 16,
3675 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
3676 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3677 {SetFloatArray, 0, 0, 5},
3678 {SetFloatArray, 0, 6, 11, 8,
3679 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3680 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 16,
3681 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000,
3682 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3683 {SetValue, 1, 0, 23},
3684 {SetValue, 1, 24, 47, 8,
3685 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3686 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 16,
3687 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
3688 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3689 {SetVector},
3690 {SetVectorArray, 0, 0, 1},
3691 {SetVectorArray, 0, 2, 3, 8,
3692 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3693 {SetVectorArray, 0, 4, REGISTER_OUTPUT_SIZE / 4, 16,
3694 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000,
3695 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3696 {SetMatrix, 0, 0, 0, 8,
3697 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3698 {SetMatrixArray},
3699 {SetMatrixArray, 0, 1, 1, 8,
3700 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3701 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3702 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000,
3703 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3704 {SetMatrixTranspose, 0, 0, 0, 8,
3705 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3706 {SetMatrixTransposeArray},
3707 {SetMatrixTransposeArray, 0, 1, 1, 8,
3708 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3709 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3710 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
3711 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3712 {SetMatrixPointerArray},
3713 {SetMatrixPointerArray, 0, 1, 1, 8,
3714 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
3715 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3716 {0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000,
3717 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000}},
3718 {SetMatrixTransposePointerArray},
3719 {SetMatrixTransposePointerArray, 0, 1, 1, 8,
3720 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000}},
3721 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 16,
3722 {0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
3723 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000}},
3727 * fxc.exe /Tvs_3_0
3729 #if 0
3730 row_major bool3x2 rb = {1, 1, 0, 0, 1, 1};
3731 row_major int3x2 rn = {80, 81, 82, 83, 84, 85};
3732 row_major float3x2 rf = {95.1, 95.2, 95.3, 95.4, 95.5, 95.6};
3733 row_major bool3x2 rbf = {1, 1, 1, 1, 0, 1};
3734 row_major int3x2 rnf = {37, 13, 98, 54, 77, 36};
3735 float4 main(float4 pos : POSITION) : POSITION
3737 float4 tmp = 0;
3738 int i;
3739 if (rb._32) for (i = 0; i < rn._31; i++) tmp.x += pos.z * rf._31 * rbf._32;
3740 else for (i = 0; i < rn._32; i++) tmp.y += pos.y * rf._32 * rnf._32;
3741 return tmp;
3743 #endif
3744 static const DWORD registerset_blob_row[] =
3746 0xfffe0300, 0x0076fffe, 0x42415443, 0x0000001c, 0x000001a3, 0xfffe0300, 0x00000005, 0x0000001c,
3747 0x00000100, 0x0000019c, 0x00000080, 0x00000000, 0x00000006, 0x00000084, 0x00000094, 0x000000ac,
3748 0x00030002, 0x00000003, 0x00000084, 0x000000b0, 0x000000e0, 0x00000002, 0x00000003, 0x000000e4,
3749 0x000000f4, 0x00000124, 0x00000001, 0x00000006, 0x00000128, 0x00000138, 0x00000168, 0x00060002,
3750 0x00000003, 0x00000128, 0x0000016c, 0xab006272, 0x00010002, 0x00020003, 0x00000001, 0x00000000,
3751 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0x00666272, 0x3f800000,
3752 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
3753 0x3f800000, 0x00000000, 0x00000000, 0xab006672, 0x00030002, 0x00020003, 0x00000001, 0x00000000,
3754 0x42be3333, 0x42be6666, 0x00000000, 0x00000000, 0x42be999a, 0x42becccd, 0x00000000, 0x00000000,
3755 0x42bf0000, 0x42bf3333, 0x00000000, 0x00000000, 0xab006e72, 0x00020002, 0x00020003, 0x00000001,
3756 0x00000000, 0x00000050, 0x00000051, 0x00000001, 0x00000000, 0x00000052, 0x00000053, 0x00000001,
3757 0x00000000, 0x00000054, 0x00000055, 0x00000001, 0x00000000, 0x00666e72, 0x42140000, 0x41500000,
3758 0x00000000, 0x00000000, 0x42c40000, 0x42580000, 0x00000000, 0x00000000, 0x429a0000, 0x42100000,
3759 0x00000000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
3760 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
3761 0x05000051, 0xa00f0009, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
3762 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x01000028, 0xe0e40805, 0x03000005, 0x80010000,
3763 0xa0000002, 0x90aa0000, 0x02000001, 0x80010001, 0xa0000009, 0x01000026, 0xf0e40004, 0x04000004,
3764 0x80010001, 0x80000000, 0xa0550005, 0x80000001, 0x00000027, 0x02000001, 0x80020001, 0xa0000009,
3765 0x0000002a, 0x03000005, 0x80010000, 0xa0550002, 0x90550000, 0x02000001, 0x80020001, 0xa0000009,
3766 0x01000026, 0xf0e40005, 0x04000004, 0x80020001, 0x80000000, 0xa0550008, 0x80550001, 0x00000027,
3767 0x02000001, 0x80010001, 0xa0000009, 0x0000002b, 0x02000001, 0xe0030000, 0x80e40001, 0x02000001,
3768 0xe00c0000, 0xa0000009, 0x0000ffff,
3771 static const struct registerset_constants registerset_constants_row_float[] =
3773 {"rf", {"rf", D3DXRS_FLOAT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 61},
3776 static const struct registerset_test registerset_test_row_float[] =
3778 {SetInt},
3779 {SetBool},
3780 {SetFloat},
3781 {SetIntArray, 1, 0, 5},
3782 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3783 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
3784 0x00000000, 0x40e00000}},
3785 {SetBoolArray, 1, 0, 5},
3786 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3787 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
3788 0x00000000, 0x3f800000}},
3789 {SetFloatArray, 0, 0, 5},
3790 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 12,
3791 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000, 0x00000000,
3792 0x40c00123, 0x40e00123}},
3793 {SetValue, 0, 0, 23},
3794 {SetValue, 0, 24, REGISTER_OUTPUT_SIZE * 4, 12,
3795 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000, 0x00000000,
3796 0x40c00123, 0x40e00123}},
3797 {SetVector},
3798 {SetVectorArray, 0, 0, 2},
3799 {SetVectorArray, 0, 3, REGISTER_OUTPUT_SIZE / 4, 12,
3800 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
3801 0x41200123, 0x41300123}},
3802 {SetMatrix, 0, 0, 0, 12,
3803 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
3804 0x41200123, 0x41300123}},
3805 {SetMatrixArray},
3806 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3807 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
3808 0x41200123, 0x41300123}},
3809 {SetMatrixTranspose, 0, 0, 0, 12,
3810 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
3811 0x40800123, 0x41000123}},
3812 {SetMatrixTransposeArray},
3813 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3814 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
3815 0x40800123, 0x41000123}},
3816 {SetMatrixPointerArray},
3817 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3818 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
3819 0x41200123, 0x41300123}},
3820 {SetMatrixTransposePointerArray},
3821 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3822 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
3823 0x40800123, 0x41000123}},
3826 static const struct registerset_constants registerset_constants_row_int[] =
3828 {"rn", {"rn", D3DXRS_INT4, 0, 6, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 78},
3831 static const struct registerset_test registerset_test_row_int[] =
3833 {SetInt},
3834 {SetBool},
3835 {SetFloat},
3836 {SetIntArray, 1, 0, 5},
3837 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3838 {0x00000002, 0x00000003, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
3839 0x00000000, 0x00000007, 0x00000001}},
3840 {SetBoolArray, 1, 0, 5},
3841 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3842 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000,
3843 0x00000000, 0x00000001, 0x00000001}},
3844 {SetFloatArray, 0, 0, 5},
3845 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 12,
3846 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
3847 0x00000006, 0x00000007, 0x00000001}},
3848 {SetValue, 1, 0, 23},
3849 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 12,
3850 {0x00000002, 0x00000003, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
3851 0x00000000, 0x00000007, 0x00000001}},
3852 {SetVector},
3853 {SetVectorArray, 0, 0, 2},
3854 {SetVectorArray, 0, 3, REGISTER_OUTPUT_SIZE / 4, 12,
3855 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
3856 0x0000000a, 0x0000000b, 0x00000001}},
3857 {SetMatrix, 0, 0, 0, 12,
3858 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
3859 0x0000000a, 0x0000000b, 0x00000001}},
3860 {SetMatrixArray},
3861 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3862 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
3863 0x0000000a, 0x0000000b, 0x00000001}},
3864 {SetMatrixTranspose, 0, 0, 0, 12,
3865 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
3866 0x00000004, 0x00000008, 0x00000001}},
3867 {SetMatrixTransposeArray},
3868 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3869 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
3870 0x00000004, 0x00000008, 0x00000001}},
3871 {SetMatrixPointerArray},
3872 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3873 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
3874 0x0000000a, 0x0000000b, 0x00000001}},
3875 {SetMatrixTransposePointerArray},
3876 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3877 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
3878 0x00000004, 0x00000008, 0x00000001}},
3881 static const struct registerset_constants registerset_constants_row_bool[] =
3883 {"rb", {"rb", D3DXRS_BOOL, 0, 6, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 37},
3886 static const struct registerset_test registerset_test_row_bool[] =
3888 {SetInt},
3889 {SetBool},
3890 {SetFloat},
3891 {SetIntArray, 0, 0, 5,},
3892 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
3893 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
3894 {SetBoolArray, 0, 0, 5},
3895 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
3896 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
3897 {SetFloatArray, 0, 0, 5},
3898 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 6,
3899 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3900 {SetValue, 0, 0, 23},
3901 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 6,
3902 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
3903 {SetVector},
3904 {SetVectorArray, 0, 0, 2},
3905 {SetVectorArray, 0, 3, REGISTER_OUTPUT_SIZE / 4, 6,
3906 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3907 {SetMatrix, 0, 0, 0, 6,
3908 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001},},
3909 {SetMatrixArray},
3910 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
3911 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3912 {SetMatrixTranspose, 0, 0, 0, 6,
3913 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3914 {SetMatrixTransposeArray},
3915 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
3916 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3917 {SetMatrixPointerArray},
3918 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
3919 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
3920 {SetMatrixTransposePointerArray},
3921 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
3922 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
3925 static const struct registerset_constants registerset_constants_row_int_float[] =
3927 {"rnf", {"rnf", D3DXRS_FLOAT4, 6, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 91},
3930 static const struct registerset_test registerset_test_row_int_float[] =
3932 {SetInt},
3933 {SetBool},
3934 {SetFloat},
3935 {SetIntArray, 1, 0, 5},
3936 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3937 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
3938 0x00000000, 0x40e00000}},
3939 {SetBoolArray, 1, 0, 5},
3940 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3941 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
3942 0x00000000, 0x3f800000}},
3943 {SetFloatArray, 0, 0, 5},
3944 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 12,
3945 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
3946 0x40c00000, 0x40e00000}},
3947 {SetValue, 1, 0, 23},
3948 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 12,
3949 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
3950 0x00000000, 0x40e00000}},
3951 {SetVector},
3952 {SetVectorArray, 0, 0, 2},
3953 {SetVectorArray, 0, 3, REGISTER_OUTPUT_SIZE / 4, 12,
3954 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
3955 0x41200000, 0x41300000}},
3956 {SetMatrix, 0, 0, 0, 12,
3957 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
3958 0x41200000, 0x41300000}},
3959 {SetMatrixArray},
3960 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3961 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
3962 0x41200000, 0x41300000}},
3963 {SetMatrixTranspose, 0, 0, 0, 12,
3964 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
3965 0x40800000, 0x41000000}},
3966 {SetMatrixTransposeArray},
3967 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3968 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
3969 0x40800000, 0x41000000}},
3970 {SetMatrixPointerArray},
3971 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3972 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
3973 0x41200000, 0x41300000}},
3974 {SetMatrixTransposePointerArray},
3975 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
3976 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
3977 0x40800000, 0x41000000}},
3980 static const struct registerset_constants registerset_constants_row_bool_float[] =
3982 {"rbf", {"rbf", D3DXRS_FLOAT4, 3, 3, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 44},
3985 static const struct registerset_test registerset_test_row_bool_float[] =
3987 {SetInt},
3988 {SetBool},
3989 {SetFloat},
3990 {SetIntArray, 1, 0, 5},
3991 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3992 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
3993 0x00000000, 0x3f800000}},
3994 {SetBoolArray, 1, 0, 5},
3995 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 12,
3996 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
3997 0x00000000, 0x3f800000}},
3998 {SetFloatArray, 0, 0, 5},
3999 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 12,
4000 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4001 0x3f800000, 0x3f800000}},
4002 {SetValue, 1, 0, 23},
4003 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 12,
4004 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4005 0x00000000, 0x3f800000}},
4006 {SetVector},
4007 {SetVectorArray, 0, 0, 2},
4008 {SetVectorArray, 0, 3, REGISTER_OUTPUT_SIZE / 4, 12,
4009 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4010 0x3f800000, 0x3f800000}},
4011 {SetMatrix, 0, 0, 0, 12,
4012 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4013 0x3f800000, 0x3f800000}},
4014 {SetMatrixArray},
4015 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
4016 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4017 0x3f800000, 0x3f800000}},
4018 {SetMatrixTranspose, 0, 0, 0, 12,
4019 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
4020 0x3f800000, 0x3f800000}},
4021 {SetMatrixTransposeArray},
4022 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
4023 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
4024 0x3f800000, 0x3f800000}},
4025 {SetMatrixPointerArray},
4026 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
4027 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4028 0x3f800000, 0x3f800000}},
4029 {SetMatrixTransposePointerArray},
4030 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 12,
4031 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
4032 0x3f800000, 0x3f800000}},
4036 * fxc.exe /Tvs_3_0
4038 #if 0
4039 row_major bool3x2 rab[2] = {1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1};
4040 row_major int3x2 ran[2] = {4, 5, 6, 1, 8, 1, 5, 3, 9, 6, 7, 3};
4041 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};
4042 row_major bool3x2 rabf[2] = {1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1};
4043 row_major int3x2 ranf[2] = {35, 40, 60, 80, 70, 56, 37, 13, 98, 54, 77, 36};
4044 float4 main(float4 pos : POSITION) : POSITION
4046 float4 tmp = 0;
4047 int i;
4048 if (rab[1]._32) for (i = 0; i < ran[1]._31; i++) tmp.x += pos.z * raf[1]._31 * rabf[1]._32;
4049 else for (i = 0; i < ran[1]._32; i++) tmp.y += pos.y * raf[1]._32 * ranf[1]._32;
4050 return tmp;
4052 #endif
4053 static const DWORD registerset_blob_row_array[] =
4055 0xfffe0300, 0x00b6fffe, 0x42415443, 0x0000001c, 0x000002a3, 0xfffe0300, 0x00000005, 0x0000001c,
4056 0x00000100, 0x0000029c, 0x00000080, 0x00000000, 0x0000000c, 0x00000084, 0x00000094, 0x000000c4,
4057 0x00060002, 0x00000006, 0x000000cc, 0x000000dc, 0x0000013c, 0x00000002, 0x00000006, 0x00000140,
4058 0x00000150, 0x000001b0, 0x00000001, 0x0000000c, 0x000001b4, 0x000001c4, 0x00000224, 0x000c0002,
4059 0x00000006, 0x0000022c, 0x0000023c, 0x00626172, 0x00010002, 0x00020003, 0x00000002, 0x00000000,
4060 0xffffffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
4061 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x66626172, 0xababab00, 0x00010002, 0x00020003,
4062 0x00000002, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000,
4063 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000,
4064 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000,
4065 0x00000000, 0x00000000, 0x00666172, 0x00030002, 0x00020003, 0x00000002, 0x00000000, 0x3fc00000,
4066 0x40333333, 0x00000000, 0x00000000, 0x40533333, 0x409ccccd, 0x00000000, 0x00000000, 0x40bccccd,
4067 0x40d9999a, 0x00000000, 0x00000000, 0x40fccccd, 0x41080000, 0x00000000, 0x00000000, 0x41166666,
4068 0x3fa66666, 0x00000000, 0x00000000, 0x3f99999a, 0x3f8ccccd, 0x00000000, 0x00000000, 0x006e6172,
4069 0x00020002, 0x00020003, 0x00000002, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
4070 0x00000006, 0x00000001, 0x00000001, 0x00000000, 0x00000008, 0x00000001, 0x00000001, 0x00000000,
4071 0x00000005, 0x00000003, 0x00000001, 0x00000000, 0x00000009, 0x00000006, 0x00000001, 0x00000000,
4072 0x00000007, 0x00000003, 0x00000001, 0x00000000, 0x666e6172, 0xababab00, 0x00020002, 0x00020003,
4073 0x00000002, 0x00000000, 0x420c0000, 0x42200000, 0x00000000, 0x00000000, 0x42700000, 0x42a00000,
4074 0x00000000, 0x00000000, 0x428c0000, 0x42600000, 0x00000000, 0x00000000, 0x42140000, 0x41500000,
4075 0x00000000, 0x00000000, 0x42c40000, 0x42580000, 0x00000000, 0x00000000, 0x429a0000, 0x42100000,
4076 0x00000000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4077 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4078 0x05000051, 0xa00f0012, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
4079 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x01000028, 0xe0e4080b, 0x03000005, 0x80010000,
4080 0xa0000005, 0x90aa0000, 0x02000001, 0x80010001, 0xa0000012, 0x01000026, 0xf0e4000a, 0x04000004,
4081 0x80010001, 0x80000000, 0xa055000b, 0x80000001, 0x00000027, 0x02000001, 0x80020001, 0xa0000012,
4082 0x0000002a, 0x03000005, 0x80010000, 0xa0550005, 0x90550000, 0x02000001, 0x80020001, 0xa0000012,
4083 0x01000026, 0xf0e4000b, 0x04000004, 0x80020001, 0x80000000, 0xa0550011, 0x80550001, 0x00000027,
4084 0x02000001, 0x80010001, 0xa0000012, 0x0000002b, 0x02000001, 0xe0030000, 0x80e40001, 0x02000001,
4085 0xe00c0000, 0xa0000012, 0x0000ffff,
4088 static const struct registerset_constants registerset_constants_row_array_float[] =
4090 {"raf", {"raf", D3DXRS_FLOAT4, 0, 6, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 2, 0, 48, NULL}, 84},
4091 {"raf[0]", {"raf", D3DXRS_FLOAT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 84},
4092 {"raf[1]", {"raf", D3DXRS_FLOAT4, 3, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 1, 0, 24, NULL}, 96},
4095 static const struct registerset_test registerset_test_row_array_float[] =
4097 {SetInt},
4098 {SetBool},
4099 {SetFloat},
4100 {SetIntArray, 1, 0, 5},
4101 {SetIntArray, 1, 6, 11, 12,
4102 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4103 0x00000000, 0x40e00000}},
4104 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4105 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4106 0x00000000, 0x40e00000, 0x00000000, 0x00000000, 0x41000000, 0x41100000, 0x00000000, 0x00000000,
4107 0x41200000, 0x41300000, 0x00000000, 0x00000000, 0x41400000, 0x41500000}},
4108 {SetBoolArray, 1, 0, 5},
4109 {SetBoolArray, 1, 6, 11, 12,
4110 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4111 0x00000000, 0x3f800000}},
4112 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4113 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4114 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4115 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4116 {SetFloatArray, 0, 0, 5},
4117 {SetFloatArray, 0, 6, 11, 12,
4118 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000, 0x00000000,
4119 0x40c00123, 0x40e00123}},
4120 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 24,
4121 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000, 0x00000000,
4122 0x40c00123, 0x40e00123, 0x00000000, 0x00000000, 0x41000123, 0x41100123, 0x00000000, 0x00000000,
4123 0x41200123, 0x41300123, 0x00000000, 0x00000000, 0x41400123, 0x41500123}},
4124 {SetValue, 0, 0, 23},
4125 {SetValue, 0, 24, 47, 12,
4126 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000, 0x00000000,
4127 0x40c00123, 0x40e00123}},
4128 {SetValue, 0, 48, REGISTER_OUTPUT_SIZE * 4, 24,
4129 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000, 0x00000000,
4130 0x40c00123, 0x40e00123, 0x00000000, 0x00000000, 0x41000123, 0x41100123, 0x00000000, 0x00000000,
4131 0x41200123, 0x41300123, 0x00000000, 0x00000000, 0x41400123, 0x41500123}},
4132 {SetVector},
4133 {SetVectorArray, 0, 0, 2},
4134 {SetVectorArray, 0, 3, 5, 12,
4135 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
4136 0x41200123, 0x41300123}},
4137 {SetVectorArray, 0, 6, REGISTER_OUTPUT_SIZE / 4, 24,
4138 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
4139 0x41200123, 0x41300123, 0x00000000, 0x00000000, 0x41600123, 0x41700123, 0x00000000, 0x00000000,
4140 0x41a00123, 0x41b00123, 0x00000000, 0x00000000, 0x00000000, 0x41f00123}},
4141 {SetMatrix, 0, 0, 0, 12,
4142 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
4143 0x41200123, 0x41300123}},
4144 {SetMatrixArray},
4145 {SetMatrixArray, 0, 1, 1, 12,
4146 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
4147 0x41200123, 0x41300123}},
4148 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4149 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
4150 0x41200123, 0x41300123, 0x00000000, 0x00000000, 0x41a00123, 0x41b00123, 0x00000000, 0x00000000,
4151 0x00000000, 0x41f00123, 0x00000000, 0x00000000, 0x00000000, 0x42300123}},
4152 {SetMatrixTranspose, 0, 0, 0, 12,
4153 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
4154 0x40800123, 0x41000123}},
4155 {SetMatrixTransposeArray},
4156 {SetMatrixTransposeArray, 0, 1, 1, 12,
4157 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
4158 0x40800123, 0x41000123}},
4159 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4160 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
4161 0x40800123, 0x41000123, 0x00000000, 0x00000000, 0x41a00123, 0x00000000, 0x00000000, 0x00000000,
4162 0x41b00123, 0x41f00123, 0x00000000, 0x00000000, 0x41c00123, 0x42000123}},
4163 {SetMatrixPointerArray},
4164 {SetMatrixPointerArray, 0, 1, 1, 12,
4165 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
4166 0x41200123, 0x41300123}},
4167 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4168 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x40c00123, 0x40e00123, 0x00000000, 0x00000000,
4169 0x41200123, 0x41300123, 0x00000000, 0x00000000, 0x41900123, 0x41a00123, 0x00000000, 0x00000000,
4170 0x41d00123, 0x00000000, 0x00000000, 0x00000000, 0x42100123, 0x00000000}},
4171 {SetMatrixTransposePointerArray},
4172 {SetMatrixTransposePointerArray, 0, 1, 1, 12,
4173 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
4174 0x40800123, 0x41000123}},
4175 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4176 {0x40000123, 0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x00000000, 0x00000000,
4177 0x40800123, 0x41000123, 0x00000000, 0x00000000, 0x41900123, 0x41d00123, 0x00000000, 0x00000000,
4178 0x41a00123, 0x00000000, 0x00000000, 0x00000000, 0x41b00123, 0x41f00123}},
4181 static const struct registerset_constants registerset_constants_row_array_int[] =
4183 {"ran", {"ran", D3DXRS_INT4, 0, 12, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 2, 0, 48, NULL}, 113},
4184 {"ran[0]", {"ran", D3DXRS_INT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 113},
4185 {"ran[1]", {"ran", D3DXRS_INT4, 3, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 125},
4188 static const struct registerset_test registerset_test_row_array_int[] =
4190 {SetInt},
4191 {SetBool},
4192 {SetFloat},
4193 {SetIntArray, 1, 0, 5},
4194 {SetIntArray, 1, 6, 11, 12,
4195 {0x00000002, 0x00000003, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
4196 0x00000000, 0x00000007, 0x00000001}},
4197 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4198 {0x00000002, 0x00000003, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
4199 0x00000000, 0x00000007, 0x00000001, 0x00000000, 0x00000008, 0x00000009, 0x00000001, 0x00000000,
4200 0x0000000a, 0x0000000b, 0x00000001, 0x00000000, 0x0000000c, 0x0000000d, 0x00000001}},
4201 {SetBoolArray, 1, 0, 5},
4202 {SetBoolArray, 1, 6, 11, 12,
4203 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000,
4204 0x00000000, 0x00000001, 0x00000001}},
4205 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4206 {0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000,
4207 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000,
4208 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
4209 {SetFloatArray, 0, 0, 5},
4210 {SetFloatArray, 0, 6, 11, 12,
4211 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
4212 0x00000006, 0x00000007, 0x00000001}},
4213 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 24,
4214 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
4215 0x00000006, 0x00000007, 0x00000001, 0x00000000, 0x00000008, 0x00000009, 0x00000001, 0x00000000,
4216 0x0000000a, 0x0000000b, 0x00000001, 0x00000000, 0x0000000c, 0x0000000d, 0x00000001}},
4217 {SetValue, 1, 0, 23},
4218 {SetValue, 1, 24, 47, 12,
4219 {0x00000002, 0x00000003, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
4220 0x00000000, 0x00000007, 0x00000001}},
4221 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 24,
4222 {0x00000002, 0x00000003, 0x00000001, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
4223 0x00000000, 0x00000007, 0x00000001, 0x00000000, 0x00000008, 0x00000009, 0x00000001, 0x00000000,
4224 0x0000000a, 0x0000000b, 0x00000001, 0x00000000, 0x0000000c, 0x0000000d, 0x00000001}},
4225 {SetVector},
4226 {SetVectorArray, 0, 0, 2},
4227 {SetVectorArray, 0, 3, 5, 12,
4228 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
4229 0x0000000a, 0x0000000b, 0x00000001}},
4230 {SetVectorArray, 0, 6, REGISTER_OUTPUT_SIZE / 4, 24,
4231 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
4232 0x0000000a, 0x0000000b, 0x00000001, 0x00000000, 0x0000000e, 0x0000000f, 0x00000001, 0x00000000,
4233 0x00000014, 0x00000016, 0x00000001, 0x00000000, 0x00000000, 0x0000001e, 0x00000001}},
4234 {SetMatrix, 0, 0, 0, 12,
4235 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
4236 0x0000000a, 0x0000000b, 0x00000001}},
4237 {SetMatrixArray},
4238 {SetMatrixArray, 0, 1, 1, 12,
4239 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
4240 0x0000000a, 0x0000000b, 0x00000001}},
4241 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4242 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
4243 0x0000000a, 0x0000000b, 0x00000001, 0x00000000, 0x00000014, 0x00000016, 0x00000001, 0x00000000,
4244 0x00000000, 0x0000001e, 0x00000001, 0x00000000, 0x00000000, 0x0000002c, 0x00000001}},
4245 {SetMatrixTranspose, 0, 0, 0, 12,
4246 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
4247 0x00000004, 0x00000008, 0x00000001}},
4248 {SetMatrixTransposeArray},
4249 {SetMatrixTransposeArray, 0, 1, 1, 12,
4250 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
4251 0x00000004, 0x00000008, 0x00000001}},
4252 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4253 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
4254 0x00000004, 0x00000008, 0x00000001, 0x00000000, 0x00000014, 0x00000000, 0x00000001, 0x00000000,
4255 0x00000016, 0x0000001e, 0x00000001, 0x00000000, 0x00000018, 0x00000020, 0x00000001}},
4256 {SetMatrixPointerArray},
4257 {SetMatrixPointerArray, 0, 1, 1, 12,
4258 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
4259 0x0000000a, 0x0000000b, 0x00000001}},
4260 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4261 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000006, 0x00000007, 0x00000001, 0x00000000,
4262 0x0000000a, 0x0000000b, 0x00000001, 0x00000000, 0x00000012, 0x00000014, 0x00000001, 0x00000000,
4263 0x0000001a, 0x00000000, 0x00000001, 0x00000000, 0x00000024, 0x00000000, 0x00000001}},
4264 {SetMatrixTransposePointerArray},
4265 {SetMatrixTransposePointerArray, 0, 1, 1, 12,
4266 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
4267 0x00000004, 0x00000008, 0x00000001}},
4268 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4269 {0x00000002, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000000,
4270 0x00000004, 0x00000008, 0x00000001, 0x00000000, 0x00000012, 0x0000001a, 0x00000001, 0x00000000,
4271 0x00000014, 0x00000000, 0x00000001, 0x00000000, 0x00000016, 0x0000001e, 0x00000001}},
4274 static const struct registerset_constants registerset_constants_row_array_bool[] =
4276 {"rab", {"rab", D3DXRS_BOOL, 0, 12, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 2, 0, 48, NULL}, 37},
4277 {"rab[0]", {"rab", D3DXRS_BOOL, 0, 6, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 37},
4278 {"rab[1]", {"rab", D3DXRS_BOOL, 6, 6, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 43},
4281 static const struct registerset_test registerset_test_row_array_bool[] =
4283 {SetInt},
4284 {SetBool},
4285 {SetFloat},
4286 {SetIntArray, 1, 0, 5,},
4287 {SetIntArray, 1, 6, 11, 6,
4288 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
4289 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 12,
4290 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001,
4291 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4292 {SetBoolArray, 1, 0, 5},
4293 {SetBoolArray, 1, 6, 11, 6,
4294 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
4295 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 12,
4296 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007, 0x00000008, 0x00000009,
4297 0x0000000a, 0x0000000b, 0x0000000c, 0x0000000d}},
4298 {SetFloatArray, 0, 0, 5},
4299 {SetFloatArray, 0, 6, 11, 6,
4300 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4301 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 12,
4302 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
4303 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4304 {SetValue, 1, 0, 23},
4305 {SetValue, 1, 24, 47, 6,
4306 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
4307 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 12,
4308 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007, 0x00000008, 0x00000009,
4309 0x0000000a, 0x0000000b, 0x0000000c, 0x0000000d}},
4310 {SetVector},
4311 {SetVectorArray, 0, 0, 2},
4312 {SetVectorArray, 0, 3, 5, 6,
4313 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4314 {SetVectorArray, 0, 6, REGISTER_OUTPUT_SIZE / 4, 12,
4315 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
4316 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
4317 {SetMatrix, 0, 0, 0, 6,
4318 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4319 {SetMatrixArray},
4320 {SetMatrixArray, 0, 1, 1, 6,
4321 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4322 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
4323 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
4324 0x00000000, 0x00000001, 0x00000000, 0x00000001}},
4325 {SetMatrixTranspose, 0, 0, 0, 6,
4326 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
4327 {SetMatrixTransposeArray},
4328 {SetMatrixTransposeArray, 0, 1, 1, 6,
4329 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
4330 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
4331 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000,
4332 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4333 {SetMatrixPointerArray},
4334 {SetMatrixPointerArray, 0, 1, 1, 6,
4335 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4336 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
4337 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
4338 0x00000001, 0x00000000, 0x00000001, 0x00000000}},
4339 {SetMatrixTransposePointerArray},
4340 {SetMatrixTransposePointerArray, 0, 1, 1, 6,
4341 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001}},
4342 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 12,
4343 {0x00000001, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
4344 0x00000001, 0x00000000, 0x00000001, 0x00000001}},
4347 static const struct registerset_constants registerset_constants_row_array_int_float[] =
4349 {"ranf", {"ranf", D3DXRS_FLOAT4, 12, 6, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 2, 0, 48, NULL}, 143},
4350 {"ranf[0]", {"ranf", D3DXRS_FLOAT4, 12, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 143},
4351 {"ranf[1]", {"ranf", D3DXRS_FLOAT4, 15, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 155},
4354 static const struct registerset_test registerset_test_row_array_int_float[] =
4356 {SetInt},
4357 {SetBool},
4358 {SetFloat},
4359 {SetIntArray, 1, 0, 5},
4360 {SetIntArray, 1, 6, 11, 12,
4361 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4362 0x00000000, 0x40e00000,}},
4363 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4364 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4365 0x00000000, 0x40e00000, 0x00000000, 0x00000000, 0x41000000, 0x41100000, 0x00000000, 0x00000000,
4366 0x41200000, 0x41300000, 0x00000000, 0x00000000, 0x41400000, 0x41500000}},
4367 {SetBoolArray, 1, 0, 5},
4368 {SetBoolArray, 1, 6, 11, 12,
4369 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4370 0x00000000, 0x3f800000}},
4371 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4372 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4373 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4374 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4375 {SetFloatArray, 0, 0, 5},
4376 {SetFloatArray, 0, 6, 11, 12,
4377 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4378 0x40c00000, 0x40e00000}},
4379 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 24,
4380 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4381 0x40c00000, 0x40e00000, 0x00000000, 0x00000000, 0x41000000, 0x41100000, 0x00000000, 0x00000000,
4382 0x41200000, 0x41300000, 0x00000000, 0x00000000, 0x41400000, 0x41500000}},
4383 {SetValue, 1, 0, 23},
4384 {SetValue, 1, 24, 47, 12,
4385 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4386 0x00000000, 0x40e00000}},
4387 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 24,
4388 {0x40000000, 0x40400000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000, 0x00000000,
4389 0x00000000, 0x40e00000, 0x00000000, 0x00000000, 0x41000000, 0x41100000, 0x00000000, 0x00000000,
4390 0x41200000, 0x41300000, 0x00000000, 0x00000000, 0x41400000, 0x41500000}},
4391 {SetVector},
4392 {SetVectorArray, 0, 0, 2},
4393 {SetVectorArray, 0, 3, 5, 12,
4394 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
4395 0x41200000, 0x41300000}},
4396 {SetVectorArray, 0, 6, REGISTER_OUTPUT_SIZE / 4, 24,
4397 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
4398 0x41200000, 0x41300000, 0x00000000, 0x00000000, 0x41600000, 0x41700000, 0x00000000, 0x00000000,
4399 0x41a00000, 0x41b00000, 0x00000000, 0x00000000, 0x00000000, 0x41f00000}},
4400 {SetMatrix, 0, 0, 0, 12,
4401 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
4402 0x41200000, 0x41300000}},
4403 {SetMatrixArray},
4404 {SetMatrixArray, 0, 1, 1, 12,
4405 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
4406 0x41200000, 0x41300000}},
4407 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4408 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
4409 0x41200000, 0x41300000, 0x00000000, 0x00000000, 0x41a00000, 0x41b00000, 0x00000000, 0x00000000,
4410 0x00000000, 0x41f00000, 0x00000000, 0x00000000, 0x00000000, 0x42300000}},
4411 {SetMatrixTranspose, 0, 0, 0, 12,
4412 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
4413 0x40800000, 0x41000000}},
4414 {SetMatrixTransposeArray},
4415 {SetMatrixTransposeArray, 0, 1, 1, 12,
4416 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
4417 0x40800000, 0x41000000}},
4418 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4419 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
4420 0x40800000, 0x41000000, 0x00000000, 0x00000000, 0x41a00000, 0x00000000, 0x00000000, 0x00000000,
4421 0x41b00000, 0x41f00000, 0x00000000, 0x00000000, 0x41c00000, 0x42000000}},
4422 {SetMatrixPointerArray},
4423 {SetMatrixPointerArray, 0, 1, 1, 12,
4424 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
4425 0x41200000, 0x41300000}},
4426 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4427 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x40e00000, 0x00000000, 0x00000000,
4428 0x41200000, 0x41300000, 0x00000000, 0x00000000, 0x41900000, 0x41a00000, 0x00000000, 0x00000000,
4429 0x41d00000, 0x00000000, 0x00000000, 0x00000000, 0x42100000, 0x00000000}},
4430 {SetMatrixTransposePointerArray},
4431 {SetMatrixTransposePointerArray, 0, 1, 1, 12,
4432 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
4433 0x40800000, 0x41000000}},
4434 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4435 {0x40000000, 0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x00000000, 0x00000000,
4436 0x40800000, 0x41000000, 0x00000000, 0x00000000, 0x41900000, 0x41d00000, 0x00000000, 0x00000000,
4437 0x41a00000, 0x00000000, 0x00000000, 0x00000000, 0x41b00000, 0x41f00000}},
4440 static const struct registerset_constants registerset_constants_row_array_bool_float[] =
4442 {"rabf", {"rabf", D3DXRS_FLOAT4, 6, 6, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 2, 0, 48, NULL}, 55},
4443 {"rabf[0]", {"rabf", D3DXRS_FLOAT4, 6, 3, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 55},
4444 {"rabf[1]", {"rabf", D3DXRS_FLOAT4, 9, 3, D3DXPC_MATRIX_ROWS, D3DXPT_BOOL, 3, 2, 1, 0, 24, NULL}, 67},
4447 static const struct registerset_test registerset_test_row_array_bool_float[] =
4449 {SetInt},
4450 {SetBool},
4451 {SetFloat},
4452 {SetIntArray, 1, 0, 5},
4453 {SetIntArray, 1, 6, 11, 12,
4454 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4455 0x00000000, 0x3f800000}},
4456 {SetIntArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4457 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4458 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4459 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4460 {SetBoolArray, 1, 0, 5},
4461 {SetBoolArray, 1, 6, 11, 12,
4462 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4463 0x00000000, 0x3f800000}},
4464 {SetBoolArray, 1, 12, REGISTER_OUTPUT_SIZE, 24,
4465 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4466 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4467 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4468 {SetFloatArray, 0, 0, 5},
4469 {SetFloatArray, 0, 6, 11, 12,
4470 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4471 0x3f800000, 0x3f800000}},
4472 {SetFloatArray, 0, 12, REGISTER_OUTPUT_SIZE, 24,
4473 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4474 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4475 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4476 {SetValue, 1, 0, 23},
4477 {SetValue, 1, 24, 47, 12,
4478 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4479 0x00000000, 0x3f800000}},
4480 {SetValue, 1, 48, REGISTER_OUTPUT_SIZE * 4, 24,
4481 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4482 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4483 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4484 {SetVector},
4485 {SetVectorArray, 0, 0, 2},
4486 {SetVectorArray, 0, 3, 5, 12,
4487 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4488 0x3f800000, 0x3f800000}},
4489 {SetVectorArray, 0, 6, REGISTER_OUTPUT_SIZE / 4, 24,
4490 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4491 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4492 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
4493 {SetMatrix, 0, 0, 0, 12,
4494 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4495 0x3f800000, 0x3f800000}},
4496 {SetMatrixArray},
4497 {SetMatrixArray, 0, 1, 1, 12,
4498 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4499 0x3f800000, 0x3f800000}},
4500 {SetMatrixArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4501 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4502 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4503 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000}},
4504 {SetMatrixTranspose, 0, 0, 0, 12,
4505 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
4506 0x3f800000, 0x3f800000}},
4507 {SetMatrixTransposeArray},
4508 {SetMatrixTransposeArray, 0, 1, 1, 12,
4509 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
4510 0x3f800000, 0x3f800000}},
4511 {SetMatrixTransposeArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4512 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
4513 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
4514 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4515 {SetMatrixPointerArray},
4516 {SetMatrixPointerArray, 0, 1, 1, 12,
4517 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4518 0x3f800000, 0x3f800000}},
4519 {SetMatrixPointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4520 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4521 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4522 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000}},
4523 {SetMatrixTransposePointerArray},
4524 {SetMatrixTransposePointerArray, 0, 1, 1, 12,
4525 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
4526 0x3f800000, 0x3f800000}},
4527 {SetMatrixTransposePointerArray, 0, 2, REGISTER_OUTPUT_SIZE / 16, 24,
4528 {0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
4529 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4530 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4534 * fxc.exe /Tvs_3_0
4536 #if 0
4537 struct {bool b; bool3 vb;} sb = {1, 1, 0, 1};
4538 struct {int n; int3 vn;} sn = {11, 12, 13, 14};
4539 struct {float f; float3 vf;} sf = {1.1f, 2.2f, 3.3f, 4.4f};
4540 struct {int nf; int3 vnf;} snf = {31, 32, 33, 34};
4541 struct {bool bf; bool3 vbf;} sbf = {1, 0, 0, 1};
4542 float4 main(float4 pos : POSITION) : POSITION
4544 float4 tmp = 0;
4545 int i;
4546 if (sb.vb.z) for (i = 0; i < sn.n; i++) tmp.x += pos.z * sf.vf.x * snf.vnf.z;
4547 else for (i = 0; i < sn.vn.z; i++) tmp.y += pos.y * sf.vf.z * sbf.vbf.y;
4548 return tmp;
4550 #endif
4551 static const DWORD registerset_blob_struct[] =
4553 0xfffe0300, 0x00a2fffe, 0x42415443, 0x0000001c, 0x00000253, 0xfffe0300, 0x00000005, 0x0000001c,
4554 0x00000100, 0x0000024c, 0x00000080, 0x00000000, 0x00000004, 0x000000bc, 0x000000cc, 0x000000dc,
4555 0x00040002, 0x00000002, 0x000000f8, 0x00000108, 0x00000128, 0x00000002, 0x00000002, 0x00000164,
4556 0x00000174, 0x00000194, 0x00000001, 0x00000004, 0x000001d0, 0x000001e0, 0x00000200, 0x00020002,
4557 0x00000002, 0x0000021c, 0x0000022c, 0x62006273, 0xababab00, 0x00010000, 0x00010001, 0x00000001,
4558 0x00000000, 0xab006276, 0x00010001, 0x00030001, 0x00000001, 0x00000000, 0x00000083, 0x00000088,
4559 0x00000098, 0x0000009c, 0x00000005, 0x00040001, 0x00020001, 0x000000ac, 0xffffffff, 0xffffffff,
4560 0x00000000, 0xffffffff, 0x00666273, 0x76006662, 0xab006662, 0x000000e0, 0x00000088, 0x000000e3,
4561 0x0000009c, 0x00000005, 0x00040001, 0x00020001, 0x000000e8, 0x3f800000, 0x00000000, 0x00000000,
4562 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x66006673, 0xababab00, 0x00030000,
4563 0x00010001, 0x00000001, 0x00000000, 0xab006676, 0x00030001, 0x00030001, 0x00000001, 0x00000000,
4564 0x0000012b, 0x00000130, 0x00000140, 0x00000144, 0x00000005, 0x00040001, 0x00020001, 0x00000154,
4565 0x3f8ccccd, 0x00000000, 0x00000000, 0x00000000, 0x400ccccd, 0x40533333, 0x408ccccd, 0x00000000,
4566 0x6e006e73, 0xababab00, 0x00020000, 0x00010001, 0x00000001, 0x00000000, 0xab006e76, 0x00020001,
4567 0x00030001, 0x00000001, 0x00000000, 0x00000197, 0x0000019c, 0x000001ac, 0x000001b0, 0x00000005,
4568 0x00040001, 0x00020001, 0x000001c0, 0x0000000b, 0x00000000, 0x00000001, 0x00000000, 0x0000000c,
4569 0x0000000d, 0x0000000e, 0x00000000, 0x00666e73, 0x7600666e, 0xab00666e, 0x00000204, 0x0000019c,
4570 0x00000207, 0x000001b0, 0x00000005, 0x00040001, 0x00020001, 0x0000020c, 0x41f80000, 0x00000000,
4571 0x00000000, 0x00000000, 0x42000000, 0x42040000, 0x42080000, 0x00000000, 0x335f7376, 0x4d00305f,
4572 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
4573 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x05000051, 0xa00f0006, 0x00000000, 0x00000000,
4574 0x00000000, 0x00000000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000,
4575 0x01000028, 0xe0e40803, 0x03000005, 0x80010000, 0xa0000001, 0x90aa0000, 0x02000001, 0x80010001,
4576 0xa0000006, 0x01000026, 0xf0e40000, 0x04000004, 0x80010001, 0x80000000, 0xa0aa0003, 0x80000001,
4577 0x00000027, 0x02000001, 0x80020001, 0xa0000006, 0x0000002a, 0x03000005, 0x80010000, 0xa0aa0001,
4578 0x90550000, 0x02000001, 0x80020001, 0xa0000006, 0x01000026, 0xf0e40003, 0x04000004, 0x80020001,
4579 0x80000000, 0xa0550005, 0x80550001, 0x00000027, 0x02000001, 0x80010001, 0xa0000006, 0x0000002b,
4580 0x02000001, 0xe0030000, 0x80e40001, 0x02000001, 0xe00c0000, 0xa0000006, 0x0000ffff,
4583 static const struct registerset_constants registerset_constants_struct_float[] =
4585 {"sf", {"sf", D3DXRS_FLOAT4, 0, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 93},
4586 {"sf.f", {"f", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 93},
4587 {"sf.vf", {"vf", D3DXRS_FLOAT4, 1, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 97},
4590 static const struct registerset_test registerset_test_struct_float[] =
4592 {SetInt},
4593 {SetBool},
4594 {SetFloat},
4595 {SetIntArray, 1, 0, 3},
4596 {SetIntArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4597 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x40800000, 0x40a00000, 0x00000000}},
4598 {SetBoolArray, 1, 0, 3},
4599 {SetBoolArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4600 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
4601 {SetFloatArray, 0, 0, 3},
4602 {SetFloatArray, 0, 4, REGISTER_OUTPUT_SIZE, 8,
4603 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4604 {SetValue, 0, 0, 15},
4605 {SetValue, 0, 16, REGISTER_OUTPUT_SIZE * 4, 8,
4606 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4607 {SetVector, 0, 0, 0, 8,
4608 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4609 {SetVectorArray},
4610 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
4611 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4612 {SetMatrix, 0, 0, 0, 8,
4613 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4614 {SetMatrixArray},
4615 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4616 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4617 {SetMatrixTranspose, 0, 0, 0, 8,
4618 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4619 {SetMatrixTransposeArray},
4620 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4621 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4622 {SetMatrixPointerArray},
4623 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4624 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4625 {SetMatrixTransposePointerArray},
4626 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4627 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4630 static const struct registerset_constants registerset_constants_struct_int[] =
4632 {"sn", {"sn", D3DXRS_INT4, 0, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 120},
4633 {"sn.n", {"n", D3DXRS_INT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 120},
4634 {"sn.vn", {"vn", D3DXRS_INT4, 1, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 124},
4637 static const struct registerset_test registerset_test_struct_int[] =
4639 {SetInt},
4640 {SetBool},
4641 {SetFloat},
4642 {SetIntArray, 1, 0, 3},
4643 {SetIntArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4644 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000004, 0x00000005, 0x00000000}},
4645 {SetBoolArray, 1, 0, 3},
4646 {SetBoolArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4647 {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000}},
4648 {SetFloatArray, 0, 0, 3},
4649 {SetFloatArray, 0, 4, REGISTER_OUTPUT_SIZE, 8,
4650 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4651 {SetValue, 1, 0, 15},
4652 {SetValue, 1, 16, REGISTER_OUTPUT_SIZE * 4, 8,
4653 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000004, 0x00000005, 0x00000000}},
4654 {SetVector, 0, 0, 0, 8,
4655 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4656 {SetVectorArray},
4657 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
4658 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4659 {SetMatrix, 0, 0, 0, 8,
4660 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4661 {SetMatrixArray},
4662 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4663 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4664 {SetMatrixTranspose, 0, 0, 0, 8,
4665 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4666 {SetMatrixTransposeArray},
4667 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4668 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4669 {SetMatrixPointerArray},
4670 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4671 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4672 {SetMatrixTransposePointerArray},
4673 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4674 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4677 static const struct registerset_constants registerset_constants_struct_bool[] =
4679 {"sb", {"sb", D3DXRS_BOOL, 0, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 51},
4680 {"sb.b", {"b", D3DXRS_BOOL, 0, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 51},
4681 {"sb.vb", {"vb", D3DXRS_BOOL, 1, 3, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 52},
4684 static const struct registerset_test registerset_test_struct_bool[] =
4686 {SetInt},
4687 {SetBool},
4688 {SetFloat},
4689 {SetIntArray, 1, 0, 3},
4690 {SetIntArray, 1, 4, REGISTER_OUTPUT_SIZE, 4,
4691 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4692 {SetBoolArray, 1, 0, 3},
4693 {SetBoolArray, 1, 4, REGISTER_OUTPUT_SIZE, 4,
4694 {0x00000002, 0x00000003, 0x00000004, 0x00000005}},
4695 {SetFloatArray, 0, 0, 3},
4696 {SetFloatArray, 0, 4, REGISTER_OUTPUT_SIZE, 4,
4697 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
4698 {SetValue, 1, 0, 15},
4699 {SetValue, 1, 16, REGISTER_OUTPUT_SIZE * 4, 4,
4700 {0x00000002, 0x00000003, 0x00000004, 0x00000005}},
4701 {SetVector, 0, 0, 0, 4,
4702 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
4703 {SetVectorArray},
4704 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 4,
4705 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
4706 {SetMatrix, 0, 0, 0, 4,
4707 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
4708 {SetMatrixArray},
4709 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
4710 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
4711 {SetMatrixTranspose, 0, 0, 0, 4,
4712 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4713 {SetMatrixTransposeArray},
4714 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
4715 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4716 {SetMatrixPointerArray},
4717 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
4718 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
4719 {SetMatrixTransposePointerArray},
4720 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
4721 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
4724 static const struct registerset_constants registerset_constants_struct_int_float[] =
4726 {"snf", {"snf", D3DXRS_FLOAT4, 2, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 139},
4727 {"snf.nf", {"nf", D3DXRS_FLOAT4, 2, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 139},
4728 {"snf.vnf", {"vnf", D3DXRS_FLOAT4, 3, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 143},
4731 static const struct registerset_test registerset_test_struct_int_float[] =
4733 {SetInt},
4734 {SetBool},
4735 {SetFloat},
4736 {SetIntArray, 1, 0, 3},
4737 {SetIntArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4738 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x40800000, 0x40a00000, 0x00000000}},
4739 {SetBoolArray, 1, 0, 3},
4740 {SetBoolArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4741 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
4742 {SetFloatArray, 0, 0, 3},
4743 {SetFloatArray, 0, 4, REGISTER_OUTPUT_SIZE, 8,
4744 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
4745 {SetValue, 1, 0, 15},
4746 {SetValue, 1, 16, REGISTER_OUTPUT_SIZE * 4, 8,
4747 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x40800000, 0x40a00000, 0x00000000}},
4748 {SetVector, 0, 0, 0, 8,
4749 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
4750 {SetVectorArray},
4751 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
4752 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
4753 {SetMatrix, 0, 0, 0, 8,
4754 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
4755 {SetMatrixArray},
4756 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4757 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
4758 {SetMatrixTranspose, 0, 0, 0, 8,
4759 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4760 {SetMatrixTransposeArray},
4761 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4762 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4763 {SetMatrixPointerArray},
4764 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4765 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4766 {SetMatrixTransposePointerArray},
4767 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4768 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4771 static const struct registerset_constants registerset_constants_struct_bool_float[] =
4773 {"sbf", {"sbf", D3DXRS_FLOAT4, 4, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 66},
4774 {"sbf.bf", {"bf", D3DXRS_FLOAT4, 4, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 66},
4775 {"sbf.vbf", {"vbf", D3DXRS_FLOAT4, 5, 1, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 70},
4778 static const struct registerset_test registerset_test_struct_bool_float[] =
4780 {SetInt},
4781 {SetBool},
4782 {SetFloat},
4783 {SetIntArray, 1, 0, 3},
4784 {SetIntArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4785 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
4786 {SetBoolArray, 1, 0, 3},
4787 {SetBoolArray, 1, 4, REGISTER_OUTPUT_SIZE, 8,
4788 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
4789 {SetFloatArray, 0, 0, 3},
4790 {SetFloatArray, 0, 4, REGISTER_OUTPUT_SIZE, 8,
4791 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
4792 {SetValue, 1, 0, 15},
4793 {SetValue, 1, 16, REGISTER_OUTPUT_SIZE * 4, 8,
4794 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
4795 {SetVector, 0, 0, 0, 8,
4796 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
4797 {SetVectorArray},
4798 {SetVectorArray, 0, 1, REGISTER_OUTPUT_SIZE / 4, 8,
4799 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
4800 {SetMatrix, 0, 0, 0, 8,
4801 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
4802 {SetMatrixArray},
4803 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4804 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
4805 {SetMatrixTranspose, 0, 0, 0, 8,
4806 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4807 {SetMatrixTransposeArray},
4808 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4809 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4810 {SetMatrixPointerArray},
4811 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4812 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4813 {SetMatrixTransposePointerArray},
4814 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4815 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4819 * fxc.exe /Tvs_3_0
4821 #if 0
4822 struct {bool b; bool3 vb;} sab[2] = {1, 1, 0, 1, 0, 1, 0, 1};
4823 struct {int n; int3 vn;} san[2] = {21, 22, 23, 24, 25, 26, 27, 28};
4824 struct {float f; float3 vf;} saf[2] = {1.1f, 2.1f, 3.1f, 4.1f, 5.1f, 6.1f, 7.1f, 8.1f};
4825 struct {int nf; int3 vnf;} sanf[2] = {41, 0, 43, 44, 41, 42, 43, 44};
4826 struct {bool bf; bool3 vbf;} sabf[2] = {1, 0, 0, 1, 1, 1, 0, 1};
4827 float4 main(float4 pos : POSITION) : POSITION
4829 float4 tmp = 0;
4830 int i;
4831 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;
4832 else for (i = 0; i < san[1].vn.z; i++) tmp.y += pos.y * saf[1].vf.z * sabf[1].vbf.y;
4833 return tmp;
4835 #endif
4836 static const DWORD registerset_blob_struct_array[] =
4838 0xfffe0300, 0x00c6fffe, 0x42415443, 0x0000001c, 0x000002e3, 0xfffe0300, 0x00000005, 0x0000001c,
4839 0x00000100, 0x000002dc, 0x00000080, 0x00000000, 0x00000008, 0x000000bc, 0x000000cc, 0x000000ec,
4840 0x00080002, 0x00000004, 0x00000108, 0x00000118, 0x00000158, 0x00000002, 0x00000004, 0x00000194,
4841 0x000001a4, 0x000001e4, 0x00000001, 0x00000008, 0x00000220, 0x00000230, 0x00000270, 0x00040002,
4842 0x00000004, 0x0000028c, 0x0000029c, 0x00626173, 0xabab0062, 0x00010000, 0x00010001, 0x00000001,
4843 0x00000000, 0xab006276, 0x00010001, 0x00030001, 0x00000001, 0x00000000, 0x00000084, 0x00000088,
4844 0x00000098, 0x0000009c, 0x00000005, 0x00040001, 0x00020002, 0x000000ac, 0xffffffff, 0xffffffff,
4845 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x66626173, 0x00666200,
4846 0x00666276, 0x000000f1, 0x00000088, 0x000000f4, 0x0000009c, 0x00000005, 0x00040001, 0x00020002,
4847 0x000000f8, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000,
4848 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000,
4849 0x00000000, 0x00666173, 0xabab0066, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0xab006676,
4850 0x00030001, 0x00030001, 0x00000001, 0x00000000, 0x0000015c, 0x00000160, 0x00000170, 0x00000174,
4851 0x00000005, 0x00040001, 0x00020002, 0x00000184, 0x3f8ccccd, 0x00000000, 0x00000000, 0x00000000,
4852 0x40066666, 0x40466666, 0x40833333, 0x00000000, 0x40a33333, 0x00000000, 0x00000000, 0x00000000,
4853 0x40c33333, 0x40e33333, 0x4101999a, 0x00000000, 0x006e6173, 0xabab006e, 0x00020000, 0x00010001,
4854 0x00000001, 0x00000000, 0xab006e76, 0x00020001, 0x00030001, 0x00000001, 0x00000000, 0x000001e8,
4855 0x000001ec, 0x000001fc, 0x00000200, 0x00000005, 0x00040001, 0x00020002, 0x00000210, 0x00000015,
4856 0x00000000, 0x00000001, 0x00000000, 0x00000016, 0x00000017, 0x00000018, 0x00000000, 0x00000019,
4857 0x00000000, 0x00000001, 0x00000000, 0x0000001a, 0x0000001b, 0x0000001c, 0x00000000, 0x666e6173,
4858 0x00666e00, 0x00666e76, 0x00000275, 0x000001ec, 0x00000278, 0x00000200, 0x00000005, 0x00040001,
4859 0x00020002, 0x0000027c, 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x422c0000,
4860 0x42300000, 0x00000000, 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x42280000, 0x422c0000,
4861 0x42300000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4862 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4863 0x05000051, 0xa00f000c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
4864 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x01000028, 0xe0e40807, 0x03000005, 0x80010000,
4865 0xa0000003, 0x90aa0000, 0x02000001, 0x80010001, 0xa000000c, 0x01000026, 0xf0e40004, 0x04000004,
4866 0x80010001, 0x80000000, 0xa0aa0007, 0x80000001, 0x00000027, 0x02000001, 0x80020001, 0xa000000c,
4867 0x0000002a, 0x03000005, 0x80010000, 0xa0aa0003, 0x90550000, 0x02000001, 0x80020001, 0xa000000c,
4868 0x01000026, 0xf0e40007, 0x04000004, 0x80020001, 0x80000000, 0xa055000b, 0x80550001, 0x00000027,
4869 0x02000001, 0x80010001, 0xa000000c, 0x0000002b, 0x02000001, 0xe0030000, 0x80e40001, 0x02000001,
4870 0xe00c0000, 0xa000000c, 0x0000ffff,
4873 static const struct registerset_constants registerset_constants_struct_array_float[] =
4875 {"saf", {"saf", D3DXRS_FLOAT4, 0, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 2, 2, 32, NULL}, 105},
4876 {"saf[0]", {"saf", D3DXRS_FLOAT4, 0, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 105},
4877 {"saf[0].f", {"f", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 105},
4878 {"saf[0].vf", {"vf", D3DXRS_FLOAT4, 1, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 109},
4879 {"saf[1]", {"saf", D3DXRS_FLOAT4, 2, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 113},
4880 {"saf[1].f", {"f", D3DXRS_FLOAT4, 2, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 113},
4881 {"saf[1].vf", {"vf", D3DXRS_FLOAT4, 3, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 117},
4884 static const struct registerset_test registerset_test_struct_array_float[] =
4886 {SetInt},
4887 {SetBool},
4888 {SetFloat},
4889 {SetIntArray, 1, 0, 3},
4890 {SetIntArray, 1, 4, 7, 8,
4891 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x40800000, 0x40a00000, 0x00000000}},
4892 {SetIntArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
4893 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x41000000, 0x41100000, 0x00000000}},
4894 {SetBoolArray, 1, 0, 3},
4895 {SetBoolArray, 1, 4, 7, 8,
4896 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
4897 {SetBoolArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
4898 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
4899 {SetFloatArray, 0, 0, 3},
4900 {SetFloatArray, 0, 4, 7, 8,
4901 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4902 {SetFloatArray, 0, 8, REGISTER_OUTPUT_SIZE, 8,
4903 {0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x41000123, 0x41100123, 0x00000000}},
4904 {SetValue, 0, 0, 15},
4905 {SetValue, 0, 16, 31, 8,
4906 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4907 {SetValue, 0, 32, REGISTER_OUTPUT_SIZE * 4, 8,
4908 {0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x41000123, 0x41100123, 0x00000000}},
4909 {SetVector, 0, 0, 0, 8,
4910 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4911 {SetVectorArray},
4912 {SetVectorArray, 0, 1, 1, 8,
4913 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800123, 0x40a00123, 0x00000000}},
4914 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
4915 {0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x41000123, 0x41100123, 0x00000000}},
4916 {SetMatrix, 0, 0, 0, 8,
4917 {0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x41000123, 0x41100123, 0x00000000}},
4918 {SetMatrixArray},
4919 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4920 {0x40c00123, 0x00000000, 0x00000000, 0x00000000, 0x40e00123, 0x41000123, 0x41100123, 0x00000000}},
4921 {SetMatrixTranspose, 0, 0, 0, 8,
4922 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4923 {SetMatrixTransposeArray},
4924 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4925 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4926 {SetMatrixPointerArray},
4927 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8},
4928 {SetMatrixTransposePointerArray},
4929 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8},
4932 static const struct registerset_constants registerset_constants_struct_array_int[] =
4934 {"san", {"san", D3DXRS_INT4, 0, 8, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 2, 2, 32, NULL}, 140},
4935 {"san[0]", {"san", D3DXRS_INT4, 0, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 140},
4936 {"san[0].n", {"n", D3DXRS_INT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 140},
4937 {"san[0].vn", {"vn", D3DXRS_INT4, 1, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 144},
4938 {"san[1]", {"san", D3DXRS_INT4, 2, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 148},
4939 {"san[1].n", {"n", D3DXRS_INT4, 2, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 148},
4940 {"san[1].vn", {"vn", D3DXRS_INT4, 3, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 152},
4943 static const struct registerset_test registerset_test_struct_array_int[] =
4945 {SetInt},
4946 {SetBool},
4947 {SetFloat},
4948 {SetIntArray, 1, 0, 3},
4949 {SetIntArray, 1, 4, 7, 8,
4950 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000004, 0x00000005, 0x00000000}},
4951 {SetIntArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
4952 {0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000009, 0x00000000}},
4953 {SetBoolArray, 1, 0, 3},
4954 {SetBoolArray, 1, 4, 7, 8,
4955 {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000}},
4956 {SetBoolArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
4957 {0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000}},
4958 {SetFloatArray, 0, 0, 3},
4959 {SetFloatArray, 0, 4, 7, 8,
4960 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4961 {SetFloatArray, 0, 8, REGISTER_OUTPUT_SIZE, 8,
4962 {0x00000006, 0x00000000, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000009, 0x00000000}},
4963 {SetValue, 1, 0, 15},
4964 {SetValue, 1, 16, 31, 8,
4965 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000004, 0x00000005, 0x00000000}},
4966 {SetValue, 1, 32, REGISTER_OUTPUT_SIZE * 4, 8,
4967 {0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000009, 0x00000000}},
4968 {SetVector, 0, 0, 0, 8,
4969 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4970 {SetVectorArray},
4971 {SetVectorArray, 0, 1, 1, 8,
4972 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000005, 0x00000000}},
4973 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
4974 {0x00000006, 0x00000000, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000009, 0x00000000}},
4975 {SetMatrix, 0, 0, 0, 8,
4976 {0x00000006, 0x00000000, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000009, 0x00000000},},
4977 {SetMatrixArray},
4978 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4979 {0x00000006, 0x00000000, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000009, 0x00000000}},
4980 {SetMatrixTranspose, 0, 0, 0, 8,
4981 {0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4982 {SetMatrixTransposeArray},
4983 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4984 {0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4985 {SetMatrixPointerArray},
4986 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4987 {0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4988 {SetMatrixTransposePointerArray},
4989 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
4990 {0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
4993 static const struct registerset_constants registerset_constants_struct_array_bool[] =
4995 {"sab", {"sab", D3DXRS_BOOL, 0, 8, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 2, 2, 32, NULL}, 51},
4996 {"sab[0]", {"sab", D3DXRS_BOOL, 0, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 51},
4997 {"sab[0].b", {"b", D3DXRS_BOOL, 0, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 51},
4998 {"sab[0].vb", {"vb", D3DXRS_BOOL, 1, 3, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 52},
4999 {"sab[1]", {"sab", D3DXRS_BOOL, 4, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 55},
5000 {"sab[1].b", {"b", D3DXRS_BOOL, 4, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 55},
5001 {"sab[1].vb", {"vb", D3DXRS_BOOL, 5, 3, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 56},
5004 static const struct registerset_test registerset_test_struct_array_bool[] =
5006 {SetInt},
5007 {SetBool},
5008 {SetFloat},
5009 {SetIntArray, 1, 0, 3},
5010 {SetIntArray, 1, 4, 7, 4,
5011 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5012 {SetIntArray, 1, 8, REGISTER_OUTPUT_SIZE, 4,
5013 {0x00000000, 0x00000001, 0x00000001, 0x00000001}},
5014 {SetBoolArray, 1, 0, 3},
5015 {SetBoolArray, 1, 4, 7, 4,
5016 {0x00000002, 0x00000003, 0x00000004, 0x00000005}},
5017 {SetBoolArray, 1, 8, REGISTER_OUTPUT_SIZE, 4,
5018 {0x00000000, 0x00000007, 0x00000008, 0x00000009}},
5019 {SetFloatArray, 0, 0, 3},
5020 {SetFloatArray, 0, 4, 7, 4,
5021 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
5022 {SetFloatArray, 0, 8, REGISTER_OUTPUT_SIZE, 4,
5023 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5024 {SetValue, 1, 0, 15},
5025 {SetValue, 1, 16, 31, 4,
5026 {0x00000002, 0x00000003, 0x00000004, 0x00000005}},
5027 {SetValue, 1, 32, REGISTER_OUTPUT_SIZE * 4, 4,
5028 {0x00000000, 0x00000007, 0x00000008, 0x00000009}},
5029 {SetVector, 0, 0, 0, 4,
5030 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
5031 {SetVectorArray},
5032 {SetVectorArray, 0, 1, 1, 4,
5033 {0x00000001, 0x00000000, 0x00000001, 0x00000001}},
5034 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 4,
5035 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5036 {SetMatrix, 0, 0, 0, 4,
5037 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5038 {SetMatrixArray},
5039 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
5040 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5041 {SetMatrixTranspose, 0, 0, 0, 4,
5042 {0x00000000, 0x00000001, 0x00000001, 0x00000001}},
5043 {SetMatrixTransposeArray},
5044 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
5045 {0x00000000, 0x00000001, 0x00000001, 0x00000001}},
5046 {SetMatrixPointerArray},
5047 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
5048 {0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5049 {SetMatrixTransposePointerArray},
5050 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 4,
5051 {0x00000000, 0x00000001, 0x00000001, 0x00000001}},
5054 static const struct registerset_constants registerset_constants_struct_array_int_float[] =
5056 {"sanf", {"sanf", D3DXRS_FLOAT4, 4, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 2, 2, 32, NULL}, 167},
5057 {"sanf[0]", {"sanf", D3DXRS_FLOAT4, 4, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 167},
5058 {"sanf[0].nf", {"nf", D3DXRS_FLOAT4, 4, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 167},
5059 {"sanf[0].vnf", {"vnf", D3DXRS_FLOAT4, 5, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 171},
5060 {"sanf[1]", {"sanf", D3DXRS_FLOAT4, 6, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 175},
5061 {"sanf[1].nf", {"nf", D3DXRS_FLOAT4, 6, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 175},
5062 {"sanf[1].vnf", {"vnf", D3DXRS_FLOAT4, 7, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 179},
5065 static const struct registerset_test registerset_test_struct_array_int_float[] =
5067 {SetInt},
5068 {SetBool},
5069 {SetFloat},
5070 {SetIntArray, 1, 0, 3},
5071 {SetIntArray, 1, 4, 7, 8,
5072 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x40800000, 0x40a00000, 0x00000000}},
5073 {SetIntArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
5074 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x41000000, 0x41100000, 0x00000000}},
5075 {SetBoolArray, 1, 0, 3},
5076 {SetBoolArray, 1, 4, 7, 8,
5077 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5078 {SetBoolArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
5079 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5080 {SetFloatArray, 0, 0, 3},
5081 {SetFloatArray, 0, 4, 7, 8,
5082 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
5083 {SetFloatArray, 0, 8, REGISTER_OUTPUT_SIZE, 8,
5084 {0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x41000000, 0x41100000, 0x00000000}},
5085 {SetValue, 1, 0, 15},
5086 {SetValue, 1, 16, 31, 8,
5087 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x40800000, 0x40a00000, 0x00000000}},
5088 {SetValue, 1, 32, REGISTER_OUTPUT_SIZE * 4, 8,
5089 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x41000000, 0x41100000, 0x00000000}},
5090 {SetVector, 0, 0, 0, 8,
5091 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
5092 {SetVectorArray},
5093 {SetVectorArray, 0, 1, 1, 8,
5094 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40800000, 0x40a00000, 0x00000000}},
5095 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
5096 {0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x41000000, 0x41100000, 0x00000000}},
5097 {SetMatrix, 0, 0, 0, 8,
5098 {0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x41000000, 0x41100000, 0x00000000}},
5099 {SetMatrixArray},
5100 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
5101 {0x40c00000, 0x00000000, 0x00000000, 0x00000000, 0x40e00000, 0x41000000, 0x41100000, 0x00000000}},
5102 {SetMatrixTranspose, 0, 0, 0, 8,
5103 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
5104 {SetMatrixTransposeArray},
5105 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
5106 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
5107 {SetMatrixPointerArray},
5108 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8},
5109 {SetMatrixTransposePointerArray},
5110 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8},
5113 static const struct registerset_constants registerset_constants_struct_array_bool_float[] =
5115 {"sabf", {"sabf", D3DXRS_FLOAT4, 8, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 2, 2, 32, NULL}, 70},
5116 {"sabf[0]", {"sabf", D3DXRS_FLOAT4, 8, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 70},
5117 {"sabf[0].bf", {"bf", D3DXRS_FLOAT4, 8, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 70},
5118 {"sabf[0].vbf", {"vbf", D3DXRS_FLOAT4, 9, 1, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 74},
5119 {"sabf[1]", {"sabf", D3DXRS_FLOAT4, 10, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 78},
5120 {"sabf[1].bf", {"bf", D3DXRS_FLOAT4, 10, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 78},
5121 {"sabf[1].vbf", {"vbf", D3DXRS_FLOAT4, 11, 1, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 82},
5124 static const struct registerset_test registerset_test_struct_array_bool_float[] =
5126 {SetInt},
5127 {SetBool},
5128 {SetFloat},
5129 {SetIntArray, 1, 0, 3},
5130 {SetIntArray, 1, 4, 7, 8,
5131 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5132 {SetIntArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
5133 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5134 {SetBoolArray, 1, 0, 3},
5135 {SetBoolArray, 1, 4, 7, 8,
5136 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5137 {SetBoolArray, 1, 8, REGISTER_OUTPUT_SIZE, 8,
5138 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5139 {SetFloatArray, 0, 0, 3},
5140 {SetFloatArray, 0, 4, 7, 8,
5141 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
5142 {SetFloatArray, 0, 8, REGISTER_OUTPUT_SIZE, 8,
5143 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5144 {SetValue, 1, 0, 15},
5145 {SetValue, 1, 16, 31, 8,
5146 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5147 {SetValue, 1, 32, REGISTER_OUTPUT_SIZE * 4, 8,
5148 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5149 {SetVector, 0, 0, 0, 8,
5150 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
5151 {SetVectorArray},
5152 {SetVectorArray, 0, 1, 1, 8,
5153 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000}},
5154 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 8,
5155 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5156 {SetMatrix, 0, 0, 0, 8,
5157 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5158 {SetMatrixArray},
5159 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
5160 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000}},
5161 {SetMatrixTranspose, 0, 0, 0, 8,
5162 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
5163 {SetMatrixTransposeArray},
5164 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8,
5165 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}},
5166 {SetMatrixPointerArray},
5167 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8},
5168 {SetMatrixTransposePointerArray},
5169 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 8},
5173 * fxc.exe /Tvs_3_0
5175 #if 0
5176 struct {bool b; struct {bool b; bool3 vb;} s; bool b1;} ssb = {1, 1, 0, 1, 1, 0};
5177 struct {int n; struct {int n; int3 vn;} s; int n1;} ssn = {71, 72, 73, 74, 75, 76};
5178 struct {float f; struct {float f; float3 vf;} s; float f1;} ssf = {1.1f, 2.1f, 3.1f, 4.1f, 5.1f, 6.1f};
5179 struct {int nf; struct {int nf; int3 vnf;} s; int nf1;} ssnf = {41, 0, 43, 44, 41, 42};
5180 struct {bool bf; struct {bool bf; bool3 vbf;} s; bool bf1;} ssbf = {1, 0, 0, 1, 1, 0};
5181 float4 main(float4 pos : POSITION) : POSITION
5183 float4 tmp = 0;
5184 int i;
5185 if (ssb.b1) for (i = 0; i < ssn.n1; i++) tmp.x += pos.z * ssf.f1 * ssnf.nf1;
5186 else for (i = 0; i < ssn.s.vn.z; i++) tmp.y += pos.y * ssf.s.vf.z * ssbf.bf1;
5187 return tmp;
5189 #endif
5190 static const DWORD registerset_blob_struct_struct[] =
5192 0xfffe0300, 0x00fcfffe, 0x42415443, 0x0000001c, 0x000003bb, 0xfffe0300, 0x00000005, 0x0000001c,
5193 0x00000100, 0x000003b4, 0x00000080, 0x00000000, 0x00000006, 0x000000ec, 0x000000fc, 0x00000114,
5194 0x00080002, 0x00000004, 0x0000015c, 0x0000016c, 0x000001ac, 0x00000002, 0x00000004, 0x00000214,
5195 0x00000224, 0x00000264, 0x00000001, 0x00000006, 0x000002cc, 0x000002dc, 0x0000031c, 0x00040002,
5196 0x00000004, 0x00000364, 0x00000374, 0x00627373, 0xabab0062, 0x00010000, 0x00010001, 0x00000001,
5197 0x00000000, 0x62760073, 0xababab00, 0x00010001, 0x00030001, 0x00000001, 0x00000000, 0x00000084,
5198 0x00000088, 0x0000009a, 0x000000a0, 0x00000005, 0x00040001, 0x00020001, 0x000000b0, 0xab003162,
5199 0x00000084, 0x00000088, 0x00000098, 0x000000c0, 0x000000d0, 0x00000088, 0x00000005, 0x00060001,
5200 0x00030001, 0x000000d4, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000,
5201 0x66627373, 0x00666200, 0x00666276, 0x00000119, 0x00000088, 0x0000011c, 0x000000a0, 0x00000005,
5202 0x00040001, 0x00020001, 0x00000120, 0x00316662, 0x00000119, 0x00000088, 0x00000098, 0x00000130,
5203 0x00000140, 0x00000088, 0x00000005, 0x00060001, 0x00030001, 0x00000144, 0x3f800000, 0x00000000,
5204 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000,
5205 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00667373, 0xabab0066,
5206 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0xab006676, 0x00030001, 0x00030001, 0x00000001,
5207 0x00000000, 0x000001b0, 0x000001b4, 0x000001c4, 0x000001c8, 0x00000005, 0x00040001, 0x00020001,
5208 0x000001d8, 0xab003166, 0x000001b0, 0x000001b4, 0x00000098, 0x000001e8, 0x000001f8, 0x000001b4,
5209 0x00000005, 0x00060001, 0x00030001, 0x000001fc, 0x3f8ccccd, 0x00000000, 0x00000000, 0x00000000,
5210 0x40066666, 0x00000000, 0x00000000, 0x00000000, 0x40466666, 0x40833333, 0x40a33333, 0x00000000,
5211 0x40c33333, 0x00000000, 0x00000000, 0x00000000, 0x006e7373, 0xabab006e, 0x00020000, 0x00010001,
5212 0x00000001, 0x00000000, 0xab006e76, 0x00020001, 0x00030001, 0x00000001, 0x00000000, 0x00000268,
5213 0x0000026c, 0x0000027c, 0x00000280, 0x00000005, 0x00040001, 0x00020001, 0x00000290, 0xab00316e,
5214 0x00000268, 0x0000026c, 0x00000098, 0x000002a0, 0x000002b0, 0x0000026c, 0x00000005, 0x00060001,
5215 0x00030001, 0x000002b4, 0x00000047, 0x00000000, 0x00000001, 0x00000000, 0x00000048, 0x00000000,
5216 0x00000001, 0x00000000, 0x00000049, 0x0000004a, 0x0000004b, 0x00000000, 0x0000004c, 0x00000000,
5217 0x00000001, 0x00000000, 0x666e7373, 0x00666e00, 0x00666e76, 0x00000321, 0x0000026c, 0x00000324,
5218 0x00000280, 0x00000005, 0x00040001, 0x00020001, 0x00000328, 0x0031666e, 0x00000321, 0x0000026c,
5219 0x00000098, 0x00000338, 0x00000348, 0x0000026c, 0x00000005, 0x00060001, 0x00030001, 0x0000034c,
5220 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5221 0x422c0000, 0x42300000, 0x42240000, 0x00000000, 0x42280000, 0x00000000, 0x00000000, 0x00000000,
5222 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
5223 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x05000051, 0xa00f000c,
5224 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f,
5225 0x80000000, 0xe00f0000, 0x01000028, 0xe0e40805, 0x03000005, 0x80010000, 0xa0000003, 0x90aa0000,
5226 0x02000001, 0x80010001, 0xa000000c, 0x01000026, 0xf0e40005, 0x04000004, 0x80010001, 0x80000000,
5227 0xa0000007, 0x80000001, 0x00000027, 0x02000001, 0x80020001, 0xa000000c, 0x0000002a, 0x03000005,
5228 0x80010000, 0xa0aa0002, 0x90550000, 0x02000001, 0x80020001, 0xa000000c, 0x01000026, 0xf0e40004,
5229 0x04000004, 0x80020001, 0x80000000, 0xa000000b, 0x80550001, 0x00000027, 0x02000001, 0x80010001,
5230 0xa000000c, 0x0000002b, 0x02000001, 0xe0030000, 0x80e40001, 0x02000001, 0xe00c0000, 0xa000000c,
5231 0x0000ffff,
5234 static const struct registerset_constants registerset_constants_struct_struct_float[] =
5236 {"ssf", {"ssf", D3DXRS_FLOAT4, 0, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 6, 1, 3, 24, NULL}, 137},
5237 {"ssf.f", {"f", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 137},
5238 {"ssf.s", {"s", D3DXRS_FLOAT4, 1, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 141},
5239 {"ssf.s.f", {"f", D3DXRS_FLOAT4, 1, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 141},
5240 {"ssf.s.vf", {"vf", D3DXRS_FLOAT4, 2, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 145},
5241 {"ssf.f1", {"f1", D3DXRS_FLOAT4, 3, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 149},
5244 static const struct registerset_test registerset_test_struct_struct_float[] =
5246 {SetInt},
5247 {SetBool},
5248 {SetFloat},
5249 {SetIntArray, 1, 0, 5},
5250 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5251 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x00000000, 0x00000000, 0x00000000,
5252 0x40800000, 0x40a00000, 0x00000000, 0x00000000, 0x40e00000}},
5253 {SetBoolArray, 1, 0, 5},
5254 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5255 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
5256 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000}},
5257 {SetFloatArray, 0, 0, 5},
5258 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 16,
5259 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5260 0x40800123, 0x40a00123, 0x40c00123, 0x00000000, 0x40e00123}},
5261 {SetValue, 0, 0, 23},
5262 {SetValue, 0, 24, REGISTER_OUTPUT_SIZE * 4, 16,
5263 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5264 0x40800123, 0x40a00123, 0x40c00123, 0x00000000, 0x40e00123}},
5265 {SetVector},
5266 {SetVectorArray, 0, 0, 1},
5267 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 16,
5268 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5269 0x40800123, 0x40a00123, 0x40c00123, 0x00000000, 0x40e00123}},
5270 {SetMatrix, 0, 0, 0, 16,
5271 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5272 0x40800123, 0x40a00123, 0x40c00123, 0x00000000, 0x40e00123}},
5273 {SetMatrixArray},
5274 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16,
5275 {0x40000123, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5276 0x40800123, 0x40a00123, 0x40c00123, 0x00000000, 0x40e00123}},
5277 {SetMatrixTranspose, 0, 0, 0, 16, {0x40000123}},
5278 {SetMatrixTransposeArray},
5279 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x40000123}},
5280 {SetMatrixPointerArray},
5281 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x40000123}},
5282 {SetMatrixTransposePointerArray},
5283 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x40000123}},
5286 static const struct registerset_constants registerset_constants_struct_struct_int[] =
5288 {"ssn", {"ssn", D3DXRS_INT4, 0, 6, D3DXPC_STRUCT, D3DXPT_VOID, 1, 6, 1, 3, 24, NULL}, 183},
5289 {"ssn.n", {"n", D3DXRS_INT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 183},
5290 {"ssn.s", {"s", D3DXRS_INT4, 1, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 187},
5291 {"ssn.s.n", {"n", D3DXRS_INT4, 1, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 187},
5292 {"ssn.s.vn", {"vn", D3DXRS_INT4, 2, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 191},
5293 {"ssn.n1", {"n1", D3DXRS_INT4, 3, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 195},
5296 static const struct registerset_test registerset_test_struct_struct_int[] =
5298 {SetInt},
5299 {SetBool},
5300 {SetFloat},
5301 {SetIntArray, 1, 0, 5},
5302 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5303 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000000, 0x00000001, 0x00000000,
5304 0x00000004, 0x00000005, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000001}},
5305 {SetBoolArray, 1, 0, 5},
5306 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5307 {0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000000,
5308 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000001}},
5309 {SetFloatArray, 0, 0, 5},
5310 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 16,
5311 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5312 0x00000004, 0x00000005, 0x00000006, 0x00000000, 0x00000007, 0x00000000, 0x00000001}},
5313 {SetValue, 1, 0, 23},
5314 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 16,
5315 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000003, 0x00000000, 0x00000001, 0x00000000,
5316 0x00000004, 0x00000005, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000001}},
5317 {SetVector},
5318 {SetVectorArray, 0, 0, 1},
5319 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 16,
5320 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5321 0x00000004, 0x00000005, 0x00000006, 0x00000000, 0x00000007, 0x00000000, 0x00000001}},
5322 {SetMatrix, 0, 0, 0, 16,
5323 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5324 0x00000004, 0x00000005, 0x00000006, 0x00000000, 0x00000007, 0x00000000, 0x00000001}},
5325 {SetMatrixArray},
5326 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16,
5327 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5328 0x00000004, 0x00000005, 0x00000006, 0x00000000, 0x00000007, 0x00000000, 0x00000001}},
5329 {SetMatrixTranspose, 0, 0, 0, 16,
5330 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5331 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
5332 {SetMatrixTransposeArray},
5333 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16,
5334 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5335 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
5336 {SetMatrixPointerArray},
5337 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16,
5338 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5339 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
5340 {SetMatrixTransposePointerArray},
5341 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16,
5342 {0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
5343 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001}},
5346 static const struct registerset_constants registerset_constants_struct_struct_bool[] =
5348 {"ssb", {"ssb", D3DXRS_BOOL, 0, 6, D3DXPC_STRUCT, D3DXPT_VOID, 1, 6, 1, 3, 24, NULL}, 63},
5349 {"ssb.b", {"b", D3DXRS_BOOL, 0, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 63},
5350 {"ssb.s", {"s", D3DXRS_BOOL, 1, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 64},
5351 {"ssb.s.b", {"b", D3DXRS_BOOL, 1, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 64},
5352 {"ssb.s.vb", {"vb", D3DXRS_BOOL, 2, 3, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 65},
5353 {"ssb.b1", {"b1", D3DXRS_BOOL, 5, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 68},
5356 static const struct registerset_test registerset_test_struct_struct_bool[] =
5358 {SetInt},
5359 {SetBool},
5360 {SetFloat},
5361 {SetIntArray, 1, 0, 5},
5362 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
5363 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
5364 {SetBoolArray, 1, 0, 5},
5365 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 6,
5366 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
5367 {SetFloatArray, 0, 0, 5},
5368 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 6,
5369 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5370 {SetValue, 1, 0, 23},
5371 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 6,
5372 {0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000000, 0x00000007}},
5373 {SetVector},
5374 {SetVectorArray, 0, 0, 1},
5375 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 6,
5376 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5377 {SetMatrix, 0, 0, 0, 6,
5378 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5379 {SetMatrixArray},
5380 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
5381 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5382 {SetMatrixTranspose, 0, 0, 0, 6,
5383 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
5384 {SetMatrixTransposeArray},
5385 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
5386 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
5387 {SetMatrixPointerArray},
5388 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
5389 {0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000001}},
5390 {SetMatrixTransposePointerArray},
5391 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 6,
5392 {0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000001}},
5395 static const struct registerset_constants registerset_constants_struct_struct_int_float[] =
5397 {"ssnf", {"ssnf", D3DXRS_FLOAT4, 4, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 6, 1, 3, 24, NULL}, 221},
5398 {"ssnf.nf", {"nf", D3DXRS_FLOAT4, 4, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 221},
5399 {"ssnf.s", {"s", D3DXRS_FLOAT4, 5, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 225},
5400 {"ssnf.s.nf", {"nf", D3DXRS_FLOAT4, 5, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 225},
5401 {"ssnf.s.vnf", {"vnf", D3DXRS_FLOAT4, 6, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 1, 0, 12, NULL}, 229},
5402 {"ssnf.nf1", {"nf1", D3DXRS_FLOAT4, 7, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL}, 233},
5405 static const struct registerset_test registerset_test_struct_struct_int_float[] =
5407 {SetInt},
5408 {SetBool},
5409 {SetFloat},
5410 {SetIntArray, 1, 0, 5},
5411 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5412 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x00000000, 0x00000000, 0x00000000,
5413 0x40800000, 0x40a00000, 0x00000000, 0x00000000, 0x40e00000}},
5414 {SetBoolArray, 1, 0, 5},
5415 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5416 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
5417 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000}},
5418 {SetFloatArray, 0, 0, 5},
5419 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 16,
5420 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5421 0x40800000, 0x40a00000, 0x40c00000, 0x00000000, 0x40e00000}},
5422 {SetValue, 1, 0, 23},
5423 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 16,
5424 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x00000000, 0x00000000, 0x00000000,
5425 0x40800000, 0x40a00000, 0x00000000, 0x00000000, 0x40e00000}},
5426 {SetVector},
5427 {SetVectorArray, 0, 0, 1},
5428 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 16,
5429 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5430 0x40800000, 0x40a00000, 0x40c00000, 0x00000000, 0x40e00000}},
5431 {SetMatrix, 0, 0, 0, 16,
5432 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5433 0x40800000, 0x40a00000, 0x40c00000, 0x00000000, 0x40e00000}},
5434 {SetMatrixArray},
5435 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16,
5436 {0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5437 0x40800000, 0x40a00000, 0x40c00000, 0x00000000, 0x40e00000}},
5438 {SetMatrixTranspose, 0, 0, 0, 16, {0x40000000}},
5439 {SetMatrixTransposeArray},
5440 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x40000000}},
5441 {SetMatrixPointerArray},
5442 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x40000000}},
5443 {SetMatrixTransposePointerArray},
5444 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x40000000}},
5447 static const struct registerset_constants registerset_constants_struct_struct_bool_float[] =
5449 {"ssbf", {"ssbf", D3DXRS_FLOAT4, 8, 4, D3DXPC_STRUCT, D3DXPT_VOID, 1, 6, 1, 3, 24, NULL}, 91},
5450 {"ssbf.bf", {"bf", D3DXRS_FLOAT4, 8, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 91},
5451 {"ssbf.s", {"s", D3DXRS_FLOAT4, 9, 2, D3DXPC_STRUCT, D3DXPT_VOID, 1, 4, 1, 2, 16, NULL}, 95},
5452 {"ssbf.s.bf", {"bf", D3DXRS_FLOAT4, 9, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 95},
5453 {"ssbf.s.vbf", {"vbf", D3DXRS_FLOAT4, 10, 1, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 1, 0, 12, NULL}, 99},
5454 {"ssbf.bf1", {"bf1", D3DXRS_FLOAT4, 11, 1, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 1, 0, 4, NULL}, 103},
5457 static const struct registerset_test registerset_test_struct_struct_bool_float[] =
5459 {SetInt},
5460 {SetBool},
5461 {SetFloat},
5462 {SetIntArray, 1, 0, 5},
5463 {SetIntArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5464 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
5465 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000}},
5466 {SetBoolArray, 1, 0, 5},
5467 {SetBoolArray, 1, 6, REGISTER_OUTPUT_SIZE, 16,
5468 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
5469 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000}},
5470 {SetFloatArray, 0, 0, 5},
5471 {SetFloatArray, 0, 6, REGISTER_OUTPUT_SIZE, 16,
5472 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5473 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000}},
5474 {SetValue, 1, 0, 23},
5475 {SetValue, 1, 24, REGISTER_OUTPUT_SIZE * 4, 16,
5476 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
5477 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000}},
5478 {SetVector},
5479 {SetVectorArray, 0, 0, 1},
5480 {SetVectorArray, 0, 2, REGISTER_OUTPUT_SIZE / 4, 16,
5481 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5482 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000}},
5483 {SetMatrix, 0, 0, 0, 16,
5484 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5485 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000}},
5486 {SetMatrixArray},
5487 {SetMatrixArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16,
5488 {0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5489 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000}},
5490 {SetMatrixTranspose, 0, 0, 0, 16, {0x3f800000}},
5491 {SetMatrixTransposeArray},
5492 {SetMatrixTransposeArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x3f800000}},
5493 {SetMatrixPointerArray},
5494 {SetMatrixPointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x3f800000}},
5495 {SetMatrixTransposePointerArray},
5496 {SetMatrixTransposePointerArray, 0, 1, REGISTER_OUTPUT_SIZE / 16, 16, {0x3f800000}},
5500 * fxc.exe /Tvs_3_0
5502 #if 0
5503 row_major int3x2 ran[2] = {4, 5, 6, 1, 8, 1, 2, 3, 4, 7, 9, 1};
5504 float4 main(float4 pos : POSITION) : POSITION
5506 float4 tmp = 0;
5507 int k;
5508 for (k = 0; k < ran[1]._21; k++)
5509 tmp.y += pos.y + tmp.x;
5510 return tmp;
5512 #endif
5513 static const DWORD registerset_blob_special_int[] =
5515 0xfffe0300, 0x0038fffe, 0x42415443, 0x0000001c, 0x000000ab, 0xfffe0300, 0x00000001, 0x0000001c,
5516 0x00000100, 0x000000a4, 0x00000030, 0x00000001, 0x00000009, 0x00000034, 0x00000044, 0x006e6172,
5517 0x00020002, 0x00020003, 0x00000002, 0x00000000, 0x00000004, 0x00000005, 0x00000001, 0x00000000,
5518 0x00000006, 0x00000001, 0x00000001, 0x00000000, 0x00000008, 0x00000001, 0x00000001, 0x00000000,
5519 0x00000002, 0x00000003, 0x00000001, 0x00000000, 0x00000004, 0x00000007, 0x00000001, 0x00000000,
5520 0x00000009, 0x00000001, 0x00000001, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73,
5521 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
5522 0x332e3235, 0x00313131, 0x05000051, 0xa00f0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5523 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x02000001, 0x80010000,
5524 0xa0000000, 0x01000026, 0xf0e40008, 0x03000002, 0x80010000, 0x80000000, 0x90550000, 0x00000027,
5525 0x02000001, 0xe0020000, 0x80000000, 0x02000001, 0xe00d0000, 0xa0000000, 0x0000ffff,
5528 static const struct registerset_constants registerset_constants_special_int[] =
5530 {"ran", {"ran", D3DXRS_INT4, 0, 9, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 2, 0, 48, NULL}, 17},
5531 {"ran[0]", {"ran", D3DXRS_INT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 17},
5532 {"ran[1]", {"ran", D3DXRS_INT4, 3, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 1, 0, 24, NULL}, 29},
5536 * fxc.exe /Tvs_3_0
5538 #if 0
5539 float3 vaf[10];
5540 float4 main(float4 pos : POSITION) : POSITION
5542 float4 tmp = 0;
5543 tmp.y += pos.y + vaf[8].x;
5544 return tmp;
5546 #endif
5547 static const DWORD registerset_blob_bigvec[] =
5549 0xfffe0300, 0x0020fffe, 0x42415443, 0x0000001c, 0x0000004b, 0xfffe0300, 0x00000001, 0x0000001c,
5550 0x00000100, 0x00000044, 0x00000030, 0x00000002, 0x00000009, 0x00000034, 0x00000000, 0x00666176,
5551 0x00030001, 0x00030001, 0x0000000a, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73,
5552 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
5553 0x332e3235, 0x00313131, 0x05000051, 0xa00f0009, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5554 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x03000002, 0xe0020000,
5555 0xa0000008, 0x90550000, 0x02000001, 0xe00d0000, 0xa0000009, 0x0000ffff,
5558 static const struct registerset_constants registerset_constants_bigvec_float[] =
5560 {"vaf", {"vaf", D3DXRS_FLOAT4, 0, 9, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 10, 0, 120, NULL}, 0},
5561 {"vaf[0]", {"vaf", D3DXRS_FLOAT4, 0, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5562 {"vaf[1]", {"vaf", D3DXRS_FLOAT4, 1, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5563 {"vaf[2]", {"vaf", D3DXRS_FLOAT4, 2, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5564 {"vaf[3]", {"vaf", D3DXRS_FLOAT4, 3, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5565 {"vaf[4]", {"vaf", D3DXRS_FLOAT4, 4, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5566 {"vaf[5]", {"vaf", D3DXRS_FLOAT4, 5, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5567 {"vaf[6]", {"vaf", D3DXRS_FLOAT4, 6, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5568 {"vaf[7]", {"vaf", D3DXRS_FLOAT4, 7, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5569 {"vaf[8]", {"vaf", D3DXRS_FLOAT4, 8, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5570 {"vaf[9]", {"vaf", D3DXRS_FLOAT4, 9, 0, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 1, 0, 12, NULL}, 0},
5573 static const struct registerset_test registerset_test_bigvec_float[] =
5575 {SetMatrix, 0, 0, 0, 16,
5576 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
5577 0x41200123, 0x41300123, 0x41400123, 0x00000000, 0x41600123, 0x41700123, 0x41800123}},
5578 {SetMatrixArray},
5579 {SetMatrixArray, 0, 1, 1, 16,
5580 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
5581 0x41200123, 0x41300123, 0x41400123, 0x00000000, 0x41600123, 0x41700123, 0x41800123}},
5582 {SetMatrixArray, 0, 2, 2, 32,
5583 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
5584 0x41200123, 0x41300123, 0x41400123, 0x00000000, 0x41600123, 0x41700123, 0x41800123, 0x00000000,
5585 0x41a00123, 0x41b00123, 0x41c00123, 0x00000000, 0x00000000, 0x41f00123, 0x42000123, 0x00000000,
5586 0x00000000, 0x42300123, 0x42400123, 0x00000000, 0x42600123, 0x42700123, 0x42800123}},
5587 {SetMatrixArray, 0, 3, REGISTER_OUTPUT_SIZE / 16, 36,
5588 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
5589 0x41200123, 0x41300123, 0x41400123, 0x00000000, 0x41600123, 0x41700123, 0x41800123, 0x00000000,
5590 0x41a00123, 0x41b00123, 0x41c00123, 0x00000000, 0x00000000, 0x41f00123, 0x42000123, 0x00000000,
5591 0x00000000, 0x42300123, 0x42400123, 0x00000000, 0x42600123, 0x42700123, 0x42800123, 0x00000000,
5592 0x43000123, 0x43100123, 0x43200123}},
5593 {SetMatrixTranspose, 0, 0, 0, 16,
5594 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
5595 0x40800123, 0x41000123, 0x41400123, 0x00000000, 0x40a00123, 0x41100123, 0x41500123}},
5596 {SetMatrixTransposeArray},
5597 {SetMatrixTransposeArray, 0, 1, 1, 16,
5598 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
5599 0x40800123, 0x41000123, 0x41400123, 0x00000000, 0x40a00123, 0x41100123, 0x41500123}},
5600 {SetMatrixTransposeArray, 0, 2, 2, 32,
5601 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
5602 0x40800123, 0x41000123, 0x41400123, 0x00000000, 0x40a00123, 0x41100123, 0x41500123, 0x00000000,
5603 0x41a00123, 0x00000000, 0x00000000, 0x00000000, 0x41b00123, 0x41f00123, 0x42300123, 0x00000000,
5604 0x41c00123, 0x42000123, 0x42400123, 0x00000000, 0x41d00123, 0x42100123, 0x42500123}},
5605 {SetMatrixTransposeArray, 0, 3, REGISTER_OUTPUT_SIZE / 16, 36,
5606 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
5607 0x40800123, 0x41000123, 0x41400123, 0x00000000, 0x40a00123, 0x41100123, 0x41500123, 0x00000000,
5608 0x41a00123, 0x00000000, 0x00000000, 0x00000000, 0x41b00123, 0x41f00123, 0x42300123, 0x00000000,
5609 0x41c00123, 0x42000123, 0x42400123, 0x00000000, 0x41d00123, 0x42100123, 0x42500123, 0x00000000,
5610 0x43000123, 0x43400123, 0x43800123}},
5611 {SetMatrixPointerArray},
5612 {SetMatrixPointerArray, 0, 1, 1, 16,
5613 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
5614 0x41200123, 0x41300123, 0x41400123, 0x00000000, 0x41600123, 0x41700123, 0x41800123}},
5615 {SetMatrixPointerArray, 0, 2, 2, 32,
5616 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
5617 0x41200123, 0x41300123, 0x41400123, 0x00000000, 0x41600123, 0x41700123, 0x41800123, 0x00000000,
5618 0x41900123, 0x41a00123, 0x41b00123, 0x00000000, 0x41d00123, 0x00000000, 0x41f00123, 0x00000000,
5619 0x42100123, 0x00000000, 0x42300123, 0x00000000, 0x42500123, 0x42600123, 0x42700123}},
5620 {SetMatrixPointerArray, 0, 3, REGISTER_OUTPUT_SIZE / 16, 36,
5621 {0x40000123, 0x00000000, 0x40800123, 0x00000000, 0x40c00123, 0x40e00123, 0x41000123, 0x00000000,
5622 0x41200123, 0x41300123, 0x41400123, 0x00000000, 0x41600123, 0x41700123, 0x41800123, 0x00000000,
5623 0x41900123, 0x41a00123, 0x41b00123, 0x00000000, 0x41d00123, 0x00000000, 0x41f00123, 0x00000000,
5624 0x42100123, 0x00000000, 0x42300123, 0x00000000, 0x42500123, 0x42600123, 0x42700123, 0x00000000,
5625 0x42800123, 0x42900123, 0x43000123}},
5626 {SetMatrixTransposePointerArray},
5627 {SetMatrixTransposePointerArray, 0, 1, 1, 16,
5628 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
5629 0x40800123, 0x41000123, 0x41400123, 0x00000000, 0x40a00123, 0x41100123, 0x41500123}},
5630 {SetMatrixTransposePointerArray, 0, 2, 2, 32,
5631 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
5632 0x40800123, 0x41000123, 0x41400123, 0x00000000, 0x40a00123, 0x41100123, 0x41500123, 0x00000000,
5633 0x41900123, 0x41d00123, 0x42100123, 0x00000000, 0x41a00123, 0x00000000, 0x00000000, 0x00000000,
5634 0x41b00123, 0x41f00123, 0x42300123, 0x00000000, 0x41c00123, 0x42000123, 0x42400123}},
5635 {SetMatrixTransposePointerArray, 0, 3, REGISTER_OUTPUT_SIZE / 16, 36,
5636 {0x40000123, 0x40c00123, 0x41200123, 0x00000000, 0x00000000, 0x40e00123, 0x41300123, 0x00000000,
5637 0x40800123, 0x41000123, 0x41400123, 0x00000000, 0x40a00123, 0x41100123, 0x41500123, 0x00000000,
5638 0x41900123, 0x41d00123, 0x42100123, 0x00000000, 0x41a00123, 0x00000000, 0x00000000, 0x00000000,
5639 0x41b00123, 0x41f00123, 0x42300123, 0x00000000, 0x41c00123, 0x42000123, 0x42400123, 0x00000000,
5640 0x42800123, 0x43200123, 0x43600123}},
5644 * fxc.exe /Tvs_3_0
5646 #if 0
5647 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};
5648 float f = 33.33;
5649 float4 main(float4 pos : POSITION) : POSITION
5651 float4 tmp = 0;
5652 tmp.y += cf._22;
5653 tmp.z = f;
5654 return tmp;
5656 #endif
5657 static const DWORD registerset_blob_matrix_column_clamp[] =
5659 0xfffe0300, 0x003efffe, 0x42415443, 0x0000001c, 0x000000c3, 0xfffe0300, 0x00000002, 0x0000001c,
5660 0x00000100, 0x000000bc, 0x00000044, 0x00000002, 0x00000002, 0x00000048, 0x00000058, 0x00000098,
5661 0x00020002, 0x00000001, 0x0000009c, 0x000000ac, 0xab006663, 0x00030003, 0x00040004, 0x00000001,
5662 0x00000000, 0x3f8ccccd, 0x40b00000, 0x411e6666, 0x3fc00000, 0x400ccccd, 0x40d33333, 0x3f99999a,
5663 0x3fcccccd, 0x40533333, 0x40f66666, 0x3fa66666, 0x3fd9999a, 0x408ccccd, 0x410ccccd, 0x3fb33333,
5664 0x3fe66666, 0xabab0066, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0x420551ec, 0x00000000,
5665 0x00000000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
5666 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
5667 0x05000051, 0xa00f0003, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
5668 0xe00f0000, 0x02000001, 0x80020000, 0xa0550001, 0x03000005, 0xe00b0000, 0x80550000, 0xa0240003,
5669 0x02000001, 0xe0040000, 0xa0000002, 0x0000ffff,
5672 static const struct registerset_constants registerset_constants_matrix_column_clamp[] =
5674 {"cf", {"cf", D3DXRS_FLOAT4, 0, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 4, 4, 1, 0, 64, NULL}, 0},
5675 {"f", {"f", D3DXRS_FLOAT4, 2, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL}, 0},
5678 static const struct registerset_test registerset_test_matrix_column_clamp[] =
5680 {SetMatrix, 0, 0, 0, 8,
5681 {0x40000123, 0x40c00123, 0x41200123, 0x41600123, 0x00000000, 0x40e00123, 0x41300123, 0x41700123}},
5684 static const struct
5686 const char *name;
5687 const char *var;
5688 UINT start;
5689 D3DXREGISTER_SET regset;
5690 const DWORD *blob;
5691 const struct registerset_test *tests;
5692 UINT test_count;
5693 const struct registerset_constants *constants;
5694 UINT constant_count;
5696 registerset_data[] =
5698 /* scalar */
5699 {"float", "f", 0, D3DXRS_FLOAT4, registerset_blob_scalar,
5700 registerset_test_scalar_float, ARRAY_SIZE(registerset_test_scalar_float),
5701 registerset_constants_scalar_float, ARRAY_SIZE(registerset_constants_scalar_float)},
5702 {"int", "n", 0, D3DXRS_INT4, registerset_blob_scalar,
5703 registerset_test_scalar_int, ARRAY_SIZE(registerset_test_scalar_int),
5704 registerset_constants_scalar_int, ARRAY_SIZE(registerset_constants_scalar_int)},
5705 {"int float", "nf", 4, D3DXRS_FLOAT4, registerset_blob_scalar,
5706 registerset_test_scalar_int_float, ARRAY_SIZE(registerset_test_scalar_int_float),
5707 registerset_constants_scalar_int_float, ARRAY_SIZE(registerset_constants_scalar_int_float)},
5708 {"bool float", "bf", 8, D3DXRS_FLOAT4, registerset_blob_scalar,
5709 registerset_test_scalar_bool_float, ARRAY_SIZE(registerset_test_scalar_bool_float),
5710 registerset_constants_scalar_bool_float, ARRAY_SIZE(registerset_constants_scalar_bool_float)},
5711 {"bool", "b", 0, D3DXRS_BOOL, registerset_blob_scalar,
5712 registerset_test_scalar_bool, ARRAY_SIZE(registerset_test_scalar_bool),
5713 registerset_constants_scalar_bool, ARRAY_SIZE(registerset_constants_scalar_bool)},
5714 /* scalar array */
5715 {"float [2]", "af", 0, D3DXRS_FLOAT4, registerset_blob_scalar_array,
5716 registerset_test_scalar_array_float, ARRAY_SIZE(registerset_test_scalar_array_float),
5717 registerset_constants_scalar_array_float, ARRAY_SIZE(registerset_constants_scalar_array_float)},
5718 {"int [2]", "an", 0, D3DXRS_INT4, registerset_blob_scalar_array,
5719 registerset_test_scalar_array_int, ARRAY_SIZE(registerset_test_scalar_array_int),
5720 registerset_constants_scalar_array_int, ARRAY_SIZE(registerset_constants_scalar_array_int)},
5721 {"bool [2]", "ab", 0, D3DXRS_BOOL, registerset_blob_scalar_array,
5722 registerset_test_scalar_array_bool, ARRAY_SIZE(registerset_test_scalar_array_bool),
5723 registerset_constants_scalar_array_bool, ARRAY_SIZE(registerset_constants_scalar_array_bool)},
5724 {"int float [2]", "anf", 8, D3DXRS_FLOAT4, registerset_blob_scalar_array,
5725 registerset_test_scalar_array_int_float, ARRAY_SIZE(registerset_test_scalar_array_int_float),
5726 registerset_constants_scalar_array_int_float, ARRAY_SIZE(registerset_constants_scalar_array_int_float)},
5727 {"bool float [2]", "abf", 16, D3DXRS_FLOAT4, registerset_blob_scalar_array,
5728 registerset_test_scalar_array_bool_float, ARRAY_SIZE(registerset_test_scalar_array_bool_float),
5729 registerset_constants_scalar_array_bool_float, ARRAY_SIZE(registerset_constants_scalar_array_bool_float)},
5730 /* vector */
5731 {"float 3", "vf", 0, D3DXRS_FLOAT4, registerset_blob_vector,
5732 registerset_test_vector_float, ARRAY_SIZE(registerset_test_vector_float),
5733 registerset_constants_vector_float, ARRAY_SIZE(registerset_constants_vector_float)},
5734 {"int 3", "vn", 0, D3DXRS_INT4, registerset_blob_vector,
5735 registerset_test_vector_int, ARRAY_SIZE(registerset_test_vector_int),
5736 registerset_constants_vector_int, ARRAY_SIZE(registerset_constants_vector_int)},
5737 {"bool 3", "vb", 0, D3DXRS_BOOL, registerset_blob_vector,
5738 registerset_test_vector_bool, ARRAY_SIZE(registerset_test_vector_bool),
5739 registerset_constants_vector_bool, ARRAY_SIZE(registerset_constants_vector_bool)},
5740 {"bool float 3", "vbf", 8, D3DXRS_FLOAT4, registerset_blob_vector,
5741 registerset_test_vector_bool_float, ARRAY_SIZE(registerset_test_vector_bool_float),
5742 registerset_constants_vector_bool_float, ARRAY_SIZE(registerset_constants_vector_bool_float)},
5743 {"int float 3", "vnf", 4, D3DXRS_FLOAT4, registerset_blob_vector,
5744 registerset_test_vector_int_float, ARRAY_SIZE(registerset_test_vector_int_float),
5745 registerset_constants_vector_int_float, ARRAY_SIZE(registerset_constants_vector_int_float)},
5746 /* vector array */
5747 {"float 3 [2]", "vaf", 0, D3DXRS_FLOAT4, registerset_blob_vector_array,
5748 registerset_test_vector_array_float, ARRAY_SIZE(registerset_test_vector_array_float),
5749 registerset_constants_vector_array_float, ARRAY_SIZE(registerset_constants_vector_array_float)},
5750 {"int 3 [2]", "van", 0, D3DXRS_INT4, registerset_blob_vector_array,
5751 registerset_test_vector_array_int, ARRAY_SIZE(registerset_test_vector_array_int),
5752 registerset_constants_vector_array_int, ARRAY_SIZE(registerset_constants_vector_array_int)},
5753 {"bool 3 [2]", "vab", 0, D3DXRS_BOOL, registerset_blob_vector_array,
5754 registerset_test_vector_array_bool, ARRAY_SIZE(registerset_test_vector_array_bool),
5755 registerset_constants_vector_array_bool, ARRAY_SIZE(registerset_constants_vector_array_bool)},
5756 {"bool float 3 [2]", "vabf", 16, D3DXRS_FLOAT4, registerset_blob_vector_array,
5757 registerset_test_vector_array_bool_float, ARRAY_SIZE(registerset_test_vector_array_bool_float),
5758 registerset_constants_vector_array_bool_float, ARRAY_SIZE(registerset_constants_vector_array_bool_float)},
5759 {"int float 3 [2]", "vanf", 8, D3DXRS_FLOAT4, registerset_blob_vector_array,
5760 registerset_test_vector_array_int_float, ARRAY_SIZE(registerset_test_vector_array_int_float),
5761 registerset_constants_vector_array_int_float, ARRAY_SIZE(registerset_constants_vector_array_int_float)},
5762 /* matrix column */
5763 {"float c3x2", "cf", 0, D3DXRS_FLOAT4, registerset_blob_column,
5764 registerset_test_column_float, ARRAY_SIZE(registerset_test_column_float),
5765 registerset_constants_column_float, ARRAY_SIZE(registerset_constants_column_float)},
5766 {"int c3x2", "cn", 0, D3DXRS_INT4, registerset_blob_column,
5767 registerset_test_column_int, ARRAY_SIZE(registerset_test_column_int),
5768 registerset_constants_column_int, ARRAY_SIZE(registerset_constants_column_int)},
5769 {"bool c3x2", "cb", 0, D3DXRS_BOOL, registerset_blob_column,
5770 registerset_test_column_bool, ARRAY_SIZE(registerset_test_column_bool),
5771 registerset_constants_column_bool, ARRAY_SIZE(registerset_constants_column_bool)},
5772 {"bool float c3x2", "cbf", 8, D3DXRS_FLOAT4, registerset_blob_column,
5773 registerset_test_column_bool_float, ARRAY_SIZE(registerset_test_column_bool_float),
5774 registerset_constants_column_bool_float, ARRAY_SIZE(registerset_constants_column_bool_float)},
5775 {"int float c3x2", "cnf", 16, D3DXRS_FLOAT4, registerset_blob_column,
5776 registerset_test_column_int_float, ARRAY_SIZE(registerset_test_column_int_float),
5777 registerset_constants_column_int_float, ARRAY_SIZE(registerset_constants_column_int_float)},
5778 /* matrix column array */
5779 {"float c3x2 [2]", "caf", 0, D3DXRS_FLOAT4, registerset_blob_column_array,
5780 registerset_test_column_array_float, ARRAY_SIZE(registerset_test_column_array_float),
5781 registerset_constants_column_array_float, ARRAY_SIZE(registerset_constants_column_array_float)},
5782 {"int c3x2 [2]", "can", 0, D3DXRS_INT4, registerset_blob_column_array,
5783 registerset_test_column_array_int, ARRAY_SIZE(registerset_test_column_array_int),
5784 registerset_constants_column_array_int, ARRAY_SIZE(registerset_constants_column_array_int)},
5785 {"bool c3x2 [2]", "cab", 0, D3DXRS_BOOL, registerset_blob_column_array,
5786 registerset_test_column_array_bool, ARRAY_SIZE(registerset_test_column_array_bool),
5787 registerset_constants_column_array_bool, ARRAY_SIZE(registerset_constants_column_array_bool)},
5788 {"bool float c3x2 [2]", "cabf", 16, D3DXRS_FLOAT4, registerset_blob_column_array,
5789 registerset_test_column_array_bool_float, ARRAY_SIZE(registerset_test_column_array_bool_float),
5790 registerset_constants_column_array_bool_float, ARRAY_SIZE(registerset_constants_column_array_bool_float)},
5791 {"int float c3x2 [2]", "canf", 32, D3DXRS_FLOAT4, registerset_blob_column_array,
5792 registerset_test_column_array_int_float, ARRAY_SIZE(registerset_test_column_array_int_float),
5793 registerset_constants_column_array_int_float, ARRAY_SIZE(registerset_constants_column_array_int_float)},
5794 /* matrix row */
5795 {"float r3x2", "rf", 0, D3DXRS_FLOAT4, registerset_blob_row,
5796 registerset_test_row_float, ARRAY_SIZE(registerset_test_row_float),
5797 registerset_constants_row_float, ARRAY_SIZE(registerset_constants_row_float)},
5798 {"int r3x2", "rn", 0, D3DXRS_INT4, registerset_blob_row,
5799 registerset_test_row_int, ARRAY_SIZE(registerset_test_row_int),
5800 registerset_constants_row_int, ARRAY_SIZE(registerset_constants_row_int)},
5801 {"bool r3x2", "rb", 0, D3DXRS_BOOL, registerset_blob_row,
5802 registerset_test_row_bool, ARRAY_SIZE(registerset_test_row_bool),
5803 registerset_constants_row_bool, ARRAY_SIZE(registerset_constants_row_bool)},
5804 {"bool float r3x2", "rbf", 12, D3DXRS_FLOAT4, registerset_blob_row,
5805 registerset_test_row_bool_float, ARRAY_SIZE(registerset_test_row_bool_float),
5806 registerset_constants_row_bool_float, ARRAY_SIZE(registerset_constants_row_bool_float)},
5807 {"int float r3x2", "rnf", 24, D3DXRS_FLOAT4, registerset_blob_row,
5808 registerset_test_row_int_float, ARRAY_SIZE(registerset_test_row_int_float),
5809 registerset_constants_row_int_float, ARRAY_SIZE(registerset_constants_row_int_float)},
5810 /* matrix row array */
5811 {"float 3x2 [2]", "raf", 0, D3DXRS_FLOAT4, registerset_blob_row_array,
5812 registerset_test_row_array_float, ARRAY_SIZE(registerset_test_row_array_float),
5813 registerset_constants_row_array_float, ARRAY_SIZE(registerset_constants_row_array_float)},
5814 {"int 3x2 [2]", "ran", 0, D3DXRS_INT4, registerset_blob_row_array,
5815 registerset_test_row_array_int, ARRAY_SIZE(registerset_test_row_array_int),
5816 registerset_constants_row_array_int, ARRAY_SIZE(registerset_constants_row_array_int)},
5817 {"bool 3x2 [2]", "rab", 0, D3DXRS_BOOL, registerset_blob_row_array,
5818 registerset_test_row_array_bool, ARRAY_SIZE(registerset_test_row_array_bool),
5819 registerset_constants_row_array_bool, ARRAY_SIZE(registerset_constants_row_array_bool)},
5820 {"bool float 3x2 [2]", "rabf", 24, D3DXRS_FLOAT4, registerset_blob_row_array,
5821 registerset_test_row_array_bool_float, ARRAY_SIZE(registerset_test_row_array_bool_float),
5822 registerset_constants_row_array_bool_float, ARRAY_SIZE(registerset_constants_row_array_bool_float)},
5823 {"int float 3x2 [2]", "ranf", 48, D3DXRS_FLOAT4, registerset_blob_row_array,
5824 registerset_test_row_array_int_float, ARRAY_SIZE(registerset_test_row_array_int_float),
5825 registerset_constants_row_array_int_float, ARRAY_SIZE(registerset_constants_row_array_int_float)},
5826 /* struct */
5827 {"struct float", "sf", 0, D3DXRS_FLOAT4, registerset_blob_struct,
5828 registerset_test_struct_float, ARRAY_SIZE(registerset_test_struct_float),
5829 registerset_constants_struct_float, ARRAY_SIZE(registerset_constants_struct_float)},
5830 {"struct int", "sn", 0, D3DXRS_INT4, registerset_blob_struct,
5831 registerset_test_struct_int, ARRAY_SIZE(registerset_test_struct_int),
5832 registerset_constants_struct_int, ARRAY_SIZE(registerset_constants_struct_int)},
5833 {"struct bool", "sb", 0, D3DXRS_BOOL, registerset_blob_struct,
5834 registerset_test_struct_bool, ARRAY_SIZE(registerset_test_struct_bool),
5835 registerset_constants_struct_bool, ARRAY_SIZE(registerset_constants_struct_bool)},
5836 {"struct bool float", "sbf", 16, D3DXRS_FLOAT4, registerset_blob_struct,
5837 registerset_test_struct_bool_float, ARRAY_SIZE(registerset_test_struct_bool_float),
5838 registerset_constants_struct_bool_float, ARRAY_SIZE(registerset_constants_struct_bool_float)},
5839 {"struct int float", "snf", 8, D3DXRS_FLOAT4, registerset_blob_struct,
5840 registerset_test_struct_int_float, ARRAY_SIZE(registerset_test_struct_int_float),
5841 registerset_constants_struct_int_float, ARRAY_SIZE(registerset_constants_struct_int_float)},
5842 /* struct array */
5843 {"struct float [2]", "saf", 0, D3DXRS_FLOAT4, registerset_blob_struct_array,
5844 registerset_test_struct_array_float, ARRAY_SIZE(registerset_test_struct_array_float),
5845 registerset_constants_struct_array_float, ARRAY_SIZE(registerset_constants_struct_array_float)},
5846 {"struct int [2]", "san", 0, D3DXRS_INT4, registerset_blob_struct_array,
5847 registerset_test_struct_array_int, ARRAY_SIZE(registerset_test_struct_array_int),
5848 registerset_constants_struct_array_int, ARRAY_SIZE(registerset_constants_struct_array_int)},
5849 {"struct bool [2]", "sab", 0, D3DXRS_BOOL, registerset_blob_struct_array,
5850 registerset_test_struct_array_bool, ARRAY_SIZE(registerset_test_struct_array_bool),
5851 registerset_constants_struct_array_bool, ARRAY_SIZE(registerset_constants_struct_array_bool)},
5852 {"struct bool float [2]", "sabf", 32, D3DXRS_FLOAT4, registerset_blob_struct_array,
5853 registerset_test_struct_array_bool_float, ARRAY_SIZE(registerset_test_struct_array_bool_float),
5854 registerset_constants_struct_array_bool_float, ARRAY_SIZE(registerset_constants_struct_array_bool_float)},
5855 {"struct int float [2]", "sanf", 16, D3DXRS_FLOAT4, registerset_blob_struct_array,
5856 registerset_test_struct_array_int_float, ARRAY_SIZE(registerset_test_struct_array_int_float),
5857 registerset_constants_struct_array_int_float, ARRAY_SIZE(registerset_constants_struct_array_int_float)},
5858 /* struct struct */
5859 {"struct struct float", "ssf", 0, D3DXRS_FLOAT4, registerset_blob_struct_struct,
5860 registerset_test_struct_struct_float, ARRAY_SIZE(registerset_test_struct_struct_float),
5861 registerset_constants_struct_struct_float, ARRAY_SIZE(registerset_constants_struct_struct_float)},
5862 {"struct struct int", "ssn", 0, D3DXRS_INT4, registerset_blob_struct_struct,
5863 registerset_test_struct_struct_int, ARRAY_SIZE(registerset_test_struct_struct_int),
5864 registerset_constants_struct_struct_int, ARRAY_SIZE(registerset_constants_struct_struct_int)},
5865 {"struct struct bool", "ssb", 0, D3DXRS_BOOL, registerset_blob_struct_struct,
5866 registerset_test_struct_struct_bool, ARRAY_SIZE(registerset_test_struct_struct_bool),
5867 registerset_constants_struct_struct_bool, ARRAY_SIZE(registerset_constants_struct_struct_bool)},
5868 {"struct struct bool float", "ssbf", 32, D3DXRS_FLOAT4, registerset_blob_struct_struct,
5869 registerset_test_struct_struct_bool_float, ARRAY_SIZE(registerset_test_struct_struct_bool_float),
5870 registerset_constants_struct_struct_bool_float, ARRAY_SIZE(registerset_constants_struct_struct_bool_float)},
5871 {"struct struct int float", "ssnf", 16, D3DXRS_FLOAT4, registerset_blob_struct_struct,
5872 registerset_test_struct_struct_int_float, ARRAY_SIZE(registerset_test_struct_struct_int_float),
5873 registerset_constants_struct_struct_int_float, ARRAY_SIZE(registerset_constants_struct_struct_int_float)},
5874 /* special */
5875 {"int ran", "ran", 0, D3DXRS_INT4, registerset_blob_special_int, NULL, 0,
5876 registerset_constants_special_int, ARRAY_SIZE(registerset_constants_special_int)},
5877 {"bigvec", "vaf", 0, D3DXRS_FLOAT4, registerset_blob_bigvec,
5878 registerset_test_bigvec_float, ARRAY_SIZE(registerset_test_bigvec_float),
5879 registerset_constants_bigvec_float, ARRAY_SIZE(registerset_constants_bigvec_float)},
5880 {"cf", "cf", 0, D3DXRS_FLOAT4, registerset_blob_matrix_column_clamp,
5881 registerset_test_matrix_column_clamp, ARRAY_SIZE(registerset_test_matrix_column_clamp),
5882 registerset_constants_matrix_column_clamp, ARRAY_SIZE(registerset_constants_matrix_column_clamp)},
5885 static void registerset_clear(IDirect3DDevice9 *device)
5887 DWORD zero[1024];
5888 HRESULT hr;
5890 memset(zero, 0xde, 4096);
5892 hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 0, (FLOAT*)zero, 256);
5893 ok(hr == D3D_OK, "Clear failed, got %08lx, expected %08lx\n", hr, D3D_OK);
5895 hr = IDirect3DDevice9_SetPixelShaderConstantF(device, 0, (FLOAT*)zero, 224);
5896 ok(hr == D3D_OK, "Clear failed, got %08lx, expected %08lx\n", hr, D3D_OK);
5898 hr = IDirect3DDevice9_SetVertexShaderConstantB(device, 0, (BOOL*)zero, 16);
5899 ok(hr == D3D_OK, "Clear failed, got %08lx, expected %08lx\n", hr, D3D_OK);
5901 hr = IDirect3DDevice9_SetPixelShaderConstantB(device, 0, (BOOL*)zero, 16);
5902 ok(hr == D3D_OK, "Clear failed, got %08lx, expected %08lx\n", hr, D3D_OK);
5904 hr = IDirect3DDevice9_SetVertexShaderConstantI(device, 0, (INT*)zero, 16);
5905 ok(hr == D3D_OK, "Clear failed, got %08lx, expected %08lx\n", hr, D3D_OK);
5907 hr = IDirect3DDevice9_SetPixelShaderConstantI(device, 0, (INT*)zero, 16);
5908 ok(hr == D3D_OK, "Clear failed, got %08lx, expected %08lx\n", hr, D3D_OK);
5911 static UINT registerset_compare(IDirect3DDevice9 *device, BOOL is_vs, D3DXREGISTER_SET regset,
5912 UINT start, UINT in_count, const DWORD *expected)
5914 DWORD ret[1024] = {0};
5915 HRESULT hr;
5916 UINT count = 1024, i, err = 0;
5918 memset(ret, 0xde, 4096);
5920 /* get shader constants */
5921 switch (regset)
5923 case D3DXRS_BOOL:
5924 count = 16;
5925 if (is_vs) hr = IDirect3DDevice9_GetVertexShaderConstantB(device, 0, (BOOL*)ret, 16);
5926 else hr = IDirect3DDevice9_GetPixelShaderConstantB(device, 0, (BOOL*)ret, 16);
5927 ok(hr == D3D_OK, "Get*ShaderConstantB failed, got %08lx\n", hr);
5928 break;
5930 case D3DXRS_INT4:
5931 count = 256;
5932 if (is_vs) hr = IDirect3DDevice9_GetVertexShaderConstantI(device, 0, (INT*)ret, 16);
5933 else hr = IDirect3DDevice9_GetPixelShaderConstantI(device, 0, (INT*)ret, 16);
5934 ok(hr == D3D_OK, "Get*ShaderConstantI failed, got %08lx\n", hr);
5935 break;
5937 case D3DXRS_FLOAT4:
5938 if (is_vs) hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 0, (FLOAT*)ret, 256);
5939 else
5941 count = 896;
5942 hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 0, (FLOAT*)ret, 224);
5944 ok(hr == D3D_OK, "Get*ShaderConstantF failed, got %08lx\n", hr);
5945 break;
5947 default:
5948 ok(0, "This should not happen!\n");
5949 break;
5952 /* compare shader constants */
5953 for (i = 0; i < count; ++i)
5955 DWORD value = 0xdededede;
5956 if (i >= start && i < start + in_count) value = expected[i - start];
5958 ok(ret[i] == value, "Get*ShaderConstant failed, %u got 0x%lx(%f) expected 0x%lx(%f)\n", i,
5959 ret[i], ((FLOAT *)ret)[i], value, *((FLOAT *)&value));
5960 if (ret[i] != value) err++;
5963 return err;
5966 static UINT registerset_compare_all(IDirect3DDevice9 *device, BOOL is_vs, D3DXREGISTER_SET regset,
5967 UINT start, UINT in_count, const DWORD *expected)
5969 D3DXREGISTER_SET regsets[] = {D3DXRS_BOOL, D3DXRS_INT4, D3DXRS_FLOAT4};
5970 UINT err = 0, i;
5972 for (i = 0; i < ARRAY_SIZE(regsets); i++)
5974 if (regset == regsets[i])
5975 err += registerset_compare(device, is_vs, regset, start, in_count, expected);
5976 else
5977 err += registerset_compare(device, is_vs, regsets[i], 0, 0, NULL);
5979 err += registerset_compare(device, !is_vs, regsets[i], 0, 0, NULL);
5982 return err;
5985 static HRESULT registerset_apply(ID3DXConstantTable *ctable, IDirect3DDevice9 *device, D3DXHANDLE constant,
5986 UINT index, DWORD count, enum Type type)
5988 const DWORD *in = registerset_test_input[index];
5989 const D3DXMATRIX *inp[REGISTER_OUTPUT_SIZE / 16];
5990 unsigned int i;
5992 /* overlap, to see the difference between Array and PointerArray */
5993 for (i = 0; i < REGISTER_OUTPUT_SIZE / 16; i++)
5995 inp[i] = (D3DXMATRIX *)&in[i * 15];
5998 switch (type)
6000 case SetInt:
6001 return ID3DXConstantTable_SetInt(ctable, device, constant, *((INT *)in));
6002 case SetFloat:
6003 return ID3DXConstantTable_SetFloat(ctable, device, constant, *((FLOAT *)in));
6004 case SetBool:
6005 return ID3DXConstantTable_SetBool(ctable, device, constant, *((BOOL *)in));
6006 case SetIntArray:
6007 return ID3DXConstantTable_SetIntArray(ctable, device, constant, (INT *)in, count);
6008 case SetBoolArray:
6009 return ID3DXConstantTable_SetBoolArray(ctable, device, constant, (BOOL *)in, count);
6010 case SetFloatArray:
6011 return ID3DXConstantTable_SetFloatArray(ctable, device, constant, (FLOAT *)in, count);
6012 case SetMatrix:
6013 return ID3DXConstantTable_SetMatrix(ctable, device, constant, (D3DXMATRIX *)in);
6014 case SetMatrixTranspose:
6015 return ID3DXConstantTable_SetMatrixTranspose(ctable, device, constant, (D3DXMATRIX *)in);
6016 case SetMatrixArray:
6017 return ID3DXConstantTable_SetMatrixArray(ctable, device, constant, (D3DXMATRIX *)in, count);
6018 case SetMatrixTransposeArray:
6019 return ID3DXConstantTable_SetMatrixTransposeArray(ctable, device, constant, (D3DXMATRIX *)in, count);
6020 case SetVector:
6021 return ID3DXConstantTable_SetVector(ctable, device, constant, (D3DXVECTOR4 *)in);
6022 case SetVectorArray:
6023 return ID3DXConstantTable_SetVectorArray(ctable, device, constant, (D3DXVECTOR4 *)in, count);
6024 case SetValue:
6025 return ID3DXConstantTable_SetValue(ctable, device, constant, in, count);
6026 case SetMatrixPointerArray:
6027 return ID3DXConstantTable_SetMatrixPointerArray(ctable, device, constant, inp, count);
6028 case SetMatrixTransposePointerArray:
6029 return ID3DXConstantTable_SetMatrixTransposePointerArray(ctable, device, constant, inp, count);
6032 ok(0, "This should not happen!\n");
6033 return D3D_OK;
6036 static void test_registerset(void)
6038 UINT k;
6039 HWND wnd;
6040 IDirect3D9 *d3d;
6041 IDirect3DDevice9 *device;
6042 D3DPRESENT_PARAMETERS d3dpp;
6043 HRESULT hr;
6044 ULONG count;
6045 D3DCAPS9 caps;
6047 if (!(wnd = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
6048 640, 480, NULL, NULL, NULL, NULL)))
6050 skip("Couldn't create application window\n");
6051 return;
6053 if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
6055 skip("Couldn't create IDirect3D9 object\n");
6056 DestroyWindow(wnd);
6057 return;
6060 ZeroMemory(&d3dpp, sizeof(d3dpp));
6061 d3dpp.Windowed = TRUE;
6062 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
6063 hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &device);
6064 if (FAILED(hr))
6066 skip("Failed to create IDirect3DDevice9 object %#lx\n", hr);
6067 IDirect3D9_Release(d3d);
6068 DestroyWindow(wnd);
6069 return;
6072 hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
6073 ok(SUCCEEDED(hr), "Failed to get device caps, hr %#lx.\n", hr);
6074 if (caps.VertexShaderVersion < D3DVS_VERSION(3, 0)
6075 || caps.PixelShaderVersion < D3DPS_VERSION(3, 0))
6077 skip("Skipping: Test requires VS >= 3 and PS >= 3.\n");
6078 IDirect3DDevice9_Release(device);
6079 IDirect3D9_Release(d3d);
6080 DestroyWindow(wnd);
6081 return;
6084 for (k = 0; k < ARRAY_SIZE(registerset_data); ++k)
6086 const char *tablename = registerset_data[k].name;
6087 const char *name = registerset_data[k].var;
6088 ID3DXConstantTable *ctable;
6089 D3DXCONSTANTTABLE_DESC tdesc;
6090 D3DXHANDLE constant;
6091 UINT i;
6092 BOOL is_vs;
6093 DWORD *ctab;
6095 hr = D3DXGetShaderConstantTable(registerset_data[k].blob, &ctable);
6096 ok(hr == D3D_OK, "D3DXGetShaderConstantTable \"%s\" failed, got %08lx, expected %08lx\n", tablename, hr, D3D_OK);
6098 hr = ID3DXConstantTable_GetDesc(ctable, &tdesc);
6099 ok(hr == D3D_OK, "GetDesc \"%s\" failed, got %08lx, expected %08lx\n", tablename, hr, D3D_OK);
6101 ctab = ID3DXConstantTable_GetBufferPointer(ctable);
6102 ok(ctab[0] == registerset_data[k].blob[3], "ID3DXConstantTable_GetBufferPointer failed\n");
6104 is_vs = (tdesc.Version & 0xFFFF0000) == 0xFFFE0000;
6106 for (i = 0; i < registerset_data[k].constant_count; ++i)
6108 const char *fullname = registerset_data[k].constants[i].fullname;
6109 const D3DXCONSTANT_DESC *expected_desc = &registerset_data[k].constants[i].desc;
6110 D3DXCONSTANT_DESC desc;
6111 UINT nr = 0;
6112 UINT ctaboffset = registerset_data[k].constants[i].ctaboffset;
6114 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, fullname);
6115 ok(constant != NULL, "GetConstantByName \"%s\" failed\n", fullname);
6117 hr = ID3DXConstantTable_GetConstantDesc(ctable, constant, &desc, &nr);
6118 ok(hr == D3D_OK, "GetConstantDesc \"%s\" failed, got %08lx, expected %08lx\n", fullname, hr, D3D_OK);
6120 ok(!strcmp(expected_desc->Name, desc.Name), "GetConstantDesc \"%s\" failed, got \"%s\", expected \"%s\"\n",
6121 fullname, desc.Name, expected_desc->Name);
6122 ok(expected_desc->RegisterSet == desc.RegisterSet, "GetConstantDesc \"%s\" failed, got %#x, expected %#x\n",
6123 fullname, desc.RegisterSet, expected_desc->RegisterSet);
6124 ok(expected_desc->RegisterIndex == desc.RegisterIndex,
6125 "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6126 fullname, desc.RegisterIndex, expected_desc->RegisterIndex);
6127 ok(expected_desc->RegisterCount == desc.RegisterCount,
6128 "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6129 fullname, desc.RegisterCount, expected_desc->RegisterCount);
6130 ok(expected_desc->Class == desc.Class, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6131 fullname, desc.Class, expected_desc->Class);
6132 ok(expected_desc->Type == desc.Type, "GetConstantDesc \"%s\" failed, got %#x, expected %#x\n",
6133 fullname, desc.Type, expected_desc->Type);
6134 ok(expected_desc->Rows == desc.Rows, "GetConstantDesc \"%s\" failed, got %#x, expected %#x\n",
6135 fullname, desc.Rows, expected_desc->Rows);
6136 ok(expected_desc->Columns == desc.Columns, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6137 fullname, desc.Columns, expected_desc->Columns);
6138 ok(expected_desc->Elements == desc.Elements, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6139 fullname, desc.Elements, expected_desc->Elements);
6140 ok(expected_desc->StructMembers == desc.StructMembers,
6141 "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6142 fullname, desc.StructMembers, expected_desc->StructMembers);
6143 ok(expected_desc->Bytes == desc.Bytes, "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6144 fullname, desc.Bytes, expected_desc->Bytes);
6145 if (ctaboffset)
6147 ok(ctaboffset == (DWORD *)desc.DefaultValue - ctab,
6148 "GetConstantDesc \"%s\" failed, got %u, expected %u\n",
6149 fullname, (UINT)((DWORD *)desc.DefaultValue - ctab), ctaboffset);
6153 constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, name);
6154 ok(constant != NULL, "GetConstantByName \"%s\" \"%s\" failed\n", tablename, name);
6156 for (i = 0; i < registerset_data[k].test_count; ++i)
6158 const struct registerset_test *test = &registerset_data[k].tests[i];
6159 UINT ret;
6161 registerset_clear(device);
6163 hr = registerset_apply(ctable, device, constant, test->in_index, test->in_count_min, test->type);
6164 ok(hr == D3D_OK, "Set* \"%s\" index %u, count %u failed, got %lx, expected %lx\n", tablename, i,
6165 test->in_count_min, hr, D3D_OK);
6167 ret = registerset_compare_all(device, is_vs, registerset_data[k].regset,
6168 registerset_data[k].start, test->out_count, test->out);
6169 ok(ret == 0, "Get*ShaderConstant \"%s\" index %u, count %u failed\n", tablename, i, test->in_count_min);
6171 if (test->in_count_max > test->in_count_min)
6173 registerset_clear(device);
6175 hr = registerset_apply(ctable, device, constant, test->in_index, test->in_count_max, test->type);
6176 ok(hr == D3D_OK, "Set* \"%s\" index %u, count %u failed, got %lx, expected %lx\n", tablename, i,
6177 test->in_count_max, hr, D3D_OK);
6179 ret = registerset_compare_all(device, is_vs, registerset_data[k].regset,
6180 registerset_data[k].start, test->out_count, test->out);
6181 ok(ret == 0, "Get*ShaderConstant \"%s\" index %u, count %u failed\n", tablename, i, test->in_count_max);
6185 count = ID3DXConstantTable_Release(ctable);
6186 ok(count == 0, "Release \"%s\" failed, got %lu, expected %u\n", tablename, count, 0);
6189 /* Release resources */
6190 count = IDirect3DDevice9_Release(device);
6191 ok(count == 0, "The Direct3D device reference count was %lu, should be 0\n", count);
6193 count = IDirect3D9_Release(d3d);
6194 ok(count == 0, "The Direct3D object reference count was %lu, should be 0\n", count);
6196 if (wnd) DestroyWindow(wnd);
6200 * For D3DXRS_INT4 (int_count, ints[]):
6201 * Native seems to just set the following shader blob up to the register count, which in bad cases is up
6202 * to 4 times larger than the actual correct value. This explanes where the "bogus" values for these cases
6203 * come from. Somehow they forgot that the registers are INT4 and not INT.
6205 static const struct
6207 const char *name;
6208 const DWORD *blob;
6209 unsigned int float_count;
6210 unsigned int int_count;
6211 unsigned int bool_count;
6212 const DWORD floats[1024];
6213 const DWORD ints[256];
6214 const DWORD bools[16];
6216 registerset_defaults_data[] =
6218 {"scalar", registerset_blob_scalar, 12, 4, 1,
6219 {0x40a33333, 0x00000000, 0x00000000, 0x00000000, 0x41300000, 0x00000000, 0x00000000, 0x00000000,
6220 0x3f800000, 0x00000000, 0x00000000, 0x00000000},
6221 {0x00000008, 0x00000000, 0x00000001},
6222 {0xffffffff}},
6223 {"scalar array", registerset_blob_scalar_array, 24, 8, 2,
6224 {0x40466666, 0x00000000, 0x00000000, 0x00000000, 0x404ccccd, 0x00000000, 0x00000000, 0x00000000,
6225 0x41600000, 0x00000000, 0x00000000, 0x00000000, 0x41700000, 0x00000000, 0x00000000, 0x00000000,
6226 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000},
6227 {0x00000020, 0x00000000, 0x00000001, 0x00000000, 0x00000021, 0x00000000, 0x00000001, 0x00000000},
6228 {0xffffffff, 0x00000000}},
6229 {"vector", registerset_blob_vector, 12, 12, 3,
6230 {0x40a33333, 0x40a66666, 0x40a9999a, 0x00000000, 0x41300000, 0x42aa0000, 0x42780000, 0x00000000,
6231 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000},
6232 {0x00000007, 0x00000008, 0x00000009, 0x00000000, 0x00666e76, 0x41300000, 0x42aa0000, 0x42780000,
6233 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369},
6234 {0xffffffff, 0x00000000, 0xffffffff}},
6235 {"vector array", registerset_blob_vector_array, 24, 24, 6,
6236 {0x425c6666, 0x425ccccd, 0x425d3333, 0x00000000, 0x425d999a, 0x425e0000, 0x425e6666, 0x00000000,
6237 0x43020000, 0x430c0000, 0x43160000, 0x00000000, 0x43200000, 0x432a0000, 0x43340000, 0x00000000,
6238 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000},
6239 {0x00000046, 0x00000050, 0x0000005a, 0x00000000, 0x00000064, 0x0000006e, 0x00000078, 0x00000000,
6240 0x666e6176, 0xababab00, 0x00020001, 0x00030001, 0x00000002, 0x00000000, 0x43020000, 0x430c0000,
6241 0x43160000, 0x00000000, 0x43200000, 0x432a0000, 0x43340000, 0x00000000, 0x335f7376, 0x4d00305f},
6242 {0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff}},
6243 {"column", registerset_blob_column, 24, 24, 6,
6244 {0x4171999a, 0x4174cccd, 0x41780000, 0x00000000, 0x41733333, 0x41766666, 0x4179999a, 0x00000000,
6245 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
6246 0x41f00000, 0x42040000, 0x42080000, 0x00000000, 0x41f80000, 0x42000000, 0x42100000, 0x00000000},
6247 {0x00000004, 0x00000006, 0x00000008, 0x00000000, 0x00000005, 0x00000007, 0x00000009, 0x00000000,
6248 0x00666e63, 0x41f00000, 0x42040000, 0x42080000, 0x00000000, 0x41f80000, 0x42000000, 0x42100000,
6249 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c},
6250 {0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff}},
6251 {"column array", registerset_blob_column_array, 48, 48, 12,
6252 {0x3f8ccccd, 0x40533333, 0x40b00000, 0x00000000, 0x400ccccd, 0x408ccccd, 0x40d33333, 0x00000000,
6253 0x40f66666, 0x411e6666, 0x3fa66666, 0x00000000, 0x410ccccd, 0x3f99999a, 0x3fb33333, 0x00000000,
6254 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
6255 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
6256 0x43960000, 0x43978000, 0x43980000, 0x00000000, 0x43968000, 0x43970000, 0x43990000, 0x00000000,
6257 0x43af0000, 0x44238000, 0x43a30000, 0x00000000, 0x43b68000, 0x44190000, 0x4479c000, 0x00000000},
6258 {0x0000000e, 0x00000010, 0x00000012, 0x00000000, 0x0000000f, 0x00000047, 0x00000013, 0x00000000,
6259 0x00000037, 0x00000060, 0x00000061, 0x00000000, 0x0000003f, 0x00000060, 0x0000000d, 0x00000000,
6260 0x666e6163, 0xababab00, 0x00020003, 0x00020003, 0x00000002, 0x00000000, 0x43960000, 0x43978000,
6261 0x43980000, 0x00000000, 0x43968000, 0x43970000, 0x43990000, 0x00000000, 0x43af0000, 0x44238000,
6262 0x43a30000, 0x00000000, 0x43b68000, 0x44190000, 0x4479c000, 0x00000000, 0x335f7376, 0x4d00305f,
6263 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970},
6264 {0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000,
6265 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff}},
6266 {"row", registerset_blob_row, 36, 24, 6,
6267 {0x42be3333, 0x42be6666, 0x00000000, 0x00000000, 0x42be999a, 0x42becccd, 0x00000000, 0x00000000,
6268 0x42bf0000, 0x42bf3333, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
6269 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
6270 0x42140000, 0x41500000, 0x00000000, 0x00000000, 0x42c40000, 0x42580000, 0x00000000, 0x00000000,
6271 0x429a0000, 0x42100000, 0x00000000, 0x00000000},
6272 {0x00000050, 0x00000051, 0x00000001, 0x00000000, 0x00000052, 0x00000053, 0x00000001, 0x00000000,
6273 0x00000054, 0x00000055, 0x00000001, 0x00000000, 0x00666e72, 0x42140000, 0x41500000, 0x00000000,
6274 0x00000000, 0x42c40000, 0x42580000, 0x00000000, 0x00000000, 0x429a0000, 0x42100000, 0x00000000},
6275 {0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff}},
6276 {"row array", registerset_blob_row_array, 72, 48, 12,
6277 {0x3fc00000, 0x40333333, 0x00000000, 0x00000000, 0x40533333, 0x409ccccd, 0x00000000, 0x00000000,
6278 0x40bccccd, 0x40d9999a, 0x00000000, 0x00000000, 0x40fccccd, 0x41080000, 0x00000000, 0x00000000,
6279 0x41166666, 0x3fa66666, 0x00000000, 0x00000000, 0x3f99999a, 0x3f8ccccd, 0x00000000, 0x00000000,
6280 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
6281 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
6282 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
6283 0x420c0000, 0x42200000, 0x00000000, 0x00000000, 0x42700000, 0x42a00000, 0x00000000, 0x00000000,
6284 0x428c0000, 0x42600000, 0x00000000, 0x00000000, 0x42140000, 0x41500000, 0x00000000, 0x00000000,
6285 0x42c40000, 0x42580000, 0x00000000, 0x00000000, 0x429a0000, 0x42100000, 0x00000000, 0x00000000},
6286 {0x00000004, 0x00000005, 0x00000001, 0x00000000, 0x00000006, 0x00000001, 0x00000001, 0x00000000,
6287 0x00000008, 0x00000001, 0x00000001, 0x00000000, 0x00000005, 0x00000003, 0x00000001, 0x00000000,
6288 0x00000009, 0x00000006, 0x00000001, 0x00000000, 0x00000007, 0x00000003, 0x00000001, 0x00000000,
6289 0x666e6172, 0xababab00, 0x00020002, 0x00020003, 0x00000002, 0x00000000, 0x420c0000, 0x42200000,
6290 0x00000000, 0x00000000, 0x42700000, 0x42a00000, 0x00000000, 0x00000000, 0x428c0000, 0x42600000,
6291 0x00000000, 0x00000000, 0x42140000, 0x41500000, 0x00000000, 0x00000000, 0x42c40000, 0x42580000},
6292 {0xffffffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
6293 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff}},
6294 {"struct", registerset_blob_struct, 24, 16, 4,
6295 {0x3f8ccccd, 0x00000000, 0x00000000, 0x00000000, 0x400ccccd, 0x40533333, 0x408ccccd, 0x00000000,
6296 0x41f80000, 0x00000000, 0x00000000, 0x00000000, 0x42000000, 0x42040000, 0x42080000, 0x00000000,
6297 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000},
6298 {0x0000000b, 0x00000000, 0x00000001, 0x00000000, 0x0000000c, 0x0000000d, 0x0000000e, 0x00000000,
6299 0x00666e73, 0x7600666e, 0xab00666e, 0x00000204, 0x0000019c, 0x00000207, 0x000001b0, 0x00000005},
6300 {0xffffffff, 0xffffffff, 0x00000000, 0xffffffff}},
6301 {"struct array", registerset_blob_struct_array, 48, 32, 8,
6302 {0x3f8ccccd, 0x00000000, 0x00000000, 0x00000000, 0x40066666, 0x40466666, 0x40833333, 0x00000000,
6303 0x40a33333, 0x00000000, 0x00000000, 0x00000000, 0x40c33333, 0x40e33333, 0x4101999a, 0x00000000,
6304 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x422c0000, 0x42300000, 0x00000000,
6305 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x42280000, 0x422c0000, 0x42300000, 0x00000000,
6306 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000,
6307 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x00000000},
6308 {0x00000015, 0x00000000, 0x00000001, 0x00000000, 0x00000016, 0x00000017, 0x00000018, 0x00000000,
6309 0x00000019, 0x00000000, 0x00000001, 0x00000000, 0x0000001a, 0x0000001b, 0x0000001c, 0x00000000,
6310 0x666e6173, 0x00666e00, 0x00666e76, 0x00000275, 0x000001ec, 0x00000278, 0x00000200, 0x00000005,
6311 0x00040001, 0x00020002, 0x0000027c, 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
6312 {0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff}},
6313 {"struct struct", registerset_blob_struct_struct, 48, 24, 6,
6314 {0x3f8ccccd, 0x00000000, 0x00000000, 0x00000000, 0x40066666, 0x00000000, 0x00000000, 0x00000000,
6315 0x40466666, 0x40833333, 0x40a33333, 0x00000000, 0x40c33333, 0x00000000, 0x00000000, 0x00000000,
6316 0x42240000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6317 0x422c0000, 0x42300000, 0x42240000, 0x00000000, 0x42280000, 0x00000000, 0x00000000, 0x00000000,
6318 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6319 0x00000000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
6320 {0x00000047, 0x00000000, 0x00000001, 0x00000000, 0x00000048, 0x00000000, 0x00000001, 0x00000000,
6321 0x00000049, 0x0000004a, 0x0000004b, 0x00000000, 0x0000004c, 0x00000000, 0x00000001, 0x00000000,
6322 0x666e7373, 0x00666e00, 0x00666e76, 0x00000321, 0x0000026c, 0x00000324, 0x00000280, 0x00000005},
6323 {0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000}},
6324 {"int ran", registerset_blob_special_int, 0, 36, 0,
6325 {0x00000000},
6326 {0x00000004, 0x00000005, 0x00000001, 0x00000000, 0x00000006, 0x00000001, 0x00000001, 0x00000000,
6327 0x00000008, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0x00000003, 0x00000001, 0x00000000,
6328 0x00000004, 0x00000007, 0x00000001, 0x00000000, 0x00000009, 0x00000001, 0x00000001, 0x00000000,
6329 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
6330 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932},
6331 {0x00000000}},
6332 /* DefaultValue = NULL */
6333 {"big vector", registerset_blob_bigvec},
6334 {"matrix column clamp", registerset_blob_matrix_column_clamp, 12, 0, 0,
6335 {0x3f8ccccd, 0x40b00000, 0x411e6666, 0x3fc00000, 0x400ccccd, 0x40d33333, 0x3f99999a, 0x3fcccccd,
6336 0x420551ec, 0x00000000, 0x00000000, 0x00000000},
6337 {0x00000000},
6338 {0x00000000}},
6341 static void test_registerset_defaults(void)
6343 UINT k;
6344 HWND wnd;
6345 IDirect3D9 *d3d;
6346 IDirect3DDevice9 *device;
6347 D3DPRESENT_PARAMETERS d3dpp;
6348 HRESULT hr;
6349 ULONG count;
6350 D3DCAPS9 caps;
6352 if (!(wnd = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
6353 640, 480, NULL, NULL, NULL, NULL)))
6355 skip("Couldn't create application window\n");
6356 return;
6358 if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
6360 skip("Couldn't create IDirect3D9 object\n");
6361 DestroyWindow(wnd);
6362 return;
6365 ZeroMemory(&d3dpp, sizeof(d3dpp));
6366 d3dpp.Windowed = TRUE;
6367 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
6368 hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &device);
6369 if (FAILED(hr))
6371 skip("Failed to create IDirect3DDevice9 object %#lx\n", hr);
6372 IDirect3D9_Release(d3d);
6373 DestroyWindow(wnd);
6374 return;
6377 hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
6378 ok(SUCCEEDED(hr), "Failed to get device caps, hr %#lx.\n", hr);
6379 if (caps.VertexShaderVersion < D3DVS_VERSION(3, 0)
6380 || caps.PixelShaderVersion < D3DPS_VERSION(3, 0))
6382 skip("Skipping: Test requires VS >= 3 and PS >= 3.\n");
6383 IDirect3DDevice9_Release(device);
6384 IDirect3D9_Release(d3d);
6385 DestroyWindow(wnd);
6386 return;
6389 for (k = 0; k < ARRAY_SIZE(registerset_defaults_data); ++k)
6391 const char *tablename = registerset_defaults_data[k].name;
6392 ID3DXConstantTable *ctable;
6393 D3DXCONSTANTTABLE_DESC tdesc;
6394 BOOL is_vs;
6395 UINT ret;
6397 hr = D3DXGetShaderConstantTable(registerset_defaults_data[k].blob, &ctable);
6398 ok(hr == D3D_OK, "D3DXGetShaderConstantTable \"%s\" failed, got %08lx, expected %08lx\n", tablename, hr, D3D_OK);
6400 hr = ID3DXConstantTable_GetDesc(ctable, &tdesc);
6401 ok(hr == D3D_OK, "GetDesc \"%s\" failed, got %08lx, expected %08lx\n", tablename, hr, D3D_OK);
6403 is_vs = (tdesc.Version & 0xFFFF0000) == 0xFFFE0000;
6405 registerset_clear(device);
6407 hr = ID3DXConstantTable_SetDefaults(ctable, device);
6408 ok(hr == D3D_OK, "SetDefaults \"%s\" failed, got %08lx, expected %08lx\n", tablename, hr, D3D_OK);
6410 ret = registerset_compare(device, is_vs, D3DXRS_FLOAT4, 0, registerset_defaults_data[k].float_count,
6411 registerset_defaults_data[k].floats);
6412 ok(ret == 0, "Get*ShaderConstantF \"%s\" failed\n", tablename);
6414 ret = registerset_compare(device, is_vs, D3DXRS_INT4, 0, registerset_defaults_data[k].int_count,
6415 registerset_defaults_data[k].ints);
6416 ok(ret == 0, "Get*ShaderConstantI \"%s\" failed\n", tablename);
6418 ret = registerset_compare(device, is_vs, D3DXRS_BOOL, 0, registerset_defaults_data[k].bool_count,
6419 registerset_defaults_data[k].bools);
6420 ok(ret == 0, "Get*ShaderConstantB \"%s\" failed\n", tablename);
6422 count = ID3DXConstantTable_Release(ctable);
6423 ok(count == 0, "Release \"%s\" failed, got %lu, expected %u\n", tablename, count, 0);
6426 /* Release resources */
6427 count = IDirect3DDevice9_Release(device);
6428 ok(count == 0, "The Direct3D device reference count was %lu, should be 0\n", count);
6430 count = IDirect3D9_Release(d3d);
6431 ok(count == 0, "The Direct3D object reference count was %lu, should be 0\n", count);
6433 if (wnd) DestroyWindow(wnd);
6436 static void test_shader_semantics(void)
6438 static const DWORD invalid_1[] =
6440 0x00000200
6442 invalid_2[] =
6444 0xfffe0400
6446 invalid_3[] =
6448 0xfffe0000
6450 vs_1_1[] =
6452 0xfffe0101, /* vs_1_1 */
6453 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position v0 */
6454 0x0000001f, 0x80000003, 0x900f0001, /* dcl_normal v1 */
6455 0x0000001f, 0x8001000a, 0x900f0002, /* dcl_color1 v2 */
6456 0x0000001f, 0x80000005, 0x900f0003, /* dcl_texcoord0 v3 */
6457 0x00000001, 0xc00f0000, 0x90e40000, /* mov oPos, v0 */
6458 0x00000001, 0xd00f0001, 0x90e40002, /* mov oD1, v2 */
6459 0x00000001, 0xe0070000, 0x90e40001, /* mov oT0.xyz, v1 */
6460 0x00000001, 0xc00f0001, 0x90ff0002, /* mov oFog, v2.w */
6461 0x00000001, 0xc00f0002, 0x90ff0001, /* mov oPts, v1.w */
6462 0x0000ffff
6464 vs_2_0[] =
6466 0xfffe0200, /* vs_2_0 */
6467 0x0200001f, 0x80000000, 0x900f0000, /* dcl_position v0 */
6468 0x0200001f, 0x80000003, 0x900f0001, /* dcl_normal v1 */
6469 0x0200001f, 0x8001000a, 0x900f0002, /* dcl_color1 v2 */
6470 0x0200001f, 0x80000005, 0x900f0003, /* dcl_texcoord0 v3 */
6471 0x02000001, 0xc00f0000, 0x90e40000, /* mov oPos, v0 */
6472 0x02000001, 0xd00f0001, 0x90e40002, /* mov oD1, v2 */
6473 0x02000001, 0xe0070000, 0x90e40003, /* mov oT0.xyz, v3 */
6474 0x02000001, 0xc00f0001, 0x90ff0002, /* mov oFog, v2.w */
6475 0x02000001, 0xc00f0002, 0x90ff0001, /* mov oPts, v1.w */
6476 0x0000ffff
6478 vs_3_0[] =
6480 0xfffe0300, /* vs_3_0 */
6481 0x0002fffe, 0x0200000f, 0x00000000, /* comment */
6482 0x0200001f, 0x80000000, 0x900f0000, /* dcl_position v0 */
6483 0x0200001f, 0x80000003, 0x900f0001, /* dcl_normal v1 */
6484 0x0200001f, 0x8001000a, 0x900f0002, /* dcl_color1 v2 */
6485 0x0200001f, 0x80000005, 0x900f0003, /* dcl_texcoord0 v3 */
6486 0x0200001f, 0x80000000, 0xe00f0000, /* dcl_position o0 */
6487 0x0200001f, 0x8001000a, 0xe00f0001, /* dcl_color1 o1 */
6488 0x0200001f, 0x80000005, 0xe00f0002, /* dcl_texcoord0 o2 */
6489 0x0200001f, 0x8000000b, 0xe00f0003, /* dcl_fog o3 */
6490 0x0200001f, 0x80000004, 0xe00f0004, /* dcl_psize o4 */
6491 0x02000001, 0xe00f0000, 0x90e40000, /* mov o0, v0 */
6492 0x02000001, 0xe00f0001, 0x90e40002, /* mov o1, v2 */
6493 0x02000001, 0xe0070002, 0x90e40003, /* mov o2.xyz, v3 */
6494 0x02000001, 0xe00f0003, 0x90ff0002, /* mov o3, v2.w */
6495 0x02000001, 0xe00f0004, 0x90ff0001, /* mov o4, v1.w */
6496 0x0000ffff
6498 ps_1_1[] =
6500 0xffff0101, /* ps_1_1 */
6501 0x00000042, 0xb00f0000, /* tex t0 */
6502 0x00000002, 0x800f0000, 0x90e40000, 0xb0e40000, /* add r0, v0, t0 */
6503 0x0000ffff
6505 ps_2_0[] =
6507 0xffff0200, /* ps_2_0 */
6508 0x0200001f, 0x80000000, 0x900f0000, /* dcl v0 */
6509 0x0200001f, 0x80000000, 0xb00f0000, /* dcl t0 */
6510 0x02000001, 0x800f0800, 0x90e40000, /* mov oC0, v0 */
6511 0x0000ffff
6513 ps_3_0[] =
6515 0xffff0300, /* ps_3_0 */
6516 0x0200001f, 0x8001000a, 0x900f0000, /* dcl_color1 v0 */
6517 0x0200001f, 0x80000003, 0x900f0001, /* dcl_normal v1 */
6518 0x0200001f, 0x80000005, 0x900f0002, /* dcl_texcoord0 v2 */
6519 0x0200001f, 0x8000000b, 0x900f0003, /* dcl_fog v3 */
6520 0x0200001f, 0x80000000, 0x90031000, /* dcl vPos.xy */
6521 0x0200001f, 0x80000000, 0x900f1001, /* dcl vFace */
6522 0x05000051, 0xa00f0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.0, 0.0, 0.0, 0.0 */
6523 0x02000001, 0x800f0000, 0x90e40000, /* mov r0, v0 */
6524 0x03000002, 0x800f0800, 0x80e40000, 0x90e40003, /* add oC0, r0, v3 */
6525 0x02000001, 0x800f0001, 0x90e40001, /* mov r1, v1 */
6526 0x03000005, 0x800f0801, 0x80e40001, 0x90e40002, /* mul oC1, r1, v2 */
6527 0x02000001, 0x800f0802, 0x90441000, /* mov oC2, vPos.xyxy */
6528 0x04000058, 0x800f0803, 0x90e41001, 0x90e40000, 0xa0e40000, /* cmp oC3, vFace, v0, c0 */
6529 0x02000001, 0x900f0800, 0x90ff0001, /* mov oDepth, v1.w */
6530 0x0000ffff
6532 static const struct
6534 const DWORD *shader;
6535 D3DXSEMANTIC expected_input[MAXD3DDECLLENGTH];
6536 D3DXSEMANTIC expected_output[MAXD3DDECLLENGTH];
6538 tests[] =
6540 {vs_1_1, {{0, 0}, {3, 0}, {10, 1}, {5, 0}, {~0, ~0}}, {{5, 0}, {10, 1}, {0, 0}, {11, 0}, {4, 0}, {~0, ~0}}},
6541 {vs_2_0, {{0, 0}, {3, 0}, {10, 1}, {5, 0}, {~0, ~0}}, {{5, 0}, {10, 1}, {0, 0}, {11, 0}, {4, 0}, {~0, ~0}}},
6542 {vs_3_0, {{0, 0}, {3, 0}, {10, 1}, {5, 0}, {~0, ~0}}, {{0, 0}, {10, 1}, {5, 0}, {11, 0}, {4, 0}, {~0, ~0}}},
6543 {ps_1_1, {{5, 0}, {10, 0}, {~0, ~0}}, {{10, 0}, {~0, ~0}}},
6544 {ps_2_0, {{10, 0}, {5, 0}, {~0, ~0}}, {{10, 0}, {~0, ~0}}},
6545 {ps_3_0, {{10, 1}, {3,0}, {5, 0}, {11, 0}, {~0, ~0}}, {{10, 0}, {10, 1}, {10, 2}, {10, 3}, {12, 0}, {~0, ~0}}},
6547 D3DXSEMANTIC semantics[MAXD3DDECLLENGTH];
6548 unsigned int count, count2;
6549 unsigned int i, j;
6550 HRESULT hr;
6552 hr = D3DXGetShaderInputSemantics(invalid_1, NULL, NULL);
6553 ok(hr == D3DXERR_INVALIDDATA, "Unexpected hr %#lx.\n", hr);
6554 hr = D3DXGetShaderInputSemantics(invalid_2, NULL, NULL);
6555 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
6556 hr = D3DXGetShaderInputSemantics(invalid_3, NULL, NULL);
6557 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
6559 hr = D3DXGetShaderInputSemantics(vs_1_1, NULL, NULL);
6560 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
6561 hr = D3DXGetShaderInputSemantics(vs_1_1, semantics, NULL);
6562 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
6564 for (i = 0; i < ARRAY_SIZE(tests); ++i)
6566 const DWORD *shader = tests[i].shader;
6568 hr = D3DXGetShaderInputSemantics(shader, NULL, &count);
6569 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
6570 hr = D3DXGetShaderInputSemantics(shader, semantics, &count2);
6571 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
6572 ok(count == count2, "Semantics count %u differs from previous count %u.\n", count2, count);
6573 for (j = 0; j < count; ++j)
6575 ok(semantics[j].Usage == tests[i].expected_input[j].Usage
6576 && semantics[j].UsageIndex == tests[i].expected_input[j].UsageIndex,
6577 "Unexpected semantic %u, %u, test %u, idx %u.\n",
6578 semantics[j].Usage, semantics[j].UsageIndex, i, j);
6580 ok(tests[i].expected_input[j].Usage == ~0 && tests[i].expected_input[j].UsageIndex == ~0,
6581 "Unexpected semantics count %u.\n", count);
6582 hr = D3DXGetShaderOutputSemantics(shader, NULL, &count);
6583 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
6584 hr = D3DXGetShaderOutputSemantics(shader, semantics, &count2);
6585 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
6586 ok(count == count2, "Semantics count %u differs from previous count %u.\n", count2, count);
6587 for (j = 0; j < count; ++j)
6589 ok(semantics[j].Usage == tests[i].expected_output[j].Usage
6590 && semantics[j].UsageIndex == tests[i].expected_output[j].UsageIndex,
6591 "Unexpected semantic %u, %u, test %u, idx %u.\n",
6592 semantics[j].Usage, semantics[j].UsageIndex, i, j);
6594 ok(tests[i].expected_output[j].Usage == ~0 && tests[i].expected_output[j].UsageIndex == ~0,
6595 "Unexpected semantics count %u.\n", count);
6599 static void test_fragment_linker(void)
6601 ID3DXFragmentLinker *linker;
6602 D3DPRESENT_PARAMETERS d3dpp;
6603 IDirect3DDevice9 *device;
6604 IDirect3D9 *d3d;
6605 ULONG refcount;
6606 HWND window;
6607 HRESULT hr;
6609 window = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, NULL, NULL, NULL, NULL);
6610 if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
6612 skip("Failed to create a D3D object.\n");
6613 DestroyWindow(window);
6614 return;
6617 ZeroMemory(&d3dpp, sizeof(d3dpp));
6618 d3dpp.Windowed = TRUE;
6619 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
6620 hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window,
6621 D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &device);
6622 if (FAILED(hr))
6624 skip("Failed to create a D3D device, hr %#lx.\n", hr);
6625 IDirect3D9_Release(d3d);
6626 DestroyWindow(window);
6627 return;
6630 hr = D3DXCreateFragmentLinker(device, 1024, &linker);
6631 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
6632 ok(!!linker, "Unexpected linker %p.\n", linker);
6633 linker->lpVtbl->Release(linker);
6635 hr = D3DXCreateFragmentLinkerEx(device, 1024, 0, &linker);
6636 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
6637 ok(!!linker, "Unexpected linker %p.\n", linker);
6638 linker->lpVtbl->Release(linker);
6640 refcount = IDirect3DDevice9_Release(device);
6641 ok(!refcount, "Device has %lu references left.\n", refcount);
6642 refcount = IDirect3D9_Release(d3d);
6643 ok(!refcount, "The D3D object has %lu references left.\n", refcount);
6644 DestroyWindow(window);
6647 START_TEST(shader)
6649 test_get_shader_size();
6650 test_get_shader_version();
6651 test_find_shader_comment();
6652 test_get_shader_constant_table_ex();
6653 test_constant_tables();
6654 test_setting_constants();
6655 test_get_sampler_index();
6656 test_get_shader_samplers();
6657 test_get_shader_constant_variables();
6658 test_registerset();
6659 test_registerset_defaults();
6660 test_shader_semantics();
6661 test_fragment_linker();