[Mesa-dev] [PATCH] mesa: fix GL_{COLOR, DEPTH, STENCIL}_COMPONENTS queries for TBOs

Marek Olšák maraeo at gmail.com
Tue Oct 24 01:16:04 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/mesa/main/formatquery.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 05b7810..9c53d7c 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -1094,43 +1094,54 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
    }
 
    case GL_COLOR_COMPONENTS:
       /* The ARB_internalformat_query2 spec says:
        *
        *     "- COLOR_COMPONENTS: If the internal format contains any color
        *     components (R, G, B, or A), TRUE is returned in <params>.
        *     If the internal format is unsupported or contains no color
        *     components, FALSE is returned."
        */
+      if (target == GL_TEXTURE_BUFFER &&
+          _mesa_validate_texbuffer_format(ctx, internalformat) ==
+          MESA_FORMAT_NONE)
+         break;
+
       if (_mesa_is_color_format(internalformat))
          buffer[0] = GL_TRUE;
       break;
 
    case GL_DEPTH_COMPONENTS:
       /* The ARB_internalformat_query2 spec says:
        *
        *     "- DEPTH_COMPONENTS: If the internal format contains a depth
        *     component (D), TRUE is returned in <params>. If the internal format
        *     is unsupported or contains no depth component, FALSE is returned."
        */
+      if (target == GL_TEXTURE_BUFFER)
+         break;
+
       if (_mesa_is_depth_format(internalformat) ||
           _mesa_is_depthstencil_format(internalformat))
          buffer[0] = GL_TRUE;
       break;
 
    case GL_STENCIL_COMPONENTS:
       /* The ARB_internalformat_query2 spec says:
        *
        *     "- STENCIL_COMPONENTS: If the internal format contains a stencil
        *     component (S), TRUE is returned in <params>. If the internal format
        *     is unsupported or contains no stencil component, FALSE is returned.
        */
+      if (target == GL_TEXTURE_BUFFER)
+         break;
+
       if (_mesa_is_stencil_format(internalformat) ||
           _mesa_is_depthstencil_format(internalformat))
          buffer[0] = GL_TRUE;
       break;
 
    case GL_COLOR_RENDERABLE:
    case GL_DEPTH_RENDERABLE:
    case GL_STENCIL_RENDERABLE:
       if (!_is_renderable(ctx, internalformat))
          goto end;
-- 
2.7.4



More information about the mesa-dev mailing list