Skip to main content
gamedev.net
🔒 Locked

glTexImage3D memory allocation

Started by pixelhead 2 replies 1.1k views
Original Post
pixelhead
pixelhead
Hi - Wondering how GL allocates memory for textures. Does it make a copy in CPU memory and GPU memory? (From my simple tests, it looks like at least CPU memory is being used up). Is there a way (like VBOs) to hint where the driver will put the texture? Thanks!
Brother Bob
Brother Bob
Internal memory management is a detail OpenGL is not concerned about. It's up to the driver to choose how to do it, as long as it's behaviour is allowed by the specification.

From my knowledge though, dated a few years ago, I believe a copy is kept in system memory so the texture don't have to be transported back from the video memory when it needs to be removed (as in the working set being replaced by other textures).

There are no ways of controling memory allocation.
Soth
Soth
You may set texture priorities


(excerpt from OpenGL SuperBible):

void glPrioritizeTextures(GLsizei n, const GLuint *textures,

const GLclampf *priorities);




This function takes an array of texture object names and a corresponding array of texture object priorities that are clamped between 0 and 1.0. A low priority tells the implementation that this texture object should be left out of resident memory whenever space becomes tight. A higher priority (such as 1.0) tells the implementation that you want that texture object to remain resident if possible, even if the texture seems to be used infrequently.
Brother Bob
Brother Bob
Texture prioroties doesn't affect memory management in the driver, but the working set in the on board video memory. A texture with high priority is less likely to be replaced by other textures that needs some space. It doesn't control whether there are other copies, or where these copes are stored.

Topic Locked

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

Sign in to reply to this topic.