[PATCH vkd3d 2/3] vkd3d-shader/hlsl: Take writemask into account when emitting a SM4 constant.

Giovanni Mascellani gmascellani at codeweavers.com
Wed Nov 17 04:04:12 CST 2021


Hi,

On 17/11/21 10:52, Matteo Bruni wrote:
> That's probably right but it raises all kinds of red flags for me. Why
> is dimx == 1 such a special case (aside from the SCALAR / VEC4
> dimension)? We're basically saying that we ignore the writemask for
> scalar constants. Why?
> 
> The code being convoluted, or mostly duplicated, is a consequence of
> the above. It feels like we should fix that instead.

My understanding is that the special case here is not made by us, but by 
Microsoft: when an immediate is SCALAR instead of VEC4, then it is 
implicitly swizzled to all the components, but that means that it has to 
be always be stored in component 0 (the only one that exists), not in 
the component selected by the writemask.

Note that we're not ignoring the writemask at writing time; here we're 
just formatting the immediate in the right way, and when there is only 
one component, of course, there is no useful information in the 
writemask. You cannot choose between different components if there is 
only one. When the write will be executed, it will still be with the 
right writemask.

Giovanni.



More information about the wine-devel mailing list