Mesa (7.11): mesa: fix error handling for glMapBufferRange

Ian Romanick idr at kemper.freedesktop.org
Mon Oct 24 22:54:49 UTC 2011


Module: Mesa
Branch: 7.11
Commit: 8d0d4381da798b3b946397d0a3a81f573df4ed68
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8d0d4381da798b3b946397d0a3a81f573df4ed68

Author: Yuanhan Liu <yuanhan.liu at linux.intel.com>
Date:   Mon Sep 19 18:25:55 2011 +0800

mesa: fix error handling for glMapBufferRange

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.liu at linux.intel.com>
Signed-off-by: Brian Paul <brianp at vmware.com>
(cherry picked from commit 099af9e9dfb4afa0283b0a86dc53b354a5a16ec1)

---

 src/mesa/main/bufferobj.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 3e28d34..767cc4d 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1410,6 +1410,17 @@ _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)) {
+      /* generate an error if any undefind bit is set */
+      _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)");




More information about the mesa-commit mailing list