SPV: When passing structs of opaque types, flatten and pass the members instead.

This avoids either A) needing uniformConstant struct, or
B) initializing a struct with opaque members, as writing them is not
allowed.
This commit is contained in:
John Kessenich 2017-05-26 00:01:36 -06:00
parent d66c5b1299
commit 750c2d07f7
6 changed files with 528 additions and 70 deletions

View file

@ -0,0 +1,40 @@
struct os {
sampler2D s2D;
};
struct os2 {
sampler2D s2D;
Texture2D tex;
};
Texture2D tex;
os s;
os2 s2;
float4 osCall1(os s)
{
return tex.Sample(s.s2D, float2(0.2, 0.3));
}
float4 osCall2(os s, float2 f2)
{
return tex.Sample(s.s2D, f2);
}
float4 os2Call1(os2 s)
{
return s.tex.Sample(s.s2D, float2(0.2, 0.3));
}
float4 os2Call2(os2 s, float2 f2)
{
return s.tex.Sample(s.s2D, f2);
}
float4 main() : SV_TARGET0
{
return osCall1(s) +
osCall2(s, float2(0.2, 0.3)) +
os2Call1(s2) +
os2Call2(s2, float2(0.2, 0.3));
}