summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-10-02 14:50:21 -0700
committerIan Romanick <[email protected]>2011-10-04 12:25:56 -0700
commit7e4cb32d05cdf948a60632270e75b5513e780b28 (patch)
treebc36b03d3e17c56b01fb85182650c984c2a95532
parent3db309aecee57d7e0055a49a0e12a491a554347b (diff)
mesa/es: Validate FBO attachment enum in Mesa code rather than the ES wrapper
Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]>
-rw-r--r--src/mesa/main/APIspec.xml27
-rw-r--r--src/mesa/main/fbobject.c7
2 files changed, 6 insertions, 28 deletions
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 @@
<value name="GL_FRAMEBUFFER" category="GLES2.0"/>
</desc>
- <desc name="attachment">
- <value name="GL_COLOR_ATTACHMENT0_OES" category="OES_framebuffer_object"/>
- <value name="GL_DEPTH_ATTACHMENT_OES" category="OES_framebuffer_object"/>
- <value name="GL_STENCIL_ATTACHMENT_OES" category="OES_framebuffer_object"/>
- <value name="GL_COLOR_ATTACHMENT0" category="GLES2.0"/>
- <value name="GL_DEPTH_ATTACHMENT" category="GLES2.0"/>
- <value name="GL_STENCIL_ATTACHMENT" category="GLES2.0"/>
- </desc>
-
<desc name="renderbuffertarget">
<value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/>
<value name="GL_RENDERBUFFER" category="GLES2.0"/>
@@ -3247,15 +3238,6 @@
<value name="GL_FRAMEBUFFER" category="GLES2.0"/>
</desc>
- <desc name="attachment">
- <value name="GL_COLOR_ATTACHMENT0_OES" category="OES_framebuffer_object"/>
- <value name="GL_DEPTH_ATTACHMENT_OES" category="OES_framebuffer_object"/>
- <value name="GL_STENCIL_ATTACHMENT_OES" category="OES_framebuffer_object"/>
- <value name="GL_COLOR_ATTACHMENT0" category="GLES2.0"/>
- <value name="GL_DEPTH_ATTACHMENT" category="GLES2.0"/>
- <value name="GL_STENCIL_ATTACHMENT" category="GLES2.0"/>
- </desc>
-
<desc name="textarget" error="GL_INVALID_OPERATION">
<value name="GL_TEXTURE_2D"/>
<value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
@@ -3292,15 +3274,6 @@
<value name="GL_FRAMEBUFFER" category="GLES2.0"/>
</desc>
- <desc name="attachment">
- <value name="GL_COLOR_ATTACHMENT0_OES" category="OES_framebuffer_object"/>
- <value name="GL_DEPTH_ATTACHMENT_OES" category="OES_framebuffer_object"/>
- <value name="GL_STENCIL_ATTACHMENT_OES" category="OES_framebuffer_object"/>
- <value name="GL_COLOR_ATTACHMENT0" category="GLES2.0"/>
- <value name="GL_DEPTH_ATTACHMENT" category="GLES2.0"/>
- <value name="GL_STENCIL_ATTACHMENT" category="GLES2.0"/>
- </desc>
-
<desc name="textarget" error="GL_INVALID_OPERATION">
<value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
</desc>
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];