d3dcompiler: Allow casts to arrays.

This commit is contained in:
Matteo Bruni 2012-09-21 16:25:55 +02:00 committed by Alexandre Julliard
parent 1acf5a0401
commit 76525af7f1
2 changed files with 19 additions and 3 deletions

View File

@ -1488,7 +1488,10 @@ unary_expr: postfix_expr
return 1; return 1;
} }
dst_type = $3; if ($4)
dst_type = new_array_type($3, $4);
else
dst_type = $3;
if (!compatible_data_types(src_type, dst_type)) if (!compatible_data_types(src_type, dst_type))
{ {

View File

@ -854,8 +854,15 @@ struct hlsl_type *new_hlsl_type(const char *name, enum hlsl_type_class type_clas
struct hlsl_type *new_array_type(struct hlsl_type *basic_type, unsigned int array_size) struct hlsl_type *new_array_type(struct hlsl_type *basic_type, unsigned int array_size)
{ {
FIXME("stub.\n"); struct hlsl_type *type = new_hlsl_type(NULL, HLSL_CLASS_ARRAY, HLSL_TYPE_FLOAT, 1, 1);
return NULL;
if (!type)
return NULL;
type->modifiers = basic_type->modifiers;
type->e.array.elements_count = array_size;
type->e.array.type = basic_type;
return type;
} }
struct hlsl_type *get_type(struct hlsl_scope *scope, const char *name, BOOL recursive) struct hlsl_type *get_type(struct hlsl_scope *scope, const char *name, BOOL recursive)
@ -1791,6 +1798,12 @@ const char *debug_hlsl_type(const struct hlsl_type *type)
if (type->type == HLSL_CLASS_STRUCT) if (type->type == HLSL_CLASS_STRUCT)
return "<anonymous struct>"; return "<anonymous struct>";
if (type->type == HLSL_CLASS_ARRAY)
{
name = debug_base_type(type->e.array.type);
return wine_dbg_sprintf("%s[%u]", name, type->e.array.elements_count);
}
name = debug_base_type(type); name = debug_base_type(type);
if (type->type == HLSL_CLASS_SCALAR) if (type->type == HLSL_CLASS_SCALAR)