160{
161 static const char test1[] =
162 "vs.1.1\n"
163 "mov DEF2, v0\n";
164 static const char testincl[] =
165 "#define REGISTER r0\n"
166 "vs.1.1\n";
167 static const char testshader[] =
168 "#include \"incl.vsh\"\n"
169 "mov REGISTER, v0\n";
170 static const char testshader2[] =
171 "#include \"incl2.vsh\"\n"
172 "mov REGISTER, v0\n";
173 static const char testshader3[] =
174 "#include \"include/incl3.vsh\"\n"
175 "mov REGISTER, v0\n";
176 static const char testincl3[] =
177 "#include \"incl4.vsh\"\n";
178 static const char testincl4_ok[] =
179 "#define REGISTER r0\n"
180 "vs.1.1\n";
181 static const char testincl4_wrong[] =
182 "#error \"wrong include\"\n";
186 {
187 "DEF1", "10 + 15"
188 },
189 {
190 "DEF2", "r0"
191 },
192 {
194 }
195 };
198
199
205 ok(
hr ==
D3D_OK,
"pDefines test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
209 }
211
212
217 ok(
hr ==
D3D_OK,
"NULL messages test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
219
220
225 ok(
hr ==
D3D_OK,
"NULL shader test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
229 }
230
231
237 ok(
hr ==
D3D_OK,
"pInclude test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
241 }
243
244
254 }
256
257
262 ok(
hr ==
D3D_OK,
"D3DXAssembleShader test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
266 }
268
269
274 ok(
hr ==
D3D_OK,
"D3DXAssembleShader test failed with error 0x%x - %d\n",
hr,
hr & 0x0000ffff);
276 {
279 }
282
283 if (
create_file(
"shader.vsh", testshader,
sizeof(testshader) - 1, shader_vsh_path))
284 {
286
287
293 ok(
hr ==
D3D_OK,
"D3DXAssembleShaderFromFile test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
297 }
299
300
305 ok(
hr ==
D3D_OK,
"D3DXAssembleShaderFromFile + pInclude test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
309 }
311
312 create_file(
"shader3.vsh", testshader3,
sizeof(testshader3) - 1, shader3_vsh_path);
313 create_file(
"incl4.vsh", testincl4_wrong,
sizeof(testincl4_wrong) - 1,
NULL);
315 {
316 create_file(
"include\\incl3.vsh", testincl3,
sizeof(testincl3) - 1,
NULL);
317 create_file(
"include\\incl4.vsh", testincl4_ok,
sizeof(testincl4_ok) - 1,
NULL);
318
319
325 ok(
hr ==
D3D_OK,
"D3DXAssembleShaderFromFile path search test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
329 }
331 }
else skip(
"Couldn't create \"include\" directory\n");
332
340
341
346 ok(
hr ==
D3D_OK,
"D3DXAssembleShaderFromFile + pInclude main shader test failed with error 0x%x - %d\n",
347 hr,
hr & 0x0000ffff);
349 {
352 }
355
360 ok(
hr ==
D3D_OK,
"D3DXAssembleShaderFromFile + pInclude main shader test failed with error 0x%x - %d\n",
361 hr,
hr & 0x0000ffff);
363 {
366 }
369 }
else skip(
"Couldn't create \"shader.vsh\"\n");
370
371
381 }
383
390 "D3DXAssembleShaderFromFile nonexistent file test failed with error 0x%x - %d\n",
391 hr,
hr & 0x0000FFFF);
395 }
397
398
404 ok(
hr ==
D3D_OK,
"D3DXAssembleShaderFromResource test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
408 }
410
411
417 ok(
hr ==
D3DXERR_INVALIDDATA,
"D3DXAssembleShaderFromResource NULL shader test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
421 }
423}
ACPI_SIZE strlen(const char *String)
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
#define D3DXERR_INVALIDDATA
static SIZE_T const char const D3D_SHADER_MACRO * defines
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ** shader
struct ID3DXBuffer ID3DXBuffer
static BOOL create_directory(const char *name)
static const struct ID3DXIncludeVtbl D3DXInclude_Vtbl
static void delete_directory(const char *name)
#define ID3DXBuffer_GetBufferPointer(p)
#define ID3DXBuffer_Release(p)
#define D3DXSHADER_SKIPVALIDATION
HRESULT WINAPI D3DXAssembleShaderFromFileW(const WCHAR *filename, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
HRESULT WINAPI D3DXAssembleShader(const char *data, UINT data_len, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
HRESULT WINAPI D3DXAssembleShaderFromFileA(const char *filename, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
HRESULT WINAPI D3DXAssembleShaderFromResourceA(HMODULE module, const char *resource, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
#define create_file(name, size)
#define MAKEINTRESOURCEA(i)