[Mesa-dev] [RFC 41/63] mesa/formatquery: Added SRGB_{READ, WRITE} <pname> queries

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


From: Antia Puentes <apuentes at igalia.com>

>From the ARB_internalformat_query2 specification:

   "- SRGB_READ: The support for converting from sRGB colorspace on read
      operations (see section 3.9.18) from the resource is returned in
      <params>.
      Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE.
      If the resource or operation is not supported, NONE is returned.

    - SRGB_WRITE: The support for converting to sRGB colorspace on write
      operations to the resource is returned in <params>.
      This indicates that writing to framebuffers with this internalformat
      will encode to sRGB color spaces when FRAMEBUFFER_SRGB is enabled (see
      section 4.1.8).
      Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE.
      If the resource or operation is not supported, NONE is returned."
---
 src/mesa/main/formatquery.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index c1a07a9..1f13b58 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -596,6 +596,8 @@ _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target,
 
    case GL_MANUAL_GENERATE_MIPMAP:
    case GL_AUTO_GENERATE_MIPMAP:
+   case GL_SRGB_READ:
+   case GL_SRGB_WRITE:
       params[0] = GL_FULL_SUPPORT;
       break;
 
@@ -1092,11 +1094,19 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
       break;
 
    case GL_SRGB_READ:
-      /* @TODO */
+      if (!ctx->Extensions.EXT_texture_sRGB)
+         goto end;
+
+      ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
+                                      buffer);
       break;
 
    case GL_SRGB_WRITE:
-      /* @TODO */
+      if (!ctx->Extensions.EXT_framebuffer_sRGB)
+         goto end;
+
+      ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
+                                      buffer);
       break;
 
    case GL_SRGB_DECODE_ARB:
-- 
2.5.3



More information about the mesa-dev mailing list