[PATCH vkd3d v3 2/7] vkd3d-shader/hlsl: Allocate enough space for temporary matrices.

Giovanni Mascellani gmascellani at codeweavers.com
Thu Jun 2 09:06:04 CDT 2022


Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
If this is reverted on top of "Lower numeric casts", then the shader
runner crashes with:

  shader_runner: ../vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h:1165: vkd3d_write_mask_component_count: Assertion `1 <= count && count <= VKD3D_VEC4_SIZE' failed.

While the HLSL copiler is expected to output correct programs, the DXBC
parser should not crash on malformed inputs anyway, so there is a bug
to be fixed there too.

v2:
* Use hlsl_type_component_count()
---
 libs/vkd3d-shader/hlsl_codegen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c
index 78b22910..e38660af 100644
--- a/libs/vkd3d-shader/hlsl_codegen.c
+++ b/libs/vkd3d-shader/hlsl_codegen.c
@@ -1348,7 +1348,7 @@ static void allocate_variable_temp_register(struct hlsl_ctx *ctx, struct hlsl_ir
                     var->last_read, var->data_type->reg_size);
         else
             var->reg = allocate_register(ctx, liveness, var->first_write,
-                    var->last_read, var->data_type->dimx);
+                    var->last_read, hlsl_type_component_count(var->data_type));
         TRACE("Allocated %s to %s (liveness %u-%u).\n", var->name,
                 debug_register('r', var->reg, var->data_type), var->first_write, var->last_read);
     }
-- 
2.36.1




More information about the wine-devel mailing list