mesa/formatquery: Added COLOR_ENCODING <pname> query.
authorAntia Puentes <apuentes@igalia.com>
Sat, 19 Dec 2015 18:10:51 +0000 (19:10 +0100)
committerEduardo Lima Mitev <elima@igalia.com>
Thu, 3 Mar 2016 14:14:07 +0000 (15:14 +0100)
From the ARB_internalformat_query2 specification:

   "- COLOR_ENCODING: The color encoding for the resource is returned in
      <params>.  Possible values for color buffers are LINEAR or SRGB,
      for linear or sRGB-encoded color components, respectively. For non-color
      formats (such as depth or stencil), or for unsupported resources,
      the value NONE is returned."

Reviewed-by: Dave Airlie <airlied@redhat.com>
src/mesa/main/formatquery.c

index aeed46f725930598a8c1b0afa3128599ac44c77a..bd69ea8f67771ccdeec5ade09e25cc79b9081abd 100644 (file)
@@ -1099,7 +1099,13 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
       break;
 
    case GL_COLOR_ENCODING:
-      /* @TODO */
+      if (!_mesa_is_color_format(internalformat))
+         goto end;
+
+      if (_mesa_is_srgb_format(internalformat))
+         buffer[0] = GL_SRGB;
+      else
+         buffer[0] = GL_LINEAR;
       break;
 
    case GL_SRGB_READ: