[PATCH vkd3d 3/5] vkd3d-shader/hlsl: Write SM4 negation instructions.

Matteo Bruni matteo.mystral at gmail.com
Wed Sep 1 03:27:13 CDT 2021


On Wed, Sep 1, 2021 at 3:24 AM Zebediah Figura (she/her)
<zfigura at codeweavers.com> wrote:
>
> On 8/31/21 6:33 PM, Matteo Bruni wrote:
> > On Mon, Aug 30, 2021 at 7:21 PM Zebediah Figura <zfigura at codeweavers.com> wrote:
> >>
> >> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
> >> ---
> >>   Makefile.am                  |  5 +----
> >>   libs/vkd3d-shader/hlsl_sm4.c | 32 ++++++++++++++++++++++++++++++++
> >>   2 files changed, 33 insertions(+), 4 deletions(-)
> >
> >> diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c
> >> index ace2eb66..160da47f 100644
> >> --- a/libs/vkd3d-shader/hlsl_sm4.c
> >> +++ b/libs/vkd3d-shader/hlsl_sm4.c
> >> @@ -561,6 +561,7 @@ struct sm4_register
> >>       unsigned int idx_count;
> >>       enum vkd3d_sm4_dimension dim;
> >>       uint32_t immconst_uint[4];
> >> +    unsigned int mod;
> >>   };
> >>
> >>   struct sm4_instruction
> >> @@ -710,6 +711,8 @@ static uint32_t sm4_register_order(const struct sm4_register *reg)
> >>       if (reg->type == VKD3D_SM4_RT_IMMCONST)
> >>           order += reg->dim == VKD3D_SM4_DIMENSION_VEC4 ? 4 : 1;
> >>       order += reg->idx_count;
> >> +    if (reg->mod)
> >> +        ++order;
> >>       return order;
> >>   }
> >
> > Something that came to my mind at least twice while looking at that
> > function... Do you know e.g. by random looks to DXC's sources what the
> > size of a register in the bytecode is supposed to be called? "Order"
> > feels like a curious choice for a name.
> >
> > No need to go investigate, just wondering if you happened to see anything.
> >
>
> I recently discovered that the SM4 format is effectively documented in
> headers released with the DDK, namely "d3d10tokenizedprogramformat.hpp"
> and similar. Anyway, their version of SM4_REGISTER_ORDER_* is
> D3D10_SB_OPERAND_INDEX_DIMENSION_*.

Oh, excellent! I'll have a look at some point.
No reason to change everything now, but going forward it's probably a
good idea to make more informed decisions so to use the same naming
principles as the original.



More information about the wine-devel mailing list