diff TaskManager/Test/simple_render/viewer.cpp @ 81:b03a4d3565c0

*** empty log message ***
author gongo
date Wed, 20 Feb 2008 17:07:11 +0900
parents 83b57e03d3ef
children 9b96b190cb73
line wrap: on
line diff
--- a/TaskManager/Test/simple_render/viewer.cpp	Wed Feb 20 10:56:37 2008 +0900
+++ b/TaskManager/Test/simple_render/viewer.cpp	Wed Feb 20 17:07:11 2008 +0900
@@ -3,6 +3,7 @@
 #include "polygon.h"
 #include "viewer.h"
 #include "sys.h"
+#include "spu_span.h"
 using namespace std;
 
 #define redMask   0x00ff0000
@@ -219,10 +220,15 @@
 SDL_PixelFormat *pixelFormat;
 Uint32 background;
 Polygon *polygon;
-SceneGraphPack *sgp;
-PolygonPack *pp;    
-//DmaBuffer *sgp_buff __attribute__((aligned(DEFAULT_ALIGNMENT)));
-//DmaBuffer *pp_buff __attribute__((aligned(DEFAULT_ALIGNMENT)));
+//SceneGraphPack *sgp;
+//PolygonPack *pp;    
+DmaBuffer *sgp_buff;
+DmaBuffer *pp_buff;
+DmaBuffer *spl_buff;
+DmaBuffer *sp_buff;
+DmaBuffer *ssl_buff;
+DmaBuffer *splssl_buff;
+
 
 void
 Viewer::run_init()
@@ -231,6 +237,8 @@
     int fd;
 
     SceneGraphPack *sgp;
+    SPANPACKLIST *spl;
+    SPLSSL *splssl;
 
     start_time = get_ticks();
     this_time  = 0;
@@ -242,12 +250,29 @@
     polygon->set_data("cube.xml");
     polygon->viewer  = this;
 
-#if 0
+#if 1
     // 通信用 buffer の allocate 
     // これじゃないと通信用に使えない(ように処理を書かないと!)
     sgp_buff = manager->allocate(sizeof(SceneGraphPack));
 
+    pp_buff = manager->allocate(sizeof(PolygonPack));
+
+    sp_buff  = manager->allocate(sizeof(SPANPACK));
+    spl_buff = manager->allocate(sizeof(SPANPACKLIST));
+
+    spl_buff->get_buffer(&spl);
+    spl->size = 60;
+    spl_buff->swap_buffer();
+    spl_buff->get_buffer(&spl);
+    spl->size = 60;
+    spl_buff->swap_buffer();
+
+    ssl_buff = manager->allocate(sizeof(SPUSPANLIST));
+    splssl_buff = manager->allocate(sizeof(SPLSSL));
+
     sgp_buff->get_buffer(&sgp);
+    //spl_buff->get_buffer(&spl);
+
     create_sgp(polygon, sgp);
     sgp_buff->swap_buffer();
 
@@ -255,12 +280,16 @@
     create_sgp(polygon, sgp);
     sgp_buff->swap_buffer();
 
-    pp_buff = manager->allocate(sizeof(PolygonPack));
+    
+
+
 #else
-    sgp = new SceneGraphPack;
+    //sgp = new SceneGraphPack;
+    posix_memalign((void**)&sgp, DEFAULT_ALIGNMENT, sizeof(SceneGraphPack));
     create_sgp(polygon, sgp);   
 
-    pp = new PolygonPack;
+    //pp = new PolygonPack;
+    posix_memalign((void**)&pp, DEFAULT_ALIGNMENT, sizeof(PolygonPack));
 #endif
 
     pixels = new Uint32[width*height];
@@ -280,10 +309,14 @@
 Viewer::run_loop(void)
 {
     HTaskPtr task_update_sgp = NULL;
-    HTaskPtr task_create_pp = NULL;
-    HTaskPtr task_finish = NULL;
+    HTaskPtr task_create_pp  = NULL;
+    HTaskPtr task_create_sp  = NULL;
+    HTaskPtr task_spu_sp     = NULL;
+    HTaskPtr task_finish     = NULL;
     int fd_update_sgp;
     int fd_create_pp;
+    int fd_create_sp;
+    int fd_spu_sp;
     int fd_finish;
 
     HTaskPtr task;
@@ -308,22 +341,31 @@
 
     fd_update_sgp = manager->open("UpdateSGP");
     fd_create_pp  = manager->open("CreatePP");
+    //fd_create_sp  = manager->open("CreateSP");
+    //fd_spu_sp     = manager->open("SpuSP");
     fd = manager->open("ViewerRunDraw");
-    task_update_sgp = manager->create_task(fd_update_sgp,
-					   sizeof(SceneGraphPack),
-					   //sgp_buff, sgp_buff, NULL);
-					   (unsigned int)sgp, (unsigned int)sgp, NULL);
-    task_create_pp = manager->create_task(fd_create_pp,
-					  sizeof(SceneGraphPack),
-					  //sgp_buff, pp_buff, NULL);
-					  (unsigned int)sgp, (unsigned int)pp, NULL);
+
+    task_update_sgp
+	= manager->create_task(fd_update_sgp, sizeof(SceneGraphPack),
+			       sgp_buff, sgp_buff, NULL);
+    task_create_pp
+	= manager->create_task(fd_create_pp, sizeof(SceneGraphPack),
+			       sgp_buff, pp_buff, NULL);
+#if 0
+    task_create_sp 
+	= manager->create_task(fd_update_sgp, sizeof(SceneGraphPack),
+			       sgp_buff, sgp_buff, NULL);    
+    task_spu_sp
+	= manager->create_task(fd_create_pp, sizeof(SceneGraphPack),
+			       sgp_buff, pp_buff, NULL);
+#endif
     task = manager->create_task(fd, 0, 0, 0, NULL);
 
     task->set_depend(task_update_sgp);
     task->set_depend(task_create_pp);
     
     //task_update_sgp->set_cpu(CPU_SPE);
-    //task_create_pp->set_cpu(CPU_SPE);
+    task_create_pp->set_cpu(CPU_SPE);
 
     task_update_sgp->spawn();
     task_create_pp->spawn();
@@ -338,9 +380,9 @@
     HTaskPtr task;
     int fd;
 
-    //PolygonPack *pp;
+    PolygonPack *pp;
 
-    //pp_buff->get_buffer(&pp);
+    pp_buff->get_buffer(&pp);
 
     polygon->draw(pp);    // test draw of PolygonPack
     SDL_BlitSurface(bitmap, NULL, screen, NULL);