[Mesa-dev] [RFC 24/63] mesa/formatquery: Added INTERNALFORMAT_PREFERRED pname

Eduardo Lima Mitev elima at igalia.com
Tue Jan 19 08:42:04 PST 2016


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

diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index da65624..1a3bdbd 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -580,6 +580,10 @@ _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target,
       params[0] = GL_TRUE;
       break;
 
+   case GL_INTERNALFORMAT_PREFERRED:
+      params[0] = internalFormat;
+      break;
+
    default:
       _set_default_response(pname, params);
       break;
@@ -660,7 +664,16 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
       break;
 
    case GL_INTERNALFORMAT_PREFERRED:
-      /* @TODO */
+      /* The ARB_internalformat_query2 spec says:
+       *
+       *     "- INTERNALFORMAT_PREFERRED: The implementation-preferred internal
+       *     format for representing resources of the specified <internalformat> is
+       *     returned in <params>.
+       *
+       * Therefore, we let the driver answer.
+       */
+      ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
+                                      buffer);
       break;
 
    case GL_INTERNALFORMAT_RED_SIZE:
-- 
2.5.3



More information about the mesa-dev mailing list