[PATCH] d3dx9_36: Set compilation_errors to NULL when no error encountered + tests.

Christian Costa titan.costa at gmail.com
Tue Jun 11 15:08:52 CDT 2013


Fixes bug 26598.
---
 dlls/d3dx9_36/effect.c       |    4 ++++
 dlls/d3dx9_36/tests/effect.c |   17 +++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index 1924c07..bab4560 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -5792,6 +5792,10 @@ HRESULT WINAPI D3DXCreateEffectEx(struct IDirect3DDevice9 *device, const void *s
 
     *effect = &object->ID3DXEffect_iface;
 
+    /* Must be set to NULL if no compilation error */
+    if (compilation_errors)
+        *compilation_errors = NULL;
+
     TRACE("Created ID3DXEffect %p\n", object);
 
     return D3D_OK;
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c
index 7f238be..83461fd 100644
--- a/dlls/d3dx9_36/tests/effect.c
+++ b/dlls/d3dx9_36/tests/effect.c
@@ -2662,6 +2662,22 @@ static void test_effect_variable_names(IDirect3DDevice9 *device)
     ok(!count, "Release failed %u\n", count);
 }
 
+static void test_effect_compilation_errors(IDirect3DDevice9 *device)
+{
+    ID3DXEffect *effect;
+    ID3DXBuffer *compilation_errors;
+    HRESULT hr;
+
+    /* Test binary effect */
+    compilation_errors = (ID3DXBuffer*)0xdeadbeef;
+    hr = D3DXCreateEffect(device, test_effect_variable_names_blob,
+            sizeof(test_effect_variable_names_blob), NULL, NULL, 0, NULL, &effect, &compilation_errors);
+    ok(hr == D3D_OK, "D3DXCreateEffect failed, got %#x, expected %#x\n", hr, D3D_OK);
+    ok(!compilation_errors, "Returned %p\n", compilation_errors);
+
+    effect->lpVtbl->Release(effect);
+}
+
 START_TEST(effect)
 {
     HWND wnd;
@@ -2698,6 +2714,7 @@ START_TEST(effect)
     test_create_effect_compiler();
     test_effect_parameter_value(device);
     test_effect_variable_names(device);
+    test_effect_compilation_errors(device);
 
     count = IDirect3DDevice9_Release(device);
     ok(count == 0, "The device was not properly freed: refcount %u\n", count);




More information about the wine-patches mailing list