From 69ca1ef683b9cb3baaae423e726a0b867e0dbc33 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Fri, 5 May 2017 17:00:34 +1000 Subject: [PATCH] mesa: pass rb attachment to _mesa_framebuffer_texture() This change will help us add KHR_no_error support to the caller. Reviewed-by: Eric Anholt --- src/mesa/drivers/common/meta.c | 8 +++-- src/mesa/main/fbobject.c | 54 +++++++++++++++++++++++----------- src/mesa/main/fbobject.h | 4 +-- 3 files changed, 45 insertions(+), 21 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index f4c91ac22cc..47ef16b3e7d 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -118,8 +118,12 @@ _mesa_meta_framebuffer_texture_image(struct gl_context *ctx, ? GL_TEXTURE_CUBE_MAP_POSITIVE_X + texImage->Face : texObj->Target; - _mesa_framebuffer_texture(ctx, fb, attachment, texObj, texTarget, - level, layer, false, __func__); + struct gl_renderbuffer_attachment *att = + _mesa_get_and_validate_attachment(ctx, fb, attachment, __func__); + assert(att); + + _mesa_framebuffer_texture(ctx, fb, attachment, att, texObj, texTarget, + level, layer, false); } static struct gl_shader * diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 88679215c27..fb8fbe900d6 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -3224,15 +3224,10 @@ _mesa_get_and_validate_attachment(struct gl_context *ctx, void _mesa_framebuffer_texture(struct gl_context *ctx, struct gl_framebuffer *fb, GLenum attachment, + struct gl_renderbuffer_attachment *att, struct gl_texture_object *texObj, GLenum textarget, - GLint level, GLuint layer, GLboolean layered, - const char *caller) + GLint level, GLuint layer, GLboolean layered) { - struct gl_renderbuffer_attachment *att = - _mesa_get_and_validate_attachment(ctx, fb, attachment, caller); - if (!att) - return; - FLUSH_VERTICES(ctx, _NEW_BUFFERS); mtx_lock(&fb->Mutex); @@ -3331,8 +3326,13 @@ framebuffer_texture_with_dims(int dims, GLenum target, return; } - _mesa_framebuffer_texture(ctx, fb, attachment, texObj, textarget, level, - layer, GL_FALSE, caller); + struct gl_renderbuffer_attachment *att = + _mesa_get_and_validate_attachment(ctx, fb, attachment, caller); + if (!att) + return; + + _mesa_framebuffer_texture(ctx, fb, attachment, att, texObj, textarget, + level, layer, GL_FALSE); } @@ -3405,8 +3405,13 @@ _mesa_FramebufferTextureLayer(GLenum target, GLenum attachment, } } - _mesa_framebuffer_texture(ctx, fb, attachment, texObj, textarget, level, - layer, GL_FALSE, func); + struct gl_renderbuffer_attachment *att = + _mesa_get_and_validate_attachment(ctx, fb, attachment, func); + if (!att) + return; + + _mesa_framebuffer_texture(ctx, fb, attachment, att, texObj, textarget, + level, layer, GL_FALSE); } @@ -3447,8 +3452,13 @@ _mesa_NamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment, } } - _mesa_framebuffer_texture(ctx, fb, attachment, texObj, textarget, level, - layer, GL_FALSE, func); + struct gl_renderbuffer_attachment *att = + _mesa_get_and_validate_attachment(ctx, fb, attachment, func); + if (!att) + return; + + _mesa_framebuffer_texture(ctx, fb, attachment, att, texObj, textarget, + level, layer, GL_FALSE); } @@ -3490,8 +3500,13 @@ _mesa_FramebufferTexture(GLenum target, GLenum attachment, return; } - _mesa_framebuffer_texture(ctx, fb, attachment, texObj, 0, level, - 0, layered, func); + struct gl_renderbuffer_attachment *att = + _mesa_get_and_validate_attachment(ctx, fb, attachment, func); + if (!att) + return; + + _mesa_framebuffer_texture(ctx, fb, attachment, att, texObj, 0, level, + 0, layered); } @@ -3530,8 +3545,13 @@ _mesa_NamedFramebufferTexture(GLuint framebuffer, GLenum attachment, return; } - _mesa_framebuffer_texture(ctx, fb, attachment, texObj, 0, level, - 0, layered, func); + struct gl_renderbuffer_attachment *att = + _mesa_get_and_validate_attachment(ctx, fb, attachment, func); + if (!att) + return; + + _mesa_framebuffer_texture(ctx, fb, attachment, att, texObj, 0, level, + 0, layered); } diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h index aef2755c661..d0f905e46b0 100644 --- a/src/mesa/main/fbobject.h +++ b/src/mesa/main/fbobject.h @@ -127,9 +127,9 @@ _mesa_get_and_validate_attachment(struct gl_context *ctx, extern void _mesa_framebuffer_texture(struct gl_context *ctx, struct gl_framebuffer *fb, GLenum attachment, + struct gl_renderbuffer_attachment *att, struct gl_texture_object *texObj, GLenum textarget, - GLint level, GLuint layer, GLboolean layered, - const char *caller); + GLint level, GLuint layer, GLboolean layered); extern GLenum _mesa_check_framebuffer_status(struct gl_context *ctx, -- 2.30.2