[Mesa-dev] [RFC 39/63] mesa/formatquery: Added mipmap related <pname> queries
Eduardo Lima Mitev
elima at igalia.com
Tue Jan 19 08:42:19 PST 2016
From: Antia Puentes <apuentes at igalia.com>
Specifically MIPMAP, MANUAL_GENERATE_MIPMAP and AUTO_GENERATE_MIPMAP <pname>
queries.
>From the ARB_internalformat_query2 specification:
"- MIPMAP: If the resource supports mipmaps, TRUE is returned in <params>.
If the resource is not supported, or if mipmaps are not supported for
this type of resource, FALSE is returned.
- MANUAL_GENERATE_MIPMAP: The support for manually generating mipmaps for
the resource is returned in <params>.
Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE.
If the resource is not supported, or if the operation is not supported,
NONE is returned.
- AUTO_GENERATE_MIPMAP: The support for automatic generation of mipmaps
for the resource is returned in <params>.
Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE.
If the resource is not supported, or if the operation is not supported,
NONE is returned."
---
src/mesa/main/formatquery.c | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index f0ea210..f6d0df5 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -32,6 +32,7 @@
#include "texparam.h"
#include "texobj.h"
#include "get.h"
+#include "genmipmap.h"
static bool
_is_renderable(struct gl_context *ctx, GLenum internalformat)
@@ -593,6 +594,11 @@ _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target,
params[0] = internalFormat;
break;
+ case GL_MANUAL_GENERATE_MIPMAP:
+ case GL_AUTO_GENERATE_MIPMAP:
+ params[0] = GL_FULL_SUPPORT;
+ break;
+
default:
_set_default_response(pname, params);
break;
@@ -1057,15 +1063,22 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
break;
case GL_MIPMAP:
- /* @TODO */
- break;
-
case GL_MANUAL_GENERATE_MIPMAP:
- /* @TODO */
- break;
-
case GL_AUTO_GENERATE_MIPMAP:
- /* @TODO */
+ if (pname == GL_MANUAL_GENERATE_MIPMAP &&
+ !ctx->Extensions.ARB_framebuffer_object)
+ goto end;
+
+ if (!_mesa_is_valid_generate_texture_mipmap_target(ctx, target) ||
+ !_mesa_is_valid_generate_texture_mipmap_internalformat(ctx,
+ internalformat))
+ goto end;
+
+ if (pname == GL_MIPMAP)
+ buffer[0] = GL_TRUE;
+ else
+ ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
+ buffer);
break;
case GL_COLOR_ENCODING:
--
2.5.3
More information about the mesa-dev
mailing list