d3d10: Improve parse_fx10_type().

This commit is contained in:
Rico Schüller 2009-10-25 17:11:46 +01:00 committed by Alexandre Julliard
parent 22d8fc081a
commit 7e1ad91ea4
1 changed files with 80 additions and 60 deletions

View File

@ -352,6 +352,8 @@ static HRESULT parse_fx10_type(struct d3d10_effect_type *t, const char *ptr, con
{
DWORD unknown0;
DWORD offset;
DWORD typeinfo;
unsigned int i;
read_dword(&ptr, &offset);
TRACE("Type name at offset %#x.\n", offset);
@ -378,30 +380,43 @@ static HRESULT parse_fx10_type(struct d3d10_effect_type *t, const char *ptr, con
read_dword(&ptr, &t->size_packed);
TRACE("Packed size %#x.\n", t->size_packed);
if (unknown0 == 1)
switch (unknown0)
{
DWORD tmp;
case 1:
t->member_count = 0;
read_dword(&ptr, &tmp);
t->column_count = (tmp & D3D10_FX10_TYPE_COLUMN_MASK) >> D3D10_FX10_TYPE_COLUMN_SHIFT;
t->row_count = (tmp & D3D10_FX10_TYPE_ROW_MASK) >> D3D10_FX10_TYPE_ROW_SHIFT;
t->basetype = d3d10_variable_type((tmp & D3D10_FX10_TYPE_BASETYPE_MASK) >> D3D10_FX10_TYPE_BASETYPE_SHIFT, FALSE);
t->type_class = d3d10_variable_class((tmp & D3D10_FX10_TYPE_CLASS_MASK) >> D3D10_FX10_TYPE_CLASS_SHIFT, tmp & D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK);
read_dword(&ptr, &typeinfo);
t->column_count = (typeinfo & D3D10_FX10_TYPE_COLUMN_MASK) >> D3D10_FX10_TYPE_COLUMN_SHIFT;
t->row_count = (typeinfo & D3D10_FX10_TYPE_ROW_MASK) >> D3D10_FX10_TYPE_ROW_SHIFT;
t->basetype = d3d10_variable_type((typeinfo & D3D10_FX10_TYPE_BASETYPE_MASK) >> D3D10_FX10_TYPE_BASETYPE_SHIFT, FALSE);
t->type_class = d3d10_variable_class((typeinfo & D3D10_FX10_TYPE_CLASS_MASK) >> D3D10_FX10_TYPE_CLASS_SHIFT, typeinfo & D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK);
TRACE("Type description: %#x.\n", tmp);
TRACE("Type description: %#x.\n", typeinfo);
TRACE("\tcolumns: %u.\n", t->column_count);
TRACE("\trows: %u.\n", t->row_count);
TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
TRACE("\tunknown bits: %#x.\n", tmp & ~(D3D10_FX10_TYPE_COLUMN_MASK | D3D10_FX10_TYPE_ROW_MASK
TRACE("\tunknown bits: %#x.\n", typeinfo & ~(D3D10_FX10_TYPE_COLUMN_MASK | D3D10_FX10_TYPE_ROW_MASK
| D3D10_FX10_TYPE_BASETYPE_MASK | D3D10_FX10_TYPE_CLASS_MASK | D3D10_FX10_TYPE_MATRIX_COLUMN_MAJOR_MASK));
}
else if (unknown0 == 3)
{
unsigned int i;
break;
case 2:
TRACE("Type is an object.\n");
t->member_count = 0;
t->column_count = 0;
t->row_count = 0;
t->type_class = D3D10_SVC_OBJECT;
read_dword(&ptr, &typeinfo);
t->basetype = d3d10_variable_type(typeinfo, TRUE);
TRACE("Type description: %#x.\n", typeinfo);
TRACE("\tbasetype: %s.\n", debug_d3d10_shader_variable_type(t->basetype));
TRACE("\tclass: %s.\n", debug_d3d10_shader_variable_class(t->type_class));
break;
case 3:
TRACE("Type is a structure.\n");
read_dword(&ptr, &t->member_count);
@ -456,6 +471,11 @@ static HRESULT parse_fx10_type(struct d3d10_effect_type *t, const char *ptr, con
return E_FAIL;
}
}
break;
default:
FIXME("Unhandled case %#x.\n", unknown0);
return E_FAIL;
}
if (t->element_count)