diff options
author | marha <marha@users.sourceforge.net> | 2011-09-05 08:42:34 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-09-05 08:42:34 +0200 |
commit | 324c1ed4069c7d49d0ff7c63261281148f9b6cd8 (patch) | |
tree | b03f9a87fc540816c1c78c325a53aed6240db739 /mesalib/src/mesa/main/bufferobj.c | |
parent | 746359d2f7e675a0bfc48a4ba6f8200cace98df2 (diff) | |
download | vcxsrv-324c1ed4069c7d49d0ff7c63261281148f9b6cd8.tar.gz vcxsrv-324c1ed4069c7d49d0ff7c63261281148f9b6cd8.tar.bz2 vcxsrv-324c1ed4069c7d49d0ff7c63261281148f9b6cd8.zip |
git update libxcb mesa 5 sep 2011
Diffstat (limited to 'mesalib/src/mesa/main/bufferobj.c')
-rw-r--r-- | mesalib/src/mesa/main/bufferobj.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index c453f9c85..a30340174 100644 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -1004,6 +1004,12 @@ _mesa_MapBufferARB(GLenum target, GLenum access) return NULL; } + if (!bufObj->Size) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, + "glMapBuffer(buffer size = 0)"); + return NULL; + } + ASSERT(ctx->Driver.MapBufferRange); map = ctx->Driver.MapBufferRange(ctx, 0, bufObj->Size, accessFlags, bufObj); if (!map) { @@ -1410,7 +1416,23 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, "glMapBufferRange(buffer already mapped)"); return NULL; } - + + if (!bufObj->Size) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, + "glMapBufferRange(buffer size = 0)"); + return NULL; + } + + /* Mapping zero bytes should return a non-null pointer. */ + if (!length) { + static long dummy = 0; + bufObj->Pointer = &dummy; + bufObj->Length = length; + bufObj->Offset = offset; + bufObj->AccessFlags = access; + return bufObj->Pointer; + } + ASSERT(ctx->Driver.MapBufferRange); map = ctx->Driver.MapBufferRange(ctx, offset, length, access, bufObj); if (!map) { |