From 76525af7f1ecdb8f295fc9a7f3b1afebbd68ed49 Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Fri, 21 Sep 2012 16:25:55 +0200 Subject: [PATCH] d3dcompiler: Allow casts to arrays. --- dlls/d3dcompiler_43/hlsl.y | 5 ++++- dlls/d3dcompiler_43/utils.c | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index eea49be7677..7bce0544c32 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -1488,7 +1488,10 @@ unary_expr: postfix_expr 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)) { diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c index 84443ae6924..cc35ce97d40 100644 --- a/dlls/d3dcompiler_43/utils.c +++ b/dlls/d3dcompiler_43/utils.c @@ -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) { - FIXME("stub.\n"); - return NULL; + struct hlsl_type *type = new_hlsl_type(NULL, HLSL_CLASS_ARRAY, HLSL_TYPE_FLOAT, 1, 1); + + 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) @@ -1791,6 +1798,12 @@ const char *debug_hlsl_type(const struct hlsl_type *type) if (type->type == HLSL_CLASS_STRUCT) return ""; + 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); if (type->type == HLSL_CLASS_SCALAR) -- 2.11.4.GIT