[PATCH vkd3d 2/7] vkd3d-shader: Handle arrayed builtin inputs.
Conor McCarthy
cmccarthy at codeweavers.com
Wed Sep 22 23:55:42 CDT 2021
Prevents a crash in RADV when such inputs are present.
>From a vkd3d-proton patch by Hans-Kristian Arntzen.
Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
---
libs/vkd3d-shader/spirv.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index 20744fe7..b070230a 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -4604,6 +4604,16 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
val_id = vkd3d_spirv_build_op_in_bounds_access_chain1(builder, ptr_type_id, input_id, index);
dst_reg.idx[0].offset = i;
}
+ else if (builtin && builtin->spirv_array_size >= 1)
+ {
+ /* The DXBC builtin is not an array, but the SPIR-V builtin is an array, so
+ * we'll need to index into the builtin when we try to load it.
+ * This happens when we try to read TessLevel in domain shader. */
+ ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassInput, type_id);
+ index = vkd3d_dxbc_compiler_get_constant_uint(compiler, builtin->member_idx);
+ val_id = vkd3d_spirv_build_op_in_bounds_access_chain1(builder, ptr_type_id, input_id, index);
+ dst_reg.idx[0].offset = reg_idx + i;
+ }
val_id = vkd3d_spirv_build_op_load(builder, type_id, val_id, SpvMemoryAccessMaskNone);
if (builtin && builtin->fixup_pfn)
--
2.32.0
More information about the wine-devel
mailing list