[Mesa-dev] [PATCH] mesa: more TBO fixes for ARB_internalformat_query2

Marek Olšák maraeo at gmail.com
Tue Oct 24 09:02:18 UTC 2017


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

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

diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 9c53d7c..619904f 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -919,20 +919,25 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
        *
        *     "- INTERNALFORMAT_PREFERRED: The implementation-preferred internal
        *     format for representing resources of the specified <internalformat> is
        *     returned in <params>.
        *
        * Therefore, we let the driver answer. Note that if we reach this
        * point, it means that the internalformat is supported, so the driver
        * is called just to try to get a preferred format. If not supported,
        * GL_NONE was already returned and the driver is not called.
        */
+      if (target == GL_TEXTURE_BUFFER &&
+          _mesa_validate_texbuffer_format(ctx, internalformat) ==
+          MESA_FORMAT_NONE)
+         goto end;
+
       ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
                                       buffer);
       break;
 
    case GL_INTERNALFORMAT_RED_SIZE:
    case GL_INTERNALFORMAT_GREEN_SIZE:
    case GL_INTERNALFORMAT_BLUE_SIZE:
    case GL_INTERNALFORMAT_ALPHA_SIZE:
    case GL_INTERNALFORMAT_DEPTH_SIZE:
    case GL_INTERNALFORMAT_STENCIL_SIZE:
@@ -1139,20 +1144,23 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
           _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;
 
+      if (target == GL_TEXTURE_BUFFER)
+         goto end;
+
       if (pname == GL_COLOR_RENDERABLE) {
          if (!_mesa_is_color_format(internalformat))
             goto end;
       } else {
          GLenum baseFormat = _mesa_base_fbo_format(ctx, internalformat);
          if (baseFormat != GL_DEPTH_STENCIL &&
              ((pname == GL_DEPTH_RENDERABLE && baseFormat != GL_DEPTH_COMPONENT) ||
               (pname == GL_STENCIL_RENDERABLE && baseFormat != GL_STENCIL_INDEX)))
             goto end;
       }
-- 
2.7.4



More information about the mesa-dev mailing list