return false;
}
+ return true;
+}
+
+/**
+ * Compute the bitmask of allowed primitive types (ValidPrimMask) depending
+ * on shaders and current states. This is used by draw validation.
+ *
+ * If some combinations of shaders and states are invalid, ValidPrimMask is
+ * set to 0, which will always set GL_INVALID_OPERATION in draw calls
+ * except for invalid enums, which will set GL_INVALID_ENUM, minimizing
+ * the number of gl_context variables that have to be read by draw calls.
+ */
+void
+_mesa_update_valid_to_render_state(struct gl_context *ctx)
+{
+ struct gl_pipeline_object *shader = ctx->_Shader;
+ unsigned mask = ctx->SupportedPrimMask;
+
+ if (_mesa_is_no_error_enabled(ctx)) {
+ ctx->ValidPrimMask = mask;
+ return;
+ }
+
+ /* Start with an empty mask and set this to the trimmed mask at the end. */
+ ctx->ValidPrimMask = 0;
+
/* Section 11.2 (Tessellation) of the ES 3.2 spec says:
*
* "An INVALID_OPERATION error is generated by any command that
* 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;
- }
+ if (shader->CurrentProgram[MESA_SHADER_TESS_CTRL] &&
+ !shader->CurrentProgram[MESA_SHADER_TESS_EVAL])
+ return;
switch (ctx->API) {
case API_OPENGLES2:
* evaluation shader."
*/
if (_mesa_is_gles3(ctx) &&
- ctx->TessEvalProgram._Current && !ctx->TessCtrlProgram._Current) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "%s(tess ctrl shader is missing)", function);
- return false;
- }
+ shader->CurrentProgram[MESA_SHADER_TESS_EVAL] &&
+ !shader->CurrentProgram[MESA_SHADER_TESS_CTRL])
+ return;
/* From GL_EXT_color_buffer_float:
*
* However GL_EXT_float_blend removes this text.
*/
if (!ctx->Extensions.EXT_float_blend &&
- (ctx->DrawBuffer->_FP32Buffers & ctx->Color.BlendEnabled)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "%s(32-bit float output + blending)", function);
- return false;
- }
+ (ctx->DrawBuffer->_FP32Buffers & ctx->Color.BlendEnabled))
+ return;
break;
case API_OPENGL_CORE:
* "An INVALID_OPERATION error is generated if no vertex array
* object is bound (see section 10.3.1)."
*/
- if (ctx->Array.VAO == ctx->Array.DefaultVAO) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no VAO bound)", function);
- return false;
- }
+ if (ctx->Array.VAO == ctx->Array.DefaultVAO)
+ return;
break;
case API_OPENGLES:
break;
default:
- unreachable("Invalid API value in check_valid_to_render()");
+ unreachable("Invalid API value in _mesa_update_valid_to_render_state");
}
- return true;
-}
-
-/**
- * Compute the bitmask of allowed primitive types (ValidPrimMask) depending
- * on shaders and current states. This is used by draw validation.
- *
- * If some combinations of shaders and states are invalid, ValidPrimMask is
- * set to 0, which will always set GL_INVALID_OPERATION in draw calls
- * except for invalid enums, which will set GL_INVALID_ENUM, minimizing
- * the number of gl_context variables that have to be read by draw calls.
- */
-void
-_mesa_update_valid_to_render_state(struct gl_context *ctx)
-{
- struct gl_pipeline_object *shader = ctx->_Shader;
- unsigned mask = ctx->SupportedPrimMask;
-
- if (_mesa_is_no_error_enabled(ctx)) {
- ctx->ValidPrimMask = mask;
- return;
- }
-
- /* Start with an empty mask and set this to the trimmed mask at the end. */
- ctx->ValidPrimMask = 0;
-
/* From GL_INTEL_conservative_rasterization spec:
*
* The conservative rasterization option applies only to polygons with