Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/ir.c:
- unsigned int components_read = 3 + (parser->shader_version.major >= 2);
- unsigned int tmp_idx = ~0u;
- unsigned int i, k;
- for (i = 0; i < instructions->count; ++i)
- {
texkill_ins = &instructions->elements[i];
if (texkill_ins->handler_idx != VKD3DSIH_TEXKILL)
continue;
if (!shader_instruction_array_insert_at(instructions, i + 1, components_read + 1))
return VKD3D_ERROR_OUT_OF_MEMORY;
if (tmp_idx == ~0u)
tmp_idx = parser->shader_desc.temp_count++;
Right now you're also supposed to update the DCL_TEMPS instruction (and add it if it's not there). Since @cmccarthy is having the same problem in !564 too and I'm going to need it soon too, I think we could handle this problem in a uniform way: * either we add a preliminary pass that adds `dcl_temps 0` if there is no DCL_TEMPS around (and then everybody increments it just like we do for `temp_count`); * or we add a preliminary pass that removes any DCL_TEMPS around and then rely just on `temp_count`; this would require some minor changes to the validator.
I would vote for the second one.