[Mesa-dev] [RFC 58/63] mesa/formatquery: Add READ_PIXELS_FORMAT pname
Eduardo Lima Mitev
elima at igalia.com
Tue Jan 19 08:42:38 PST 2016
---
src/mesa/main/formatquery.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 1b98b82..fc8c10f 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -596,9 +596,7 @@ _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target,
GLenum internalFormat, GLenum pname,
GLint *params)
{
- (void) ctx;
(void) target;
- (void) internalFormat;
switch (pname) {
case GL_SAMPLES:
@@ -614,6 +612,26 @@ _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target,
params[0] = internalFormat;
break;
+ case GL_READ_PIXELS_FORMAT: {
+ GLenum base_format = _mesa_base_tex_format(ctx, internalFormat);
+ switch (base_format) {
+ case GL_STENCIL_INDEX:
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_STENCIL:
+ case GL_RED:
+ case GL_RGB:
+ case GL_BGR:
+ case GL_RGBA:
+ case GL_BGRA:
+ params[0] = base_format;
+ break;
+ default:
+ params[0] = GL_NONE;
+ break;
+ }
+ break;
+ }
+
case GL_MANUAL_GENERATE_MIPMAP:
case GL_AUTO_GENERATE_MIPMAP:
case GL_SRGB_READ:
@@ -1086,14 +1104,11 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
break;
case GL_READ_PIXELS:
+ case GL_READ_PIXELS_FORMAT:
ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
buffer);
break;
- case GL_READ_PIXELS_FORMAT:
- /* @TODO */
- break;
-
case GL_READ_PIXELS_TYPE:
/* @TODO */
break;
--
2.5.3
More information about the mesa-dev
mailing list