1
\$\begingroup\$

How exactly (or, how often) are textures passed to the GPU shaders in MonoGame/XNA?

I am asking because I was profiling a MonoGame/XNA application and noticed that the memory controller load (using GPU-Z) was pretty high.

After disabling pretty much everything except the background texture (a static 24-bit 1920x1080 image), my frame rate went up as expected (~500fps) with GPU load peaking at 99% - but what surprised me was that the GPU memory controller load remained at ~50%.

Setting the breakpoint inside TextureCollection.PlatformSetTextures confirmed that SpriteBatch is indeed passing this texture to the pixel shader on each call.

Does this really mean that all textures are being passed to GPU on each frame over and over again? Am I misinterpreting these readings, or have a fundamentally wrong understanding of how the rendering process should work? Or did I mess something up with my Draw calls?

\$\endgroup\$
  • \$\begingroup\$ From my understanding the driver will not send the texture across if its already loaded into the GPU and it will stay loaded until displaced. So if you use 1 and only 1 texture it should be sent once and that is it. Leaving this as a comment because I'm not 100% sure so more knowledgeable users feel free to chime in. \$\endgroup\$ – ClassicThunder Feb 6 '15 at 17:54
  • \$\begingroup\$ I can confirm what ClassicThunder says. GPUs and their drivers are optimised to avoid passing data between CPU and GPU. When setting textures you will be just setting a reference and the actual graphics resources will only be evicted from the GPU memory when it starts to run low. That said, I'm not sure exactly what "Memory controller load" in GPU-Z is referring to. Googling the term brings up a lot of results which seem to indicate problems specific to some NVidia cards and driver versions. \$\endgroup\$ – Aranda Feb 24 '15 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.