Francisco Casas (@fcasas) commented about libs/vkd3d-shader/tpf.c:
struct signature_element *e = &output_signature->elements[i]; if (version.type == VKD3D_SHADER_TYPE_PIXEL
&& ascii_strcasecmp(e->semantic_name, "SV_Target"))
&& ascii_strcasecmp(e->semantic_name, "SV_Target")
&& ascii_strcasecmp(e->semantic_name, "COLOR"))
Ok, took me a while to find out the implications of this.
So, this for loop has the purpose of initializing sm4->output_map[] when reading dxbc-tpf binaries.
And this array is used to translate, for pixel shaders, references to the output registers (VKD3DSPR_OUTPUT) to the VKD3DSPR_COLOROUT registers, using the semantic_index as offset, in map_register().
So, if we find a say, "COLOR2" semantic in the output signature of a SM4 pixel shader binary we would be correctly mapping the arbitrary output register to VKD3DSPR_COLOROUT2 after reading the shader.
I am not sure this change is necessary.
My understanding is that the "COLOR" semantic is invalid as a ps_4_0 output semantic, except when compatibility mode is used, and in this case it is written as "SV_Target", so no dxbc-tpf **pixel shader** binary should have "COLOR" as a semantic on its output signature.