Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture Swapping: Does size matter?

Started by metsfan Mar 6, 2014 at 3:40 AM 1 replies 2k views
Original Post
metsfan
metsfan

Hey all,

I am wondering something about texture swapping, hoping someone can shed some light. Question is simple: If I swap to a different texture unit, whether it be DirectX or OpenGL, will the operation take longer depending on the size of a texture? In other words, is a texture swap to a 64x64 texture the same cost as a 2048x2048 texture? Is it just like changing a pointer, or does it actually have to move the memory to make it accessible to the GPU? It is safe to assume in this situation the textures are fully initialized and have already been rendered with already (so the data is guarenteed to be in GPU memory), and that the data will not change for the runtime of the application.

It seems intuitive to me that it would take longer for the larger texture swap, but I have found more than once that the GPU does things that surprise me, so any knowledge here would be great. Thank you.

MJP
MJP

If you're talking about standard desktop GPU's, binding a texture generally isn't going to cause any memory to move around. For dedicated GPU's the driver is going to keep all of your textures in GPU memory as long as everything fits, and so the "swap" is mostly a CPU-side operation involving pointers. In that case the size of the texture shouldn't have any bearing on the cost of switching.

metsfan
metsfan

If you're talking about standard desktop GPU's, binding a texture generally isn't going to cause any memory to move around. For dedicated GPU's the driver is going to keep all of your textures in GPU memory as long as everything fits, and so the "swap" is mostly a CPU-side operation involving pointers. In that case the size of the texture shouldn't have any bearing on the cost of switching.

Perfect, thanks. Yes, I was referring to dedicated desktop GPUs.

Topic Locked

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

Sign in to reply to this topic.