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

Matteo Bruni matteo.mystral at gmail.com
Wed Nov 17 04:17:33 CST 2021


On Wed, Nov 17, 2021 at 11:04 AM Giovanni Mascellani
<gmascellani at codeweavers.com> wrote:
>
> 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.

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.



More information about the wine-devel mailing list