vkd3d/tests/cast-broadcast.shader_test
Francisco Casas d93ce28995 vkd3d-shader/hlsl: Handle complex types in add_cast().
This extends the support of this function, whether doing broadcasts or
component-wise casts, to struct and array types.
2022-10-25 21:25:51 +02:00

71 lines
780 B
Plaintext

[pixel shader]
struct apple
{
float3 aa;
float4 bb;
};
struct banana
{
struct apple aa;
int2 bb;
int4 cc[8];
};
float4 main() : SV_TARGET
{
struct banana p = (struct banana)42;
return p.aa.bb + p.cc[5];
}
[test]
draw quad
probe all rgba (84.0, 84.0, 84.0, 84.0)
[pixel shader fail]
struct apple
{
float3 aa;
float4 bb;
};
float4 main() : SV_TARGET
{
struct apple f = 31;
return f.bb;
}
[pixel shader fail]
struct apple
{
float3 aa;
float4 bb;
};
float4 fun(struct apple f)
{
return f.bb;
}
float4 main() : SV_TARGET
{
return fun(31);
}
[pixel shader fail]
struct apple
{
float4 foo;
Texture2D tex;
};
float4 PSMain() : SV_TARGET
{
struct apple a1;
a1 = (struct apple)1;
return a1.foo;
}