mesa/texture: Also check for LA texture when querying intensity component size
authorGert Wollny <gert.wollny@collabora.com>
Mon, 10 Sep 2018 10:39:44 +0000 (12:39 +0200)
committerGert Wollny <gw.fossdev@gmail.com>
Tue, 11 Sep 2018 07:07:05 +0000 (09:07 +0200)
Gallium may pick L16A16_FLOAT to represent GL_INTENSITY16F if no intensity
format is provided by the driver. However, when calling

   glGetTexLevelParameteriv(..., GL_TEXTURE_INTENSITY_SIZE, ...)

mesa will return a zero size because the actually used format has no
intensity channel and as a fallback only the sizes of the red/green
channels are checked.

Also checking for LA sizes in the allocated texture resolves this problem.

v2: Only check alpha channel size and return it (Marek)
    L and A size are always the same in this case.

Fixes (on virgl):
  ext_framebuffer_multisample-fast-clear GL_ARB_texture_float *

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107832

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/main/texparam.c

index b5d86d64d5bd624c4bc2aa893bd020a0373885c5..a3ec72419865e4cb53afde04338cbf7fb285880d 100644 (file)
@@ -1426,6 +1426,11 @@ get_tex_level_parameter_image(struct gl_context *ctx,
                               _mesa_get_format_bits(texFormat,
                                                     GL_TEXTURE_GREEN_SIZE));
             }
+            if (*params == 0 && pname == GL_TEXTURE_INTENSITY_SIZE) {
+               /* Gallium may store intensity as LA */
+               *params = _mesa_get_format_bits(texFormat, 
+                                               GL_TEXTURE_ALPHA_SIZE);
+            }
          }
          else {
             *params = 0;