I have a trivial shader that simply draws quads. If the combined size of the vertex shader input struct (input layout) exceeds 52 bytes my application becomes signifcantly slower after a device reset (ie. resizing the window). When the application starts, I get close to ~600 fps, regardless of input layout size (within reason). As soon as I reset the device the frame rate goes down to ~50 fps.
I know I've seen input layouts much larger than mine in use so I know it's not a limitation of DX9. What could I be doing wrong?
Some of my code:
The vertex shader input struct looks like this:
struct VS_IN
{
float3 posL : POSITION0;
float3 tangentL : TANGENT0;
float3 normalL : NORMAL0;
float2 texC : TEXCOORD0;
float4 colour : TEXCOORD1;
};
and my input layout for it:
D3DVERTEXELEMENT9 genericVertexDesc_DX9[] = {
{ 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
{ 0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT, 0 },
{ 0, 24, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 },
{ 0, 36, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },
{ 0, 44, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1 },
D3DDECL_END()
};
HR( AC3DX9Device->CreateVertexDeclaration( genericVertexDesc_DX9, &generic_DX9 ) );
If I change the size of "colour" to float2 frame rate no longer drops after a device reset.
Thanks in advance.