vkd3d-shader/hlsl: Parse 'centroid' and 'noperspective' modifiers.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2023-09-21 15:11:26 +02:00 committed by Alexandre Julliard
parent 4b8a4809d1
commit de860c3cbf
Notes: Alexandre Julliard 2023-10-09 23:10:36 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/358
5 changed files with 21 additions and 3 deletions

View File

@ -2211,6 +2211,10 @@ struct vkd3d_string_buffer *hlsl_modifiers_to_string(struct hlsl_ctx *ctx, unsig
vkd3d_string_buffer_printf(string, "extern ");
if (modifiers & HLSL_STORAGE_NOINTERPOLATION)
vkd3d_string_buffer_printf(string, "nointerpolation ");
if (modifiers & HLSL_STORAGE_CENTROID)
vkd3d_string_buffer_printf(string, "centroid ");
if (modifiers & HLSL_STORAGE_NOPERSPECTIVE)
vkd3d_string_buffer_printf(string, "noperspective ");
if (modifiers & HLSL_MODIFIER_PRECISE)
vkd3d_string_buffer_printf(string, "precise ");
if (modifiers & HLSL_STORAGE_SHARED)

View File

@ -354,6 +354,8 @@ struct hlsl_attribute
#define HLSL_STORAGE_IN 0x00000800
#define HLSL_STORAGE_OUT 0x00001000
#define HLSL_MODIFIER_INLINE 0x00002000
#define HLSL_STORAGE_CENTROID 0x00004000
#define HLSL_STORAGE_NOPERSPECTIVE 0x00008000
#define HLSL_TYPE_MODIFIERS_MASK (HLSL_MODIFIER_PRECISE | HLSL_MODIFIER_VOLATILE | \
HLSL_MODIFIER_CONST | HLSL_MODIFIER_ROW_MAJOR | \

View File

@ -74,6 +74,7 @@ BlendState {return KW_BLENDSTATE; }
break {return KW_BREAK; }
Buffer {return KW_BUFFER; }
cbuffer {return KW_CBUFFER; }
centroid {return KW_CENTROID; }
compile {return KW_COMPILE; }
const {return KW_CONST; }
continue {return KW_CONTINUE; }
@ -95,6 +96,7 @@ inout {return KW_INOUT; }
matrix {return KW_MATRIX; }
namespace {return KW_NAMESPACE; }
nointerpolation {return KW_NOINTERPOLATION; }
noperspective {return KW_NOPERSPECTIVE; }
out {return KW_OUT; }
packoffset {return KW_PACKOFFSET; }
pass {return KW_PASS; }

View File

@ -4685,6 +4685,7 @@ static struct hlsl_scope *get_loop_scope(struct hlsl_scope *scope)
%token KW_BREAK
%token KW_BUFFER
%token KW_CBUFFER
%token KW_CENTROID
%token KW_COLUMN_MAJOR
%token KW_COMPILE
%token KW_CONST
@ -4707,6 +4708,7 @@ static struct hlsl_scope *get_loop_scope(struct hlsl_scope *scope)
%token KW_MATRIX
%token KW_NAMESPACE
%token KW_NOINTERPOLATION
%token KW_NOPERSPECTIVE
%token KW_OUT
%token KW_PACKOFFSET
%token KW_PASS
@ -6005,6 +6007,14 @@ var_modifiers:
{
$$ = add_modifiers(ctx, $2, HLSL_STORAGE_NOINTERPOLATION, &@1);
}
| KW_CENTROID var_modifiers
{
$$ = add_modifiers(ctx, $2, HLSL_STORAGE_CENTROID, &@1);
}
| KW_NOPERSPECTIVE var_modifiers
{
$$ = add_modifiers(ctx, $2, HLSL_STORAGE_NOPERSPECTIVE, &@1);
}
| KW_PRECISE var_modifiers
{
$$ = add_modifiers(ctx, $2, HLSL_MODIFIER_PRECISE, &@1);

View File

@ -92,7 +92,7 @@ void main(uint id : sv_vertexid, inout ps_input input, out float4 pos : sv_posit
pos = float4(coords * float2(2, -2) + float2(-1, 1), 0, 1);
}
[pixel shader todo]
[pixel shader]
struct ps_input
{
nointerpolation float4 t : texcoord;
@ -104,7 +104,7 @@ float4 main(centroid ps_input input) : sv_target
}
[test]
todo draw triangle list 3
draw triangle list 3
todo probe all rgba (0.0, 1.0, 0.0, 1.0)
[vertex shader]
@ -146,7 +146,7 @@ void main(uint id : sv_vertexid, inout ps_input input, out float4 pos : sv_posit
pos = float4(coords * float2(2, -2) + float2(-1, 1), 0, 1);
}
[vertex shader todo]
[vertex shader]
struct ps_input
{
nointerpolation float4 t : texcoord;