vkd3d/tests/hlsl/initializer-objects.shader_test
Francisco Casas b08be04465 tests/shader-runner: Change resource declaration syntax on shader_test files.
On shader_test files, now resources should be declared this way:

    [texture n]       -> [srv n]
    [srv buffer n]    -> [srv n]
    [uav n]           -> [uav n]
    [uav buffer n]    -> [uav n]
    [vertex buffer n] -> [vb n]
    [render target n] -> [rtv n]

The dimension (buffer or 2D) is now specified as an additional parameter
in the "size" directive:

  For 2D resources:
  size (n, m)         -> size (2d, n, m)

  For buffers:
  size (n, 1)         -> size (buffer, n)
2024-02-19 21:11:52 +01:00

110 lines
1.6 KiB
Plaintext

[require]
shader model >= 4.0
[srv 0]
size (2d, 3, 3)
0.1 0.1 0.1 0.1 0.2 0.2 0.2 0.2 0.3 0.3 0.3 0.3
0.4 0.4 0.4 0.4 0.5 0.5 0.5 0.5 0.6 0.6 0.6 0.6
0.7 0.7 0.7 0.7 0.8 0.8 0.8 0.8 0.9 0.9 0.9 0.9
[srv 1]
size (2d, 2, 2)
0.1 0.1 0.1 0.0 0.2 0.2 0.2 0.0
0.4 0.4 0.4 0.0 0.5 0.5 0.5 0.0
[pixel shader]
Texture2D tex1;
Texture2D tex2;
float4 main() : sv_target
{
Texture2D q[2] = {tex1, tex2};
return q[0].Load(int3(0, 0, 0)) + q[1].Load(int3(0, 0, 0));
}
[test]
draw quad
probe all rgba (0.2, 0.2, 0.2, 0.1)
[pixel shader]
Texture2D tex;
struct foo
{
float2 aa;
Texture2D bb;
Texture2D cc;
float4 dd;
};
float4 main() : sv_target
{
struct foo q = {10, 20, tex, tex, 30, 40, 50, 60};
return q.bb.Load(int3(2, 0, 0)) + q.cc.Load(int3(1, 2, 0)) + q.dd;
}
[test]
draw quad
probe all rgba (31.1, 41.1, 51.1, 61.1) 1
[pixel shader]
Texture2D tex1;
Texture2D tex2;
struct foo
{
float2 aa;
Texture2D bb[2]; // NOTE: this cannot be initialized in shader model >= 5.1
float4 cc;
};
float4 main() : sv_target
{
struct foo q = {10, 20, tex1, tex2, 30, 40, 50, 60};
return q.bb[0].Load(int3(0, 0, 0)) + q.bb[1].Load(int3(1, 1, 0)) + q.cc;
}
[pixel shader fail]
Texture2D tex;
struct foo
{
float2 aa;
Texture2D bb;
Texture2D cc;
float4 dd;
};
float4 main() : sv_target
{
struct foo q = {10, 20, tex, 30, 40, 50, 60};
return 0.0;
}
[pixel shader fail]
Texture2D tex;
struct foo
{
float2 aa;
Texture2D bb;
Texture2D cc;
float4 dd;
};
float4 main() : sv_target
{
struct foo q = {10, 20, tex, tex, tex, 30, 40, 50, 60};
return 0.0;
}