mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Parse the CompileShader() syntax.
This commit is contained in:
parent
45f18a7838
commit
7ec44bd70b
Notes:
Henri Verbeet
2024-09-04 18:48:35 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/943
@ -80,6 +80,7 @@ centroid {return KW_CENTROID; }
|
|||||||
column_major {return KW_COLUMN_MAJOR; }
|
column_major {return KW_COLUMN_MAJOR; }
|
||||||
ComputeShader {return KW_COMPUTESHADER; }
|
ComputeShader {return KW_COMPUTESHADER; }
|
||||||
compile {return KW_COMPILE; }
|
compile {return KW_COMPILE; }
|
||||||
|
CompileShader {return KW_COMPILESHADER; }
|
||||||
const {return KW_CONST; }
|
const {return KW_CONST; }
|
||||||
continue {return KW_CONTINUE; }
|
continue {return KW_CONTINUE; }
|
||||||
DepthStencilState {return KW_DEPTHSTENCILSTATE; }
|
DepthStencilState {return KW_DEPTHSTENCILSTATE; }
|
||||||
|
@ -6135,6 +6135,7 @@ static bool state_block_add_entry(struct hlsl_state_block *state_block, struct h
|
|||||||
%token KW_CENTROID
|
%token KW_CENTROID
|
||||||
%token KW_COLUMN_MAJOR
|
%token KW_COLUMN_MAJOR
|
||||||
%token KW_COMPILE
|
%token KW_COMPILE
|
||||||
|
%token KW_COMPILESHADER
|
||||||
%token KW_COMPUTESHADER
|
%token KW_COMPUTESHADER
|
||||||
%token KW_CONST
|
%token KW_CONST
|
||||||
%token KW_CONTINUE
|
%token KW_CONTINUE
|
||||||
@ -8480,6 +8481,17 @@ primary_expr:
|
|||||||
vkd3d_free($2);
|
vkd3d_free($2);
|
||||||
vkd3d_free($3);
|
vkd3d_free($3);
|
||||||
}
|
}
|
||||||
|
| KW_COMPILESHADER '(' any_identifier ',' var_identifier '(' func_arguments ')' ')'
|
||||||
|
{
|
||||||
|
if (!($$ = add_shader_compilation(ctx, $3, $5, &$7, &@1)))
|
||||||
|
{
|
||||||
|
vkd3d_free($3);
|
||||||
|
vkd3d_free($5);
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
|
vkd3d_free($3);
|
||||||
|
vkd3d_free($5);
|
||||||
|
}
|
||||||
| var_identifier '(' func_arguments ')'
|
| var_identifier '(' func_arguments ')'
|
||||||
{
|
{
|
||||||
if (!($$ = add_call(ctx, $1, &$3, &@1)))
|
if (!($$ = add_call(ctx, $1, &$3, &@1)))
|
||||||
|
@ -78,7 +78,7 @@ float4 main() : sv_target
|
|||||||
|
|
||||||
|
|
||||||
% Test the CompileShader() syntax.
|
% Test the CompileShader() syntax.
|
||||||
[pixel shader todo fail(sm>=6)]
|
[pixel shader fail(sm>=6)]
|
||||||
float arg1, arg2;
|
float arg1, arg2;
|
||||||
|
|
||||||
float4 main_vertex(uniform float a) : sv_position { return a; }
|
float4 main_vertex(uniform float a) : sv_position { return a; }
|
||||||
@ -107,7 +107,7 @@ PixelShader ps1 = CompileShader(ps_2_0, main(foobar));
|
|||||||
|
|
||||||
|
|
||||||
% But undefined identifiers are allowed if inside a state block.
|
% But undefined identifiers are allowed if inside a state block.
|
||||||
[pixel shader todo fail(sm>=6)]
|
[pixel shader fail(sm>=6)]
|
||||||
float4 main_vertex(uniform float a) : sv_position { return a; }
|
float4 main_vertex(uniform float a) : sv_position { return a; }
|
||||||
|
|
||||||
float4 main(uniform float a) : sv_target { return a; }
|
float4 main(uniform float a) : sv_target { return a; }
|
||||||
@ -145,7 +145,7 @@ PixelShader ps1 = CompileShader(fs_2_0, main());
|
|||||||
|
|
||||||
|
|
||||||
% Shaders cannot be passed around to another variable: "Initializer must be literal expressions.".
|
% Shaders cannot be passed around to another variable: "Initializer must be literal expressions.".
|
||||||
[pixel shader fail(sm<6)]
|
[pixel shader fail(sm<6) todo]
|
||||||
float4 main() : sv_target { return 0; }
|
float4 main() : sv_target { return 0; }
|
||||||
|
|
||||||
PixelShader ps1 = CompileShader(ps_2_0, main());
|
PixelShader ps1 = CompileShader(ps_2_0, main());
|
||||||
|
Loading…
Reference in New Issue
Block a user