From: Ian Romanick Date: Sun, 2 Oct 2011 21:50:21 +0000 (-0700) Subject: mesa/es: Validate FBO attachment enum in Mesa code rather than the ES wrapper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e4cb32d05cdf948a60632270e75b5513e780b28;p=mesa.git mesa/es: Validate FBO attachment enum in Mesa code rather than the ES wrapper Signed-off-by: Ian Romanick Reviewed-by: Brian Paul --- diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml index 0f82d0a38e1..2b277a081b9 100644 --- a/src/mesa/main/APIspec.xml +++ b/src/mesa/main/APIspec.xml @@ -3217,15 +3217,6 @@ - - - - - - - - - @@ -3247,15 +3238,6 @@ - - - - - - - - - @@ -3292,15 +3274,6 @@ - - - - - - - - - diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 139ff03da06..2e0af97f4d3 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -239,17 +239,22 @@ _mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, case GL_COLOR_ATTACHMENT14_EXT: case GL_COLOR_ATTACHMENT15_EXT: i = attachment - GL_COLOR_ATTACHMENT0_EXT; - if (i >= ctx->Const.MaxColorAttachments) { + if (i >= ctx->Const.MaxColorAttachments + || (i > 0 && ctx->API != API_OPENGL)) { return NULL; } return &fb->Attachment[BUFFER_COLOR0 + i]; case GL_DEPTH_STENCIL_ATTACHMENT: + if (ctx->API != API_OPENGL) + return NULL; /* fall-through */ case GL_DEPTH_BUFFER: /* fall-through / new in GL 3.0 */ case GL_DEPTH_ATTACHMENT_EXT: return &fb->Attachment[BUFFER_DEPTH]; case GL_STENCIL_BUFFER: + if (ctx->API != API_OPENGL) + return NULL; /* fall-through / new in GL 3.0 */ case GL_STENCIL_ATTACHMENT_EXT: return &fb->Attachment[BUFFER_STENCIL];