From: Matt Turner Date: Wed, 5 Dec 2012 01:52:00 +0000 (-0800) Subject: mesa: Ignore size and offset parameters for BindBufferRange when buffer is 0 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=970ec8dbc3491615964808ce1563d34d08e806cb;p=mesa.git mesa: Ignore size and offset parameters for BindBufferRange when buffer is 0 The ES 3 conformance suite unbinds buffers (by binding buffer 0) and passes zero for the size and offset, which the spec explicitly disallows. Otherwise, this seems like a reasonable thing to do. Khronos will be changing the spec to allow this (bug 9765). Fixes es3conform's transform_feedback_init_defaults test. Reviewed-by: Kenneth Graunke Reviewed-by: Eric Anholt --- diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 5521617f1af..6733644b612 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -2160,17 +2160,19 @@ _mesa_BindBufferRange(GLenum target, GLuint index, return; } - if (size <= 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)", - (int) size); - return; - } + if (buffer != 0) { + if (size <= 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)", + (int) size); + return; + } - if (offset + size > bufObj->Size) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glBindBufferRange(offset + size %d > buffer size %d)", - (int) (offset + size), (int) (bufObj->Size)); - return; + if (offset + size > bufObj->Size) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glBindBufferRange(offset + size %d > buffer size %d)", + (int) (offset + size), (int) (bufObj->Size)); + return; + } } switch (target) {