Module: wine Branch: master Commit: a847b9dddb3875b4189104f02dbf319be8274803 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a847b9dddb3875b4189104f02d...
Author: Rico Schüller kgbricola@web.de Date: Mon Jan 7 21:57:13 2013 +0100
d3dx9: Always set the table = NULL in D3DXGetShaderConstantTableEx().
---
dlls/d3dx9_36/shader.c | 4 +++- dlls/d3dx9_36/tests/shader.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c index 9269237..e266fe2 100644 --- a/dlls/d3dx9_36/shader.c +++ b/dlls/d3dx9_36/shader.c @@ -1629,7 +1629,9 @@ HRESULT WINAPI D3DXGetShaderConstantTableEx(const DWORD *byte_code, DWORD flags, D3DXSHADER_CONSTANTINFO* constant_info; DWORD i;
- TRACE("(%p, %x, %p)\n", byte_code, flags, constant_table); + TRACE("byte_code %p, flags %x, constant_table %p\n", byte_code, flags, constant_table); + + if (constant_table) *constant_table = NULL;
if (!byte_code || !constant_table) { diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c index 8ec98ba..fb8f270 100644 --- a/dlls/d3dx9_36/tests/shader.c +++ b/dlls/d3dx9_36/tests/shader.c @@ -355,18 +355,22 @@ static void test_find_shader_comment(void)
static void test_get_shader_constant_table_ex(void) { - ID3DXConstantTable *constant_table = NULL; + ID3DXConstantTable *constant_table; HRESULT hr; LPVOID data; DWORD size; D3DXCONSTANTTABLE_DESC desc;
+ constant_table = (ID3DXConstantTable *)0xdeadbeef; hr = D3DXGetShaderConstantTableEx(NULL, 0, &constant_table); ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL); + ok(constant_table == NULL, "D3DXGetShaderConstantTableEx() failed, got %p\n", constant_table);
/* No CTAB data */ + constant_table = (ID3DXConstantTable *)0xdeadbeef; hr = D3DXGetShaderConstantTableEx(simple_ps, 0, &constant_table); ok(hr == D3DXERR_INVALIDDATA, "Got result %x, expected %x (D3DXERR_INVALIDDATA)\n", hr, D3DXERR_INVALIDDATA); + ok(constant_table == NULL, "D3DXGetShaderConstantTableEx() failed, got %p\n", constant_table);
/* With invalid CTAB data */ hr = D3DXGetShaderConstantTableEx(shader_with_invalid_ctab, 0, &constant_table); @@ -376,6 +380,7 @@ static void test_get_shader_constant_table_ex(void)
hr = D3DXGetShaderConstantTableEx(shader_with_ctab, 0, &constant_table); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr); + ok(constant_table != NULL, "D3DXGetShaderConstantTableEx() failed, got NULL\n");
if (constant_table) { @@ -399,8 +404,9 @@ static void test_get_shader_constant_table_ex(void)
hr = D3DXGetShaderConstantTableEx(shader_with_ctab_constants, 0, &constant_table); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr); + ok(constant_table != NULL, "D3DXGetShaderConstantTableEx() failed, got NULL\n");
- if (SUCCEEDED(hr)) + if (constant_table) { D3DXHANDLE constant; D3DXCONSTANT_DESC constant_desc;