Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/dxil.c:
+ instruction_init_with_resource(ins, is_texture ? VKD3DSIH_RESINFO : VKD3DSIH_BUFINFO, resource, sm6); + + if (!(src_params = instruction_src_params_alloc(ins, 1 + is_texture, sm6))) + return; + src_param_init_vector_from_reg(&src_params[is_texture], &resource->u.handle.reg); + + if (is_texture) + { + /* DXIL does not have an instrinsic for sample info, and resinfo is expected to return + * the sample count in .w for MS textures. The result is always a struct of 4 x uint32. */ + ins->flags = VKD3DSI_RESINFO_UINT; + src_param_init_from_value(&src_params[0], operands[1]); + component_count = VKD3D_VEC4_SIZE; + + instruction_dst_param_init_temp_vector(ins++, sm6); + state->temp_idx = 1; This feels fragile: if in the future somewhere else `r1` is used and `temp_idx = 2` is put somewhere else, then the reference `r1` becomes illegal. Maybe setting `temp_idx` should filter with a `max()` and be moved inside `instruction_dst_param_init_temp_vector()`?
-- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/629#note_61405