Mesa (master): intel: Don' t try to do work for BufferSubData with a size of 0.

Eric Anholt anholt at kemper.freedesktop.org
Fri Aug 20 19:38:04 UTC 2010


Module: Mesa
Branch: master
Commit: 27e6552a8fb0fd49be84fbaf9504e8371033db23
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=27e6552a8fb0fd49be84fbaf9504e8371033db23

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Aug 20 12:36:34 2010 -0700

intel: Don't try to do work for BufferSubData with a size of 0.

If we hit the linear blit path, we'd come up with a pitch of 0, then
divide by zero.

Fixes vbo-subdata-zero, made for bug #28931 (warsow).

---

 src/mesa/drivers/dri/intel/intel_buffer_objects.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index 8ab41f8..117d4da 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -202,6 +202,9 @@ intel_bufferobj_subdata(GLcontext * ctx,
    struct intel_context *intel = intel_context(ctx);
    struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
 
+   if (size == 0)
+      return;
+
    assert(intel_obj);
 
    if (intel_obj->region)
@@ -426,6 +429,9 @@ intel_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target,
    if (intel_obj->range_map_buffer == NULL)
       return;
 
+   if (length == 0)
+      return;
+
    temp_bo = drm_intel_bo_alloc(intel->bufmgr, "range map flush", length, 64);
 
    drm_intel_bo_subdata(temp_bo, 0, length, intel_obj->range_map_buffer);




More information about the mesa-commit mailing list