draw/gs: copy the outputs only if we emitted something
authorZack Rusin <zackr@vmware.com>
Sat, 12 Jun 2010 14:44:31 +0000 (10:44 -0400)
committerZack Rusin <zackr@vmware.com>
Sat, 12 Jun 2010 14:45:42 +0000 (10:45 -0400)
src/gallium/auxiliary/draw/draw_gs.c

index a1ca7071e353f3015e6f5db80f0c72261e637589..52f61d29b7909d8ec271420bad07467515de7559 100644 (file)
@@ -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;