mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
tests: Test object references.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
This commit is contained in:
parent
f3432966da
commit
e9829fdc65
Notes:
Alexandre Julliard
2022-10-18 00:13:00 +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/7
@ -115,6 +115,7 @@ vkd3d_shader_tests = \
|
|||||||
tests/matrix-semantics.shader_test \
|
tests/matrix-semantics.shader_test \
|
||||||
tests/multiple-rt.shader_test \
|
tests/multiple-rt.shader_test \
|
||||||
tests/nointerpolation.shader_test \
|
tests/nointerpolation.shader_test \
|
||||||
|
tests/object-references.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 \
|
||||||
|
120
tests/object-references.shader_test
Normal file
120
tests/object-references.shader_test
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
[require]
|
||||||
|
shader model >= 4.0
|
||||||
|
|
||||||
|
[texture 0]
|
||||||
|
size (2, 2)
|
||||||
|
0.1 0.2 0.3 0.4 0.5 0.7 0.6 0.8
|
||||||
|
0.6 0.5 0.2 0.1 0.8 0.0 0.7 1.0
|
||||||
|
|
||||||
|
[pixel shader]
|
||||||
|
Texture2D t;
|
||||||
|
|
||||||
|
struct foo {
|
||||||
|
int3 a;
|
||||||
|
Texture2D b;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 main(float4 pos : sv_position) : sv_target
|
||||||
|
{
|
||||||
|
struct foo q;
|
||||||
|
|
||||||
|
q.a = int3(pos.xy, 0);
|
||||||
|
q.b = t;
|
||||||
|
return q.b.Load(q.a);
|
||||||
|
}
|
||||||
|
|
||||||
|
[test]
|
||||||
|
draw quad
|
||||||
|
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
|
||||||
|
probe (1, 0) rgba (0.5, 0.7, 0.6, 0.8)
|
||||||
|
probe (0, 1) rgba (0.6, 0.5, 0.2, 0.1)
|
||||||
|
probe (1, 1) rgba (0.8, 0.0, 0.7, 1.0)
|
||||||
|
|
||||||
|
|
||||||
|
[texture 0]
|
||||||
|
size (1, 1)
|
||||||
|
1.0 1.0 1.0 1.0
|
||||||
|
|
||||||
|
[texture 1]
|
||||||
|
size (1, 1)
|
||||||
|
2.0 2.0 2.0 1.0
|
||||||
|
|
||||||
|
[texture 2]
|
||||||
|
size (1, 1)
|
||||||
|
3.0 3.0 3.0 1.0
|
||||||
|
|
||||||
|
[pixel shader]
|
||||||
|
Texture2D tex[3];
|
||||||
|
|
||||||
|
struct foo {
|
||||||
|
float4 p;
|
||||||
|
Texture2D t;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 main() : sv_target
|
||||||
|
{
|
||||||
|
struct foo s[3];
|
||||||
|
|
||||||
|
s[0].t = tex[0];
|
||||||
|
s[1].t = tex[1];
|
||||||
|
s[2].t = tex[2];
|
||||||
|
return 100 * s[2].t.Load(0) + 10 * s[0].t.Load(0) + s[1].t.Load(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[test]
|
||||||
|
todo draw quad
|
||||||
|
todo probe all rgba (312, 312, 312, 111)
|
||||||
|
|
||||||
|
|
||||||
|
[pixel shader]
|
||||||
|
Texture2D tex1;
|
||||||
|
Texture2D tex2;
|
||||||
|
Texture2D tex3;
|
||||||
|
|
||||||
|
float4 main() : sv_target
|
||||||
|
{
|
||||||
|
Texture2D t[3][2];
|
||||||
|
|
||||||
|
t[0][0] = tex1; // Note: Only invalid in shader model 5.1, array ref. cannot be used as l-value.
|
||||||
|
t[0][1] = tex2;
|
||||||
|
t[1][0] = tex3;
|
||||||
|
t[1][1] = tex1;
|
||||||
|
t[2][0] = tex2;
|
||||||
|
t[2][1] = tex3;
|
||||||
|
return 1000 * t[2][0].Load(0) + 100 * t[1][1].Load(0) + 10 * t[2][1].Load(0) + t[0][1].Load(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[test]
|
||||||
|
draw quad
|
||||||
|
probe all rgba (2132, 2132, 2132, 1111)
|
||||||
|
|
||||||
|
|
||||||
|
[pixel shader fail todo]
|
||||||
|
Texture2D tex[3];
|
||||||
|
uniform int n;
|
||||||
|
|
||||||
|
struct foo {
|
||||||
|
float4 p;
|
||||||
|
Texture2D t;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 main() : sv_target
|
||||||
|
{
|
||||||
|
struct foo s[3];
|
||||||
|
|
||||||
|
s[0].t = tex[0];
|
||||||
|
s[1].t = tex[1];
|
||||||
|
s[2].t = tex[2];
|
||||||
|
return s[n].t.Load(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[pixel shader fail todo]
|
||||||
|
// Note: Only valid in shader model 5.1
|
||||||
|
Texture2D tex[3];
|
||||||
|
uniform int n;
|
||||||
|
|
||||||
|
float4 main() : sv_target
|
||||||
|
{
|
||||||
|
return tex[n].Load(0);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user