[PATCH vkd3d 3/6] vkd3d-shader/hlsl: Declare integer semantics as having constant interpolation.

Giovanni Mascellani gmascellani at codeweavers.com
Wed Mar 23 08:20:05 CDT 2022


Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>

Il 22/03/22 22:59, Zebediah Figura ha scritto:
> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
> ---
>   libs/vkd3d-shader/hlsl_sm4.c | 30 +++++++++++++++---------------
>   1 file changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c
> index 95ea299cf..bc7d966c2 100644
> --- a/libs/vkd3d-shader/hlsl_sm4.c
> +++ b/libs/vkd3d-shader/hlsl_sm4.c
> @@ -25,6 +25,20 @@
>   
>   static void write_sm4_block(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer, const struct hlsl_block *block);
>   
> +static bool type_is_integer(const struct hlsl_type *type)
> +{
> +    switch (type->base_type)
> +    {
> +        case HLSL_TYPE_BOOL:
> +        case HLSL_TYPE_INT:
> +        case HLSL_TYPE_UINT:
> +            return true;
> +
> +        default:
> +            return false;
> +    }
> +}
> +
>   bool hlsl_sm4_register_from_semantic(struct hlsl_ctx *ctx, const struct hlsl_semantic *semantic,
>           bool output, enum vkd3d_sm4_register_type *type, enum vkd3d_sm4_swizzle_type *swizzle_type, bool *has_idx)
>   {
> @@ -1206,7 +1220,7 @@ static void write_sm4_dcl_semantic(struct hlsl_ctx *ctx, struct vkd3d_bytecode_b
>           {
>               enum vkd3d_shader_interpolation_mode mode = VKD3DSIM_LINEAR;
>   
> -            if (var->modifiers & HLSL_STORAGE_NOINTERPOLATION)
> +            if ((var->modifiers & HLSL_STORAGE_NOINTERPOLATION) || type_is_integer(var->data_type))
>                   mode = VKD3DSIM_CONSTANT;
>   
>               instr.opcode |= mode << VKD3D_SM4_INTERPOLATION_MODE_SHIFT;
> @@ -1419,20 +1433,6 @@ static void write_sm4_sample(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer
>       write_sm4_instruction(buffer, &instr);
>   }
>   
> -static bool type_is_integer(const struct hlsl_type *type)
> -{
> -    switch (type->base_type)
> -    {
> -        case HLSL_TYPE_BOOL:
> -        case HLSL_TYPE_INT:
> -        case HLSL_TYPE_UINT:
> -            return true;
> -
> -        default:
> -            return false;
> -    }
> -}
> -
>   static bool type_is_float(const struct hlsl_type *type)
>   {
>       return type->base_type == HLSL_TYPE_FLOAT || type->base_type == HLSL_TYPE_HALF;



More information about the wine-devel mailing list