質問

Maya promo video explains how GPU Cache affects user making application run faster. In frameworks like Cinder we redraw all geopetry we want to be in the scene on each frame update sending it to video card. So I worder what is behind GPU Caching from a programmer prespective? What OpenGL/DirectX APIs are behind such technology? How to "Cache" my mesh in GPU memory?

役に立ちましたか?

解決 2

First off, the "GPU cache" terminology that Maya uses probably refers to graphics data that is simply stored on the card refers to optimizing a mesh for device-independent storage and rendering in Maya . For card manufacturer's the notion of a "GPU cache" is different (in this case it means something more like the L1 or L2 CPU caches).

To answer your final question: Using OpenGL terminology, you generally create vertex buffer objects (VBO's). These will store the data on the card. Then, when you want to draw, you can simply instruct the card to use those buffers.

This will avoid the overhead of copying the mesh data from main (CPU) memory into graphics (GPU) memory. If you need to draw the mesh many times without changing the mesh data, it performs much better.

他のヒント

There is, to my knowledge, no way in OpenGL or DirectX to directly specify what is to be, and not to be, stored and tracked on the GPU cache. There are however methodologies that should be followed and maintained in order to make best use of the cache. Some of these include:

  • Batch, batch, batch.
  • Upload data directly to the GPU
  • Order indices to maximize vertex locality across the mesh.
  • Keep state changes to a minimum.
  • Keep shader changes to a minimum.
  • Keep texture changes to a minimum.
  • Use maximum texture compression whenever possible.
  • Use mipmapping whenever possible (to maximize texel sampling locality)

It is also important to keep in mind that there is no single GPU cache. There are multiple (vertex, texture, etc.) independent caches.

Sources:

OpenGL SuperBible - Memory Bandwidth and Vertices

GPU Gems - Graphics Pipeline Performance

GDC 2012 - Optimizing DirectX Graphics

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top