summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/formatquery.c
diff options
context:
space:
mode:
authorAntia Puentes <apuentes@igalia.com>2015-12-19 19:14:51 +0100
committerEduardo Lima Mitev <elima@igalia.com>2016-03-03 15:14:07 +0100
commitbcb2f9cdb97ab2b866e238780ba68908b10e2e79 (patch)
tree85b064940ec7d47bff65728a125e225d94ae81f2 /src/mesa/main/formatquery.c
parente88cbb7a51051da66bf142515bc028559f999a64 (diff)
downloadexternal_mesa3d-bcb2f9cdb97ab2b866e238780ba68908b10e2e79.zip
external_mesa3d-bcb2f9cdb97ab2b866e238780ba68908b10e2e79.tar.gz
external_mesa3d-bcb2f9cdb97ab2b866e238780ba68908b10e2e79.tar.bz2
mesa/formatquery: Added SRGB_{READ,WRITE} <pname> queries
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." Reviewed-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/mesa/main/formatquery.c')
-rw-r--r--src/mesa/main/formatquery.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index bd69ea8..03ec11a 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -598,6 +598,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;
@@ -1109,11 +1111,23 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
break;
case GL_SRGB_READ:
- /* @TODO */
+ if (!_mesa_has_EXT_texture_sRGB(ctx) ||
+ !_mesa_is_srgb_format(internalformat)) {
+ goto end;
+ }
+
+ ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
+ buffer);
break;
case GL_SRGB_WRITE:
- /* @TODO */
+ if (!_mesa_has_EXT_framebuffer_sRGB(ctx) ||
+ !_mesa_is_color_format(internalformat)) {
+ goto end;
+ }
+
+ ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
+ buffer);
break;
case GL_SRGB_DECODE_ARB: