88 static const char shader[] =
89 "#include \"incl.vsh\"\n"
91 static const char include[] =
"#define REGISTER r0\nvs.1.1\n";
92 static const char include2[] =
"#include \"incl3.vsh\"\n";
93 static const char include3[] =
"vs.1.1\n";
96 trace(
"parent_data %p: %s.\n", parent_data, parent_data ? (
char *)parent_data :
"(null)");
118 *
bytes =
sizeof(include2);
124 *
bytes =
sizeof(include3);
126 ok(parent_data !=
NULL && !
strncmp(include2, parent_data,
strlen(include2)),
"wrong parent_data value\n");
133 ok(!parent_data,
"wrong parent_data value\n");
137 ok(0,
"Unexpected #include for file %s.\n",
filename);
161 static const char test1[] =
164 static const char testincl[] =
165 "#define REGISTER r0\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"
181 static const char testincl4_wrong[] =
182 "#error \"wrong include\"\n";
205 ok(
hr ==
D3D_OK,
"pDefines test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
217 ok(
hr ==
D3D_OK,
"NULL messages test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
225 ok(
hr ==
D3D_OK,
"NULL shader test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
237 ok(
hr ==
D3D_OK,
"pInclude test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
262 ok(
hr ==
D3D_OK,
"D3DXAssembleShader test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
274 ok(
hr ==
D3D_OK,
"D3DXAssembleShader test failed with error 0x%x - %d\n",
hr,
hr & 0x0000ffff);
283 if (
create_file(
"shader.vsh", testshader,
sizeof(testshader) - 1, shader_vsh_path))
293 ok(
hr ==
D3D_OK,
"D3DXAssembleShaderFromFile test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
305 ok(
hr ==
D3D_OK,
"D3DXAssembleShaderFromFile + pInclude test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
312 create_file(
"shader3.vsh", testshader3,
sizeof(testshader3) - 1, shader3_vsh_path);
313 create_file(
"incl4.vsh", testincl4_wrong,
sizeof(testincl4_wrong) - 1,
NULL);
316 create_file(
"include\\incl3.vsh", testincl3,
sizeof(testincl3) - 1,
NULL);
317 create_file(
"include\\incl4.vsh", testincl4_ok,
sizeof(testincl4_ok) - 1,
NULL);
325 ok(
hr ==
D3D_OK,
"D3DXAssembleShaderFromFile path search test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
331 }
else skip(
"Couldn't create \"include\" directory\n");
346 ok(
hr ==
D3D_OK,
"D3DXAssembleShaderFromFile + pInclude main shader test failed with error 0x%x - %d\n",
347 hr,
hr & 0x0000ffff);
360 ok(
hr ==
D3D_OK,
"D3DXAssembleShaderFromFile + pInclude main shader test failed with error 0x%x - %d\n",
361 hr,
hr & 0x0000ffff);
369 }
else skip(
"Couldn't create \"shader.vsh\"\n");
390 "D3DXAssembleShaderFromFile nonexistent file test failed with error 0x%x - %d\n",
391 hr,
hr & 0x0000FFFF);
404 ok(
hr ==
D3D_OK,
"D3DXAssembleShaderFromResource test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
417 ok(
hr ==
D3DXERR_INVALIDDATA,
"D3DXAssembleShaderFromResource NULL shader test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
427 static const char testincl[] =
428 "#define REGISTER r0\n"
430 static const char testshader[] =
431 "#include \"incl.vsh\"\n"
432 "mov REGISTER, v0\n";
433 static const char testshader3[] =
434 "#include \"include/incl3.vsh\"\n"
435 "mov REGISTER, v0\n";
436 static const char testincl3[] =
437 "#include \"incl4.vsh\"\n";
438 static const char testincl4_ok[] =
439 "#define REGISTER r0\n"
441 static const char testincl4_wrong[] =
442 "#error \"wrong include\"\n";
448 if (
create_file(
"shader.vsh", testshader,
sizeof(testshader) - 1, shader_vsh_path))
451 create_file(
"shader3.vsh", testshader3,
sizeof(testshader3) - 1, shader3_vsh_path);
452 create_file(
"incl4.vsh", testincl4_wrong,
sizeof(testincl4_wrong) - 1,
NULL);
455 create_file(
"include\\incl3.vsh", testincl3,
sizeof(testincl3) - 1,
NULL);
456 create_file(
"include\\incl4.vsh", testincl4_ok,
sizeof(testincl4_ok) - 1,
NULL);
463 ok(
hr ==
D3D_OK,
"D3DXPreprocessShaderFromFile path search test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
469 }
else skip(
"Couldn't create \"include\" directory\n");
477 ok(
hr ==
D3D_OK,
"D3DXPreprocessShaderFromFile test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
489 ok(
hr ==
D3D_OK,
"D3DXPreprocessShaderFromFile + pInclude test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
509 ok(
hr ==
D3D_OK,
"D3DXPreprocessShaderFromFile + pInclude main shader test failed with error 0x%x - %d\n",
510 hr,
hr & 0x0000ffff);
523 ok(
hr ==
D3D_OK,
"D3DXPreprocessShaderFromFile + pInclude main shader test failed with error 0x%x - %d\n",
524 hr,
hr & 0x0000ffff);
532 }
else skip(
"Couldn't create \"shader.vsh\"\n");
541 "D3DXPreprocessShaderFromFile nonexistent file test failed with error 0x%x - %d\n",
542 hr,
hr & 0x0000FFFF);
555 ok(
hr ==
D3D_OK,
"D3DXPreprocessShaderFromResource test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
568 ok(
hr ==
D3DXERR_INVALIDDATA,
"D3DXPreprocessShaderFromResource NULL shader test failed with error 0x%x - %d\n",
hr,
hr & 0x0000FFFF);
char * strcat(char *DstString, const char *SrcString)
int strcmp(const char *String1, const char *String2)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
char * strcpy(char *DstString, const char *SrcString)
static unsigned char bytes[4]
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
#define D3DXERR_INVALIDDATA
static void assembleshader_test(void)
static SIZE_T const char const D3D_SHADER_MACRO * defines
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ** shader
#define D3DERR_INVALIDCALL
struct ID3DXBuffer ID3DXBuffer
static void d3dxpreprocess_test(void)
static BOOL create_directory(const char *name)
static char temp_path[MAX_PATH]
static const struct ID3DXIncludeVtbl D3DXInclude_Vtbl
static void delete_directory(const char *name)
static HRESULT WINAPI testD3DXInclude_close(ID3DXInclude *iface, const void *data)
static HRESULT WINAPI testD3DXInclude_open(ID3DXInclude *iface, D3DXINCLUDE_TYPE include_type, const char *filename, const void *parent_data, const void **data, UINT *bytes)
#define ID3DXBuffer_GetBufferPointer(p)
#define ID3DXBuffer_Release(p)
#define D3DXSHADER_SKIPVALIDATION
enum _D3DXINCLUDE_TYPE D3DXINCLUDE_TYPE
HRESULT WINAPI D3DXAssembleShaderFromFileW(const WCHAR *filename, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
HRESULT WINAPI D3DXPreprocessShaderFromResourceA(HMODULE module, const char *resource, const D3DXMACRO *defines, ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
HRESULT WINAPI D3DXPreprocessShaderFromFileW(const WCHAR *filename, const D3DXMACRO *defines, ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
HRESULT WINAPI D3DXPreprocessShaderFromFileA(const char *filename, const D3DXMACRO *defines, ID3DXInclude *include, 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 INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define HeapFree(x, y, z)
#define FILE_ATTRIBUTE_NORMAL
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
#define memcpy(s1, s2, n)
#define create_file(name, size)
ID3DXInclude ID3DXInclude_iface
#define MAKEINTRESOURCEA(i)