Imagination PowerVR SDK Blog

GL_PIXEL_UNPACK_BUFFER, texture and VRAM usage


#1

If multiple textures are constructed using the same GL_PIXEL_UNPACK_BUFFER do they share the same VRAM?
What of generated mipmaps are they also attached to the buffer rather than the texture?


#2

Multiple textures won’t share the same memory, they exist as separate objects. When you call glTexImage2D() or glTexSubImage2D() texture data is copied to the bound texture object.

The difference is, when you pass a pointer from application memory to glTexImage2D(), the driver performs an upload to the GPU transparently into a buffer, it then performs a second copy from that buffer into the bound texture object. A buffer object bound to PIXEL_UNPACK_BUFFER is memory already on the GPU, so glTexImage2D() can skip the upload and perform the copy into the texture object directly from internal memory.


#3

That’s what I was afraid of. So it just saves us multiple upload which makes sense when planning to use a pixel buffer in multiple texture object. However it comes at an extra cost in VRAM usage.