Hi;
On 12/15/2014 12:47 PM, Eduardo Lima Mitev wrote:
Section 4.2 (Whole Framebuffer Operations) of the OpenGL 3.0 specification
says "Each buffer listed in bufs must be BACK, NONE, or one of the values from
table 4.3 (NONE, COLOR_ATTACHMENTi)".
This patch adds this check before previous other, more complex validation steps.
Fixes 1 dEQP test: dEQP-GLES3.functional.negative_api.buffer.draw_buffers
---
src/mesa/main/buffers.c | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 1ee2009..d7e97c7 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -323,14 +323,31 @@ _mesa_DrawBuffers(GLsizei n, const GLenum *buffers)
supportedMask = supported_buffer_bitmask(ctx, ctx->DrawBuffer);
usedBufferMask = 0x0;
- /* From the ES 3.0 specification, page 180:
- * "If the GL is bound to the default framebuffer, then n must be 1
- * and the constant must be BACK or NONE."
- */
- if (_mesa_is_gles3(ctx) && _mesa_is_winsys_fbo(ctx->DrawBuffer) &&
- (n != 1 || (buffers[0] != GL_NONE && buffers[0] != GL_BACK))) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffers(buffer)");
- return;
+ if (_mesa_is_gles3(ctx)) {
+ /* Section 4.2 (Whole Framebuffer Operations) of the OpenGL 3.0
+ * specification says:
+ *
+ * "Each buffer listed in bufs must be BACK, NONE, or one of the
values
+ * from table 4.3 (NONE, COLOR_ATTACHMENTi)"
+ */
+ for (output = 0; output < n; output++) {
+ if (buffers[output] != GL_NONE && buffers[output] != GL_BACK &&
+ (buffers[output] < GL_COLOR_ATTACHMENT0 ||
+ buffers[output] >= GL_COLOR_ATTACHMENT0 +
ctx->Const.MaxColorAttachments)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffers(buffer)");
+ return;
+ }
Could you move this check to happen in the loop below? We are anyway
iterating through the buffers there.
(This patch will need some rebasing due to my changes, sorry!)
+ }
+
+ /* From the ES 3.0 specification, page 180:
+ * "If the GL is bound to the default framebuffer, then n must be 1
+ * and the constant must be BACK or NONE."
+ */
+ if (_mesa_is_winsys_fbo(ctx->DrawBuffer) &&
+ (n != 1 || (buffers[0] != GL_NONE && buffers[0] != GL_BACK))) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffers(buffer)");
+ return;
+ }
}
/* complicated error checking... */
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev