From: Timothy Arceri Date: Fri, 5 May 2017 06:25:11 +0000 (+1000) Subject: mesa: add error version of get_texture_for_framebuffer() X-Git-Tag: upstream/18.1.0~9880 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=304058a1fb209f25be65622202c1c21dcd6ceaf5;p=platform%2Fupstream%2Fmesa.git mesa: add error version of get_texture_for_framebuffer() This is a step towards KHR_no_error support. Reviewed-by: Eric Anholt --- diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index fb8fbe9..4759441 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -2910,6 +2910,16 @@ reuse_framebuffer_texture_attachment(struct gl_framebuffer *fb, } +static struct gl_texture_object * +get_texture_for_framebuffer(struct gl_context *ctx, GLuint texture) +{ + if (!texture) + return NULL; + + return _mesa_lookup_texture(ctx, texture); +} + + /** * Common code called by gl*FramebufferTexture*() to retrieve the correct * texture object pointer. @@ -2920,9 +2930,9 @@ reuse_framebuffer_texture_attachment(struct gl_framebuffer *fb, * \return true if no errors, false if errors */ static bool -get_texture_for_framebuffer(struct gl_context *ctx, GLuint texture, - bool layered, const char *caller, - struct gl_texture_object **texObj) +get_texture_for_framebuffer_err(struct gl_context *ctx, GLuint texture, + bool layered, const char *caller, + struct gl_texture_object **texObj) { *texObj = NULL; /* This will get returned if texture = 0. */ @@ -3312,7 +3322,7 @@ framebuffer_texture_with_dims(int dims, GLenum target, } /* Get the texture object */ - if (!get_texture_for_framebuffer(ctx, texture, false, caller, &texObj)) + if (!get_texture_for_framebuffer_err(ctx, texture, false, caller, &texObj)) return; if (texObj) { @@ -3385,7 +3395,7 @@ _mesa_FramebufferTextureLayer(GLenum target, GLenum attachment, } /* Get the texture object */ - if (!get_texture_for_framebuffer(ctx, texture, false, func, &texObj)) + if (!get_texture_for_framebuffer_err(ctx, texture, false, func, &texObj)) return; if (texObj) { @@ -3432,7 +3442,7 @@ _mesa_NamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment, return; /* Get the texture object */ - if (!get_texture_for_framebuffer(ctx, texture, false, func, &texObj)) + if (!get_texture_for_framebuffer_err(ctx, texture, false, func, &texObj)) return; if (texObj) { @@ -3489,7 +3499,7 @@ _mesa_FramebufferTexture(GLenum target, GLenum attachment, } /* Get the texture object */ - if (!get_texture_for_framebuffer(ctx, texture, true, func, &texObj)) + if (!get_texture_for_framebuffer_err(ctx, texture, true, func, &texObj)) return; if (texObj) { @@ -3533,7 +3543,7 @@ _mesa_NamedFramebufferTexture(GLuint framebuffer, GLenum attachment, return; /* Get the texture object */ - if (!get_texture_for_framebuffer(ctx, texture, true, func, &texObj)) + if (!get_texture_for_framebuffer_err(ctx, texture, true, func, &texObj)) return; if (texObj) {