[PATCH 1/5] d3dcompiler: Allow casts to arrays.
Matteo Bruni
mbruni at codeweavers.com
Fri Sep 21 09:25:55 CDT 2012
---
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 eea49be..7bce054 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 84443ae..cc35ce9 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 "<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);
if (type->type == HLSL_CLASS_SCALAR)
--
1.7.8.6
More information about the wine-patches
mailing list