changeset 1118:7ba266bb54d3 draft

DRAW_TASK add.(Mac)
author tkaito
date Fri, 28 Jan 2011 02:15:08 +0900
parents 19bfb73617ad
children 543c735a98b3
files Renderer/Engine/RenderingTasks.h Renderer/Engine/task/task_init.cc Renderer/Engine/viewer.cc
diffstat 3 files changed, 24 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/RenderingTasks.h	Sun Jan 23 04:03:00 2011 +0900
+++ b/Renderer/Engine/RenderingTasks.h	Fri Jan 28 02:15:08 2011 +0900
@@ -18,6 +18,7 @@
      EXEC_ONLY_TASK,
      RUN_LOOP_TASK,
      RENDERING_TASK,
+     DRAW_TASK,
 
      LoadTexture,
      SetTexture,
--- a/Renderer/Engine/task/task_init.cc	Sun Jan 23 04:03:00 2011 +0900
+++ b/Renderer/Engine/task/task_init.cc	Fri Jan 28 02:15:08 2011 +0900
@@ -18,6 +18,7 @@
 SchedExternTask(EXEC_ONLY_TASK);
 SchedExternTask(RUN_LOOP_TASK);
 SchedExternTask(RENDERING_TASK);
+SchedExternTask(DRAW_TASK);
 
 SchedExternTask(LoadTexture);
 
@@ -62,6 +63,7 @@
     SchedRegister(EXEC_ONLY_TASK);
     SchedRegister(RUN_LOOP_TASK);
     SchedRegister(RENDERING_TASK);
+    SchedRegister(DRAW_TASK);
 
     SchedRegister( LoadTexture);
 
--- a/Renderer/Engine/viewer.cc	Sun Jan 23 04:03:00 2011 +0900
+++ b/Renderer/Engine/viewer.cc	Fri Jan 28 02:15:08 2011 +0900
@@ -300,7 +300,8 @@
 Viewer::run_loop(HTaskPtr task_next)
 {
     if (main_exec(task_next)) {
-	rendering(task_next);
+        //rendering(task_next);
+        task_next->spawn();
     }
 }
 
@@ -342,6 +343,21 @@
 {
 }
 
+SchedDefineTask1(RENDERING_TASK, rendering_task);
+
+static int
+rendering_task(SchedTask* smanager, void* rbuf, void* wbuf)
+{
+
+  Viewer *viewer = (Viewer*)smanager->get_param(0);
+  HTaskPtr task_next = smanager->create_task(DRAW_TASK, 0, 0, 0, 0);
+  task_next->set_param(0, (void*)viewer);
+
+  viewer->rendering(task_next);
+
+  return 0;
+
+}
 
 void 
 Viewer::rendering(HTaskPtr task_next)
@@ -350,15 +366,15 @@
     
     // Barrier 同期
     // run_draw() を呼ぶ post2runDraw
-    task_next->spawn();
+    task_next->spawn(); // rendering_task
 
     // TASK_CREATE_SPAN が全て終わったら DUMMY_TASK が Viewer::run_draw() を呼ぶ
 }
 
-SchedDefineTask1(RENDERING_TASK, rendering_task);
+SchedDefineTask1(DRAW_TASK, draw_task);
 
 static int
-rendering_task(SchedTask* smanager, void* rbuf, void* wbuf)
+draw_task(SchedTask* smanager, void* rbuf, void* wbuf)
 {
 
   Viewer* viewer = (Viewer*)smanager->get_param(0);
@@ -374,9 +390,8 @@
 Viewer::run_draw(HTaskPtr task_next) // 引数に post2runLoop を入れるようにする
 {
     common_draw(task_next);
-
    
-    task_next->spawn();
+    task_next->spawn(); // run_loop_task
     // TASK_DRAW_SPAN が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ    
 
     frames++;
@@ -610,7 +625,6 @@
 	task_next->wait_for(task_create_sp);
 
 	task_create_sp->set_cpu(SPE_ANY);
-	//task_create_sp->set_cpu(CPU_PPE);
         task_create_sp->spawn();
     }