tests: Test objects as parameters.

This commit is contained in:
Francisco Casas 2022-12-15 17:28:18 -03:00 committed by Alexandre Julliard
parent 6f71077e3e
commit 7c2ac5b098
Notes: Alexandre Julliard 2023-05-08 22:34:16 +02:00
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/159
3 changed files with 185 additions and 2 deletions

View File

@ -144,6 +144,7 @@ vkd3d_shader_tests = \
tests/nointerpolation.shader_test \ tests/nointerpolation.shader_test \
tests/object-field-offsets.shader_test \ tests/object-field-offsets.shader_test \
tests/object-references.shader_test \ tests/object-references.shader_test \
tests/object-parameters.shader_test \
tests/pow.shader_test \ tests/pow.shader_test \
tests/preproc-if.shader_test \ tests/preproc-if.shader_test \
tests/preproc-ifdef.shader_test \ tests/preproc-ifdef.shader_test \

View File

@ -0,0 +1,182 @@
[pixel shader fail todo]
Texture2D tex0;
float4 main(out Texture2D tex : TEXTURE) : sv_target
{
return float4(1, 2, 3, 4);
}
[pixel shader fail todo]
struct params
{
Texture2D tex : TEXTURE;
};
float4 main(inout params x) : sv_target
{
return float4(1, 2, 3, 4);
}
[require]
shader model >= 5.0
[pixel shader todo]
uniform float global;
struct apple
{
Texture2D tex;
float4 pos : sv_position;
};
float4 main(struct apple input, uniform float param) : sv_target
{
return input.tex.Load(int3(0, 0, 0)) + global + param + input.pos;
}
[texture 0]
size (2, 2)
1.0 1.0 1.0 1.0 0.0 0.0 0.0 1.0
1.0 1.0 1.0 1.0 0.0 0.0 0.0 1.0
[texture 1]
size (2, 2)
2.0 2.0 2.0 1.0 0.0 0.0 0.0 1.0
2.0 2.0 2.0 1.0 0.0 0.0 0.0 1.0
[texture 2]
size (2, 2)
3.0 3.0 3.0 1.0 0.0 0.0 0.0 1.0
3.0 3.0 3.0 1.0 0.0 0.0 0.0 1.0
[texture 3]
size (2, 2)
4.0 4.0 4.0 1.0 0.0 0.0 0.0 1.0
4.0 4.0 4.0 1.0 0.0 0.0 0.0 1.0
[texture 4]
size (2, 2)
5.0 5.0 5.0 1.0 0.0 0.0 0.0 1.0
5.0 5.0 5.0 1.0 0.0 0.0 0.0 1.0
[texture 5]
size (2, 2)
6.0 6.0 6.0 1.0 0.0 0.0 0.0 1.0
6.0 6.0 6.0 1.0 0.0 0.0 0.0 1.0
[sampler 0]
filter linear linear linear
address clamp clamp clamp
[sampler 1]
filter linear linear linear
address clamp clamp clamp
[sampler 2]
filter linear linear linear
address clamp clamp clamp
[sampler 3]
filter point point point
address clamp clamp clamp
[sampler 4]
filter linear linear linear
address clamp clamp clamp
[pixel shader todo]
struct apple
{
Texture2D unused; // must reserve t1
Texture2D tex[3]; // must reserve t2-t4
Texture2D lone; // must reserve t5
float4 pos : sv_position;
};
Texture2D tex0; // must reserve t0
sampler sam;
float4 main(struct apple input) : sv_target
{
return 100 * input.tex[1].Sample(sam, float2(0, 0))
+ 10 * tex0.Sample(sam, float2(0, 0))
+ input.lone.Sample(sam, float2(0, 0));
}
[test]
todo draw quad
todo probe all rgba (416.0, 416.0, 416.0, 111.0)
[pixel shader todo]
Texture2D tex;
struct apple
{
sampler unused0; // must reserve s0
sampler sam[3]; // must reserve to s1-s2
sampler unused1; // doesn't reserve
};
float4 main(struct apple input, sampler samp) : sv_target
{
// samp must reserve s3
return float4(tex.Sample(samp, float2(0.3, 0.3)).xy,
tex.Sample(input.sam[1], float2(0.5, 0.5)).xy);
}
[test]
todo draw quad
todo probe all rgba (1.0, 1.0, 0.5, 0.5)
[sampler 0]
filter linear linear linear
address clamp clamp clamp
[sampler 1]
filter linear linear linear
address clamp clamp clamp
[sampler 2]
filter linear linear linear
address clamp clamp clamp
[sampler 3]
filter linear linear linear
address clamp clamp clamp
[sampler 4]
filter point point point
address clamp clamp clamp
[pixel shader todo]
Texture2D tex;
sampler sam0; // must reserve s3
struct apple
{
sampler unused0; // must reserve s0
sampler sam[3]; // must reserve s1-s2
sampler unused1; // doesn't reserve
};
float4 main(struct apple input, sampler samp) : sv_target
{
// samp must reserve s4
return float4(tex.Sample(sam0, float2(0.5, 0.5)).x, tex.Sample(samp, float2(0.3, 0.3)).x,
tex.Sample(input.sam[1], float2(0.5, 0.5)).xw);
}
[test]
todo draw quad
todo probe all rgba (0.5, 1.0, 0.5, 1.0)

View File

@ -167,8 +167,8 @@ static ID3D12RootSignature *d3d12_runner_create_root_signature(struct d3d12_shad
ID3D12GraphicsCommandList *command_list, unsigned int *uniform_index) ID3D12GraphicsCommandList *command_list, unsigned int *uniform_index)
{ {
D3D12_ROOT_SIGNATURE_DESC root_signature_desc = {0}; D3D12_ROOT_SIGNATURE_DESC root_signature_desc = {0};
D3D12_ROOT_PARAMETER root_params[5], *root_param; D3D12_ROOT_PARAMETER root_params[8], *root_param;
D3D12_STATIC_SAMPLER_DESC static_samplers[1]; D3D12_STATIC_SAMPLER_DESC static_samplers[5];
ID3D12RootSignature *root_signature; ID3D12RootSignature *root_signature;
HRESULT hr; HRESULT hr;
size_t i; size_t i;