Module: Mesa Branch: 7.11 Commit: 8d0d4381da798b3b946397d0a3a81f573df4ed68 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8d0d4381da798b3b946397d0a3a81f573df4ed68
Author: Yuanhan Liu <[email protected]> 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 <[email protected]> Signed-off-by: Brian Paul <[email protected]> (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)"); _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
