On 09/19/2011 04:25 AM, Yuanhan Liu wrote:
Accroding the man page, GL_INVALID_VALUE would generated if access has any
bits set other than those valid defined bits.

Signed-off-by: Yuanhan Liu<yuanhan....@linux.intel.com>
---
  src/mesa/main/bufferobj.c |   10 ++++++++++
  1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index ba2275d..b736329 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1376,6 +1376,16 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, 
GLsizeiptr length,
        return NULL;
     }

+   if (access&  ~(GL_MAP_READ_BIT |
+                  GL_MAP_WRITE_BIT |
+                  GL_MAP_INVALIDATE_RANGE_BIT |
+                  GL_MAP_INVALIDATE_BUFFER_BIT |
+                  GL_MAP_FLUSH_EXPLICIT_BIT |
+                  GL_MAP_UNSYNCHRONIZED_BIT)) {
+      _mesa_error(ctx, GL_INVALID_VALUE, "glMapBufferRange(access)");
+      return NULL;
+   }
+
     if ((access&  (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0) {
        _mesa_error(ctx, GL_INVALID_OPERATION,
                    "glMapBufferRange(access indicates neither read or write)");


Reviewed-by: Brian Paul <bri...@vmware.com>

I'll push this soon, but maybe add a comment to the code.

-Brian
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to