vkd3d/tests/hlsl/texture-load.shader_test

201 lines
4.0 KiB
Plaintext

[require]
shader model >= 4.0
[srv 0]
size (2d, 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;
float4 main(float4 pos : sv_position) : sv_target
{
return t.Load(int3(pos.xy, 0));
}
[test]
todo(msl) 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)
[pixel shader]
Texture2D t;
float4 main(float4 pos : sv_position) : sv_target
{
return t[pos.yx];
}
[test]
todo(msl) draw quad
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1)
probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8)
probe (1, 1) rgba (0.8, 0.0, 0.7, 1.0)
[pixel shader]
static const int size = 2;
Texture2DMS<float4, size - 1> t;
Texture2DMS<float4> t2;
float4 main(float4 pos : sv_position) : sv_target
{
return t.Load(pos.yx, 0);
}
[test]
todo(glsl | msl) draw quad
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1)
probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8)
probe (1, 1) rgba (0.8, 0.0, 0.7, 1.0)
% The sample count only matters for the external definition in SM4-5;
% internally it doesn't, you can even avoid it
[require]
shader model >= 4.0
shader model < 6.0
[pixel shader]
static const int size = 2;
Texture2DMS<float4, size - 1> t;
float4 main(float4 pos : sv_position) : sv_target
{
Texture2DMS<float4, 4> s = t;
return s.Load(pos.yx, 0);
}
[test]
todo(glsl | msl) draw quad
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1)
probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8)
probe (1, 1) rgba (0.8, 0.0, 0.7, 1.0)
[pixel shader]
static const int size = 2;
Texture2DMS<float4, size - 1> t;
float4 main(float4 pos : sv_position) : sv_target
{
Texture2DMS<float4> s = t;
return s.Load(pos.yx, 0);
}
[test]
todo(glsl | msl) draw quad
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1)
probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8)
probe (1, 1) rgba (0.8, 0.0, 0.7, 1.0)
% SM6 is stricter instead
[require]
shader model >= 6.0
[pixel shader fail]
static const int size = 2;
Texture2DMS<float4, size - 1> t;
float4 main(float4 pos : sv_position) : sv_target
{
Texture2DMS<float4, 4> s = t;
return s.Load(pos.yx, 0);
}
[pixel shader fail]
static const int size = 2;
Texture2DMS<float4, size - 1> t;
float4 main(float4 pos : sv_position) : sv_target
{
Texture2DMS<float4> s = t;
return s.Load(pos.yx, 0);
}
% SM4.0 cannot dynamically index multisampled textures, it relies on loop unrolling.
[require]
shader model >= 4.0
shader model < 4.1
[pixel shader]
Texture2DMS<float4, 1> t;
float4 main(float4 pos : sv_position) : sv_target
{
int i;
float4 o;
for (i = 0; i < 1; i++)
{
o = t.Load(pos.xy, i);
}
return o;
}
[test]
todo(glsl | msl) 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)
% Test an actual multisample load
[require]
shader model >= 4.1
[rtv 0]
format r32g32b32a32-float
size (2dms, 4, 64, 64)
[srv 0]
format r32g32b32a32-float
size (2dms, 4, 64, 64)
[pixel shader]
float4 main(uint id : sv_sampleindex) : sv_target
{
return float4(1u << id, 0.25f, 0.5f, 1.0f);
}
[test]
clear rtv 0 0.0 0.0 0.0 0.0
todo(glsl | sm>=6 | msl) draw quad
probe (32, 32) rgba(3.75, 0.25, 0.5, 1.0)
todo(msl) copy rtv 0 srv 0
[rtv 0]
format r32g32b32a32-float
size (2d, 64, 64)
[pixel shader]
Texture2DMS<float4> t;
uint sample;
float4 main(float4 position : sv_position) : sv_target
{
float2 p = position.xy / 64.0f;
return t.Load(p, sample);
}
[test]
uniform 0 uint 0
todo(glsl | msl) draw quad
todo(sm>=6) probe (32, 32) rgba(1.0, 0.25, 0.5, 1.0)
uniform 0 uint 1
todo(glsl | msl) draw quad
todo(sm>=6) probe (32, 32) rgba(2.0, 0.25, 0.5, 1.0)
uniform 0 uint 2
todo(glsl | msl) draw quad
todo(sm>=6) probe (32, 32) rgba(4.0, 0.25, 0.5, 1.0)
uniform 0 uint 3
todo(glsl | msl) draw quad
todo(sm>=6) probe (32, 32) rgba(8.0, 0.25, 0.5, 1.0)