summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/api_validate.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-03-02 12:27:16 -0700
committerBrian Paul <[email protected]>2009-03-02 12:27:16 -0700
commit97dd2ddbd97ba95e8bc8ab572ec05e8081556e1e (patch)
tree076815825789ae873855b4bd311bda974e980e82 /src/mesa/main/api_validate.c
parentf1a083d4b8c86e0ba335ab162f60b6f2b8391c31 (diff)
mesa: don't draw arrays if vertex position array is not enabled
For regular GL, we must have vertex positions in order to draw. But ES2 doesn't have that requirement (positions can be computed from any array of data). See bug 19911.
Diffstat (limited to 'src/mesa/main/api_validate.c')
-rw-r--r--src/mesa/main/api_validate.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 5c8955d7c8d..42d1e579e08 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -87,11 +87,20 @@ check_valid_to_render(GLcontext *ctx, char *function)
return GL_FALSE;
}
- /* Always need vertex positions, unless a vertex program is in use */
- if (!ctx->VertexProgram._Current &&
- !ctx->Array.ArrayObj->Vertex.Enabled &&
+#if FEATURE_es2_glsl
+ /* For ES2, we can draw if any vertex array is enabled (and we should
+ * always have a vertex program/shader).
+ */
+ if (ctx->Array.ArrayObj->_Enabled == 0x0 || !ctx->VertexProgram._Current)
+ return GL_FALSE;
+#else
+ /* For regular OpenGL, only draw if we have vertex positions (regardless
+ * of whether or not we have a vertex program/shader).
+ */
+ if (!ctx->Array.ArrayObj->Vertex.Enabled &&
!ctx->Array.ArrayObj->VertexAttrib[0].Enabled)
return GL_FALSE;
+#endif
return GL_TRUE;
}