changeset 177:e742053c4c87

zRow の生成、初期化の変更
author gongo@localhost.localdomain
date Tue, 16 Dec 2008 17:16:35 +0900
parents 08e2bb36639b
children 5d1b82945b0d
files TaskManager/Test/test_render/ChangeLog TaskManager/Test/test_render/spe/DrawSpan.cpp TaskManager/Test/test_render/spe/DrawSpan.h TaskManager/Test/test_render/task/DrawSpan.cpp TaskManager/Test/test_render/task/DrawSpan.h TaskManager/Test/test_render/viewer.cpp
diffstat 6 files changed, 24 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Test/test_render/ChangeLog	Tue Dec 16 17:01:24 2008 +0900
+++ b/TaskManager/Test/test_render/ChangeLog	Tue Dec 16 17:16:35 2008 +0900
@@ -1,5 +1,12 @@
 2008-12-16  Wataru MIYAGUNI  <gongo@cr.ie.u-ryukyu.ac.jp>
 
+	* viewer.cpp (Viewer::run_init, Viewer::run_draw): fix
+	* spe/DrawSpan.cpp (DrawSpan::zRow_init): delete
+
+	Z Buffering に使う zRow は DrawSpan で毎回生成、初期化するのではなく、
+	PPE で生成、初期化を行っておき、DrawSpan に add_inData で
+	DMA で渡すという方法に変更。速度的にはほんのちょっとしか(ry
+	
 	* spe/CreateSpan.cpp (CreateSpan::half_triangle): fix
 	getScale に渡す tex_width,tex_height を修正。
 	比較にそのまま tex_width, tex_height を使うと、
--- a/TaskManager/Test/test_render/spe/DrawSpan.cpp	Tue Dec 16 17:01:24 2008 +0900
+++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp	Tue Dec 16 17:16:35 2008 +0900
@@ -81,22 +81,6 @@
     }
 }
 
-float*
-DrawSpan::zRow_init(int w, int h)
-{
-    float *zRow = NULL;
-    float z = 65535.0f;
-    int length = w*h;
-
-    zRow = (float*)smanager->allocate(sizeof(float)*length);
-
-    for (int i = 0; i < length; i++) {
-	zRow[i] = z;
-    }
-
-    return zRow;
-}
-
 Uint32
 DrawSpan::get_rgb(int tx, int ty, uint32 *addr)
 {
@@ -153,8 +137,8 @@
     int rangex_end    = get_param(1); //  (start <= x <= end)
     int rangey        = get_param(2); // y ϰ (render_y + rangey - 1)
     int rangex        = rangex_end - rangex_start + 1;
-
-    float *zRow = zRow_init(rangex, rangey);
+    
+    float *zRow = (float*)smanager->get_input(1);
     int **linebuf = (int**)smanager->allocate(sizeof(int*)*rangey);
 
     for (int i = 0; i < rangey; i++) {
@@ -274,7 +258,6 @@
 
     free(free_sp);
     free(linebuf);
-    free(zRow);
 
     return 0;
 }
--- a/TaskManager/Test/test_render/spe/DrawSpan.h	Tue Dec 16 17:01:24 2008 +0900
+++ b/TaskManager/Test/test_render/spe/DrawSpan.h	Tue Dec 16 17:16:35 2008 +0900
@@ -23,9 +23,7 @@
 
     int run(void *rbuf, void *wbuf);
 
-    float* zRow_init(int w, int h);
-    void linebuf_init(int *buf, int width, int rgb);
-    
+    void linebuf_init(int *buf, int width, int rgb);    
     Uint32 get_rgb(int tx, int ty, uint32 *addr);
 };
 
--- a/TaskManager/Test/test_render/task/DrawSpan.cpp	Tue Dec 16 17:01:24 2008 +0900
+++ b/TaskManager/Test/test_render/task/DrawSpan.cpp	Tue Dec 16 17:16:35 2008 +0900
@@ -81,22 +81,6 @@
     }
 }
 
-float*
-DrawSpan::zRow_init(int w, int h)
-{
-    float *zRow = NULL;
-    float z = 65535.0f;
-    int length = w*h;
-
-    zRow = (float*)smanager->allocate(sizeof(float)*length);
-
-    for (int i = 0; i < length; i++) {
-	zRow[i] = z;
-    }
-
-    return zRow;
-}
-
 Uint32
 DrawSpan::get_rgb(int tx, int ty, uint32 *addr)
 {
@@ -153,8 +137,8 @@
     int rangex_end    = get_param(1); //  (start <= x <= end)
     int rangey        = get_param(2); // y ϰ (render_y + rangey - 1)
     int rangex        = rangex_end - rangex_start + 1;
-
-    float *zRow = zRow_init(rangex, rangey);
+    
+    float *zRow = (float*)smanager->get_input(1);
     int **linebuf = (int**)smanager->allocate(sizeof(int*)*rangey);
 
     for (int i = 0; i < rangey; i++) {
@@ -274,7 +258,6 @@
 
     free(free_sp);
     free(linebuf);
-    free(zRow);
 
     return 0;
 }
--- a/TaskManager/Test/test_render/task/DrawSpan.h	Tue Dec 16 17:01:24 2008 +0900
+++ b/TaskManager/Test/test_render/task/DrawSpan.h	Tue Dec 16 17:16:35 2008 +0900
@@ -23,9 +23,7 @@
 
     int run(void *rbuf, void *wbuf);
 
-    float* zRow_init(int w, int h);
-    void linebuf_init(int *buf, int width, int rgb);
-    
+    void linebuf_init(int *buf, int width, int rgb);    
     Uint32 get_rgb(int tx, int ty, uint32 *addr);
 };
 
--- a/TaskManager/Test/test_render/viewer.cpp	Tue Dec 16 17:01:24 2008 +0900
+++ b/TaskManager/Test/test_render/viewer.cpp	Tue Dec 16 17:16:35 2008 +0900
@@ -29,6 +29,8 @@
 int spackList_length;
 int spackList_length_align;
 
+static float *zRow;
+
 /**
  *
  */
@@ -204,6 +206,12 @@
     }
 
     task_next->spawn();
+    
+    zRow=(float*)manager->malloc(sizeof(float)*split_screen_w*split_screen_h);
+
+    for (int i = 0; i < split_screen_w*split_screen_h; i++) {
+	zRow[i] = 65535.0f; // __FLT_MAX__ とかでも
+    }
 }
 
 void
@@ -325,6 +333,9 @@
 		// Draw SpanPack
 		task_draw = manager->create_task(TASK_DRAW_SPAN);
 		task_draw->add_inData(spack, sizeof(SpanPack));
+
+		task_draw->add_inData(zRow,
+				      sizeof(float)*(endx-startx+1)*rangey);
 	    } else {
 		// Draw Background (現在は塗りつぶし)
 		task_draw = manager->create_task(TASK_DRAW_BACK);