changeset 1419:2bf847d6202d draft

protect spack_list
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 20 Feb 2012 01:58:44 +0900
parents ff721740df6b
children e8debff40a3d
files Renderer/Engine/task/CreateSpan.cc
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/task/CreateSpan.cc	Sun Feb 19 22:52:19 2012 +0900
+++ b/Renderer/Engine/task/CreateSpan.cc	Mon Feb 20 01:58:44 2012 +0900
@@ -511,7 +511,14 @@
     VertexPackPtr vMid10 = &vMid11;
     //	= (VertexPackPtr)smanager->allocate(sizeof(VertexPack));
     NormalPackPtr normal1,normal2, normal3;
-    SpanPackPtr *spackList = (SpanPackPtr*)smanager->get_input(rbuf, 1);
+    //  do not write back spackList (even in non copy case)
+    long sz = smanager->get_inputSize(1);
+    SpanPackPtr *spackList = (SpanPackPtr *)smanager->allocate(sz);
+    SpanPackPtr *src = (SpanPackPtr *)smanager->get_input(rbuf, 1);
+    for(long i=0;i<sz/sizeof(SpanPackPtr*);i+=4) {
+        spackList[i]=src[i]; spackList[i+1]=src[i+1];
+        spackList[i+2]=src[i+2]; spackList[i+3]=src[i+3];
+    }
 
     prev_index = (long)smanager->get_param(0);
 #ifdef USE_SEGMENT
@@ -626,6 +633,7 @@
                         sizeof(SpanPack), SPAN_PACK_STORE);
     smanager->dma_wait(SPAN_PACK_STORE);
 #endif
+    free(spackList);
 #ifdef USE_SEGMENT
     // Global でSegmentとったので、いつか解放しないといかないなぁ。
 #elif defined(USE_ITERATOR)