2 Replies Latest reply on Feb 6, 2014 8:53 AM by gsellers

    OpenGL: TexStorage doesn't handle sRGB formats properly

    frazanardi

      When using TexStorage with sRGB formats, the sRGB part is ignored and the texture behaves as if it was created with the non-sRGB counterpart of the format.

       

      For example:

      - if I create a texture with TexStorage and then fill it with CompressedTexSubImage, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT will behave exactly as GL_COMPRESSED_RGBA_S3TC_DXT1_EXT.

      - if I create and fill a texture with CompressedTexImage, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT and GL_COMPRESSED_RGBA_S3TC_DXT1_EXT will behave differently.

       

      This problem does not occur on NVIDIA machines, so I'm guessing it's an AMD driver bug.

       

      Edit: it seems that it's even more broken that that.. AFAIK

      TexStorage2D(GL_TEXTURE_2D, 1, GL_DEPTH24_STENCIL8, 1024, 1024);

      should work as a drop-in replacement for

      TexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, 1024, 1024, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL);

      but in practice it doesn't work (i.e. it returns the same value everywhere when sampling). Again, working correctly on NVIDIA.