[Mesa-dev] [PATCH] mesa: Fix the cause of piglit test fbo-array failure
Brian Paul
brianp at vmware.com
Mon Mar 12 08:40:33 PDT 2012
On 03/09/2012 07:07 PM, Anuj Phogat wrote:
> 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
>
> Note: This is a candidate for stable branches
>
> Signed-off-by: Anuj Phogat<anuj.phogat at gmail.com>
> ---
> src/mesa/main/fbobject.c | 20 ++++++++++++++------
> 1 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 281b1ca..670b464 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -1993,12 +1993,20 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
> }
> }
>
> - if ((level< 0) ||
> - (level>= _mesa_max_texture_levels(ctx, textarget))) {
> - _mesa_error(ctx, GL_INVALID_VALUE,
> - "glFramebufferTexture%sEXT(level)", caller);
> - return;
> - }
> + if (target == 0)
> + if ((level< 0) ||
> + (level>= _mesa_max_texture_levels(ctx, texObj->Target))) {
> + _mesa_error(ctx, GL_INVALID_VALUE,
> + "glFramebufferTexture%sEXT(level)", caller);
> + return;
> + }
> + else
> + if ((level< 0) ||
> + (level>= _mesa_max_texture_levels(ctx, textarget))) {
> + _mesa_error(ctx, GL_INVALID_VALUE,
> + "glFramebufferTexture%sEXT(level)", caller);
> + return;
> + }
> }
>
> att = _mesa_get_attachment(ctx, fb, attachment);
Let's try to avoid so much duplicated code. How about something like
this:
GLenum maxLevelsTarget;
maxLevelsTarget = textarget ? textarget : texObj->Target;
if ((level < 0) ||
(level >= _mesa_max_texture_levels(ctx, maxLevelsTarget))) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glFramebufferTexture%sEXT(level)", caller);
return;
}
I think it's kind of confusing that we pass textarget=0 for
glFramebufferTextureLayer(). I'm going to beef up the comments for that.
-Brian
More information about the mesa-dev
mailing list