Commit 8b5cd9ed authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dx9: Always use type->Rows as D3DXPC_MATRIX_ROWS parameters size.

parent c6fefc20
......@@ -1775,7 +1775,7 @@ static const struct ID3DXConstantTableVtbl ID3DXConstantTable_Vtbl =
};
static HRESULT parse_ctab_constant_type(const char *ctab, DWORD typeoffset, struct ctab_constant *constant,
BOOL is_element, WORD index, WORD max, DWORD *offset, DWORD nameoffset, UINT regset)
BOOL is_element, WORD index, WORD max_index, DWORD *offset, DWORD nameoffset, UINT regset)
{
const D3DXSHADER_TYPEINFO *type = (LPD3DXSHADER_TYPEINFO)(ctab + typeoffset);
const D3DXSHADER_STRUCTMEMBERINFO *memberinfo = NULL;
......@@ -1824,7 +1824,7 @@ static HRESULT parse_ctab_constant_type(const char *ctab, DWORD typeoffset, stru
for (i = 0; i < count; ++i)
{
hr = parse_ctab_constant_type(ctab, memberinfo ? memberinfo[i].TypeInfo : typeoffset,
&constant->constants[i], memberinfo == NULL, index + size, max, offset,
&constant->constants[i], memberinfo == NULL, index + size, max_index, offset,
memberinfo ? memberinfo[i].Name : nameoffset, regset);
if (hr != D3D_OK)
goto error;
......@@ -1859,7 +1859,7 @@ static HRESULT parse_ctab_constant_type(const char *ctab, DWORD typeoffset, stru
case D3DXPC_MATRIX_ROWS:
offsetdiff = type->Rows * 4;
size = is_element ? type->Rows : max(type->Rows, type->Columns);
size = type->Rows;
break;
case D3DXPC_MATRIX_COLUMNS:
......@@ -1893,7 +1893,7 @@ static HRESULT parse_ctab_constant_type(const char *ctab, DWORD typeoffset, stru
if (offset) *offset += offsetdiff * 4;
}
constant->desc.RegisterCount = max(0, min(max - index, size));
constant->desc.RegisterCount = max(0, min(max_index - index, size));
constant->desc.Bytes = 4 * constant->desc.Elements * type->Rows * type->Columns;
return D3D_OK;
......
......@@ -120,7 +120,7 @@ static const DWORD ctab_matrices[] = {
0x000000ac,
0x00000058, 0x00070002, 0x00000001, 0x00000064, 0x00000000, /* Constant 1 desc (fmatrix3x1) */
0x00000074, 0x00000002, 0x00000004, 0x00000080, 0x00000000, /* Constant 2 desc (fmatrix4x4) */
0x00000090, 0x00040002, 0x00000003, 0x0000009c, 0x00000000, /* Constant 3 desc (imatrix2x3) */
0x00000090, 0x00040002, 0x00000002, 0x0000009c, 0x00000000, /* Constant 3 desc (imatrix2x3) */
0x74616D66, 0x33786972, 0xab003178, /* Constant 1 name */
0x00030003, 0x00010003, 0x00000001, 0x00000000, /* Constant 1 type desc */
0x74616D66, 0x34786972, 0xab003478, /* Constant 2 name */
......@@ -133,8 +133,9 @@ static const DWORD ctab_matrices[] = {
static const D3DXCONSTANT_DESC ctab_matrices_expected[] = {
{"fmatrix4x4", D3DXRS_FLOAT4, 0, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 4, 4, 1, 0, 64, NULL},
{"imatrix2x3", D3DXRS_FLOAT4, 4, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 1, 0, 24, NULL},
{"fmatrix3x1", D3DXRS_FLOAT4, 7, 1, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}};
{"imatrix2x3", D3DXRS_FLOAT4, 4, 2, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 1, 0, 24, NULL},
{"fmatrix3x1", D3DXRS_FLOAT4, 7, 1, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL},
};
static const DWORD ctab_matrices2[] = {
0xfffe0200, /* vs_2_0 */
......
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