Jump to content

  • Log In with Google      Sign In   
  • Create Account

Pipeline rendering optimization


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 juglar   Members   -  Reputation: 145

Like
0Likes
Like

Posted 28 July 2014 - 11:48 AM

Hi all based on the theory of almost books an basic POO... each object has a Draw() method and in the body, of this method we have  a Drawelement() and some buffer binding with the vertex, texture coord...etc... BUT here is the thing, if we do in that way... we will have some performance issue... becaouse, each object had a opengl call to draw it... so my question is how we can optimize this... one solution is send all the vertext text coord info to a pipeline manager, gather all the vertext and dispach all the vertex to a "pipeline manager class"  and that class render all the scene with on glDrawElement, what do you think on that, do you have any example of that or some other optimization to minimize the glDrawCalls ??

 

thanks in advance 



Sponsor:

#2 L. Spiro   Crossbones+   -  Reputation: 14231

Like
1Likes
Like

Posted 28 July 2014 - 03:51 PM

and that class render all the scene with one glDrawElement, what do you think on that

While it should always be your goal to reduce the number of draw calls to as few as possible, 1 draw call for the whole scene is simply not possible.
You are basically thinking in entirely the wrong direction. If you had some kind of manager like what you described you just be wasting CPU time inside your manager instead of inside the OpenGL driver. Even if it was possible to reduce the whole scene into 1 draw call, it would likely be extremely slower as you collect and reconstruct all the data each frame.


There are way to increase performance not covered in those books.
#1: Reduce redundant render-state changes. Don’t enable culling if it is already enabled. Don’t activate a shader if it is already active. Don’t set a texture if it is already set. Don’t bind a vertex buffer if it is already bound.
#2: Make things redundant. Point #1 doesn’t make sense if you draw ABABABABA. In order to make #1 useful, draw AAAAABBBB. Use a render-queue with frame-to-frame temporal coherence to sort objects such that objects are drawn using the same states one after another.
#3: Most models have meshes that are copy-pasted from the right to the left (or vise versa) and a transform applied to them. There is no reason to have a separate vertex buffer for every single part if many parts are duplicates of each other. Find duplicates and use the same vertex buffer for both parts, using the render-queue to make sure they are drawn back-to-back so that #1 can be used and no vertex-buffer changes are made between draws.

#4: Standad GPU optimizations apply. Don’t modify resources that are in-use. Reduce render-target swaps to the minimum necessary. Only use 2 render targets for bloom, even if you have to ping-pong the downsample process 6 times. Only use 16-bit indices. Order your vertices for best cache usage (major help). Etc.


L. Spiro

Edited by L. Spiro, 28 July 2014 - 03:56 PM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#3 3TATUK2   Members   -  Reputation: 730

Like
0Likes
Like

Posted 28 July 2014 - 06:01 PM

recursive hierarchical spatial partitioning



#4 juglar   Members   -  Reputation: 145

Like
0Likes
Like

Posted 29 July 2014 - 07:41 AM

thanks for clarify :)






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