vkd3d/tests/hlsl/struct-inheritance.shader_test

135 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

[pixel shader]
2024-10-07 17:57:15 -07:00
struct a
{
float4 aa;
float4 bb;
};
struct b : a
{
float4 cc;
};
struct c : b
{
float4 bb; // Shadows a.bb
};
c data;
float4 main() : sv_target
{
return data.aa + data.bb + data.cc;
}
[test]
uniform 0 float4 1 0 0 0
uniform 4 float4 0 2 0 0
uniform 8 float4 0 0 3 0
uniform 12 float4 0 0 0 4
todo(msl) draw quad
2024-10-07 17:57:15 -07:00
probe (0, 0) rgba (1, 0, 3, 4)
% Test writing to a field derived from a base class.
[pixel shader]
2024-10-07 17:57:15 -07:00
struct a
{
float4 aa;
float4 bb;
};
struct b : a
{
float4 cc;
};
struct c : b
{
float4 bb; // Shadows a.bb
};
c data;
float4 main() : sv_target
{
c data2 = data;
data2.aa = float4(-1, 0, 0, 0);
data2.bb = float4(0, 0, 0, -4);
return data2.aa + data2.bb + data2.cc;
}
[test]
uniform 0 float4 1 0 0 0
uniform 4 float4 0 2 0 0
uniform 8 float4 0 0 3 0
uniform 12 float4 0 0 0 4
todo(msl) draw quad
2024-10-07 17:57:15 -07:00
probe (0, 0) rgba (-1, 0, 3, -4)
% Multiple concrete base types are not allowed.
[pixel shader fail]
struct a
{
float4 aa;
};
struct b
{
float4 bb;
};
struct c : a, b
{
float4 cc;
};
float4 main() : sv_target
{
return 0;
}
% The concrete base type must be a struct.
[pixel shader fail]
struct a : float4
{
float4 aa;
};
float4 main() : sv_target
{
return 0;
}
[pixel shader fail]
struct a : vector<float, 4>
{
float4 aa;
};
float4 main() : sv_target
{
return 0;
}
[pixel shader fail]
struct a : Buffer<float>
{
float4 aa;
};
float4 main() : sv_target
{
return 0;
}