So, I've been playing a bit with geometry shaders recently and I've found a very interesting bug, let me show you the code example:
struct Vert2Geom
{
float4 mPosition : SV_POSITION;
float2 mTexCoord : TEXCOORD0;
float3 mNormal : TEXCOORD1;
float4 mPositionWS : TEXCOORD2;
};
struct Geom2Frag
{
float4 mPosition : SV_POSITION;
nointerpolation float4 mAABB : AABB;
float3 mNormal : TEXCOORD1;
float2 mTexCoord : TEXCOORD0;
nointerpolation uint mAxis : AXIS;
float3 temp : TEXCOORD2;
};
...
[maxvertexcount(3)]
void GS(triangle Vert2Geom input[3], inout TriangleStream<Geom2Frag> output)
{
...
}
So, as soon as I have this Geom2Frag structure - there is a crash, to be precise - the only message I get is:
D3D12: Removing Device.
Now, if Geom2Frag last attribute is just type of float2 (hence structure is 4 bytes shorter), there is no crash and everything works as should. I tried to look at limitations for Shader Model 5.1 profiles - and I either overlooked one for geometry shader outputs (which is more than possible - MSDN is confusing in many ways ... but 64 bytes limit seems way too low), or there is something iffy that shader compiler does for me.
Any ideas why this might happen?
↧