Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/ir.c:
+ memmove(®->idx[1], ®->idx[0], reg->idx_count * sizeof(reg->idx[0])); + memset(®->idx[0], 0, sizeof(reg->idx[0])); + ++reg->idx_count; + + if (vsir_write_mask_component_count(write_mask) == 1) + { + reg->idx[0].offset = array_offset + vsir_swizzle_get_component(src_param->swizzle, + vsir_write_mask_get_component_idx(write_mask)); + src_param->swizzle = 0; + return; + } + + for (i = 0, handled_mask = 0; i < VKD3D_VEC4_SIZE; ++i) + { + if (!(write_mask & (1u << i))) + continue; That said, though, the write mask logic here assumes that all instructions consuming clip/cull behave like mov with respect to write mask. Is that actually valid? E.g. for a somewhat pathological example, the coords argument of SAMPLE doesn't.
If the point is to avoid writing any out of bounds accesses (i.e. component_idx >= signature->s[element_idx].register_count), should we instead just replace such out of bounds accesses with zero or something? -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/564#note_62266