d3dcompiler: Set the x-dimension for struct types.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c6c0601396
commit
d9db4beb3b
|
@ -808,6 +808,13 @@ static struct list *gen_struct_fields(struct hlsl_type *type, DWORD modifiers, s
|
|||
return list;
|
||||
}
|
||||
|
||||
static DWORD get_array_size(const struct hlsl_type *type)
|
||||
{
|
||||
if (type->type == HLSL_CLASS_ARRAY)
|
||||
return get_array_size(type->e.array.type) * type->e.array.elements_count;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static struct hlsl_type *new_struct_type(const char *name, struct list *fields)
|
||||
{
|
||||
struct hlsl_type *type = d3dcompiler_alloc(sizeof(*type));
|
||||
|
@ -822,13 +829,15 @@ static struct hlsl_type *new_struct_type(const char *name, struct list *fields)
|
|||
type->type = HLSL_CLASS_STRUCT;
|
||||
type->base_type = HLSL_TYPE_VOID;
|
||||
type->name = name;
|
||||
type->dimx = type->dimy = 1;
|
||||
type->dimx = 0;
|
||||
type->dimy = 1;
|
||||
type->e.elements = fields;
|
||||
|
||||
LIST_FOR_EACH_ENTRY(field, fields, struct hlsl_struct_field, entry)
|
||||
{
|
||||
field->reg_offset = reg_size;
|
||||
reg_size += field->type->reg_size;
|
||||
type->dimx += field->type->dimx * field->type->dimy * get_array_size(field->type);
|
||||
}
|
||||
type->reg_size = reg_size;
|
||||
|
||||
|
|
|
@ -889,7 +889,7 @@ static void test_constant_table(void)
|
|||
"uniform struct\n"
|
||||
"{\n"
|
||||
" float2x2 a;\n"
|
||||
" float b;\n"
|
||||
" float b[2];\n"
|
||||
" float c;\n"
|
||||
"#pragma pack_matrix(row_major)\n"
|
||||
" float2x2 d;\n"
|
||||
|
@ -919,7 +919,7 @@ static void test_constant_table(void)
|
|||
{"c", D3DXRS_FLOAT4, 0, 1, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 1, 1, 0, 12},
|
||||
{"d", D3DXRS_FLOAT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12},
|
||||
{"e", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4},
|
||||
{"f", D3DXRS_FLOAT4, 0, 6, D3DXPC_STRUCT, D3DXPT_VOID, 1, 10, 1, 4, 40},
|
||||
{"f", D3DXRS_FLOAT4, 0, 7, D3DXPC_STRUCT, D3DXPT_VOID, 1, 11, 1, 4, 44},
|
||||
{"g", D3DXRS_FLOAT4, 0, 5, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 2, 5, 0, 40},
|
||||
{"i", D3DXRS_FLOAT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 3, 1, 0, 36},
|
||||
{"j", D3DXRS_FLOAT4, 0, 3, D3DXPC_STRUCT, D3DXPT_VOID, 1, 9, 1, 1, 36},
|
||||
|
@ -928,7 +928,7 @@ static void test_constant_table(void)
|
|||
static const D3DXCONSTANT_DESC expect_fields_f[] =
|
||||
{
|
||||
{"a", D3DXRS_FLOAT4, 0, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 2, 2, 1, 0, 16},
|
||||
{"b", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4},
|
||||
{"b", D3DXRS_FLOAT4, 0, 2, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 2, 0, 8},
|
||||
{"c", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4},
|
||||
{"d", D3DXRS_FLOAT4, 0, 2, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 2, 1, 0, 16},
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue