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

Giovanni Mascellani gmascellani at codeweavers.com
Mon Apr 18 01:34:06 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>
---
 libs/vkd3d-shader/hlsl_codegen.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c
index 73e3b73f..2104c48b 100644
--- a/libs/vkd3d-shader/hlsl_codegen.c
+++ b/libs/vkd3d-shader/hlsl_codegen.c
@@ -628,6 +628,13 @@ 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_error(ctx, &instr->loc, VKD3D_SHADER_ERROR_HLSL_NOT_IMPLEMENTED,
+                "array store rhs is not HLSL_IR_LOAD, missing broadcast?");
+        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))
@@ -658,6 +665,13 @@ 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_error(ctx, &instr->loc, VKD3D_SHADER_ERROR_HLSL_NOT_IMPLEMENTED,
+                "struct store rhs is not HLSL_IR_LOAD, missing broadcast?");
+        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.35.2




More information about the wine-devel mailing list