summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/fbobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 12527f8a541..26ae1087c6e 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;