vkd3d-shader/hlsl: Handle 'linear centroid' modifier.

This commit is contained in:
Nikolay Sivov 2023-11-26 20:36:29 +01:00 committed by Alexandre Julliard
parent 10957bebbf
commit 6a4a9a4518
Notes: Alexandre Julliard 2023-11-28 00:13:17 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/496
5 changed files with 11 additions and 1 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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; }

View File

@ -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);

View File

@ -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;