From: Francisco Casas fcasas@codeweavers.com
--- libs/vkd3d-shader/hlsl.y | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 03004c60..c8bf75e7 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -148,14 +148,27 @@ static void check_invalid_matrix_modifiers(struct hlsl_ctx *ctx, DWORD modifiers "'row_major' and 'column_major' modifiers are only allowed for matrices."); }
-static bool convertible_data_type(struct hlsl_type *type) +static bool type_contains_only_numerics(struct hlsl_type *type) { - return type->type != HLSL_CLASS_OBJECT; + unsigned int i; + + if (type->type == HLSL_CLASS_ARRAY) + return type_contains_only_numerics(type->e.array.type); + if (type->type == HLSL_CLASS_STRUCT) + { + for (i = 0; i < type->e.record.field_count; ++i) + { + if (!type_contains_only_numerics(type->e.record.fields[i].type)) + return false; + } + return true; + } + return type->type <= HLSL_CLASS_LAST_NUMERIC; }
static bool compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t2) { - if (!convertible_data_type(t1) || !convertible_data_type(t2)) + if (!type_contains_only_numerics(t1) || !type_contains_only_numerics(t2)) return false;
if (t1->type <= HLSL_CLASS_LAST_NUMERIC) @@ -209,7 +222,7 @@ static bool compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t2)
static bool implicit_compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t2) { - if (!convertible_data_type(t1) || !convertible_data_type(t2)) + if (!type_contains_only_numerics(t1) || !type_contains_only_numerics(t2)) return false;
if (t1->type <= HLSL_CLASS_LAST_NUMERIC)