Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Frame rate slow after device reset if vertex shader input struct exceeds 52 bytes


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Yelmond   Members   -  Reputation: 110

Like
0Likes
Like

Posted 26 August 2012 - 05:24 PM

Hello,

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.

Sponsor:

#2 Yelmond   Members   -  Reputation: 110

Like
1Likes
Like

Posted 26 August 2012 - 07:34 PM

I managed to "fix" the issue by reducing my max vertex buffer size. I noticed that the size of the input layout didn't really matter. It was more to do with the stride size (size of my CPU vertex struct).

But this is very much still magic for me as I don't understand how the maximum vertex buffer size is related to stride size. This also doesn't explain why I had still high frame rates before a device reset with the original vertex buffer sizes and only lost fps after the device reset. (I don't change vertex buffer sizes during device resets).

It's no longer a pressing issue but I'm curious as to what's going on here.

#3 Hodgman   Moderators   -  Reputation: 31920

Like
0Likes
Like

Posted 26 August 2012 - 10:51 PM

Out of interest, what kind of GPU and drivers are you using?

#4 Yelmond   Members   -  Reputation: 110

Like
1Likes
Like

Posted 27 August 2012 - 12:16 AM

Out of interest, what kind of GPU and drivers are you using?


Card: GeForce GTX 480
Drivers: 301.42




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS