diff options
author | Brian Paul <brianp@vmware.com> | 2009-10-02 08:54:55 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-10-02 09:03:27 -0600 |
commit | f1cab802b8e78906413f219ad354f5d5500b4d3f (patch) | |
tree | c3c41a199cdd4f0e874aaa9d3354fe5ca62fbfe3 /src/mesa/drivers/common | |
parent | f9f7646fe64364f74cc8dd1a6d5ca3a6700f142f (diff) |
mesa: added _mesa_meta_check_generate_mipmap_fallback()
Diffstat (limited to 'src/mesa/drivers/common')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 27 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta.h | 4 |
2 files changed, 28 insertions, 3 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index a152087a3a..20d47dc38b 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1949,6 +1949,29 @@ _mesa_meta_Bitmap(GLcontext *ctx, /** + * Check if the call to _mesa_meta_GenerateMipmap() will require a + * software fallback. The fallback path will require that the texture + * images are mapped. + */ +GLboolean +_mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target, + struct gl_texture_object *texObj) +{ + struct gl_texture_image *baseImage = + _mesa_select_tex_image(ctx, texObj, target, texObj->BaseLevel); + + /* check for fallbacks */ + if (!ctx->Extensions.EXT_framebuffer_object || + target == GL_TEXTURE_3D || + !baseImage || + baseImage->IsCompressed) { + return GL_TRUE; + } + return GL_FALSE; +} + + +/** * Called via ctx->Driver.GenerateMipmap() * Note: texture borders and 3D texture support not yet complete. */ @@ -1976,9 +1999,7 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, GLuint dstLevel; GLuint border = 0; - /* check for fallbacks */ - if (!ctx->Extensions.EXT_framebuffer_object || - target == GL_TEXTURE_3D) { + if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, texObj)) { _mesa_generate_mipmap(ctx, target, texObj); return; } diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 7f659528dc..6225b94189 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -60,6 +60,10 @@ _mesa_meta_Bitmap(GLcontext *ctx, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); +extern GLboolean +_mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target, + struct gl_texture_object *texObj); + extern void _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj); |