From cc5b0ffae048824a6bdcaf43e0c8c2dd4a7ff14b Mon Sep 17 00:00:00 2001 From: Anuj Phogat Date: Mon, 12 Mar 2012 10:39:48 -0700 Subject: mesa: Fix the cause of piglit test fbo-array failure Handle the special case of glFramebufferTextureLayer() for which we pass teximage = 0 internally in framebuffer_texture(). This patch makes failing piglit test fbo-array, fbo-depth-array to pass. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47126 V4: Removed the duplicated code. Note: This is a candidate for the stable branches. Signed-off-by: Anuj Phogat Reviewed-by: Brian Paul --- src/mesa/main/fbobject.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 12527f8a54..26ae1087c6 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1927,6 +1927,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, struct gl_renderbuffer_attachment *att; struct gl_texture_object *texObj = NULL; struct gl_framebuffer *fb; + GLenum maxLevelsTarget; ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -2001,8 +2002,9 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, } } + maxLevelsTarget = textarget ? textarget : texObj->Target; if ((level < 0) || - (level >= _mesa_max_texture_levels(ctx, textarget))) { + (level >= _mesa_max_texture_levels(ctx, maxLevelsTarget))) { _mesa_error(ctx, GL_INVALID_VALUE, "glFramebufferTexture%sEXT(level)", caller); return; -- cgit v1.2.3