From 20cf1851d82d6135b92c20323266156eb6ad5ffe Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Dec 2010 08:23:31 -0700 Subject: mesa: fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME query Return 0 instead of generating an error. See http://bugs.freedesktop.org/show_bug.cgi?id=30993 Note that piglit fbo-getframebufferattachmentparameter-01 still does not pass. But Mesa behaves the same as the NVIDIA driver in this case. Perhaps the test is incorrect. NOTE: This is a candidate for the 7.9 branch. --- src/mesa/main/fbobject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main/fbobject.c') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 7c3357043fa..560a2f68bea 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -2024,8 +2024,8 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, *params = att->Texture->Name; } else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetFramebufferAttachmentParameterivEXT(pname)"); + assert(att->Type == GL_NONE); + *params = 0; } return; case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT: -- cgit v1.2.3 From 6d13ec7dc082aea9a8ce04dd8e045e77e5921d8a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Dec 2010 08:30:41 -0700 Subject: mesa: return GL_FRAMEBUFFER_DEFAULT as FBO attachment type If querying the default/window-system FBO's attachment type, return GL_FRAMEBUFFER_DEFAULT (per the GL_ARB_framebuffer_object spec). See http://bugs.freedesktop.org/show_bug.cgi?id=31947 NOTE: This is a candidate for the 7.9 branch. --- src/mesa/main/fbobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main/fbobject.c') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 560a2f68bea..47ac6306cfe 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -2014,7 +2014,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, switch (pname) { case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT: - *params = att->Type; + *params = buffer->Name == 0 ? GL_FRAMEBUFFER_DEFAULT : att->Type; return; case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT: if (att->Type == GL_RENDERBUFFER_EXT) { -- cgit v1.2.3 From ecb7cc3319a74bda1edc226a1103f0e1a86d92a9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 6 Dec 2010 15:11:41 -0700 Subject: mesa: test for cube map completeness in glGenerateMipmap() The texture is not cube complete if the base level images aren't of the same size and format. NOTE: This is a candidate for the 7.9 branch. --- src/mesa/main/fbobject.c | 8 ++++++++ src/mesa/main/texobj.c | 38 ++++++++++++++++++++++++++++++++++++++ src/mesa/main/texobj.h | 3 +++ 3 files changed, 49 insertions(+) (limited to 'src/mesa/main/fbobject.c') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 47ac6306cfe..975063d0d78 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -2146,6 +2146,7 @@ _mesa_GenerateMipmapEXT(GLenum target) /* OK, legal value */ break; default: + /* XXX need to implement GL_TEXTURE_1D_ARRAY and GL_TEXTURE_2D_ARRAY */ _mesa_error(ctx, GL_INVALID_ENUM, "glGenerateMipmapEXT(target)"); return; } @@ -2157,6 +2158,13 @@ _mesa_GenerateMipmapEXT(GLenum target) return; } + if (texObj->Target == GL_TEXTURE_CUBE_MAP && + !_mesa_cube_complete(texObj)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGenerateMipmap(incomplete cube map)"); + return; + } + _mesa_lock_texture(ctx, texObj); if (target == GL_TEXTURE_CUBE_MAP) { GLuint face; diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 72dbf10cc4b..8d9c9794a15 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -687,6 +687,44 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, } +/** + * Check if the given cube map texture is "cube complete" as defined in + * the OpenGL specification. + */ +GLboolean +_mesa_cube_complete(const struct gl_texture_object *texObj) +{ + const GLint baseLevel = texObj->BaseLevel; + const struct gl_texture_image *img0, *img; + GLuint face; + + if (texObj->Target != GL_TEXTURE_CUBE_MAP) + return GL_FALSE; + + if ((baseLevel < 0) || (baseLevel >= MAX_TEXTURE_LEVELS)) + return GL_FALSE; + + /* check first face */ + img0 = texObj->Image[0][baseLevel]; + if (!img0 || + img0->Width < 1 || + img0->Width != img0->Height) + return GL_FALSE; + + /* check remaining faces vs. first face */ + for (face = 1; face < 6; face++) { + img = texObj->Image[face][baseLevel]; + if (!img || + img->Width != img0->Width || + img->Height != img0->Height || + img->TexFormat != img0->TexFormat) + return GL_FALSE; + } + + return GL_TRUE; +} + + /** * Mark a texture object dirty. It forces the object to be incomplete * and optionally forces the context to re-validate its state. diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index 9e3bf50147a..2461b063efd 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -69,6 +69,9 @@ extern void _mesa_test_texobj_completeness( const struct gl_context *ctx, struct gl_texture_object *obj ); +extern GLboolean +_mesa_cube_complete(const struct gl_texture_object *texObj); + extern void _mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj, GLboolean invalidate_state); -- cgit v1.2.3