d3dx9: Handle invalid byte code in D3DXGetShaderConstantTableEx().
This commit is contained in:
parent
a847b9dddb
commit
6cb4301021
|
@ -1639,6 +1639,12 @@ HRESULT WINAPI D3DXGetShaderConstantTableEx(const DWORD *byte_code, DWORD flags,
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_valid_bytecode(*byte_code))
|
||||||
|
{
|
||||||
|
WARN("Invalid byte_code specified.\n");
|
||||||
|
return D3D_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (flags) FIXME("Flags (%#x) are not handled, yet!\n", flags);
|
if (flags) FIXME("Flags (%#x) are not handled, yet!\n", flags);
|
||||||
|
|
||||||
hr = D3DXFindShaderComment(byte_code, MAKEFOURCC('C','T','A','B'), &data, &size);
|
hr = D3DXFindShaderComment(byte_code, MAKEFOURCC('C','T','A','B'), &data, &size);
|
||||||
|
|
|
@ -366,6 +366,21 @@ static void test_get_shader_constant_table_ex(void)
|
||||||
ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
|
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);
|
ok(constant_table == NULL, "D3DXGetShaderConstantTableEx() failed, got %p\n", constant_table);
|
||||||
|
|
||||||
|
constant_table = (ID3DXConstantTable *)0xdeadbeef;
|
||||||
|
hr = D3DXGetShaderConstantTableEx(shader_zero, 0, &constant_table);
|
||||||
|
ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK);
|
||||||
|
ok(constant_table == NULL, "D3DXGetShaderConstantTableEx() failed, got %p\n", constant_table);
|
||||||
|
|
||||||
|
constant_table = (ID3DXConstantTable *)0xdeadbeef;
|
||||||
|
hr = D3DXGetShaderConstantTableEx(shader_invalid, 0, &constant_table);
|
||||||
|
ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK);
|
||||||
|
ok(constant_table == NULL, "D3DXGetShaderConstantTableEx() failed, got %p\n", constant_table);
|
||||||
|
|
||||||
|
constant_table = (ID3DXConstantTable *)0xdeadbeef;
|
||||||
|
hr = D3DXGetShaderConstantTableEx(shader_empty, 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);
|
||||||
|
|
||||||
/* No CTAB data */
|
/* No CTAB data */
|
||||||
constant_table = (ID3DXConstantTable *)0xdeadbeef;
|
constant_table = (ID3DXConstantTable *)0xdeadbeef;
|
||||||
hr = D3DXGetShaderConstantTableEx(simple_ps, 0, &constant_table);
|
hr = D3DXGetShaderConstantTableEx(simple_ps, 0, &constant_table);
|
||||||
|
|
Loading…
Reference in New Issue