From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- configure | 1 + configure.ac | 1 + dlls/d3dx9_35/Makefile.in | 1 + dlls/d3dx9_35/tests/Makefile.in | 18 +++++ dlls/d3dx9_36/tests/shader.c | 119 ++++++++++++++++++++++---------- 5 files changed, 104 insertions(+), 36 deletions(-) create mode 100644 dlls/d3dx9_35/tests/Makefile.in
diff --git a/configure b/configure index ef7c99dd8e8..40379f80e1f 100755 --- a/configure +++ b/configure @@ -22271,6 +22271,7 @@ wine_fn_config_makefile dlls/d3dx9_32 enable_d3dx9_32 wine_fn_config_makefile dlls/d3dx9_33 enable_d3dx9_33 wine_fn_config_makefile dlls/d3dx9_34 enable_d3dx9_34 wine_fn_config_makefile dlls/d3dx9_35 enable_d3dx9_35 +wine_fn_config_makefile dlls/d3dx9_35/tests enable_tests wine_fn_config_makefile dlls/d3dx9_36 enable_d3dx9_36 wine_fn_config_makefile dlls/d3dx9_36/tests enable_tests wine_fn_config_makefile dlls/d3dx9_37 enable_d3dx9_37 diff --git a/configure.ac b/configure.ac index 274591f5f53..cd4afecfb1f 100644 --- a/configure.ac +++ b/configure.ac @@ -2564,6 +2564,7 @@ WINE_CONFIG_MAKEFILE(dlls/d3dx9_32) WINE_CONFIG_MAKEFILE(dlls/d3dx9_33) WINE_CONFIG_MAKEFILE(dlls/d3dx9_34) WINE_CONFIG_MAKEFILE(dlls/d3dx9_35) +WINE_CONFIG_MAKEFILE(dlls/d3dx9_35/tests) WINE_CONFIG_MAKEFILE(dlls/d3dx9_36) WINE_CONFIG_MAKEFILE(dlls/d3dx9_36/tests) WINE_CONFIG_MAKEFILE(dlls/d3dx9_37) diff --git a/dlls/d3dx9_35/Makefile.in b/dlls/d3dx9_35/Makefile.in index 0c8d93acf7e..f08b2ebc52e 100644 --- a/dlls/d3dx9_35/Makefile.in +++ b/dlls/d3dx9_35/Makefile.in @@ -1,5 +1,6 @@ EXTRADEFS = -DD3DX_SDK_VERSION=35 MODULE = d3dx9_35.dll +IMPORTLIB = d3dx9_35 IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 wined3d PARENTSRC = ../d3dx9_36 DELAYIMPORTS = windowscodecs diff --git a/dlls/d3dx9_35/tests/Makefile.in b/dlls/d3dx9_35/tests/Makefile.in new file mode 100644 index 00000000000..4d8b9a77126 --- /dev/null +++ b/dlls/d3dx9_35/tests/Makefile.in @@ -0,0 +1,18 @@ +TESTDLL = d3dx9_35.dll +IMPORTS = d3dx9_35 d3d9 user32 gdi32 +EXTRADEFS = -DD3DX_SDK_VERSION=35 +PARENTSRC = ../../d3dx9_36/tests + +SOURCES = \ + asm.c \ + core.c \ + effect.c \ + line.c \ + math.c \ + mesh.c \ + rsrc.rc \ + shader.c \ + surface.c \ + texture.c \ + volume.c \ + xfile.c diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c index 93a81dd4214..8fa4363c889 100644 --- a/dlls/d3dx9_36/tests/shader.c +++ b/dlls/d3dx9_36/tests/shader.c @@ -73,23 +73,6 @@ static const DWORD shader_with_invalid_ctab[] = { 0x00000000, 0x00000000, 0x0000ffff}; /* END */
-static const DWORD shader_with_ctab_constants[] = { - 0xfffe0300, /* vs_3_0 */ - 0x002efffe, FCC_CTAB, /* CTAB comment */ - 0x0000001c, 0x000000a4, 0xfffe0300, 0x00000003, 0x0000001c, 0x20008100, /* Header */ - 0x0000009c, - 0x00000058, 0x00070002, 0x00000001, 0x00000064, 0x00000000, /* Constant 1 desc */ - 0x00000074, 0x00000002, 0x00000004, 0x00000080, 0x00000000, /* Constant 2 desc */ - 0x00000090, 0x00040002, 0x00000003, 0x00000080, 0x00000000, /* Constant 3 desc */ - 0x736e6f43, 0x746e6174, 0xabab0031, /* Constant 1 name string */ - 0x00030001, 0x00040001, 0x00000001, 0x00000000, /* Constant 1 type desc */ - 0x736e6f43, 0x746e6174, 0xabab0032, /* Constant 2 name string */ - 0x00030003, 0x00040004, 0x00000001, 0x00000000, /* Constant 2 & 3 type desc */ - 0x736e6f43, 0x746e6174, 0xabab0033, /* Constant 3 name string */ - 0x335f7376, 0xab00305f, /* Target name string */ - 0x656e6957, 0x6f727020, 0x7463656a, 0xababab00, /* Creator name string */ - 0x0000ffff}; /* END */ - static const DWORD ctab_basic[] = { 0xfffe0300, /* vs_3_0 */ 0x0040fffe, FCC_CTAB, /* CTAB comment */ @@ -283,25 +266,6 @@ static const D3DXCONSTANT_DESC ctab_samplers_expected[] = { {"sampler2", D3DXRS_SAMPLER, 3, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER3D, 1, 1, 1, 0, 4, NULL}, {"notsampler", D3DXRS_FLOAT4, 2, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 1, 0, 16, NULL}};
-static const DWORD fx_shader_with_ctab[] = -{ - 0x46580200, /* FX20 */ - 0x002efffe, FCC_CTAB, /* CTAB comment */ - 0x0000001c, 0x000000a4, 0xfffe0300, 0x00000003, 0x0000001c, 0x20008100, /* Header */ - 0x0000009c, - 0x00000058, 0x00070002, 0x00000001, 0x00000064, 0x00000000, /* Constant 1 desc */ - 0x00000074, 0x00000002, 0x00000004, 0x00000080, 0x00000000, /* Constant 2 desc */ - 0x00000090, 0x00040002, 0x00000003, 0x00000080, 0x00000000, /* Constant 3 desc */ - 0x736e6f43, 0x746e6174, 0xabab0031, /* Constant 1 name string */ - 0x00030001, 0x00040001, 0x00000001, 0x00000000, /* Constant 1 type desc */ - 0x736e6f43, 0x746e6174, 0xabab0032, /* Constant 2 name string */ - 0x00030003, 0x00040004, 0x00000001, 0x00000000, /* Constant 2 & 3 type desc */ - 0x736e6f43, 0x746e6174, 0xabab0033, /* Constant 3 name string */ - 0x335f7376, 0xab00305f, /* Target name string */ - 0x656e6957, 0x6f727020, 0x7463656a, 0xababab00, /* Creator name string */ - 0x0000ffff /* END */ -}; - struct d3d9_test_context { HWND window; @@ -593,6 +557,43 @@ static void test_find_shader_comment(void) ok(size == 4, "Got result %u, expected 4\n", size); }
+#if D3DX_SDK_VERSION >= 36 +static const DWORD shader_with_ctab_constants[] = { + 0xfffe0300, /* vs_3_0 */ + 0x002efffe, FCC_CTAB, /* CTAB comment */ + 0x0000001c, 0x000000a4, 0xfffe0300, 0x00000003, 0x0000001c, 0x20008100, /* Header */ + 0x0000009c, + 0x00000058, 0x00070002, 0x00000001, 0x00000064, 0x00000000, /* Constant 1 desc */ + 0x00000074, 0x00000002, 0x00000004, 0x00000080, 0x00000000, /* Constant 2 desc */ + 0x00000090, 0x00040002, 0x00000003, 0x00000080, 0x00000000, /* Constant 3 desc */ + 0x736e6f43, 0x746e6174, 0xabab0031, /* Constant 1 name string */ + 0x00030001, 0x00040001, 0x00000001, 0x00000000, /* Constant 1 type desc */ + 0x736e6f43, 0x746e6174, 0xabab0032, /* Constant 2 name string */ + 0x00030003, 0x00040004, 0x00000001, 0x00000000, /* Constant 2 & 3 type desc */ + 0x736e6f43, 0x746e6174, 0xabab0033, /* Constant 3 name string */ + 0x335f7376, 0xab00305f, /* Target name string */ + 0x656e6957, 0x6f727020, 0x7463656a, 0xababab00, /* Creator name string */ + 0x0000ffff}; /* END */ + +static const DWORD fx_shader_with_ctab[] = +{ + 0x46580200, /* FX20 */ + 0x002efffe, FCC_CTAB, /* CTAB comment */ + 0x0000001c, 0x000000a4, 0xfffe0300, 0x00000003, 0x0000001c, 0x20008100, /* Header */ + 0x0000009c, + 0x00000058, 0x00070002, 0x00000001, 0x00000064, 0x00000000, /* Constant 1 desc */ + 0x00000074, 0x00000002, 0x00000004, 0x00000080, 0x00000000, /* Constant 2 desc */ + 0x00000090, 0x00040002, 0x00000003, 0x00000080, 0x00000000, /* Constant 3 desc */ + 0x736e6f43, 0x746e6174, 0xabab0031, /* Constant 1 name string */ + 0x00030001, 0x00040001, 0x00000001, 0x00000000, /* Constant 1 type desc */ + 0x736e6f43, 0x746e6174, 0xabab0032, /* Constant 2 name string */ + 0x00030003, 0x00040004, 0x00000001, 0x00000000, /* Constant 2 & 3 type desc */ + 0x736e6f43, 0x746e6174, 0xabab0033, /* Constant 3 name string */ + 0x335f7376, 0xab00305f, /* Target name string */ + 0x656e6957, 0x6f727020, 0x7463656a, 0xababab00, /* Creator name string */ + 0x0000ffff /* END */ +}; + static void test_get_shader_constant_table_ex(void) { D3DXCONSTANT_DESC constant_desc_save; @@ -780,6 +781,7 @@ static void test_get_shader_constant_table_ex(void) ok(hr == D3D_OK, "Got result %lx, expected 0 (D3D_OK).\n", hr); ok(!constant_table, "D3DXGetShaderConstantTableEx() returned a non-NULL constant table.\n"); } +#endif
static void test_constant_table(const char *test_name, const DWORD *ctable_fn, const D3DXCONSTANT_DESC *expecteds, UINT count) @@ -6825,6 +6827,46 @@ static void test_fragment_linker(void) ok(!!linker, "Unexpected linker %p.\n", linker); linker->lpVtbl->Release(linker);
+ refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %lu references left.\n", refcount); + refcount = IDirect3D9_Release(d3d); + ok(!refcount, "The D3D object has %lu references left.\n", refcount); + DestroyWindow(window); +} +#endif + +#if (D3DX_SDK_VERSION >= 36 && D3DX_SDK_VERSION <= 41) +static void test_fragment_linker_ex(void) +{ + ID3DXFragmentLinker *linker; + D3DPRESENT_PARAMETERS d3dpp; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + HWND window; + HRESULT hr; + + window = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, NULL, NULL, NULL, NULL); + if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION))) + { + skip("Failed to create a D3D object.\n"); + DestroyWindow(window); + return; + } + + ZeroMemory(&d3dpp, sizeof(d3dpp)); + d3dpp.Windowed = TRUE; + d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; + hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window, + D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &device); + if (FAILED(hr)) + { + skip("Failed to create a D3D device, hr %#lx.\n", hr); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + hr = D3DXCreateFragmentLinkerEx(device, 1024, 0, &linker); ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr); ok(!!linker, "Unexpected linker %p.\n", linker); @@ -6917,7 +6959,9 @@ START_TEST(shader) test_get_shader_size(); test_get_shader_version(); test_find_shader_comment(); +#if D3DX_SDK_VERSION >= 36 test_get_shader_constant_table_ex(); +#endif test_constant_tables(); test_setting_constants(); test_get_sampler_index(); @@ -6928,6 +6972,9 @@ START_TEST(shader) test_shader_semantics(); #if D3DX_SDK_VERSION <= 41 test_fragment_linker(); +#endif +#if (D3DX_SDK_VERSION >= 36 && D3DX_SDK_VERSION <= 41) + test_fragment_linker_ex(); #endif test_hlsl_double(); test_implicit_truncation_warning();