diff options
author | Yuanhan Liu <[email protected]> | 2011-09-19 18:25:55 +0800 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-09-19 08:22:18 -0600 |
commit | 099af9e9dfb4afa0283b0a86dc53b354a5a16ec1 (patch) | |
tree | a6ea9cf5df18776e1fcd9ba5a57eeecf2c94e5fd | |
parent | 386ec5e80e34e1164d749eee2078f2dfc8ff2b57 (diff) |
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]>
-rw-r--r-- | 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 a303401748c..99edb1adeaa 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1376,6 +1376,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)"); |