vkd3d-shader/hlsl: Parse the shader 'compile' syntax.

The hlsl_ir_compile node is introduced to represent the "compile"
syntax, and later the CompileShader() and ConstructGSWithSO()
constructs.

It basically represents a function call that remembers its arguments
using hlsl_srcs and keeps its own instruction block, which is discarded
when working on non-effect shaders.

For shader compilations it can be asserted that args_count is 1, and
that this argument (and the last node in hlsl_ir_effect_call.instrs)
is a regular hlsl_ir_call pointing to the declaration of the function
to be compiled.
This commit is contained in:
Francisco Casas
2024-06-24 17:30:46 -04:00
committed by Henri Verbeet
parent 379cd9b7b5
commit 45f18a7838
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
6 changed files with 339 additions and 46 deletions

View File

@@ -1,5 +1,5 @@
% Test special "compile" keyword syntax to compile pixel and vertex shaders
[pixel shader todo]
[pixel shader]
float4 fun() : sv_target
{
return 0;
@@ -13,7 +13,7 @@ sampler sam
float4 main() : sv_target { return 0; }
[pixel shader todo]
[pixel shader]
float4 fun() : sv_target
{
return 0;
@@ -31,7 +31,7 @@ float4 main() : sv_target { return 0; }
% Only uniform arguments are expected, even if undefined identifiers are used.
[pixel shader todo]
[pixel shader]
float4 fun(uniform float4 a, float4 b, uniform float4 c) : sv_target
{
return a + b + c;
@@ -185,7 +185,7 @@ float4 main() : sv_target
% Default values are allowed for uniform variables.
[pixel shader todo fail(sm>=6)]
[pixel shader fail(sm>=6)]
float4 fun(uniform float4 a, uniform float4 b = {1, 2, 3, 4}) : sv_target
{
return 8*a + b;
@@ -202,7 +202,7 @@ technique10 T1
float4 main() : sv_target { return 0; }
[pixel shader todo fail(sm>=6)]
[pixel shader fail(sm>=6)]
float4 fun(float4 a : COLOR0 = {-1, -2, -3, -4}, uniform float4 b = {1, 2, 3, 4}) : sv_target
{
return 8*a + b;