[Mesa-dev] [RFC 40/63] mesa/formatquery: Added COLOR_ENCODING <pname> query.
Eduardo Lima Mitev
elima at igalia.com
Tue Jan 19 08:42:20 PST 2016
From: Antia Puentes <apuentes at igalia.com>
>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."
---
src/mesa/main/formatquery.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index f6d0df5..c1a07a9 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -1082,7 +1082,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_get_linear_internalformat(internalformat) != internalformat)
+ buffer[0] = GL_SRGB;
+ else
+ buffer[0] = GL_LINEAR;
break;
case GL_SRGB_READ:
--
2.5.3
More information about the mesa-dev
mailing list