Mesa (master): draw/gs: copy the outputs only if we emitted something

Zack Rusin zack at kemper.freedesktop.org
Sat Jun 12 14:45:50 UTC 2010


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

Author: Zack Rusin <zackr at vmware.com>
Date:   Sat Jun 12 10:44:31 2010 -0400

draw/gs: copy the outputs only if we emitted something

---

 src/gallium/auxiliary/draw/draw_gs.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index a1ca707..52f61d2 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -367,9 +367,11 @@ int draw_geometry_shader_run(struct draw_geometry_shader *shader,
 
    gs_run(shader, pipe_prim, count);
 
-   memcpy(output, pipeline_verts->data,
-          shader->info.num_outputs * 4 * sizeof(float) +
-          vertex_size * (shader->emitted_vertices -1));
+   if (shader->emitted_vertices > 0) {
+      memcpy(output, pipeline_verts->data,
+             shader->info.num_outputs * 4 * sizeof(float) +
+             vertex_size * (shader->emitted_vertices -1));
+   }
 
    FREE(pipeline_verts);
    return shader->emitted_vertices;




More information about the mesa-commit mailing list