Module: vkd3d Branch: master Commit: 6a4a9a4518689a7db5eff362cc5e0fff0994a7af URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/6a4a9a4518689a7db5eff362cc5e0f...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Sun Nov 26 20:36:29 2023 +0100
vkd3d-shader/hlsl: Handle 'linear centroid' modifier.
---
libs/vkd3d-shader/hlsl.c | 2 ++ libs/vkd3d-shader/hlsl.h | 3 ++- libs/vkd3d-shader/hlsl.l | 1 + libs/vkd3d-shader/hlsl.y | 5 +++++ libs/vkd3d-shader/tpf.c | 1 + 5 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 501bff8c..da3bbda1 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -2255,6 +2255,8 @@ struct vkd3d_string_buffer *hlsl_modifiers_to_string(struct hlsl_ctx *ctx, unsig
if (modifiers & HLSL_STORAGE_EXTERN) vkd3d_string_buffer_printf(string, "extern "); + if (modifiers & HLSL_STORAGE_LINEAR) + vkd3d_string_buffer_printf(string, "linear "); if (modifiers & HLSL_STORAGE_NOINTERPOLATION) vkd3d_string_buffer_printf(string, "nointerpolation "); if (modifiers & HLSL_STORAGE_CENTROID) diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index f3596764..21b2fe38 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -357,13 +357,14 @@ struct hlsl_attribute #define HLSL_MODIFIER_INLINE 0x00002000 #define HLSL_STORAGE_CENTROID 0x00004000 #define HLSL_STORAGE_NOPERSPECTIVE 0x00008000 +#define HLSL_STORAGE_LINEAR 0x00010000
#define HLSL_TYPE_MODIFIERS_MASK (HLSL_MODIFIER_PRECISE | HLSL_MODIFIER_VOLATILE | \ HLSL_MODIFIER_CONST | HLSL_MODIFIER_ROW_MAJOR | \ HLSL_MODIFIER_COLUMN_MAJOR)
#define HLSL_INTERPOLATION_MODIFIERS_MASK (HLSL_STORAGE_NOINTERPOLATION | HLSL_STORAGE_CENTROID | \ - HLSL_STORAGE_NOPERSPECTIVE) + HLSL_STORAGE_NOPERSPECTIVE | HLSL_STORAGE_LINEAR)
#define HLSL_MODIFIERS_MAJORITY_MASK (HLSL_MODIFIER_ROW_MAJOR | HLSL_MODIFIER_COLUMN_MAJOR)
diff --git a/libs/vkd3d-shader/hlsl.l b/libs/vkd3d-shader/hlsl.l index 401fba60..fe838750 100644 --- a/libs/vkd3d-shader/hlsl.l +++ b/libs/vkd3d-shader/hlsl.l @@ -95,6 +95,7 @@ if {return KW_IF; } in {return KW_IN; } inline {return KW_INLINE; } inout {return KW_INOUT; } +linear {return KW_LINEAR; } matrix {return KW_MATRIX; } namespace {return KW_NAMESPACE; } nointerpolation {return KW_NOINTERPOLATION; } diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 67b01293..0dde4c18 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -4893,6 +4893,7 @@ static void check_duplicated_switch_cases(struct hlsl_ctx *ctx, const struct hls %token KW_IN %token KW_INLINE %token KW_INOUT +%token KW_LINEAR %token KW_MATRIX %token KW_NAMESPACE %token KW_NOINTERPOLATION @@ -6262,6 +6263,10 @@ var_modifiers: { $$ = add_modifiers(ctx, $2, HLSL_STORAGE_CENTROID, &@1); } + | KW_LINEAR var_modifiers + { + $$ = add_modifiers(ctx, $2, HLSL_STORAGE_LINEAR, &@1); + } | KW_NOPERSPECTIVE var_modifiers { $$ = add_modifiers(ctx, $2, HLSL_STORAGE_NOPERSPECTIVE, &@1); diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index 81ead41e..80f8ab98 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -4311,6 +4311,7 @@ static void write_sm4_dcl_semantic(const struct tpf_writer *tpf, const struct hl { HLSL_STORAGE_CENTROID | HLSL_STORAGE_NOPERSPECTIVE, VKD3DSIM_LINEAR_NOPERSPECTIVE_CENTROID }, { HLSL_STORAGE_NOPERSPECTIVE, VKD3DSIM_LINEAR_NOPERSPECTIVE }, { HLSL_STORAGE_CENTROID, VKD3DSIM_LINEAR_CENTROID }, + { HLSL_STORAGE_CENTROID | HLSL_STORAGE_LINEAR, VKD3DSIM_LINEAR_CENTROID }, }; unsigned int i;