Jump to content
  • Advertisement
Sign in to follow this  
shakespeare1000

OpenGL Clipping Performance

This topic is 4415 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm hoping someone might have some insight into this. I have a single textured sphere with around 30000 polygons. When the entire sphere is in the camera view, the frame rate is around 130 fps. I zoom in, and when I get to the point where the window clips the sphere, the frame rate starts to drop and goes down to around 105 fps. Since the graphics card is now clipping, I'm not particularly surprised by this, although it seems to be a big drop. However, when I run in OpenGL mode, I get roughly the same frame rate when rendering the sphere in full view, but I do not see any drop in frame rate doing the same zoom test. For directx I'm running in vertex hardware processing. Does anyone understand why I would get a performance penalty when clipping in directx, but not opengl?

Share this post


Link to post
Share on other sites
Advertisement
Weird!
Are you using the "standard" depth/stencil or a manually built one? Maybe this could matter (yet 20% of perf is something overkill)...

Did you enable GL_SCISSOR? The scissor state? Are you really sure the state is "equivalent"? As far as I remember SCISSOR is disabled by default in both GL and D3D but I may be wrong... Maybe it has something to do with the window rect test?
Is this happening in fullscreen or windowed?

Does the performance difference "change" on vertex complexity/amount?

Share this post


Link to post
Share on other sites
Hmmm, sounds odd.

It could simply be a driver implementation difference - over the years some IHVs have had crap OpenGL drivers and good Direct3D drivers, others have had the opposite. What graphics card do you have?

Are there any differences have between your OpenGL and Direct3D implementation? Such as one using indexed primitives and the other not or using different blend modes or fill modes?


I do wonder whether OpenGL (or the OpenGL driver for your graphics card) is doing anything clever with the guard band clipping region.

Any polgons that fall outside of the screen but still within the hardware guardband don't need to be subdivided/clipped so an optimisation is to determine the screen space bounding box of the transformed mesh and see whether it's inside the guardband (D3DCAPS9.GuardBandLeft, D3DCAPS9.GuardBandRight, D3DCAPS9.GuardBandTop, D3DCAPS9.GuardBandBottom). If the mesh is completely within the guardband, not clipping to the screen is a win - but that's something I'd expect the driver to do for you!


Experiments:

1. try using D3DCREATE_PUREDEVICE (or not using it if you are already).

2. try disabling clipping entirely (D3DRS_CLIPPING) and see if clipping is really the issue (versus say, fillrate).

Share this post


Link to post
Share on other sites
I'm using standared depth/stencil and GL_SCISSOR is not enabled. Also, I've tried it in both windowed and full screen and get the same results. Just now I tried setting a whole slew of different stencil depth and depth formats for both dx and ogl and still see the effect. Also tried changing the number of vertices. I went as low as 10,000 polys and as high as 76,000 and still get a 15% drop using directx.

Share this post


Link to post
Share on other sites
I set D3DRS_CLIPPING to FALSE and got the same effect, so this was a good thing to try. Wondering though about fill rate. The drop in fps occurs only after window clipping the object. If I fill the entire screen with the object, but stop just short of clipping, there is no drop in fps. I'm beginning to suspect my directx implemetation. I've got a dell laptop running an ati mobility radeon X600. Not the best card to begin with. I should probably try this test on a better system.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!