[PATCH vkd3d 1/8] vkd3d-shader/hlsl: Detect missing loads on rhs when splitting copies of non-numeric types.

Giovanni Mascellani gmascellani at codeweavers.com
Thu Apr 28 08:31:58 CDT 2022


From: Francisco Casas <fcasas at codeweavers.com>

Otherwise we can get failed assertions:
assert(node->type == HLSL_IR_LOAD);
because broadcasts to these types are not implemented yet.

Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
---
 libs/vkd3d-shader/hlsl_codegen.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c
index e945b94d..f7396a96 100644
--- a/libs/vkd3d-shader/hlsl_codegen.c
+++ b/libs/vkd3d-shader/hlsl_codegen.c
@@ -637,6 +637,12 @@ static bool split_array_copies(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
     element_type = type->e.array.type;
     element_size = hlsl_type_get_array_element_reg_size(element_type);
 
+    if (rhs->type != HLSL_IR_LOAD)
+    {
+        hlsl_fixme(ctx, &instr->loc, "Array store rhs is not HLSL_IR_LOAD. Broadcast may be missing.");
+        return false;
+    }
+
     for (i = 0; i < type->e.array.elements_count; ++i)
     {
         if (!split_copy(ctx, store, hlsl_ir_load(rhs), i * element_size, element_type))
@@ -667,6 +673,12 @@ static bool split_struct_copies(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
     if (type->type != HLSL_CLASS_STRUCT)
         return false;
 
+    if (rhs->type != HLSL_IR_LOAD)
+    {
+        hlsl_fixme(ctx, &instr->loc, "Struct store rhs is not HLSL_IR_LOAD. Broadcast may be missing.");
+        return false;
+    }
+
     LIST_FOR_EACH_ENTRY(field, type->e.elements, struct hlsl_struct_field, entry)
     {
         if (!split_copy(ctx, store, hlsl_ir_load(rhs), field->reg_offset, field->type))
-- 
2.36.0




More information about the wine-devel mailing list