[PATCH] d3dcompiler/tests: Load d3dx9_36.dll dynamically.
Zebediah Figura
z.figura12 at gmail.com
Thu Jan 2 15:01:11 CST 2020
Windows 7 Professional ships d3dcompiler_47 by default, but no version of d3dx9.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/d3dcompiler_43/tests/Makefile.in | 2 +-
dlls/d3dcompiler_43/tests/hlsl.c | 16 ++++++++++++++--
dlls/d3dcompiler_47/tests/Makefile.in | 2 +-
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/dlls/d3dcompiler_43/tests/Makefile.in b/dlls/d3dcompiler_43/tests/Makefile.in
index 3b4b7a5a42..51b1f93483 100644
--- a/dlls/d3dcompiler_43/tests/Makefile.in
+++ b/dlls/d3dcompiler_43/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = d3dcompiler_43.dll
-IMPORTS = d3d9 d3dx9 user32
+IMPORTS = d3d9 user32
EXTRADEFS = -DD3D_COMPILER_VERSION=43
C_SRCS = \
diff --git a/dlls/d3dcompiler_43/tests/hlsl.c b/dlls/d3dcompiler_43/tests/hlsl.c
index f169f681ca..8985cd51bb 100644
--- a/dlls/d3dcompiler_43/tests/hlsl.c
+++ b/dlls/d3dcompiler_43/tests/hlsl.c
@@ -24,6 +24,9 @@
static pD3DCompile ppD3DCompile;
+static HRESULT (WINAPI *pD3DXGetShaderConstantTable)(const DWORD *byte_code, ID3DXConstantTable **constant_table);
+static D3DMATRIX *(WINAPI *pD3DXMatrixOrthoLH)(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf);
+
struct vertex
{
float x, y, z;
@@ -182,7 +185,7 @@ static IDirect3DPixelShader9 *compile_pixel_shader9(IDirect3DDevice9 *device, co
errors ? (char *)ID3D10Blob_GetBufferPointer(errors) : "");
if (FAILED(hr)) return NULL;
- hr = D3DXGetShaderConstantTable(ID3D10Blob_GetBufferPointer(compiled), constants);
+ hr = pD3DXGetShaderConstantTable(ID3D10Blob_GetBufferPointer(compiled), constants);
ok(hr == D3D_OK, "Could not get constant table from compiled pixel shader\n");
hr = IDirect3DDevice9_CreatePixelShader(device, ID3D10Blob_GetBufferPointer(compiled), &pshader);
@@ -197,7 +200,7 @@ static void draw_quad_with_shader9(IDirect3DDevice9 *device, IDirect3DVertexBuff
HRESULT hr;
D3DXMATRIX projection_matrix;
- D3DXMatrixOrthoLH(&projection_matrix, 2.0f, 2.0f, 0.0f, 1.0f);
+ pD3DXMatrixOrthoLH(&projection_matrix, 2.0f, 2.0f, 0.0f, 1.0f);
IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &projection_matrix);
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
@@ -641,6 +644,7 @@ START_TEST(hlsl)
IDirect3DVertexDeclaration9 *vdeclaration;
IDirect3DVertexBuffer9 *quad_geometry;
IDirect3DVertexShader9 *vshader_passthru;
+ HMODULE mod;
if (!load_d3dcompiler())
{
@@ -648,6 +652,14 @@ START_TEST(hlsl)
return;
}
+ if (!(mod = LoadLibraryA("d3dx9_36.dll")))
+ {
+ win_skip("Failed to load d3dx9_36.dll.\n");
+ return;
+ }
+ pD3DXGetShaderConstantTable = (void *)GetProcAddress(mod, "D3DXGetShaderConstantTable");
+ pD3DXMatrixOrthoLH = (void *)GetProcAddress(mod, "D3DXMatrixOrthoLH");
+
device = init_d3d9(&vdeclaration, &quad_geometry, &vshader_passthru);
if (!device) return;
diff --git a/dlls/d3dcompiler_47/tests/Makefile.in b/dlls/d3dcompiler_47/tests/Makefile.in
index a4e3798bed..401ed30b0f 100644
--- a/dlls/d3dcompiler_47/tests/Makefile.in
+++ b/dlls/d3dcompiler_47/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = d3dcompiler_47.dll
-IMPORTS = d3d9 d3dx9 user32
+IMPORTS = d3d9 user32
EXTRADEFS = -DD3D_COMPILER_VERSION=47
PARENTSRC = ../../d3dcompiler_43/tests
--
2.24.1
More information about the wine-devel
mailing list