mesa/st: enable carry/borrow lowering pass
[mesa.git] / src / mesa / main / api_validate.c
index ce007e265981aa43cbd219be6fbc8828628238bc..8f0b1998dad966e86fce5584bec377062c062215 100644 (file)
@@ -69,7 +69,8 @@ _mesa_max_buffer_index(struct gl_context *ctx, GLuint count, GLenum type,
    if (_mesa_is_bufferobj(elementBuf)) {
       /* elements are in a user-defined buffer object.  need to map it */
       map = ctx->Driver.MapBufferRange(ctx, 0, elementBuf->Size,
-                                      GL_MAP_READ_BIT, elementBuf);
+                                      GL_MAP_READ_BIT, elementBuf,
+                                       MAP_INTERNAL);
       /* Actual address is the sum of pointers */
       indices = (const GLvoid *) ADD_POINTERS(map, (const GLubyte *) indices);
    }
@@ -92,7 +93,7 @@ _mesa_max_buffer_index(struct gl_context *ctx, GLuint count, GLenum type,
    }
 
    if (map) {
-      ctx->Driver.UnmapBuffer(ctx, elementBuf);
+      ctx->Driver.UnmapBuffer(ctx, elementBuf, MAP_INTERNAL);
    }
 
    return max;
@@ -124,11 +125,14 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
         return GL_FALSE;
       break;
 
-   case API_OPENGL_COMPAT:
    case API_OPENGL_CORE:
+      if (ctx->Array.VAO == ctx->Array.DefaultVAO)
+         return GL_FALSE;
+      /* fallthrough */
+   case API_OPENGL_COMPAT:
       {
          const struct gl_shader_program *vsProg =
-            ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX];
+            ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
          GLboolean haveVertexShader = (vsProg && vsProg->LinkStatus);
          GLboolean haveVertexProgram = ctx->VertexProgram._Enabled;
          if (haveVertexShader || haveVertexProgram) {
@@ -269,9 +273,9 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
     *   TRIANGLES_ADJACENCY_ARB or TRIANGLE_STRIP_ADJACENCY_ARB.
     *
    */
-   if (ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]) {
+   if (ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]) {
       const GLenum geom_mode =
-         ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]->Geom.InputType;
+         ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]->Geom.InputType;
       switch (mode) {
       case GL_POINTS:
          valid_enum = (geom_mode == GL_POINTS);
@@ -330,8 +334,8 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
    if (_mesa_is_xfb_active_and_unpaused(ctx)) {
       GLboolean pass = GL_TRUE;
 
-      if(ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]) {
-         switch (ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]->Geom.OutputType) {
+      if(ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]) {
+         switch (ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]->Geom.OutputType) {
          case GL_POINTS:
             pass = ctx->TransformFeedback.Mode == GL_POINTS;
             break;