[PATCH vkd3d 4/8] vkd3d-shader/hlsl: Write SM4 constant buffer declarations.

Matteo Bruni matteo.mystral at gmail.com
Sun Aug 22 14:13:56 CDT 2021


On Fri, Aug 20, 2021 at 1:45 AM Zebediah Figura <zfigura at codeweavers.com> wrote:
>
> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
> ---
>  libs/vkd3d-shader/hlsl_sm4.c | 116 +++++++++++++++++++++++++++++++++++
>  1 file changed, 116 insertions(+)
>
> diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c
> index 894c513f..029dc3de 100644
> --- a/libs/vkd3d-shader/hlsl_sm4.c
> +++ b/libs/vkd3d-shader/hlsl_sm4.c
> @@ -549,10 +549,120 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc)
>      dxbc_writer_add_section(dxbc, TAG_RDEF, buffer.data, buffer.size);
>  }
>
> +struct sm4_register
> +{
> +    enum vkd3d_sm4_register_type type;
> +    uint32_t idx[2];
> +    unsigned int idx_count;
> +    enum vkd3d_sm4_dimension dim;
> +};
> +
> +struct sm4_instruction
> +{
> +    enum vkd3d_sm4_opcode opcode;
> +
> +    struct
> +    {
> +        struct sm4_register reg;
> +        unsigned int writemask;
> +    } dst;
> +
> +    struct
> +    {
> +        struct sm4_register reg;
> +        unsigned int swizzle;
> +    } srcs[2];
> +    unsigned int src_count;
> +
> +    unsigned int has_dst;
> +};

I think there are SM4 instructions with 2 dest registers. Just
something to keep in mind for the future.



More information about the wine-devel mailing list