mesa: Move check for vbo mapping into api_validate.c.
authorMathias Fröhlich <mathias.froehlich@web.de>
Sun, 14 Aug 2016 12:03:58 +0000 (14:03 +0200)
committerMathias Fröhlich <mathias.froehlich@web.de>
Mon, 15 Aug 2016 05:10:39 +0000 (07:10 +0200)
Instead of checking for mapped buffers in vbo_bind_arrays
do this check in api_validate.c. This additionally
enables printing the draw calls name into the error
string.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/main/api_validate.c
src/mesa/vbo/vbo_exec_array.c

index ec3cc1b98535ee62c95ea41b87dde50e5e56bd7c..ae3e118f426a084044646b4c5b1abf4454ee9353 100644 (file)
@@ -25,6 +25,7 @@
 #include <stdbool.h>
 #include "glheader.h"
 #include "api_validate.h"
+#include "arrayobj.h"
 #include "bufferobj.h"
 #include "context.h"
 #include "imports.h"
@@ -119,6 +120,12 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
       unreachable("Invalid API value in check_valid_to_render()");
    }
 
+   if (!_mesa_all_buffers_are_unmapped(ctx->Array.VAO)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "%s(vertex buffers are mapped)", function);
+      return false;
+   }
+
    return true;
 }
 
index e1aa3ace32a6a9735710c7cdd64a892ed9a8493f..bfa9cd6447e5db377daeb768827ab9078a6917cf 100644 (file)
@@ -396,13 +396,7 @@ vbo_bind_arrays(struct gl_context *ctx)
       }
    }
 
-   if (!_mesa_all_buffers_are_unmapped(ctx->Array.VAO)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "draw call (vertex buffers are mapped)");
-      return false;
-   } else {
-      return true;
-   }
+   return true;
 }
 
 /**