[Mesa-stable] [Mesa-dev] [PATCH 1/2] mesa: Treat glBindRenderbuffer and glBindRenderbufferEXT correctly
Jordan Justen
jljusten at gmail.com
Sun Jul 28 12:54:16 PDT 2013
On Fri, Jul 26, 2013 at 10:55 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Allow user-generated names for glBindRenderbufferEXT on desktop GL.
> Disallow its use altogether for core profiles.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Cc: mesa-stable at lists.freedesktop.org
> ---
> src/mesa/main/fbobject.c | 32 +++++++++++++++++++++++++-------
> 1 file changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index a29f1ab..1cc0966 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -1104,11 +1104,11 @@ _mesa_IsRenderbuffer(GLuint renderbuffer)
> }
>
>
> -void GLAPIENTRY
> -_mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer)
> +static void
> +bind_renderbuffer(struct gl_context *ctx, GLenum target, GLuint renderbuffer,
> + bool allow_user_names)
> {
> struct gl_renderbuffer *newRb;
> - GET_CURRENT_CONTEXT(ctx);
>
> if (target != GL_RENDERBUFFER_EXT) {
> _mesa_error(ctx, GL_INVALID_ENUM, "glBindRenderbufferEXT(target)");
> @@ -1125,9 +1125,7 @@ _mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer)
> /* ID was reserved, but no real renderbuffer object made yet */
> newRb = NULL;
> }
> - else if (!newRb
> - && _mesa_is_desktop_gl(ctx)
> - && ctx->Extensions.ARB_framebuffer_object) {
> + else if (!newRb && !allow_user_names) {
> /* All RB IDs must be Gen'd */
> _mesa_error(ctx, GL_INVALID_OPERATION, "glBindRenderbuffer(buffer)");
> return;
> @@ -1154,11 +1152,31 @@ _mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer)
> _mesa_reference_renderbuffer(&ctx->CurrentRenderbuffer, newRb);
> }
>
> +void GLAPIENTRY
> +_mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer)
> +{
> + GET_CURRENT_CONTEXT(ctx);
> +
> + /* OpenGL ES glBindRenderbuffer and glBindRenderbufferOES use this same
> + * entry point, but they allow the use of user-generated names.
> + */
> + bind_renderbuffer(ctx, target, renderbuffer, _mesa_is_gles(ctx));
> +}
>
> void GLAPIENTRY
> _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
> {
> - _mesa_BindRenderbuffer(target, renderbuffer);
> + GET_CURRENT_CONTEXT(ctx);
> +
> + /* Disallowing the EXT function altogether prevents a loop-hole from
> + * allowing user-generated names in a core profile / OpenGL 3.1.
> + */
> + if (ctx->API == API_OPENGL_CORE) {
> + _mesa_generic_nop();
> + return;
Could we make the api_exec.c generation not bind
BindRenderbufferEXT/BindFramebufferEXT for CORE contexts?
Series Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
> + }
> +
> + bind_renderbuffer(ctx, target, renderbuffer, true);
> }
>
>
> --
> 1.8.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-stable
mailing list