Skip to main content
gamedev.net
🔒 Locked

Pipeline rendering optimization

Started by juglar Jul 28, 2014 at 5:48 PM 2 replies 3.3k views
Original Post
juglar
juglar

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

L. Spiro
L. Spiro

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
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid
3TATUK2
3TATUK2

recursive hierarchical spatial partitioning

juglar
juglar

thanks for clarify :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.