View Full Version : HELP - issue with imagetexture and muttable textures

07-03-2015, 05:34 PM
Hi All,

I have a problem since I've updated the NVIDIA drivers today.

I had some code using image load/store working perfectly. This code used 2D and 3D textures created with muttable storage, i.e. with glTexImage.

Today, after the driver update, all the examples using 2D textures stopped working. Looking at previous versions and testing them I found out the if I created the texture with immutable storage using glTexStorage everything is back to normal and working properly.

The code I use to create the texture storage is as follows:

if (immutable) {
glTexStorage2D(m_EnumProps[DIMENSION], m_IntProps[LEVELS], m_EnumProps[INTERNAL_FORMAT],
m_IntProps[WIDTH], m_IntProps[HEIGHT]);
else {
glTexImage2D(m_EnumProps[DIMENSION], 0, m_EnumProps[INTERNAL_FORMAT],
m_IntProps[WIDTH], m_IntProps[HEIGHT], 0,
m_EnumProps[FORMAT], m_EnumProps[TYPE], NULL);

If immutable is true then image load/store works, otherwise it doesn't. This is only for the 2D textures, 3D textures are working as before.

I've searched the wiki pages and man pages and found nothing mentioning that in order to bind an image texture the texture storage had to be immutable.

Am I missing something? Does anyone have the same issue?



07-03-2015, 08:06 PM

The problem seems to be related to mipmapping. Although the level in glBindImageTexture is set to zero, the fact is that image load/store works if I call glGenerateMipmaps for the texture, even with muttable textures. However without mipmaps it only works with immutable textures.

Now I'm getting confused!

Alfonse Reinheart
07-03-2015, 09:56 PM
There's nothing confusing about that. A texture must be complete (https://www.opengl.org/wiki/Texture Completeness) in order for it to be used in pretty much any rendering operation. Immutable storage textures are always complete (that's about 40% of the reason why they exist). Your mutable texturing code does not create a complete texture. And thus, you can't use it in rendering operations.

In particular, you create only one mipmap level in the mutable case, but you don't set the base/max level range (https://www.opengl.org/wiki/Texture#Mipmap_range) to tell OpenGL that the texture only is supposed to have one mipmap level.

07-04-2015, 07:59 AM
Dear Alfonse,

Yes, you're absolutely right. It seems that in recent driver versions NVIDIA decided to enforce that condition.

When not using mipmaps I've set GL_TEXTURE_MAX_LEVEL to 0 and it works :-)

Many thanks,