diff options
author | Eduardo Lima Mitev <[email protected]> | 2015-12-22 18:52:38 +0100 |
---|---|---|
committer | Eduardo Lima Mitev <[email protected]> | 2016-03-03 15:14:07 +0100 |
commit | 020671f2a3d47ff35e9937b4db3fa09df6f6d488 (patch) | |
tree | b33d03cb0f48ce1503cac3cb88536a0a759dc630 /src | |
parent | bec286f7246bedba9f7f34185f2e1e29befec3ab (diff) |
mesa/formatquery: Add READ_PIXELS_TYPE pname
We call the driver to provide its preferred type, but also provide a
default implementation that selects a generic type based on the passed
internal format.
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/formatquery.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c index a5f7c774a9d..32f8cf42953 100644 --- a/src/mesa/main/formatquery.c +++ b/src/mesa/main/formatquery.c @@ -590,6 +590,17 @@ _legal_target_for_framebuffer_texture_layer(struct gl_context *ctx, } } +static GLenum +_mesa_generic_type_for_internal_format(GLenum internalFormat) +{ + if (_mesa_is_enum_format_unsigned_int(internalFormat)) + return GL_UNSIGNED_BYTE; + else if (_mesa_is_enum_format_signed_int(internalFormat)) + return GL_BYTE; + else + return GL_FLOAT; +} + /* default implementation of QueryInternalFormat driverfunc, for * drivers not implementing ARB_internalformat_query2. */ @@ -634,6 +645,15 @@ _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target, break; } + case GL_READ_PIXELS_TYPE: { + GLenum base_format = _mesa_base_tex_format(ctx, internalFormat); + if (base_format > 0) + params[0] = _mesa_generic_type_for_internal_format(internalFormat); + else + params[0] = GL_NONE; + break; + } + case GL_MANUAL_GENERATE_MIPMAP: case GL_AUTO_GENERATE_MIPMAP: case GL_SRGB_READ: @@ -1109,14 +1129,11 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, case GL_READ_PIXELS: case GL_READ_PIXELS_FORMAT: + case GL_READ_PIXELS_TYPE: ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, buffer); break; - case GL_READ_PIXELS_TYPE: - /* @TODO */ - break; - case GL_TEXTURE_IMAGE_FORMAT: /* @TODO */ break; |