[Mesa-dev] [PATCH] mesa/st: Prefer RG_float when emulating INTENSITY Float over LA float

Gert Wollny gw.fossdev at gmail.com
Wed Sep 5 08:36:30 UTC 2018


From: Gert Wollny <gert.wollny at collabora.com>

Gallium picked R16G16_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.

Picking an RG format instead of the LA format resolves this problem.

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 at collabora.com>
---
 src/mesa/state_tracker/st_format.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 16a18c272d..b16ab9ea02 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -1448,9 +1448,9 @@ static const struct format_mapping format_map[] = {
    },
    {
       { GL_INTENSITY16F_ARB, 0 },
-      { PIPE_FORMAT_I16_FLOAT, PIPE_FORMAT_L16A16_FLOAT,
+      { PIPE_FORMAT_I16_FLOAT, PIPE_FORMAT_R16G16_FLOAT,
         PIPE_FORMAT_I32_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT,
-        PIPE_FORMAT_L32A32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT, 0 }
+        PIPE_FORMAT_R32G32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT, 0 }
    },
    {
       { GL_LUMINANCE16F_ARB, 0 },
@@ -1491,7 +1491,7 @@ static const struct format_mapping format_map[] = {
    },
    {
       { GL_INTENSITY32F_ARB, 0 },
-      { PIPE_FORMAT_I32_FLOAT, PIPE_FORMAT_L32A32_FLOAT,
+      { PIPE_FORMAT_I32_FLOAT, PIPE_FORMAT_R32G32_FLOAT,
         PIPE_FORMAT_R32G32B32A32_FLOAT, 0 }
    },
    {
-- 
2.16.4



More information about the mesa-dev mailing list