d3dcompiler/tests: Link directly to the relevant d3dcompiler version.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
fb65de04d5
commit
910a398b72
|
@ -1,4 +1,5 @@
|
|||
MODULE = d3dcompiler_43.dll
|
||||
IMPORTLIB = d3dcompiler_43
|
||||
EXTRADEFS = -DD3D_COMPILER_VERSION=43
|
||||
|
||||
EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TESTDLL = d3dcompiler_43.dll
|
||||
IMPORTS = d3d9 user32
|
||||
IMPORTS = d3d9 user32 d3dcompiler_43
|
||||
EXTRADEFS = -DD3D_COMPILER_VERSION=43
|
||||
|
||||
C_SRCS = \
|
||||
|
|
|
@ -27,11 +27,9 @@
|
|||
perhaps with a different name? */
|
||||
#define D3DXERR_INVALIDDATA 0x88760b59
|
||||
|
||||
static HRESULT (WINAPI *pD3DAssemble)(const void *data, SIZE_T datasize, const char *filename,
|
||||
const D3D_SHADER_MACRO *defines, ID3DInclude *include, UINT flags, ID3DBlob **shader,
|
||||
ID3DBlob **error_messages);
|
||||
static pD3DPreprocess ppD3DPreprocess;
|
||||
static pD3DDisassemble ppD3DDisassemble;
|
||||
HRESULT WINAPI D3DAssemble(const void *data, SIZE_T datasize, const char *filename,
|
||||
const D3D_SHADER_MACRO *defines, ID3DInclude *include, UINT flags,
|
||||
ID3DBlob **shader, ID3DBlob **error_messages);
|
||||
|
||||
struct shader_test {
|
||||
const char *text;
|
||||
|
@ -59,9 +57,8 @@ static void exec_tests(const char *name, struct shader_test tests[], unsigned in
|
|||
for(i = 0; i < count; i++) {
|
||||
/* D3DAssemble sets messages to 0 if there aren't error messages */
|
||||
messages = NULL;
|
||||
hr = pD3DAssemble(tests[i].text, strlen(tests[i].text), NULL,
|
||||
NULL, NULL, D3DCOMPILE_SKIP_VALIDATION,
|
||||
&shader, &messages);
|
||||
hr = D3DAssemble(tests[i].text, strlen(tests[i].text), NULL, NULL,
|
||||
NULL, D3DCOMPILE_SKIP_VALIDATION, &shader, &messages);
|
||||
ok(hr == S_OK, "Test %s, shader %d: D3DAssemble failed with error 0x%x - %d\n", name, i, hr, hr & 0x0000FFFF);
|
||||
if(messages) {
|
||||
trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
|
||||
|
@ -1415,9 +1412,7 @@ static void failure_test(void) {
|
|||
{
|
||||
shader = NULL;
|
||||
messages = NULL;
|
||||
hr = pD3DAssemble(tests[i], strlen(tests[i]), NULL,
|
||||
NULL, NULL, D3DCOMPILE_SKIP_VALIDATION,
|
||||
&shader, &messages);
|
||||
hr = D3DAssemble(tests[i], strlen(tests[i]), NULL, NULL, NULL, D3DCOMPILE_SKIP_VALIDATION, &shader, &messages);
|
||||
ok(hr == D3DXERR_INVALIDDATA, "Failure test, shader %d: "
|
||||
"expected D3DAssemble failure with D3DXERR_INVALIDDATA, "
|
||||
"got 0x%x - %d\n", i, hr, hr & 0x0000FFFF);
|
||||
|
@ -1543,9 +1538,7 @@ static void assembleshader_test(void) {
|
|||
/* defines test */
|
||||
shader = NULL;
|
||||
messages = NULL;
|
||||
hr = pD3DAssemble(test1, strlen(test1), NULL,
|
||||
defines, NULL, D3DCOMPILE_SKIP_VALIDATION,
|
||||
&shader, &messages);
|
||||
hr = D3DAssemble(test1, strlen(test1), NULL, defines, NULL, D3DCOMPILE_SKIP_VALIDATION, &shader, &messages);
|
||||
ok(hr == S_OK, "defines test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
|
||||
if(messages) {
|
||||
trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
|
||||
|
@ -1555,17 +1548,13 @@ static void assembleshader_test(void) {
|
|||
|
||||
/* NULL messages test */
|
||||
shader = NULL;
|
||||
hr = pD3DAssemble(test1, strlen(test1), NULL,
|
||||
defines, NULL, D3DCOMPILE_SKIP_VALIDATION,
|
||||
&shader, NULL);
|
||||
hr = D3DAssemble(test1, strlen(test1), NULL, defines, NULL, D3DCOMPILE_SKIP_VALIDATION, &shader, NULL);
|
||||
ok(hr == S_OK, "NULL messages test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
|
||||
if(shader) ID3D10Blob_Release(shader);
|
||||
|
||||
/* NULL shader test */
|
||||
messages = NULL;
|
||||
hr = pD3DAssemble(test1, strlen(test1), NULL,
|
||||
defines, NULL, D3DCOMPILE_SKIP_VALIDATION,
|
||||
NULL, &messages);
|
||||
hr = D3DAssemble(test1, strlen(test1), NULL, defines, NULL, D3DCOMPILE_SKIP_VALIDATION, NULL, &messages);
|
||||
ok(hr == S_OK, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
|
||||
if(messages) {
|
||||
trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
|
||||
|
@ -1576,8 +1565,8 @@ static void assembleshader_test(void) {
|
|||
shader = NULL;
|
||||
messages = NULL;
|
||||
include.ID3DInclude_iface.lpVtbl = &D3DInclude_Vtbl;
|
||||
hr = pD3DAssemble(testshader, strlen(testshader), NULL, NULL, &include.ID3DInclude_iface,
|
||||
D3DCOMPILE_SKIP_VALIDATION, &shader, &messages);
|
||||
hr = D3DAssemble(testshader, strlen(testshader), NULL, NULL,
|
||||
&include.ID3DInclude_iface, D3DCOMPILE_SKIP_VALIDATION, &shader, &messages);
|
||||
ok(hr == S_OK, "D3DInclude test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
|
||||
if(messages) {
|
||||
trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
|
||||
|
@ -1588,9 +1577,7 @@ static void assembleshader_test(void) {
|
|||
/* NULL shader tests */
|
||||
shader = NULL;
|
||||
messages = NULL;
|
||||
hr = pD3DAssemble(NULL, 0, NULL,
|
||||
NULL, NULL, D3DCOMPILE_SKIP_VALIDATION,
|
||||
&shader, &messages);
|
||||
hr = D3DAssemble(NULL, 0, NULL, NULL, NULL, D3DCOMPILE_SKIP_VALIDATION, &shader, &messages);
|
||||
ok(hr == D3DXERR_INVALIDDATA, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
|
||||
if(messages) {
|
||||
trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
|
||||
|
@ -1650,8 +1637,7 @@ static void d3dpreprocess_test(void)
|
|||
/* pDefines test */
|
||||
shader = NULL;
|
||||
messages = NULL;
|
||||
hr = ppD3DPreprocess(test1, strlen(test1), NULL,
|
||||
defines, NULL, &shader, &messages);
|
||||
hr = D3DPreprocess(test1, strlen(test1), NULL, defines, NULL, &shader, &messages);
|
||||
ok(hr == S_OK, "pDefines test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
|
||||
if (messages)
|
||||
{
|
||||
|
@ -1662,15 +1648,13 @@ static void d3dpreprocess_test(void)
|
|||
|
||||
/* NULL messages test */
|
||||
shader = NULL;
|
||||
hr = ppD3DPreprocess(test1, strlen(test1), NULL,
|
||||
defines, NULL, &shader, NULL);
|
||||
hr = D3DPreprocess(test1, strlen(test1), NULL, defines, NULL, &shader, NULL);
|
||||
ok(hr == S_OK, "NULL messages test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
|
||||
if (shader) ID3D10Blob_Release(shader);
|
||||
|
||||
/* NULL shader test */
|
||||
messages = NULL;
|
||||
hr = ppD3DPreprocess(test1, strlen(test1), NULL,
|
||||
defines, NULL, NULL, &messages);
|
||||
hr = D3DPreprocess(test1, strlen(test1), NULL, defines, NULL, NULL, &messages);
|
||||
ok(hr == E_INVALIDARG, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
|
||||
if (messages)
|
||||
{
|
||||
|
@ -1681,8 +1665,7 @@ static void d3dpreprocess_test(void)
|
|||
/* quotation marks test */
|
||||
shader = NULL;
|
||||
messages = NULL;
|
||||
hr = ppD3DPreprocess(quotation_marks_test, strlen(quotation_marks_test), NULL,
|
||||
NULL, NULL, &shader, &messages);
|
||||
hr = D3DPreprocess(quotation_marks_test, strlen(quotation_marks_test), NULL, NULL, NULL, &shader, &messages);
|
||||
todo_wine ok(hr == S_OK, "quotation marks test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
|
||||
if (messages)
|
||||
{
|
||||
|
@ -1697,7 +1680,7 @@ static void d3dpreprocess_test(void)
|
|||
{
|
||||
shader = NULL;
|
||||
messages = NULL;
|
||||
hr = ppD3DPreprocess(include_test_shaders[i], strlen(include_test_shaders[i]), NULL, NULL,
|
||||
hr = D3DPreprocess(include_test_shaders[i], strlen(include_test_shaders[i]), NULL, NULL,
|
||||
&include.ID3DInclude_iface, &shader, &messages);
|
||||
ok(hr == S_OK, "pInclude test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
|
||||
if (messages)
|
||||
|
@ -1711,8 +1694,7 @@ static void d3dpreprocess_test(void)
|
|||
/* NULL shader tests */
|
||||
shader = NULL;
|
||||
messages = NULL;
|
||||
hr = ppD3DPreprocess(NULL, 0, NULL,
|
||||
NULL, NULL, &shader, &messages);
|
||||
hr = D3DPreprocess(NULL, 0, NULL, NULL, NULL, &shader, &messages);
|
||||
ok(hr == E_INVALIDARG, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
|
||||
if (messages)
|
||||
{
|
||||
|
@ -1742,7 +1724,7 @@ static void test_disassemble_shader(void)
|
|||
ID3DBlob *blob;
|
||||
HRESULT hr;
|
||||
|
||||
hr = ppD3DDisassemble(vs_2_0, 0, 0, NULL, &blob);
|
||||
hr = D3DDisassemble(vs_2_0, 0, 0, NULL, &blob);
|
||||
todo_wine
|
||||
#if D3D_COMPILER_VERSION == 47
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
||||
|
@ -1750,37 +1732,15 @@ todo_wine
|
|||
ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr);
|
||||
#endif
|
||||
|
||||
hr = ppD3DDisassemble(vs_2_0, sizeof(vs_2_0), 0, NULL, &blob);
|
||||
hr = D3DDisassemble(vs_2_0, sizeof(vs_2_0), 0, NULL, &blob);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
if (SUCCEEDED(hr))
|
||||
ID3D10Blob_Release(blob);
|
||||
}
|
||||
|
||||
static BOOL load_d3dcompiler(void)
|
||||
{
|
||||
HMODULE module;
|
||||
|
||||
#if D3D_COMPILER_VERSION == 47
|
||||
if (!(module = LoadLibraryA("d3dcompiler_47.dll"))) return FALSE;
|
||||
#else
|
||||
if (!(module = LoadLibraryA("d3dcompiler_43.dll"))) return FALSE;
|
||||
#endif
|
||||
|
||||
pD3DAssemble = (void*)GetProcAddress(module, "D3DAssemble");
|
||||
ppD3DPreprocess = (void*)GetProcAddress(module, "D3DPreprocess");
|
||||
ppD3DDisassemble = (void *)GetProcAddress(module, "D3DDisassemble");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
START_TEST(asm)
|
||||
{
|
||||
if (!load_d3dcompiler())
|
||||
{
|
||||
win_skip("Could not load DLL.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
preproc_test();
|
||||
ps_1_1_test();
|
||||
vs_1_1_test();
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
#include "d3d11.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
static pD3DCompile ppD3DCompile;
|
||||
static HRESULT (WINAPI *pD3DReflect)(const void *data, SIZE_T size, REFIID iid, void **out);
|
||||
|
||||
static HRESULT (WINAPI *pD3D11CreateDevice)(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_type,
|
||||
HMODULE swrast, UINT flags, const D3D_FEATURE_LEVEL *feature_levels, UINT levels,
|
||||
UINT sdk_version, ID3D11Device **device_out, D3D_FEATURE_LEVEL *obtained_feature_level,
|
||||
|
@ -49,7 +46,7 @@ static ID3D10Blob *compile_shader_(unsigned int line, const char *source, const
|
|||
ID3D10Blob *blob = NULL, *errors = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
hr = ppD3DCompile(source, strlen(source), NULL, NULL, NULL, "main", target, flags, 0, &blob, &errors);
|
||||
hr = D3DCompile(source, strlen(source), NULL, NULL, NULL, "main", target, flags, 0, &blob, &errors);
|
||||
ok_(__FILE__, line)(hr == S_OK, "Failed to compile shader, hr %#x.\n", hr);
|
||||
if (errors)
|
||||
{
|
||||
|
@ -832,7 +829,7 @@ static void test_reflection(void)
|
|||
if (!code)
|
||||
return;
|
||||
|
||||
hr = pD3DReflect(ID3D10Blob_GetBufferPointer(code), ID3D10Blob_GetBufferSize(code),
|
||||
hr = D3DReflect(ID3D10Blob_GetBufferPointer(code), ID3D10Blob_GetBufferSize(code),
|
||||
&IID_ID3D11ShaderReflection, (void **)&reflection);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
|
@ -910,7 +907,7 @@ static void test_reflection(void)
|
|||
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
|
||||
|
||||
code = compile_shader_flags(ps_source, "ps_4_0", D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY);
|
||||
hr = pD3DReflect(ID3D10Blob_GetBufferPointer(code), ID3D10Blob_GetBufferSize(code),
|
||||
hr = D3DReflect(ID3D10Blob_GetBufferPointer(code), ID3D10Blob_GetBufferSize(code),
|
||||
&IID_ID3D11ShaderReflection, (void **)&reflection);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
|
@ -1140,7 +1137,7 @@ static void test_semantic_reflection(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
hr = pD3DReflect(ID3D10Blob_GetBufferPointer(code), ID3D10Blob_GetBufferSize(code),
|
||||
hr = D3DReflect(ID3D10Blob_GetBufferPointer(code), ID3D10Blob_GetBufferSize(code),
|
||||
&IID_ID3D11ShaderReflection, (void **)&reflection);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
|
@ -1177,31 +1174,10 @@ static void test_semantic_reflection(void)
|
|||
}
|
||||
}
|
||||
|
||||
static BOOL load_d3dcompiler(void)
|
||||
{
|
||||
HMODULE module;
|
||||
|
||||
#if D3D_COMPILER_VERSION == 47
|
||||
if (!(module = LoadLibraryA("d3dcompiler_47.dll"))) return FALSE;
|
||||
#else
|
||||
if (!(module = LoadLibraryA("d3dcompiler_43.dll"))) return FALSE;
|
||||
#endif
|
||||
|
||||
ppD3DCompile = (void *)GetProcAddress(module, "D3DCompile");
|
||||
pD3DReflect = (void *)GetProcAddress(module, "D3DReflect");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
START_TEST(hlsl_d3d11)
|
||||
{
|
||||
HMODULE mod;
|
||||
|
||||
if (!load_d3dcompiler())
|
||||
{
|
||||
win_skip("Could not load DLL.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
test_reflection();
|
||||
test_semantic_reflection();
|
||||
|
||||
|
|
|
@ -24,14 +24,6 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
static pD3DCompile ppD3DCompile;
|
||||
|
||||
static HRESULT (WINAPI *pD3DCompile2)(const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *defines,
|
||||
ID3DInclude *include, const char *entrypoint, const char *target, UINT sflags, UINT eflags, UINT secondary_flags,
|
||||
const void *secondary_data, SIZE_T secondary_data_size, ID3DBlob **shader, ID3DBlob **error_messages);
|
||||
static HRESULT (WINAPI *pD3DCompileFromFile)(const WCHAR *filename, const D3D_SHADER_MACRO *defines,
|
||||
ID3DInclude *include, const char *entrypoint, const char *target, UINT flags1, UINT flags2,
|
||||
ID3DBlob **code, ID3DBlob **errors);
|
||||
static HRESULT (WINAPI *pD3DXGetShaderConstantTable)(const DWORD *byte_code, ID3DXConstantTable **constant_table);
|
||||
|
||||
struct vec2
|
||||
|
@ -107,7 +99,7 @@ static ID3D10Blob *compile_shader_(unsigned int line, const char *source, const
|
|||
ID3D10Blob *blob = NULL, *errors = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
hr = ppD3DCompile(source, strlen(source), NULL, NULL, NULL, "main", target, 0, 0, &blob, &errors);
|
||||
hr = D3DCompile(source, strlen(source), NULL, NULL, NULL, "main", target, 0, 0, &blob, &errors);
|
||||
ok_(__FILE__, line)(hr == D3D_OK, "Failed to compile shader, hr %#x.\n", hr);
|
||||
if (errors)
|
||||
{
|
||||
|
@ -1435,7 +1427,7 @@ static void test_fail(void)
|
|||
for (i = 0; i < ARRAY_SIZE(tests); ++i)
|
||||
{
|
||||
compiled = errors = NULL;
|
||||
hr = ppD3DCompile(tests[i], strlen(tests[i]), NULL, NULL, NULL, "test", targets[j], 0, 0, &compiled, &errors);
|
||||
hr = D3DCompile(tests[i], strlen(tests[i]), NULL, NULL, NULL, "test", targets[j], 0, 0, &compiled, &errors);
|
||||
todo_wine ok(hr == E_FAIL, "Test %u, target %s, got unexpected hr %#x.\n", i, targets[j], hr);
|
||||
if (hr == E_FAIL)
|
||||
{
|
||||
|
@ -1447,22 +1439,6 @@ static void test_fail(void)
|
|||
}
|
||||
}
|
||||
|
||||
static BOOL load_d3dcompiler(void)
|
||||
{
|
||||
HMODULE module;
|
||||
|
||||
#if D3D_COMPILER_VERSION == 47
|
||||
if (!(module = LoadLibraryA("d3dcompiler_47.dll"))) return FALSE;
|
||||
pD3DCompile2 = (void*)GetProcAddress(module, "D3DCompile2");
|
||||
pD3DCompileFromFile = (void*)GetProcAddress(module, "D3DCompileFromFile");
|
||||
#else
|
||||
if (!(module = LoadLibraryA("d3dcompiler_43.dll"))) return FALSE;
|
||||
#endif
|
||||
|
||||
ppD3DCompile = (void*)GetProcAddress(module, "D3DCompile");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI test_d3dinclude_open(ID3DInclude *iface, D3D_INCLUDE_TYPE include_type,
|
||||
const char *filename, const void *parent_data, const void **data, UINT *bytes)
|
||||
{
|
||||
|
@ -1523,7 +1499,7 @@ struct test_d3dinclude
|
|||
static void test_d3dcompile(void)
|
||||
{
|
||||
struct test_d3dinclude include = {{&test_d3dinclude_vtbl}};
|
||||
WCHAR filename[MAX_PATH], directory[MAX_PATH], include_filename[MAX_PATH];
|
||||
WCHAR filename[MAX_PATH], include_filename[MAX_PATH];
|
||||
ID3D10Blob *blob = NULL, *errors = NULL;
|
||||
CHAR filename_a[MAX_PATH];
|
||||
HRESULT hr;
|
||||
|
@ -1542,6 +1518,9 @@ static void test_d3dcompile(void)
|
|||
static const char include2[] =
|
||||
"#include \"include1.h\"\n"
|
||||
"float4 light_color = LIGHT;\n";
|
||||
|
||||
#if D3D_COMPILER_VERSION >= 46
|
||||
WCHAR directory[MAX_PATH];
|
||||
static const char ps_absolute_template[] =
|
||||
"#include \"%ls\"\n"
|
||||
"\n"
|
||||
|
@ -1550,6 +1529,7 @@ static void test_d3dcompile(void)
|
|||
" return light_color;\n"
|
||||
"}";
|
||||
char ps_absolute_buffer[sizeof(ps_absolute_template) + MAX_PATH];
|
||||
#endif
|
||||
|
||||
create_file(L"source.ps", ps_code, strlen(ps_code), filename);
|
||||
create_directory(L"include");
|
||||
|
@ -1560,7 +1540,8 @@ static void test_d3dcompile(void)
|
|||
len = WideCharToMultiByte(CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL);
|
||||
WideCharToMultiByte(CP_ACP, 0, filename, -1, filename_a, len, NULL, NULL);
|
||||
|
||||
hr = ppD3DCompile(ps_code, sizeof(ps_code), filename_a, NULL, &include.ID3DInclude_iface, "main", "ps_2_0", 0, 0, &blob, &errors);
|
||||
hr = D3DCompile(ps_code, sizeof(ps_code), filename_a, NULL,
|
||||
&include.ID3DInclude_iface, "main", "ps_2_0", 0, 0, &blob, &errors);
|
||||
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
todo_wine ok(!!blob, "Got unexpected blob.\n");
|
||||
ok(!errors, "Got unexpected errors.\n");
|
||||
|
@ -1570,15 +1551,8 @@ static void test_d3dcompile(void)
|
|||
blob = NULL;
|
||||
}
|
||||
|
||||
/* Also skip D3DCompile() D3D_COMPILE_STANDARD_FILE_INCLUDE tests from
|
||||
* d3dcompiler_43 or earlier since they crash on Windows. */
|
||||
if (!pD3DCompile2)
|
||||
{
|
||||
skip("D3DCompile2() isn't supported.\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
hr = ppD3DCompile(ps_code, sizeof(ps_code), NULL, NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE,
|
||||
#if D3D_COMPILER_VERSION >= 46
|
||||
hr = D3DCompile(ps_code, sizeof(ps_code), NULL, NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE,
|
||||
"main", "ps_2_0", 0, 0, &blob, &errors);
|
||||
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
|
||||
ok(!blob, "Got unexpected blob.\n");
|
||||
|
@ -1589,7 +1563,7 @@ static void test_d3dcompile(void)
|
|||
/* Windows always seems to resolve includes from the initial file location
|
||||
* instead of using the immediate parent, as it would be the case for
|
||||
* standard C preprocessor includes. */
|
||||
hr = ppD3DCompile(ps_code, sizeof(ps_code), filename_a, NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE,
|
||||
hr = D3DCompile(ps_code, sizeof(ps_code), filename_a, NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE,
|
||||
"main", "ps_2_0", 0, 0, &blob, &errors);
|
||||
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
todo_wine ok(!!blob, "Got unexpected blob.\n");
|
||||
|
@ -1600,7 +1574,7 @@ static void test_d3dcompile(void)
|
|||
blob = NULL;
|
||||
}
|
||||
|
||||
hr = pD3DCompile2(ps_code, sizeof(ps_code), filename_a, NULL, &include.ID3DInclude_iface,
|
||||
hr = D3DCompile2(ps_code, sizeof(ps_code), filename_a, NULL, &include.ID3DInclude_iface,
|
||||
"main", "ps_2_0", 0, 0, 0, NULL, 0, &blob, &errors);
|
||||
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
todo_wine ok(!!blob, "Got unexpected blob.\n");
|
||||
|
@ -1611,7 +1585,7 @@ static void test_d3dcompile(void)
|
|||
blob = NULL;
|
||||
}
|
||||
|
||||
hr = pD3DCompile2(ps_code, sizeof(ps_code), filename_a, NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE,
|
||||
hr = D3DCompile2(ps_code, sizeof(ps_code), filename_a, NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE,
|
||||
"main", "ps_2_0", 0, 0, 0, NULL, 0, &blob, &errors);
|
||||
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
todo_wine ok(!!blob, "Got unexpected blob.\n");
|
||||
|
@ -1622,12 +1596,12 @@ static void test_d3dcompile(void)
|
|||
blob = NULL;
|
||||
}
|
||||
|
||||
hr = pD3DCompileFromFile(L"nonexistent", NULL, NULL, "main", "vs_2_0", 0, 0, &blob, &errors);
|
||||
hr = D3DCompileFromFile(L"nonexistent", NULL, NULL, "main", "vs_2_0", 0, 0, &blob, &errors);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Got hr %#x.\n", hr);
|
||||
ok(!blob, "Got unexpected blob.\n");
|
||||
ok(!errors, "Got unexpected errors.\n");
|
||||
|
||||
hr = pD3DCompileFromFile(filename, NULL, NULL, "main", "ps_2_0", 0, 0, &blob, &errors);
|
||||
hr = D3DCompileFromFile(filename, NULL, NULL, "main", "ps_2_0", 0, 0, &blob, &errors);
|
||||
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
|
||||
ok(!blob, "Got unexpected blob.\n");
|
||||
ok(!!errors, "Got unexpected errors.\n");
|
||||
|
@ -1635,7 +1609,7 @@ static void test_d3dcompile(void)
|
|||
ID3D10Blob_Release(errors);
|
||||
errors = NULL;
|
||||
|
||||
hr = pD3DCompileFromFile(filename, NULL, &include.ID3DInclude_iface, "main", "ps_2_0", 0, 0, &blob, &errors);
|
||||
hr = D3DCompileFromFile(filename, NULL, &include.ID3DInclude_iface, "main", "ps_2_0", 0, 0, &blob, &errors);
|
||||
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
todo_wine ok(!!blob, "Got unexpected blob.\n");
|
||||
ok(!errors, "Got unexpected errors.\n");
|
||||
|
@ -1648,7 +1622,7 @@ static void test_d3dcompile(void)
|
|||
/* Windows always seems to resolve includes from the initial file location
|
||||
* instead of using the immediate parent, as it would be the case for
|
||||
* standard C preprocessor includes. */
|
||||
hr = pD3DCompileFromFile(filename, NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE, "main", "ps_2_0", 0, 0, &blob, &errors);
|
||||
hr = D3DCompileFromFile(filename, NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE, "main", "ps_2_0", 0, 0, &blob, &errors);
|
||||
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
todo_wine ok(!!blob, "Got unexpected blob.\n");
|
||||
ok(!errors, "Got unexpected errors.\n");
|
||||
|
@ -1659,7 +1633,7 @@ static void test_d3dcompile(void)
|
|||
}
|
||||
|
||||
sprintf(ps_absolute_buffer, ps_absolute_template, include_filename);
|
||||
hr = ppD3DCompile(ps_absolute_buffer, sizeof(ps_absolute_buffer), filename_a, NULL,
|
||||
hr = D3DCompile(ps_absolute_buffer, sizeof(ps_absolute_buffer), filename_a, NULL,
|
||||
D3D_COMPILE_STANDARD_FILE_INCLUDE, "main", "ps_2_0", 0, 0, &blob, &errors);
|
||||
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
todo_wine ok(!!blob, "Got unexpected blob.\n");
|
||||
|
@ -1673,7 +1647,7 @@ static void test_d3dcompile(void)
|
|||
GetCurrentDirectoryW(MAX_PATH, directory);
|
||||
SetCurrentDirectoryW(temp_dir);
|
||||
|
||||
hr = ppD3DCompile(ps_code, sizeof(ps_code), "source.ps", NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE,
|
||||
hr = D3DCompile(ps_code, sizeof(ps_code), "source.ps", NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE,
|
||||
"main", "ps_2_0", 0, 0, &blob, &errors);
|
||||
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
todo_wine ok(!!blob, "Got unexpected blob.\n");
|
||||
|
@ -1684,7 +1658,7 @@ static void test_d3dcompile(void)
|
|||
blob = NULL;
|
||||
}
|
||||
|
||||
hr = pD3DCompile2(ps_code, sizeof(ps_code), "source.ps", NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE,
|
||||
hr = D3DCompile2(ps_code, sizeof(ps_code), "source.ps", NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE,
|
||||
"main", "ps_2_0", 0, 0, 0, NULL, 0, &blob, &errors);
|
||||
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
todo_wine ok(!!blob, "Got unexpected blob.\n");
|
||||
|
@ -1695,7 +1669,7 @@ static void test_d3dcompile(void)
|
|||
blob = NULL;
|
||||
}
|
||||
|
||||
hr = pD3DCompileFromFile(L"source.ps", NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE, "main", "ps_2_0", 0, 0, &blob, &errors);
|
||||
hr = D3DCompileFromFile(L"source.ps", NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE, "main", "ps_2_0", 0, 0, &blob, &errors);
|
||||
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
todo_wine ok(!!blob, "Got unexpected blob.\n");
|
||||
ok(!errors, "Got unexpected errors.\n");
|
||||
|
@ -1706,8 +1680,8 @@ static void test_d3dcompile(void)
|
|||
}
|
||||
|
||||
SetCurrentDirectoryW(directory);
|
||||
#endif /* D3D_COMPILER_VERSION >= 46 */
|
||||
|
||||
cleanup:
|
||||
delete_file(L"source.ps");
|
||||
delete_file(L"include\\include1.h");
|
||||
delete_file(L"include1.h");
|
||||
|
@ -1719,12 +1693,6 @@ START_TEST(hlsl_d3d9)
|
|||
{
|
||||
HMODULE mod;
|
||||
|
||||
if (!load_d3dcompiler())
|
||||
{
|
||||
win_skip("Could not load DLL.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(mod = LoadLibraryA("d3dx9_36.dll")))
|
||||
{
|
||||
win_skip("Failed to load d3dx9_36.dll.\n");
|
||||
|
|
|
@ -38,14 +38,10 @@
|
|||
*/
|
||||
#define D3DERR_INVALIDCALL 0x8876086c
|
||||
|
||||
#if D3D_COMPILER_VERSION
|
||||
static HRESULT (WINAPI *pD3DReflect)(const void *, SIZE_T, REFIID, void **);
|
||||
#endif
|
||||
|
||||
static HRESULT call_reflect(const void *data, SIZE_T data_size, REFIID riid, void **reflection)
|
||||
{
|
||||
#if D3D_COMPILER_VERSION
|
||||
return pD3DReflect(data, data_size, riid, reflection);
|
||||
return D3DReflect(data, data_size, riid, reflection);
|
||||
#else
|
||||
return D3D10ReflectShader(data, data_size, (ID3D10ShaderReflection **)reflection);
|
||||
#endif
|
||||
|
@ -93,7 +89,7 @@ static void test_reflection_references(void)
|
|||
HRESULT hr, expected;
|
||||
ULONG count;
|
||||
|
||||
hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
|
||||
hr = D3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
|
||||
ok(hr == S_OK, "D3DReflect failed, got %x, expected %x\n", hr, S_OK);
|
||||
|
||||
hr = ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D11ShaderReflection, (void **)&ref11_test);
|
||||
|
@ -117,22 +113,22 @@ static void test_reflection_references(void)
|
|||
#else
|
||||
expected = E_NOINTERFACE;
|
||||
#endif
|
||||
hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D10ShaderReflection, (void **)&ref10);
|
||||
hr = D3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D10ShaderReflection, (void **)&ref10);
|
||||
ok(hr == expected || broken(hr == E_NOINTERFACE) /* Windows 8 */,
|
||||
"D3DReflect failed, got %x, expected %x\n", hr, expected);
|
||||
|
||||
hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
|
||||
hr = D3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
|
||||
ok(hr == expected || broken(hr == E_NOINTERFACE) /* Windows 8 */,
|
||||
"D3DReflect failed, got %x, expected %x\n", hr, expected);
|
||||
|
||||
hr = pD3DReflect(NULL, test_reflection_blob[6], &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
|
||||
hr = D3DReflect(NULL, test_reflection_blob[6], &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
|
||||
ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
|
||||
|
||||
hr = pD3DReflect(NULL, test_reflection_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
|
||||
hr = D3DReflect(NULL, test_reflection_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
|
||||
ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
|
||||
|
||||
/* returns different errors with different sizes */
|
||||
hr = pD3DReflect(test_reflection_blob, 31, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
|
||||
hr = D3DReflect(test_reflection_blob, 31, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
|
||||
ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
|
||||
|
||||
#if D3D_COMPILER_VERSION >= 46
|
||||
|
@ -140,19 +136,19 @@ static void test_reflection_references(void)
|
|||
#else
|
||||
expected = E_FAIL;
|
||||
#endif
|
||||
hr = pD3DReflect(test_reflection_blob, 32, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
|
||||
hr = D3DReflect(test_reflection_blob, 32, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
|
||||
ok(hr == expected, "Got %x, expected %x.\n", hr, expected);
|
||||
|
||||
hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6]-1, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
|
||||
hr = D3DReflect(test_reflection_blob, test_reflection_blob[6]-1, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
|
||||
ok(hr == expected, "Got %x, expected %x.\n", hr, expected);
|
||||
|
||||
hr = pD3DReflect(test_reflection_blob, 31, &IID_ID3D11ShaderReflection, (void **)&ref11);
|
||||
hr = D3DReflect(test_reflection_blob, 31, &IID_ID3D11ShaderReflection, (void **)&ref11);
|
||||
ok(hr == D3DERR_INVALIDCALL, "Got %x, expected %x.\n", hr, D3DERR_INVALIDCALL);
|
||||
|
||||
hr = pD3DReflect(test_reflection_blob, 32, &IID_ID3D11ShaderReflection, (void **)&ref11);
|
||||
hr = D3DReflect(test_reflection_blob, 32, &IID_ID3D11ShaderReflection, (void **)&ref11);
|
||||
ok(hr == expected, "Got %x, expected %x.\n", hr, expected);
|
||||
|
||||
hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6]-1, &IID_ID3D11ShaderReflection, (void **)&ref11);
|
||||
hr = D3DReflect(test_reflection_blob, test_reflection_blob[6]-1, &IID_ID3D11ShaderReflection, (void **)&ref11);
|
||||
ok(hr == expected, "Got %x, expected %x.\n", hr, expected);
|
||||
}
|
||||
#endif
|
||||
|
@ -2122,32 +2118,8 @@ static const D3D12_SHADER_INPUT_BIND_DESC test_reflection_bound_resources_sm51_r
|
|||
{"c2", D3D_SIT_CBUFFER, 0, 1, D3D_SIF_USERPACKED, 0, D3D_SRV_DIMENSION_UNKNOWN, 0, 1, 1},
|
||||
};
|
||||
|
||||
static BOOL load_d3dreflect(void)
|
||||
{
|
||||
#if D3D_COMPILER_VERSION == 47
|
||||
static const char filename[] = "d3dcompiler_47.dll";
|
||||
#elif D3D_COMPILER_VERSION
|
||||
static const char filename[] = "d3dcompiler_43.dll";
|
||||
#endif
|
||||
#if D3D_COMPILER_VERSION
|
||||
HMODULE module;
|
||||
|
||||
if (!(module = LoadLibraryA(filename)))
|
||||
return FALSE;
|
||||
|
||||
pD3DReflect = (void*)GetProcAddress(module, "D3DReflect");
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
START_TEST(reflection)
|
||||
{
|
||||
if (!load_d3dreflect())
|
||||
{
|
||||
win_skip("Could not load DLL.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
#if D3D_COMPILER_VERSION
|
||||
test_reflection_references();
|
||||
test_reflection_interfaces();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TESTDLL = d3dcompiler_47.dll
|
||||
IMPORTS = d3d9 user32
|
||||
IMPORTS = d3d9 user32 d3dcompiler
|
||||
EXTRADEFS = -DD3D_COMPILER_VERSION=47
|
||||
PARENTSRC = ../../d3dcompiler_43/tests
|
||||
|
||||
|
|
Loading…
Reference in New Issue