+ return false;
+ }
+
+ /* Section 6.3.2 from the GL 4.5:
+ * "Any GL command which attempts to read from, write to, or change
+ * the state of a buffer object may generate an INVALID_OPERATION error if
+ * all or part of the buffer object is mapped ... However, only commands
+ * which explicitly describe this error are required to do so. If an error
+ * is not generated, such commands will have undefined results and may
+ * result in GL interruption or termination."
+ *
+ * Only some buffer API functions require INVALID_OPERATION with mapped
+ * buffers. No other functions list such an error, thus it's not required
+ * to report INVALID_OPERATION for draw calls with mapped buffers.
+ */
+ if (!ctx->Const.AllowMappedBuffersDuringExecution &&
+ !_mesa_all_buffers_are_unmapped(ctx->Array.VAO)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(vertex buffers are mapped)", function);
+ return false;
+ }
+
+ /* Section 11.2 (Tessellation) of the ES 3.2 spec says:
+ *
+ * "An INVALID_OPERATION error is generated by any command that
+ * transfers vertices to the GL if the current program state has
+ * one but not both of a tessellation control shader and tessellation
+ * evaluation shader."
+ *
+ * The OpenGL spec argues that this is allowed because a tess ctrl shader
+ * without a tess eval shader can be used with transform feedback.
+ * However, glBeginTransformFeedback doesn't allow GL_PATCHES and
+ * therefore doesn't allow tessellation.
+ *
+ * Further investigation showed that this is indeed a spec bug and
+ * a tess ctrl shader without a tess eval shader shouldn't have been
+ * allowed, because there is no API in GL 4.0 that can make use this
+ * to produce something useful.
+ *
+ * Also, all vendors except one don't support a tess ctrl shader without
+ * a tess eval shader anyway.
+ */
+ if (ctx->TessCtrlProgram._Current && !ctx->TessEvalProgram._Current) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(tess eval shader is missing)", function);
+ return false;