diff TaskManager/Test/test_render/spe/DrawSpan.cpp @ 182:df3cfc04e796

add get_inputAddr, get_outputAddr
author gongo@gendarme.cr.ie.u-ryukyu.ac.jp
date Tue, 23 Dec 2008 16:27:07 +0900
parents 5cde66c926b4
children 54787f182881 907bda4a1a14
line wrap: on
line diff
--- a/TaskManager/Test/test_render/spe/DrawSpan.cpp	Tue Dec 23 15:54:09 2008 +0900
+++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp	Tue Dec 23 16:27:07 2008 +0900
@@ -123,20 +123,23 @@
 int
 DrawSpan::run(void *rbuf, void *wbuf)
 {
-    SpanPack *sp = (SpanPack*)smanager->get_input(0);
-    SpanPack *next_sp =
+    SpanPack *spack = (SpanPack*)smanager->get_input(0);
+    SpanPack *next_spack =
 	(SpanPack*)smanager->allocate(sizeof(SpanPack));
-    SpanPack *free_sp = next_sp; // next_sp の free() 用
-    SpanPack *tmp_sp = NULL;
+    SpanPack *free_spack = next_spack; // next_spack の free() 用
     Span *span;
 
     hash = (TileHashPtr)smanager->global_get(GLOBAL_TEXTURE_HASH);
     tileList = (TileListPtr)smanager->global_get(GLOBAL_TILE_LIST);
 
-    int rangex_start  = get_param(0); // このタスクが担当する x の範囲の始点
-    int rangex_end    = get_param(1); // 終点 (start <= x <= end)
-    int rangey        = get_param(2); // y の範囲 (render_y + rangey - 1)
+    int rangex_start  = smanager->get_param(0);
+    int rangex_end    = smanager->get_param(1); 
+
+    // このタスクが担当する x の範囲
     int rangex        = rangex_end - rangex_start + 1;
+
+    // y の範囲 (render_y + rangey - 1)
+    int rangey        = smanager->get_param(2);
     
     float *zRow = (float*)smanager->get_input(1);
     int **linebuf = (int**)smanager->allocate(sizeof(int*)*rangey);
@@ -152,15 +155,15 @@
 	 * 現在の SpanPack を処理してる間に
 	 * 次の SpanPack の DMA 転送を行う
 	 */
-	if (sp->next != NULL) {
-	    smanager->dma_load(next_sp, (uint32)sp->next,
+	if (spack->next != NULL) {
+	    smanager->dma_load(next_spack, (uint32)spack->next,
 			       sizeof(SpanPack), SPAN_PACK_LOAD);
 	} else {
-	    next_sp = NULL;
+	    next_spack = NULL;
 	}
 
-	for (int t = sp->info.start; t < sp->info.size; t++) {	  
-	    span = &sp->span[t];
+	for (int t = 0; t < spack->info.size; t++) {	  
+	    span = &spack->span[t];
 
 	    Uint32 rgb = 0x00ff00;
 	    float tex1 = span->tex_x1;
@@ -224,9 +227,6 @@
 
 		    tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1);
 		    tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1);
-		    /**
-		     * ・・・なんかかっこいい書き方ないかな
-		     */
 		    if (tex_x > 1) tex_x = 1;
 		    if (tex_x < 0) tex_x = 0;
 		    if (tex_y > 1) tex_y = 1;
@@ -251,12 +251,12 @@
 
 	smanager->dma_wait(SPAN_PACK_LOAD);
 
-	tmp_sp = sp;
-	sp = next_sp;
-	next_sp = tmp_sp;
-    } while (sp);
+	SpanPack *tmp_spack = spack;
+	spack = next_spack;
+	next_spack = tmp_spack;
+    } while (spack);
 
-    free(free_sp);
+    free(free_spack);
     free(linebuf);
 
     return 0;