From f67b020a942911f80b7b774c6d64701d1981c608 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Mon, 24 May 2010 10:01:38 -0400 Subject: mesa: Handle FEATURE_es2_glsl differences at runtime too Now that we can support different APIs at runtime, we need to check the context for the API we're currently providing as well. https://bugs.freedesktop.org/show_bug.cgi?id=28194 --- src/mesa/main/api_validate.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index f6da86d296..150bc3886c 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -105,21 +105,31 @@ check_valid_to_render(GLcontext *ctx, const char *function) return GL_FALSE; } + switch (ctx->API) { #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; + case API_OPENGLES2: + /* 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; + break; #endif +#if FEATURE_ES1 || FEATURE_GL + 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) + return GL_FALSE; + break; +#endif + + default: + ASSERT_NO_FEATURE(); + } + return GL_TRUE; } -- cgit v1.2.3