vkd3d-shader/hlsl: Ignore 'inline' modifier for functions.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2023-08-09 01:09:30 +02:00 committed by Alexandre Julliard
parent 30be83f911
commit 18c1477464
Notes: Alexandre Julliard 2023-08-28 22:16:40 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/301
3 changed files with 14 additions and 6 deletions

View File

@ -356,6 +356,7 @@ struct hlsl_attribute
#define HLSL_MODIFIER_COLUMN_MAJOR 0x00000400
#define HLSL_STORAGE_IN 0x00000800
#define HLSL_STORAGE_OUT 0x00001000
#define HLSL_MODIFIER_INLINE 0x00002000
#define HLSL_TYPE_MODIFIERS_MASK (HLSL_MODIFIER_PRECISE | HLSL_MODIFIER_VOLATILE | \
HLSL_MODIFIER_CONST | HLSL_MODIFIER_ROW_MAJOR | \

View File

@ -5129,6 +5129,9 @@ func_prototype_no_attrs:
struct hlsl_ir_var *var;
struct hlsl_type *type;
/* Functions are unconditionally inlined. */
modifiers &= ~HLSL_MODIFIER_INLINE;
if (modifiers & ~HLSL_MODIFIERS_MAJORITY_MASK)
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER,
"Only majority modifiers are allowed on functions.");
@ -5970,6 +5973,10 @@ var_modifiers:
{
$$ = add_modifiers(ctx, $2, HLSL_STORAGE_IN | HLSL_STORAGE_OUT, &@1);
}
| KW_INLINE var_modifiers
{
$$ = add_modifiers(ctx, $2, HLSL_MODIFIER_INLINE, &@1);
}
complex_initializer:

View File

@ -298,7 +298,7 @@ probe all rgba (2.0, 3.0, 6.0, 7.0)
% Inline modifier
[pixel shader todo]
[pixel shader]
inline float func(float a)
{
return a + 1;
@ -312,12 +312,12 @@ float4 main() : sv_target
}
[test]
todo draw quad
todo probe all rgba (2.0, 3.0, 6.0, 7.0)
draw quad
probe all rgba (2.0, 3.0, 6.0, 7.0)
% Inline modifier used on entry point
[pixel shader todo]
[pixel shader]
float func(float a)
{
return a + 1;
@ -331,5 +331,5 @@ inline float4 main() : sv_target
}
[test]
todo draw quad
todo probe all rgba (2.0, 3.0, 6.0, 7.0)
draw quad
probe all rgba (2.0, 3.0, 6.0, 7.0)