Note that there's also a subtle difference between shader model 1 texkill and shader model 2+ texkill: SM2+ texkill always compares all four components of the destination register, while SM1 texkill always compares the first three components of the destination register. See also texkill_test() in Wine's d3d9 tests, and shader_glsl_texkill() in wined3d.
I see, the documentation only mentions the first 3 components. I added the missing 4th component to the check, since we are not supporting SM1.
The HLSL compiler may not support outputting shader model 1 bytecode, but we certainly want to support it as input for e.g. d3dbc->spirv compilation.
+ assert(texkill_ins->dst_count == 1); + assert(texkill_ins->src_count == 0);
What allows us to make those assertions?
+ /* tmp = ins->src[0] < 0 */ + + ins = texkill_ins + 1; + if (!vsir_instruction_init_with_params(parser, ins, &texkill_ins->location, VKD3DSIH_LTO, 1, 2)) + return VKD3D_ERROR_OUT_OF_MEMORY; + + vsir_register_init(&ins->dst[0].reg, VKD3DSPR_TEMP, VKD3D_DATA_INT, 1); + ins->dst[0].reg.dimension = VSIR_DIMENSION_VEC4; + ins->dst[0].reg.idx[0].offset = tmp_idx; + ins->dst[0].write_mask = VKD3DSP_WRITEMASK_ALL; + + ins->src[0].reg = texkill_ins->dst[0].reg; + vsir_register_init(&ins->src[1].reg, VKD3DSPR_IMMCONST, VKD3D_DATA_FLOAT, 0); + ins->src[1].reg.dimension = VSIR_DIMENSION_VEC4; + ins->src[1].reg.u.immconst_f32[0] = 0.0f; + ins->src[1].reg.u.immconst_f32[1] = 0.0f; + ins->src[1].reg.u.immconst_f32[2] = 0.0f; + ins->src[1].reg.u.immconst_f32[3] = 0.0f;
That's better, but note that the comment still references "src[0]".