summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/api_validate.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-05-18 16:19:06 -0600
committerBrian Paul <[email protected]>2011-05-19 21:18:33 -0600
commit43bdabd47d98975b56a759954fb5f37d2942c101 (patch)
treec8a6e35b769e6edf7c9afa6d7d2d905a8edba4b6 /src/mesa/main/api_validate.c
parentbe0a2f62f3a5bc6f05c3c7c6b674f2688aee031d (diff)
mesa: fix vertex array enable checking in check_valid_to_render()
In particular, this fixes the case where a vertex shader only uses generic vertex attributes (non-0th). Before, we were no-op'ing the glDrawArrays/Elements(). This fixes the new piglit pos-array test. NOTE: This is a candidate for the 7.10 branch.
Diffstat (limited to 'src/mesa/main/api_validate.c')
-rw-r--r--src/mesa/main/api_validate.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 7c4652f747f..993519f61b2 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -116,17 +116,39 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
break;
#endif
-#if FEATURE_ES1 || FEATURE_GL
+#if FEATURE_ES1
case API_OPENGLES:
- case API_OPENGL:
- /* 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)
+ /* For OpenGL ES, only draw if we have vertex positions
+ */
+ if (!ctx->Array.ArrayObj->Vertex.Enabled)
return GL_FALSE;
break;
#endif
+#if FEATURE_GL
+ case API_OPENGL:
+ {
+ const struct gl_shader_program *vsProg =
+ ctx->Shader.CurrentVertexProgram;
+ GLboolean haveVertexShader = (vsProg && vsProg->LinkStatus);
+ GLboolean haveVertexProgram = ctx->VertexProgram._Enabled;
+ if (haveVertexShader || haveVertexProgram) {
+ /* Draw regardless of whether or not we have any vertex arrays.
+ * (Ex: could draw a point using a constant vertex pos)
+ */
+ return GL_TRUE;
+ }
+ else {
+ /* Draw if we have vertex positions (GL_VERTEX_ARRAY or generic
+ * array [0]).
+ */
+ return (ctx->Array.ArrayObj->Vertex.Enabled ||
+ ctx->Array.ArrayObj->VertexAttrib[0].Enabled);
+ }
+ }
+ break;
+#endif
+
default:
ASSERT_NO_FEATURE();
}