[Mesa-dev] [RFC 60/63] mesa/formatquery: Add (GET_)TEXTURE_IMAGE_FORMAT pnames

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


---
 src/mesa/main/formatquery.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 0f63259..2551476 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -652,6 +652,21 @@ _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target,
       break;
    }
 
+   case GL_TEXTURE_IMAGE_FORMAT:
+   case GL_GET_TEXTURE_IMAGE_FORMAT: {
+      GLenum format = GL_NONE;
+      GLenum base_format = _mesa_base_tex_format(ctx, internalFormat);
+      if (base_format > 0) {
+         if (_mesa_is_enum_format_integer(internalFormat))
+           format = _mesa_base_format_to_integer_format(base_format);
+         else
+           format = base_format;
+      }
+
+      params[0] = format;
+      break;
+   }
+
    case GL_MANUAL_GENERATE_MIPMAP:
    case GL_AUTO_GENERATE_MIPMAP:
    case GL_SRGB_READ:
@@ -1131,17 +1146,15 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
       break;
 
    case GL_TEXTURE_IMAGE_FORMAT:
-      /* @TODO */
+   case GL_GET_TEXTURE_IMAGE_FORMAT:
+      ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
+                                      buffer);
       break;
 
    case GL_TEXTURE_IMAGE_TYPE:
       /* @TODO */
       break;
 
-   case GL_GET_TEXTURE_IMAGE_FORMAT:
-      /* @TODO */
-      break;
-
    case GL_GET_TEXTURE_IMAGE_TYPE:
       /* @TODO */
       break;
-- 
2.5.3



More information about the mesa-dev mailing list