mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Allow 'export' modifier on functions.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
636d8d3850
commit
4b0a328a2b
Notes:
Alexandre Julliard
2024-04-03 23:35:25 +02:00
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/746
@ -375,6 +375,7 @@ struct hlsl_attribute
|
||||
#define HLSL_STORAGE_NOPERSPECTIVE 0x00008000
|
||||
#define HLSL_STORAGE_LINEAR 0x00010000
|
||||
#define HLSL_MODIFIER_SINGLE 0x00020000
|
||||
#define HLSL_MODIFIER_EXPORT 0x00040000
|
||||
|
||||
#define HLSL_TYPE_MODIFIERS_MASK (HLSL_MODIFIER_PRECISE | HLSL_MODIFIER_VOLATILE | \
|
||||
HLSL_MODIFIER_CONST | HLSL_MODIFIER_ROW_MAJOR | \
|
||||
|
@ -88,6 +88,7 @@ DomainShader {return KW_DOMAINSHADER; }
|
||||
do {return KW_DO; }
|
||||
double {return KW_DOUBLE; }
|
||||
else {return KW_ELSE; }
|
||||
export {return KW_EXPORT; }
|
||||
extern {return KW_EXTERN; }
|
||||
false {return KW_FALSE; }
|
||||
for {return KW_FOR; }
|
||||
|
@ -5341,6 +5341,7 @@ static void validate_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim,
|
||||
%token KW_DOMAINSHADER
|
||||
%token KW_DOUBLE
|
||||
%token KW_ELSE
|
||||
%token KW_EXPORT
|
||||
%token KW_EXTERN
|
||||
%token KW_FALSE
|
||||
%token KW_FOR
|
||||
@ -5969,9 +5970,9 @@ func_prototype_no_attrs:
|
||||
/* Functions are unconditionally inlined. */
|
||||
modifiers &= ~HLSL_MODIFIER_INLINE;
|
||||
|
||||
if (modifiers & ~HLSL_MODIFIERS_MAJORITY_MASK)
|
||||
if (modifiers & ~(HLSL_MODIFIERS_MAJORITY_MASK | HLSL_MODIFIER_EXPORT))
|
||||
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER,
|
||||
"Only majority modifiers are allowed on functions.");
|
||||
"Unexpected modifier used on a function.");
|
||||
if (!(type = apply_type_modifiers(ctx, $2, &modifiers, true, &@1)))
|
||||
YYABORT;
|
||||
if ((var = hlsl_get_var(ctx->globals, $3)))
|
||||
@ -6868,6 +6869,10 @@ var_modifiers:
|
||||
{
|
||||
$$ = add_modifiers(ctx, $2, HLSL_MODIFIER_INLINE, &@1);
|
||||
}
|
||||
| KW_EXPORT var_modifiers
|
||||
{
|
||||
$$ = add_modifiers(ctx, $2, HLSL_MODIFIER_EXPORT, &@1);
|
||||
}
|
||||
| var_identifier var_modifiers
|
||||
{
|
||||
if (!strcmp($1, "precise"))
|
||||
|
@ -333,3 +333,15 @@ inline float4 main() : sv_target
|
||||
[test]
|
||||
todo(glsl) draw quad
|
||||
probe all rgba (2.0, 3.0, 6.0, 7.0)
|
||||
|
||||
% Export modifier
|
||||
|
||||
[pixel shader]
|
||||
export float4 main() : sv_target
|
||||
{
|
||||
return float4(1.0, 2.0, 3.0, 4.0);
|
||||
}
|
||||
|
||||
[test]
|
||||
todo(glsl) draw quad
|
||||
probe all rgba (1.0, 2.0, 3.0, 4.0)
|
||||
|
Loading…
Reference in New Issue
Block a user