vkd3d-shader: Parse a 'single' modifier.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2024-02-25 02:51:58 +01:00 committed by Alexandre Julliard
parent cf7c05f431
commit e0ef45c0a3
Notes: Alexandre Julliard 2024-03-12 22:58:37 +01:00
Approved-by: Matteo Bruni (@Mystral)
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/701
3 changed files with 63 additions and 0 deletions

View File

@ -374,6 +374,7 @@ struct hlsl_attribute
#define HLSL_STORAGE_CENTROID 0x00004000
#define HLSL_STORAGE_NOPERSPECTIVE 0x00008000
#define HLSL_STORAGE_LINEAR 0x00010000
#define HLSL_MODIFIER_SINGLE 0x00020000
#define HLSL_TYPE_MODIFIERS_MASK (HLSL_MODIFIER_PRECISE | HLSL_MODIFIER_VOLATILE | \
HLSL_MODIFIER_CONST | HLSL_MODIFIER_ROW_MAJOR | \

View File

@ -6874,6 +6874,8 @@ var_modifiers:
{
if (!strcmp($1, "precise"))
$$ = add_modifiers(ctx, $2, HLSL_MODIFIER_PRECISE, &@1);
else if (!strcmp($1, "single"))
$$ = add_modifiers(ctx, $2, HLSL_MODIFIER_SINGLE, &@1);
else
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_UNKNOWN_MODIFIER,
"Unknown modifier %s.", debugstr_a($1));

View File

@ -29,11 +29,71 @@ float4 main() : sv_target
return foo;
}
[pixel shader fail(sm>=6)]
// The 'single' modifier is not a keyword. It's meaningful only for fx_5_0.
single cbuffer cb
{
float4 single;
};
float4 main() : sv_target
{
return single;
}
[test]
uniform 0 float4 1.0 2.0 3.0 4.0
draw quad
probe all rgba (1.0, 2.0, 3.0, 4.0)
[pixel shader fail(sm>=6)]
// 'single' modifier is usable when there is a variable with the same name
cbuffer cb
{
float4 single;
};
single cbuffer cb2
{
float4 var;
};
float4 main() : sv_target
{
return single;
}
[test]
uniform 0 float4 1.0 2.0 3.0 4.0
draw quad
probe all rgba (1.0, 2.0, 3.0, 4.0)
[pixel shader]
typedef float4 single;
single var;
float4 main() : sv_target
{
return var;
}
[test]
uniform 0 float4 1.0 2.0 3.0 4.0
draw quad
probe all rgba (1.0, 2.0, 3.0, 4.0)
[pixel shader fail]
typedef float4 single;
single cbuffer cb
{
float4 var;
};
float4 main() : sv_target
{
return var;
}
% SM1 buffer offset allocation follows different rules than SM4.
% Those would have to be tested separately.
[require]