Commit 67f6073b authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dx9: Handle D3DXCONSTTABLE_LARGEADDRESSAWARE flag.

parent 514bac00
......@@ -681,11 +681,13 @@ HRESULT WINAPI D3DXPreprocessShaderFromResourceW(HMODULE module, const WCHAR *re
}
struct ID3DXConstantTableImpl {
struct ID3DXConstantTableImpl
{
ID3DXConstantTable ID3DXConstantTable_iface;
LONG ref;
char *ctab;
DWORD size;
DWORD flags;
D3DXCONSTANTTABLE_DESC desc;
struct ctab_constant *constants;
};
......@@ -860,6 +862,9 @@ static inline struct ctab_constant *get_valid_constant(struct ID3DXConstantTable
if (c) return c;
}
if (table->flags & D3DXCONSTTABLE_LARGEADDRESSAWARE)
return NULL;
return get_constant_by_name(table, NULL, handle);
}
......@@ -1959,9 +1964,10 @@ HRESULT WINAPI D3DXGetShaderConstantTableEx(const DWORD *byte_code, DWORD flags,
const D3DXSHADER_CONSTANTINFO *constant_info;
DWORD i;
TRACE("byte_code %p, flags %x, constant_table %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 (constant_table)
*constant_table = NULL;
if (!byte_code || !constant_table)
{
......@@ -1975,7 +1981,8 @@ HRESULT WINAPI D3DXGetShaderConstantTableEx(const DWORD *byte_code, DWORD flags,
return D3D_OK;
}
if (flags) FIXME("Flags (%#x) are not handled, yet!\n", flags);
if (flags & ~D3DXCONSTTABLE_LARGEADDRESSAWARE)
FIXME("Flags %#x not handled.\n", flags);
hr = D3DXFindShaderComment(byte_code, MAKEFOURCC('C','T','A','B'), &data, &size);
if (hr != D3D_OK)
......@@ -2014,6 +2021,7 @@ HRESULT WINAPI D3DXGetShaderConstantTableEx(const DWORD *byte_code, DWORD flags,
object->size = size;
memcpy(object->ctab, data, object->size);
object->flags = flags;
object->desc.Creator = ctab_header->Creator ? object->ctab + ctab_header->Creator : NULL;
object->desc.Version = ctab_header->Version;
object->desc.Constants = ctab_header->Constants;
......
......@@ -556,6 +556,34 @@ static void test_get_shader_constant_table_ex(void)
ID3DXConstantTable_Release(constant_table);
hr = D3DXGetShaderConstantTableEx(shader_with_ctab_constants, D3DXCONSTTABLE_LARGEADDRESSAWARE, &constant_table);
ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr);
ok(!!constant_table, "Unexpected constant table %p.\n", constant_table);
hr = ID3DXConstantTable_GetDesc(constant_table, &desc);
ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr);
ok(!strcmp(desc.Creator, "Wine project"), "Unexpected Creator %s.\n", debugstr_a(desc.Creator));
ok(desc.Version == D3DVS_VERSION(3, 0), "Unexpected Version %#x.\n", desc.Version);
ok(desc.Constants == 3, "Unexpected Constants %u.\n", desc.Constants);
constant = ID3DXConstantTable_GetConstant(constant_table, NULL, 0);
ok(!!constant, "No constant found.\n");
hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &constant_desc, &nb);
ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr);
ok(!strcmp(constant_desc.Name, "Constant1"), "Unexpected Name %s.\n", debugstr_a(constant_desc.Name));
ok(constant_desc.Class == D3DXPC_VECTOR, "Unexpected Class %u.\n", constant_desc.Class);
ok(constant_desc.Type == D3DXPT_FLOAT, "Unexpected Type %u.\n", constant_desc.Type);
ok(constant_desc.Rows == 1, "Unexpected Rows %u.\n", constant_desc.Rows);
ok(constant_desc.Columns == 4, "Unexpected Columns %u.\n", constant_desc.Columns);
if (0)
{
/* Native d3dx crashes with this. */
hr = ID3DXConstantTable_GetConstantDesc(constant_table, "Constant3", &constant_desc, &nb);
}
ID3DXConstantTable_Release(constant_table);
hr = D3DXGetShaderConstantTableEx(fx_shader_with_ctab, 0, &constant_table);
ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
ok(!constant_table, "D3DXGetShaderConstantTableEx() returned a non-NULL constant table.\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment