/* complicated error checking... */
for (output = 0; output < n; output++) {
+ /* 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)"
+ */
+ if (_mesa_is_gles3(ctx) && 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;
+ }
+
if (buffers[output] == GL_NONE) {
destMask[output] = 0x0;
}