Commit a8496091 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

d3dcompiler/tests: Load d3dcompiler_43.dll dynamically.

parent 25cc380b
TESTDLL = d3dcompiler_43.dll TESTDLL = d3dcompiler_43.dll
IMPORTS = d3dcompiler d3d9 d3dx9 user32 IMPORTS = d3d9 d3dx9 user32
C_SRCS = \ C_SRCS = \
asm.c \ asm.c \
......
...@@ -27,8 +27,10 @@ ...@@ -27,8 +27,10 @@
perhaps with a different name? */ perhaps with a different name? */
#define D3DXERR_INVALIDDATA 0x88760b59 #define D3DXERR_INVALIDDATA 0x88760b59
HRESULT WINAPI D3DAssemble(const void *data, SIZE_T datasize, const char *filename, const D3D_SHADER_MACRO *defines, static HRESULT (WINAPI *pD3DAssemble)(const void *data, SIZE_T datasize, const char *filename,
ID3DInclude *include, UINT flags, ID3DBlob **shader, ID3DBlob **error_messages); const D3D_SHADER_MACRO *defines, ID3DInclude *include, UINT flags, ID3DBlob **shader,
ID3DBlob **error_messages);
static pD3DPreprocess ppD3DPreprocess;
struct shader_test { struct shader_test {
const char *text; const char *text;
...@@ -56,9 +58,9 @@ static void exec_tests(const char *name, struct shader_test tests[], unsigned in ...@@ -56,9 +58,9 @@ static void exec_tests(const char *name, struct shader_test tests[], unsigned in
for(i = 0; i < count; i++) { for(i = 0; i < count; i++) {
/* D3DAssemble sets messages to 0 if there aren't error messages */ /* D3DAssemble sets messages to 0 if there aren't error messages */
messages = NULL; messages = NULL;
hr = D3DAssemble(tests[i].text, strlen(tests[i].text), NULL, hr = pD3DAssemble(tests[i].text, strlen(tests[i].text), NULL,
NULL, NULL, D3DCOMPILE_SKIP_VALIDATION, NULL, NULL, D3DCOMPILE_SKIP_VALIDATION,
&shader, &messages); &shader, &messages);
ok(hr == S_OK, "Test %s, shader %d: D3DAssemble failed with error 0x%x - %d\n", name, i, hr, hr & 0x0000FFFF); ok(hr == S_OK, "Test %s, shader %d: D3DAssemble failed with error 0x%x - %d\n", name, i, hr, hr & 0x0000FFFF);
if(messages) { if(messages) {
trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages)); trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
...@@ -1412,9 +1414,9 @@ static void failure_test(void) { ...@@ -1412,9 +1414,9 @@ static void failure_test(void) {
{ {
shader = NULL; shader = NULL;
messages = NULL; messages = NULL;
hr = D3DAssemble(tests[i], strlen(tests[i]), NULL, hr = pD3DAssemble(tests[i], strlen(tests[i]), NULL,
NULL, NULL, D3DCOMPILE_SKIP_VALIDATION, NULL, NULL, D3DCOMPILE_SKIP_VALIDATION,
&shader, &messages); &shader, &messages);
ok(hr == D3DXERR_INVALIDDATA, "Failure test, shader %d: " ok(hr == D3DXERR_INVALIDDATA, "Failure test, shader %d: "
"expected D3DAssemble failure with D3DXERR_INVALIDDATA, " "expected D3DAssemble failure with D3DXERR_INVALIDDATA, "
"got 0x%x - %d\n", i, hr, hr & 0x0000FFFF); "got 0x%x - %d\n", i, hr, hr & 0x0000FFFF);
...@@ -1540,9 +1542,9 @@ static void assembleshader_test(void) { ...@@ -1540,9 +1542,9 @@ static void assembleshader_test(void) {
/* defines test */ /* defines test */
shader = NULL; shader = NULL;
messages = NULL; messages = NULL;
hr = D3DAssemble(test1, strlen(test1), NULL, hr = pD3DAssemble(test1, strlen(test1), NULL,
defines, NULL, D3DCOMPILE_SKIP_VALIDATION, defines, NULL, D3DCOMPILE_SKIP_VALIDATION,
&shader, &messages); &shader, &messages);
ok(hr == S_OK, "defines test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF); ok(hr == S_OK, "defines test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
if(messages) { if(messages) {
trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages)); trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
...@@ -1552,17 +1554,17 @@ static void assembleshader_test(void) { ...@@ -1552,17 +1554,17 @@ static void assembleshader_test(void) {
/* NULL messages test */ /* NULL messages test */
shader = NULL; shader = NULL;
hr = D3DAssemble(test1, strlen(test1), NULL, hr = pD3DAssemble(test1, strlen(test1), NULL,
defines, NULL, D3DCOMPILE_SKIP_VALIDATION, defines, NULL, D3DCOMPILE_SKIP_VALIDATION,
&shader, NULL); &shader, NULL);
ok(hr == S_OK, "NULL messages test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF); ok(hr == S_OK, "NULL messages test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
if(shader) ID3D10Blob_Release(shader); if(shader) ID3D10Blob_Release(shader);
/* NULL shader test */ /* NULL shader test */
messages = NULL; messages = NULL;
hr = D3DAssemble(test1, strlen(test1), NULL, hr = pD3DAssemble(test1, strlen(test1), NULL,
defines, NULL, D3DCOMPILE_SKIP_VALIDATION, defines, NULL, D3DCOMPILE_SKIP_VALIDATION,
NULL, &messages); NULL, &messages);
ok(hr == S_OK, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF); ok(hr == S_OK, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
if(messages) { if(messages) {
trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages)); trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
...@@ -1573,8 +1575,8 @@ static void assembleshader_test(void) { ...@@ -1573,8 +1575,8 @@ static void assembleshader_test(void) {
shader = NULL; shader = NULL;
messages = NULL; messages = NULL;
include.ID3DInclude_iface.lpVtbl = &D3DInclude_Vtbl; include.ID3DInclude_iface.lpVtbl = &D3DInclude_Vtbl;
hr = D3DAssemble(testshader, strlen(testshader), NULL, NULL, &include.ID3DInclude_iface, hr = pD3DAssemble(testshader, strlen(testshader), NULL, NULL, &include.ID3DInclude_iface,
D3DCOMPILE_SKIP_VALIDATION, &shader, &messages); D3DCOMPILE_SKIP_VALIDATION, &shader, &messages);
ok(hr == S_OK, "D3DInclude test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF); ok(hr == S_OK, "D3DInclude test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
if(messages) { if(messages) {
trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages)); trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
...@@ -1585,9 +1587,9 @@ static void assembleshader_test(void) { ...@@ -1585,9 +1587,9 @@ static void assembleshader_test(void) {
/* NULL shader tests */ /* NULL shader tests */
shader = NULL; shader = NULL;
messages = NULL; messages = NULL;
hr = D3DAssemble(NULL, 0, NULL, hr = pD3DAssemble(NULL, 0, NULL,
NULL, NULL, D3DCOMPILE_SKIP_VALIDATION, NULL, NULL, D3DCOMPILE_SKIP_VALIDATION,
&shader, &messages); &shader, &messages);
ok(hr == D3DXERR_INVALIDDATA, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF); ok(hr == D3DXERR_INVALIDDATA, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
if(messages) { if(messages) {
trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages)); trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
...@@ -1647,7 +1649,7 @@ static void d3dpreprocess_test(void) ...@@ -1647,7 +1649,7 @@ static void d3dpreprocess_test(void)
/* pDefines test */ /* pDefines test */
shader = NULL; shader = NULL;
messages = NULL; messages = NULL;
hr = D3DPreprocess(test1, strlen(test1), NULL, hr = ppD3DPreprocess(test1, strlen(test1), NULL,
defines, NULL, &shader, &messages); defines, NULL, &shader, &messages);
ok(hr == S_OK, "pDefines test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF); ok(hr == S_OK, "pDefines test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
if (messages) if (messages)
...@@ -1659,14 +1661,14 @@ static void d3dpreprocess_test(void) ...@@ -1659,14 +1661,14 @@ static void d3dpreprocess_test(void)
/* NULL messages test */ /* NULL messages test */
shader = NULL; shader = NULL;
hr = D3DPreprocess(test1, strlen(test1), NULL, hr = ppD3DPreprocess(test1, strlen(test1), NULL,
defines, NULL, &shader, NULL); defines, NULL, &shader, NULL);
ok(hr == S_OK, "NULL messages test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF); ok(hr == S_OK, "NULL messages test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
if (shader) ID3D10Blob_Release(shader); if (shader) ID3D10Blob_Release(shader);
/* NULL shader test */ /* NULL shader test */
messages = NULL; messages = NULL;
hr = D3DPreprocess(test1, strlen(test1), NULL, hr = ppD3DPreprocess(test1, strlen(test1), NULL,
defines, NULL, NULL, &messages); defines, NULL, NULL, &messages);
ok(hr == E_INVALIDARG, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF); ok(hr == E_INVALIDARG, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
if (messages) if (messages)
...@@ -1678,7 +1680,7 @@ static void d3dpreprocess_test(void) ...@@ -1678,7 +1680,7 @@ static void d3dpreprocess_test(void)
/* quotation marks test */ /* quotation marks test */
shader = NULL; shader = NULL;
messages = NULL; messages = NULL;
hr = D3DPreprocess(quotation_marks_test, strlen(quotation_marks_test), NULL, hr = ppD3DPreprocess(quotation_marks_test, strlen(quotation_marks_test), NULL,
NULL, NULL, &shader, &messages); NULL, NULL, &shader, &messages);
todo_wine ok(hr == S_OK, "quotation marks test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF); todo_wine ok(hr == S_OK, "quotation marks test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
if (messages) if (messages)
...@@ -1694,7 +1696,7 @@ static void d3dpreprocess_test(void) ...@@ -1694,7 +1696,7 @@ static void d3dpreprocess_test(void)
{ {
shader = NULL; shader = NULL;
messages = NULL; messages = NULL;
hr = D3DPreprocess(include_test_shaders[i], strlen(include_test_shaders[i]), NULL, NULL, hr = ppD3DPreprocess(include_test_shaders[i], strlen(include_test_shaders[i]), NULL, NULL,
&include.ID3DInclude_iface, &shader, &messages); &include.ID3DInclude_iface, &shader, &messages);
ok(hr == S_OK, "pInclude test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF); ok(hr == S_OK, "pInclude test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
if (messages) if (messages)
...@@ -1708,7 +1710,7 @@ static void d3dpreprocess_test(void) ...@@ -1708,7 +1710,7 @@ static void d3dpreprocess_test(void)
/* NULL shader tests */ /* NULL shader tests */
shader = NULL; shader = NULL;
messages = NULL; messages = NULL;
hr = D3DPreprocess(NULL, 0, NULL, hr = ppD3DPreprocess(NULL, 0, NULL,
NULL, NULL, &shader, &messages); NULL, NULL, &shader, &messages);
ok(hr == E_INVALIDARG, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF); ok(hr == E_INVALIDARG, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
if (messages) if (messages)
...@@ -1719,8 +1721,25 @@ static void d3dpreprocess_test(void) ...@@ -1719,8 +1721,25 @@ static void d3dpreprocess_test(void)
if (shader) ID3D10Blob_Release(shader); if (shader) ID3D10Blob_Release(shader);
} }
static BOOL load_d3dcompiler(void)
{
HMODULE module;
if (!(module = LoadLibraryA("d3dcompiler_43.dll"))) return FALSE;
pD3DAssemble = (void*)GetProcAddress(module, "D3DAssemble");
ppD3DPreprocess = (void*)GetProcAddress(module, "D3DPreprocess");
return TRUE;
}
START_TEST(asm) START_TEST(asm)
{ {
if (!load_d3dcompiler())
{
win_skip("Could not load d3dcompiler_43.dll\n");
return;
}
preproc_test(); preproc_test();
ps_1_1_test(); ps_1_1_test();
vs_1_1_test(); vs_1_1_test();
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include <math.h> #include <math.h>
static pD3DCompile ppD3DCompile;
struct vertex struct vertex
{ {
float x, y, z; float x, y, z;
...@@ -134,7 +136,7 @@ static IDirect3DDevice9 *init_d3d9(IDirect3DVertexDeclaration9 **vdeclaration, ...@@ -134,7 +136,7 @@ static IDirect3DDevice9 *init_d3d9(IDirect3DVertexDeclaration9 **vdeclaration,
ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexDeclaration returned: %08x\n", hr); ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexDeclaration returned: %08x\n", hr);
/* Create a simple vertex shader to just pass through the values */ /* Create a simple vertex shader to just pass through the values */
hr = D3DCompile(vshader_passthru_hlsl, strlen(vshader_passthru_hlsl), NULL, hr = ppD3DCompile(vshader_passthru_hlsl, strlen(vshader_passthru_hlsl), NULL,
NULL, NULL, "vshader", "vs_1_1", 0, 0, &compiled, &errors); NULL, NULL, "vshader", "vs_1_1", 0, 0, &compiled, &errors);
if (FAILED(hr)) if (FAILED(hr))
{ {
...@@ -173,7 +175,7 @@ static IDirect3DPixelShader9 *compile_pixel_shader9(IDirect3DDevice9 *device, co ...@@ -173,7 +175,7 @@ static IDirect3DPixelShader9 *compile_pixel_shader9(IDirect3DDevice9 *device, co
IDirect3DPixelShader9 *pshader; IDirect3DPixelShader9 *pshader;
HRESULT hr; HRESULT hr;
hr = D3DCompile(shader, strlen(shader), NULL, NULL, hr = ppD3DCompile(shader, strlen(shader), NULL, NULL,
NULL, "test", profile, /* test is the name of the entry point of our shader */ NULL, "test", profile, /* test is the name of the entry point of our shader */
0, 0, &compiled, &errors); 0, 0, &compiled, &errors);
ok(hr == D3D_OK, "Pixel shader %s compilation failed: %s\n", shader, ok(hr == D3D_OK, "Pixel shader %s compilation failed: %s\n", shader,
...@@ -599,7 +601,7 @@ static void test_fail(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *qquad_ge ...@@ -599,7 +601,7 @@ static void test_fail(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *qquad_ge
ID3D10Blob *compiled = NULL, *errors = NULL; ID3D10Blob *compiled = NULL, *errors = NULL;
HRESULT hr; HRESULT hr;
hr = D3DCompile(undefined_variable_shader, strlen(undefined_variable_shader), NULL, NULL, NULL, hr = ppD3DCompile(undefined_variable_shader, strlen(undefined_variable_shader), NULL, NULL, NULL,
"test", "ps_2_0", 0, 0, &compiled, &errors); "test", "ps_2_0", 0, 0, &compiled, &errors);
ok(hr != D3D_OK, "Pixel shader compilation succeeded on shader with undefined variable\n"); ok(hr != D3D_OK, "Pixel shader compilation succeeded on shader with undefined variable\n");
ok(errors != NULL, "No errors returned for a shader with undefined variables\n"); ok(errors != NULL, "No errors returned for a shader with undefined variables\n");
...@@ -608,7 +610,7 @@ static void test_fail(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *qquad_ge ...@@ -608,7 +610,7 @@ static void test_fail(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *qquad_ge
ID3D10Blob_Release(errors); ID3D10Blob_Release(errors);
errors = NULL; errors = NULL;
hr = D3DCompile(invalid_swizzle_shader, strlen(invalid_swizzle_shader), NULL, NULL, NULL, hr = ppD3DCompile(invalid_swizzle_shader, strlen(invalid_swizzle_shader), NULL, NULL, NULL,
"test","ps_2_0", 0, 0, &compiled, &errors); "test","ps_2_0", 0, 0, &compiled, &errors);
ok(hr != D3D_OK, "Pixel shader compilation succeeded on shader with an invalid swizzle mask\n"); ok(hr != D3D_OK, "Pixel shader compilation succeeded on shader with an invalid swizzle mask\n");
ok(errors != NULL, "No errors returned for a shader with an invalid swizzle mask\n"); ok(errors != NULL, "No errors returned for a shader with an invalid swizzle mask\n");
...@@ -617,7 +619,7 @@ static void test_fail(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *qquad_ge ...@@ -617,7 +619,7 @@ static void test_fail(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *qquad_ge
ID3D10Blob_Release(errors); ID3D10Blob_Release(errors);
errors = NULL; errors = NULL;
hr = D3DCompile(invalid_conversion_shader, strlen(invalid_conversion_shader), NULL, NULL, NULL, hr = ppD3DCompile(invalid_conversion_shader, strlen(invalid_conversion_shader), NULL, NULL, NULL,
"test", "ps_2_0", 0, 0, &compiled, &errors); "test", "ps_2_0", 0, 0, &compiled, &errors);
ok(hr != D3D_OK, "Pixel shader compilation succeeded on shader with an invalid type " ok(hr != D3D_OK, "Pixel shader compilation succeeded on shader with an invalid type "
"conversion\n"); "conversion\n");
...@@ -627,7 +629,7 @@ static void test_fail(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *qquad_ge ...@@ -627,7 +629,7 @@ static void test_fail(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *qquad_ge
ID3D10Blob_Release(errors); ID3D10Blob_Release(errors);
errors = NULL; errors = NULL;
hr = D3DCompile(invalid_syntax_shader, strlen(invalid_syntax_shader), NULL, NULL, NULL, "test", hr = ppD3DCompile(invalid_syntax_shader, strlen(invalid_syntax_shader), NULL, NULL, NULL, "test",
"ps_2_0", 0, 0, &compiled, &errors); "ps_2_0", 0, 0, &compiled, &errors);
ok(hr != D3D_OK, "Pixel shader compilation succeeded on shader with blatantly invalid " ok(hr != D3D_OK, "Pixel shader compilation succeeded on shader with blatantly invalid "
"syntax\n"); "syntax\n");
...@@ -637,7 +639,7 @@ static void test_fail(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *qquad_ge ...@@ -637,7 +639,7 @@ static void test_fail(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *qquad_ge
ID3D10Blob_Release(errors); ID3D10Blob_Release(errors);
errors = NULL; errors = NULL;
hr = D3DCompile(invalid_identifiers_shader, strlen(invalid_identifiers_shader), NULL, NULL, hr = ppD3DCompile(invalid_identifiers_shader, strlen(invalid_identifiers_shader), NULL, NULL,
NULL, "test", "ps_2_0", 0, 0, &compiled, &errors); NULL, "test", "ps_2_0", 0, 0, &compiled, &errors);
ok(hr != D3D_OK, "Pixel shader compilation successful on a shader with invalid variable and " ok(hr != D3D_OK, "Pixel shader compilation successful on a shader with invalid variable and "
"function names\n"); "function names\n");
...@@ -649,6 +651,16 @@ static void test_fail(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *qquad_ge ...@@ -649,6 +651,16 @@ static void test_fail(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *qquad_ge
ID3D10Blob_Release(errors); ID3D10Blob_Release(errors);
} }
static BOOL load_d3dcompiler(void)
{
HMODULE module;
if (!(module = LoadLibraryA("d3dcompiler_43.dll"))) return FALSE;
ppD3DCompile = (void*)GetProcAddress(module, "D3DCompile");
return TRUE;
}
START_TEST(hlsl) START_TEST(hlsl)
{ {
D3DCAPS9 caps; D3DCAPS9 caps;
...@@ -658,6 +670,12 @@ START_TEST(hlsl) ...@@ -658,6 +670,12 @@ START_TEST(hlsl)
IDirect3DVertexBuffer9 *quad_geometry; IDirect3DVertexBuffer9 *quad_geometry;
IDirect3DVertexShader9 *vshader_passthru; IDirect3DVertexShader9 *vshader_passthru;
if (!load_d3dcompiler())
{
win_skip("Could not load d3dcompiler_43.dll\n");
return;
}
device = init_d3d9(&vdeclaration, &quad_geometry, &vshader_passthru); device = init_d3d9(&vdeclaration, &quad_geometry, &vshader_passthru);
if (!device) return; if (!device) return;
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
*/ */
#define D3DERR_INVALIDCALL 0x8876086c #define D3DERR_INVALIDCALL 0x8876086c
static typeof(D3DReflect) *pD3DReflect;
/* Creator string for comparison - Version 9.29.952.3111 (43) */ /* Creator string for comparison - Version 9.29.952.3111 (43) */
static DWORD shader_creator[] = { static DWORD shader_creator[] = {
0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
...@@ -79,7 +81,7 @@ static void test_reflection_references(void) ...@@ -79,7 +81,7 @@ static void test_reflection_references(void)
ID3D10ShaderReflection *ref10; ID3D10ShaderReflection *ref10;
ID3D10ShaderReflection1 *ref10_1; ID3D10ShaderReflection1 *ref10_1;
hr = D3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11); hr = pD3DReflect(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); ok(hr == S_OK, "D3DReflect failed, got %x, expected %x\n", hr, S_OK);
hr = ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D11ShaderReflection, (void **)&ref11_test); hr = ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D11ShaderReflection, (void **)&ref11_test);
...@@ -98,35 +100,35 @@ static void test_reflection_references(void) ...@@ -98,35 +100,35 @@ static void test_reflection_references(void)
ok(count == 0, "Release failed %u\n", count); ok(count == 0, "Release failed %u\n", count);
/* check invalid cases */ /* check invalid cases */
hr = D3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D10ShaderReflection, (void **)&ref10); hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D10ShaderReflection, (void **)&ref10);
ok(hr == E_NOINTERFACE, "D3DReflect failed, got %x, expected %x\n", hr, E_NOINTERFACE); ok(hr == E_NOINTERFACE, "D3DReflect failed, got %x, expected %x\n", hr, E_NOINTERFACE);
hr = D3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D10ShaderReflection1, (void **)&ref10_1); hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
ok(hr == E_NOINTERFACE, "D3DReflect failed, got %x, expected %x\n", hr, E_NOINTERFACE); ok(hr == E_NOINTERFACE, "D3DReflect failed, got %x, expected %x\n", hr, E_NOINTERFACE);
hr = D3DReflect(NULL, test_reflection_blob[6], &IID_ID3D10ShaderReflection1, (void **)&ref10_1); hr = pD3DReflect(NULL, test_reflection_blob[6], &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL); ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
hr = D3DReflect(NULL, test_reflection_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11); hr = pD3DReflect(NULL, test_reflection_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL); ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
/* returns different errors with different sizes */ /* returns different errors with different sizes */
hr = D3DReflect(test_reflection_blob, 31, &IID_ID3D10ShaderReflection1, (void **)&ref10_1); hr = pD3DReflect(test_reflection_blob, 31, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL); ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
hr = D3DReflect(test_reflection_blob, 32, &IID_ID3D10ShaderReflection1, (void **)&ref10_1); hr = pD3DReflect(test_reflection_blob, 32, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL); ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL);
hr = D3DReflect(test_reflection_blob, test_reflection_blob[6]-1, &IID_ID3D10ShaderReflection1, (void **)&ref10_1); hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6]-1, &IID_ID3D10ShaderReflection1, (void **)&ref10_1);
ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL); ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL);
hr = D3DReflect(test_reflection_blob, 31, &IID_ID3D11ShaderReflection, (void **)&ref11); hr = pD3DReflect(test_reflection_blob, 31, &IID_ID3D11ShaderReflection, (void **)&ref11);
ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL); ok(hr == D3DERR_INVALIDCALL, "D3DReflect failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
hr = D3DReflect(test_reflection_blob, 32, &IID_ID3D11ShaderReflection, (void **)&ref11); hr = pD3DReflect(test_reflection_blob, 32, &IID_ID3D11ShaderReflection, (void **)&ref11);
ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL); ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL);
hr = D3DReflect(test_reflection_blob, test_reflection_blob[6]-1, &IID_ID3D11ShaderReflection, (void **)&ref11); hr = pD3DReflect(test_reflection_blob, test_reflection_blob[6]-1, &IID_ID3D11ShaderReflection, (void **)&ref11);
ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL); ok(hr == E_FAIL, "D3DReflect failed, got %x, expected %x\n", hr, E_FAIL);
} }
...@@ -295,7 +297,7 @@ static void test_reflection_desc_vs(void) ...@@ -295,7 +297,7 @@ static void test_reflection_desc_vs(void)
UINT ret; UINT ret;
unsigned int i; unsigned int i;
hr = D3DReflect(test_reflection_desc_vs_blob, test_reflection_desc_vs_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11); hr = pD3DReflect(test_reflection_desc_vs_blob, test_reflection_desc_vs_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
ok(hr == S_OK, "D3DReflect failed %x\n", hr); ok(hr == S_OK, "D3DReflect failed %x\n", hr);
hr = ref11->lpVtbl->GetDesc(ref11, NULL); hr = ref11->lpVtbl->GetDesc(ref11, NULL);
...@@ -582,7 +584,7 @@ static void test_reflection_desc_ps(void) ...@@ -582,7 +584,7 @@ static void test_reflection_desc_ps(void)
UINT ret; UINT ret;
unsigned int i; unsigned int i;
hr = D3DReflect(test_reflection_desc_ps_blob, test_reflection_desc_ps_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11); hr = pD3DReflect(test_reflection_desc_ps_blob, test_reflection_desc_ps_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
ok(hr == S_OK, "D3DReflect failed %x\n", hr); ok(hr == S_OK, "D3DReflect failed %x\n", hr);
hr = ref11->lpVtbl->GetDesc(ref11, &sdesc11); hr = ref11->lpVtbl->GetDesc(ref11, &sdesc11);
...@@ -901,7 +903,7 @@ static void test_reflection_desc_ps_output(void) ...@@ -901,7 +903,7 @@ static void test_reflection_desc_ps_output(void)
for (i = 0; i < ARRAY_SIZE(test_reflection_desc_ps_output_result); ++i) for (i = 0; i < ARRAY_SIZE(test_reflection_desc_ps_output_result); ++i)
{ {
hr = D3DReflect(test_reflection_desc_ps_output_blob[i], test_reflection_desc_ps_output_blob[i][6], &IID_ID3D11ShaderReflection, (void **)&ref11); hr = pD3DReflect(test_reflection_desc_ps_output_blob[i], test_reflection_desc_ps_output_blob[i][6], &IID_ID3D11ShaderReflection, (void **)&ref11);
ok(hr == S_OK, "(%u): D3DReflect failed %x\n", i, hr); ok(hr == S_OK, "(%u): D3DReflect failed %x\n", i, hr);
pdesc = &test_reflection_desc_ps_output_result[i]; pdesc = &test_reflection_desc_ps_output_result[i];
...@@ -1013,7 +1015,7 @@ static void test_reflection_bound_resources(void) ...@@ -1013,7 +1015,7 @@ static void test_reflection_bound_resources(void)
const D3D11_SHADER_INPUT_BIND_DESC *pdesc; const D3D11_SHADER_INPUT_BIND_DESC *pdesc;
unsigned int i; unsigned int i;
hr = D3DReflect(test_reflection_bound_resources_blob, test_reflection_bound_resources_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11); hr = pD3DReflect(test_reflection_bound_resources_blob, test_reflection_bound_resources_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
ok(hr == S_OK, "D3DReflect failed %x\n", hr); ok(hr == S_OK, "D3DReflect failed %x\n", hr);
/* check invalid cases */ /* check invalid cases */
...@@ -1230,7 +1232,7 @@ static void test_reflection_constant_buffer(void) ...@@ -1230,7 +1232,7 @@ static void test_reflection_constant_buffer(void)
unsigned int i; unsigned int i;
LPCSTR string; LPCSTR string;
hr = D3DReflect(test_reflection_constant_buffer_blob, test_reflection_constant_buffer_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11); hr = pD3DReflect(test_reflection_constant_buffer_blob, test_reflection_constant_buffer_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11);
ok(hr == S_OK, "D3DReflect failed %x\n", hr); ok(hr == S_OK, "D3DReflect failed %x\n", hr);
hr = ref11->lpVtbl->GetDesc(ref11, &sdesc); hr = ref11->lpVtbl->GetDesc(ref11, &sdesc);
...@@ -1505,8 +1507,24 @@ static void test_reflection_constant_buffer(void) ...@@ -1505,8 +1507,24 @@ static void test_reflection_constant_buffer(void)
ok(count == 0, "Release failed %u\n", count); ok(count == 0, "Release failed %u\n", count);
} }
static BOOL load_d3dcompiler(void)
{
HMODULE module;
if (!(module = LoadLibraryA("d3dcompiler_43.dll"))) return FALSE;
pD3DReflect = (void*)GetProcAddress(module, "D3DReflect");
return TRUE;
}
START_TEST(reflection) START_TEST(reflection)
{ {
if (!load_d3dcompiler())
{
win_skip("Could not load d3dcompiler_43.dll\n");
return;
}
test_reflection_references(); test_reflection_references();
test_reflection_desc_vs(); test_reflection_desc_vs();
test_reflection_desc_ps(); test_reflection_desc_ps();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment