diff --git a/libs/vkd3d-shader/hlsl.l b/libs/vkd3d-shader/hlsl.l index 0c02b278..e5472709 100644 --- a/libs/vkd3d-shader/hlsl.l +++ b/libs/vkd3d-shader/hlsl.l @@ -80,6 +80,7 @@ centroid {return KW_CENTROID; } column_major {return KW_COLUMN_MAJOR; } ComputeShader {return KW_COMPUTESHADER; } compile {return KW_COMPILE; } +CompileShader {return KW_COMPILESHADER; } const {return KW_CONST; } continue {return KW_CONTINUE; } DepthStencilState {return KW_DEPTHSTENCILSTATE; } diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 93855990..4a5b0979 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -6135,6 +6135,7 @@ static bool state_block_add_entry(struct hlsl_state_block *state_block, struct h %token KW_CENTROID %token KW_COLUMN_MAJOR %token KW_COMPILE +%token KW_COMPILESHADER %token KW_COMPUTESHADER %token KW_CONST %token KW_CONTINUE @@ -8480,6 +8481,17 @@ primary_expr: vkd3d_free($2); 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 ')' { if (!($$ = add_call(ctx, $1, &$3, &@1))) diff --git a/tests/hlsl/effect-compile.shader_test b/tests/hlsl/effect-compile.shader_test index 94b3ae6e..7155fc56 100644 --- a/tests/hlsl/effect-compile.shader_test +++ b/tests/hlsl/effect-compile.shader_test @@ -78,7 +78,7 @@ float4 main() : sv_target % Test the CompileShader() syntax. -[pixel shader todo fail(sm>=6)] +[pixel shader fail(sm>=6)] float arg1, arg2; 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. -[pixel shader todo fail(sm>=6)] +[pixel shader fail(sm>=6)] float4 main_vertex(uniform float a) : sv_position { 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.". -[pixel shader fail(sm<6)] +[pixel shader fail(sm<6) todo] float4 main() : sv_target { return 0; } PixelShader ps1 = CompileShader(ps_2_0, main());