Hi,
On 17/11/21 11:22, Matteo Bruni wrote:
An alternative way of seeing it is asking whether instr.dsts[0].writemask is supposed to contain the writemask exactly as it should be output by the compiler or if it should be "our" writemask (which for scalar constants it could usefully have value ".x"). It's okay to pick the former option and accept the complication here but at least we should be aware of the choice we're making.
In the latter case we need to fix up the writemask when generating the bytecode, probably in write_sm4_instruction(). As it turns out we're already doing that, since we only use it for VKD3D_SM4_DIMENSION_VEC4 destinations.
Yeah, I guess we could see it in a different way, but it seems to me that currently the bulk of hlsl_sm4.c is organized around considering write_sm4_instruction essentially a serialization helper (all the callers of write_sm4_instruction "convert" their writemasks before calling it). We can discuss whether we want it this way or another one, but currently it is like that, and the target of this patch was not to change it. It was just to fix a bug.
Giovanni.