diff options
author | Kristian Høgsberg <[email protected]> | 2010-05-24 10:01:38 -0400 |
---|---|---|
committer | Kristian Høgsberg <[email protected]> | 2010-05-24 10:02:13 -0400 |
commit | f67b020a942911f80b7b774c6d64701d1981c608 (patch) | |
tree | 346fe4eb66b537070037f544cf632b88b1bf02ec /src/mesa/main/api_validate.c | |
parent | 740c8ea6d371732f3530accde44836930e03cc80 (diff) |
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
Diffstat (limited to 'src/mesa/main/api_validate.c')
-rw-r--r-- | src/mesa/main/api_validate.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index f6da86d2961..150bc3886cf 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; } |