if (mode <= GL_TRIANGLE_STRIP_ADJACENCY)
return _mesa_has_geometry_shaders(ctx);
+ if (mode == GL_PATCHES)
+ return _mesa_has_tessellation(ctx);
+
return false;
}
* etc? Also, do additional checking related to transformation feedback.
* Note: this function cannot be called during glNewList(GL_COMPILE) because
* this code depends on current transform feedback state.
+ * Also, do additional checking related to tessellation shaders.
*/
GLboolean
_mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
}
}
+ /* From the OpenGL 4.0 (Core Profile) spec (section 2.12):
+ *
+ * "Tessellation operates only on patch primitives. If tessellation is
+ * active, any command that transfers vertices to the GL will
+ * generate an INVALID_OPERATION error if the primitive mode is not
+ * PATCHES.
+ * Patch primitives are not supported by pipeline stages below the
+ * tessellation evaluation shader. If there is no active program
+ * object or the active program object does not contain a tessellation
+ * evaluation shader, the error INVALID_OPERATION is generated by any
+ * command that transfers vertices to the GL if the primitive mode is
+ * PATCHES."
+ *
+ */
+ if (ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL] ||
+ ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL]) {
+ if (mode != GL_PATCHES) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "only GL_PATCHES valid with tessellation");
+ return GL_FALSE;
+ }
+ }
+ else {
+ if (mode == GL_PATCHES) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "GL_PATCHES only valid with tessellation");
+ return GL_FALSE;
+ }
+ }
+
/* From the GL_EXT_transform_feedback spec:
*
* "The error INVALID_OPERATION is generated if Begin, or any command
pass = GL_FALSE;
}
}
+ else if (ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL]) {
+ struct gl_shader_program *tes =
+ ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
+
+ if (tes->TessEval.PointMode)
+ pass = ctx->TransformFeedback.Mode == GL_POINTS;
+ else if (tes->TessEval.PrimitiveMode == GL_ISOLINES)
+ pass = ctx->TransformFeedback.Mode == GL_LINES;
+ else
+ pass = ctx->TransformFeedback.Mode == GL_TRIANGLES;
+ }
else {
switch (mode) {
case GL_POINTS: