summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/api_validate.c
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-04-03 16:38:18 +1000
committerTimothy Arceri <[email protected]>2017-04-19 16:53:25 +1000
commit4df2931a87fe082f90871564a89a09c826641f5b (patch)
tree08754c616baa74187a9f9c9cde48f531ca4fa5c6 /src/mesa/main/api_validate.c
parent63a14e9e14796ee3e50eb2a66cd9d412e6ab10cc (diff)
mesa/vbo: move some Draw checks out of validation
These checks do not generate any errors. Move them so we can add KHR_no_error support and still make sure we do these checks. Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa/main/api_validate.c')
-rw-r--r--src/mesa/main/api_validate.c43
1 files changed, 2 insertions, 41 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index e23be60b2b4..bddde29878a 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -290,15 +290,6 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
"%s(tess ctrl shader is missing)", function);
return false;
}
-
- /* For ES2, we can draw if we have a vertex program/shader). */
- return ctx->VertexProgram._Current != NULL;
-
- case API_OPENGLES:
- /* For OpenGL ES, only draw if we have vertex positions
- */
- if (!ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled)
- return false;
break;
case API_OPENGL_CORE:
@@ -312,32 +303,10 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(no VAO bound)", function);
return false;
}
+ break;
- /* Section 7.3 (Program Objects) of the OpenGL 4.5 Core Profile spec
- * says:
- *
- * "If there is no active program for the vertex or fragment shader
- * stages, the results of vertex and/or fragment processing will be
- * undefined. However, this is not an error."
- *
- * The fragment shader is not tested here because other state (e.g.,
- * GL_RASTERIZER_DISCARD) affects whether or not we actually care.
- */
- return ctx->VertexProgram._Current != NULL;
-
+ case API_OPENGLES:
case API_OPENGL_COMPAT:
- if (ctx->VertexProgram._Current != NULL) {
- /* Draw regardless of whether or not we have any vertex arrays.
- * (Ex: could draw a point using a constant vertex pos)
- */
- return true;
- } else {
- /* Draw if we have vertex positions (GL_VERTEX_ARRAY or generic
- * array [0]).
- */
- return (ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled ||
- ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled);
- }
break;
default:
@@ -700,14 +669,6 @@ validate_DrawElements_common(struct gl_context *ctx,
if (!check_valid_to_render(ctx, caller))
return false;
- /* Not using a VBO for indices, so avoid NULL pointer derefs later.
- */
- if (!_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj) && indices == NULL)
- return false;
-
- if (count == 0)
- return false;
-
return true;
}