# HG changeset patch # User root@dolphins.cr.ie.u-ryukyu.ac.jp # Date 1297607351 -32400 # Node ID 220f9032d2d207ea3171622a0245922e5b141f50 # Parent 5addc6c1d5c4697283cc675c2879c028d27dd2a9 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK. diff -r 5addc6c1d5c4 -r 220f9032d2d2 Renderer/Engine/RenderingTasks.h --- a/Renderer/Engine/RenderingTasks.h Sun Feb 13 22:34:44 2011 +0900 +++ b/Renderer/Engine/RenderingTasks.h Sun Feb 13 23:29:11 2011 +0900 @@ -16,7 +16,8 @@ EXEC_ONLY_TASK, RUN_LOOP_TASK, - RENDERING_TASK, + CREATE_PP_TASK, + CREATE_SP_TASK, DRAW_TASK, LoadTexture, diff -r 5addc6c1d5c4 -r 220f9032d2d2 Renderer/Engine/SgChange.cc --- a/Renderer/Engine/SgChange.cc Sun Feb 13 22:34:44 2011 +0900 +++ b/Renderer/Engine/SgChange.cc Sun Feb 13 23:29:11 2011 +0900 @@ -162,8 +162,9 @@ void SgChange::rendering(HTaskPtr task_next) { - viewer->common_rendering(task_next, sgroot_B); - + viewer->rendering_pp(task_next, sgroot_B); + viewer->rendering_sp(task_next, sgroot_B); + task_next->set_post(post2runDraw, (void*)this, 0); task_next->spawn(); } diff -r 5addc6c1d5c4 -r 220f9032d2d2 Renderer/Engine/task/task_init.cc --- a/Renderer/Engine/task/task_init.cc Sun Feb 13 22:34:44 2011 +0900 +++ b/Renderer/Engine/task/task_init.cc Sun Feb 13 23:29:11 2011 +0900 @@ -16,7 +16,8 @@ SchedExternTask(EXEC_ONLY_TASK); SchedExternTask(RUN_LOOP_TASK); -SchedExternTask(RENDERING_TASK); +SchedExternTask(CREATE_PP_TASK); +SchedExternTask(CREATE_SP_TASK); SchedExternTask(DRAW_TASK); SchedExternTask(LoadTexture); @@ -60,7 +61,8 @@ SchedRegister(EXEC_ONLY_TASK); SchedRegister(RUN_LOOP_TASK); - SchedRegister(RENDERING_TASK); + SchedRegister(CREATE_PP_TASK); + SchedRegister(CREATE_SP_TASK); SchedRegister(DRAW_TASK); SchedRegister( LoadTexture); diff -r 5addc6c1d5c4 -r 220f9032d2d2 Renderer/Engine/viewer.cc --- a/Renderer/Engine/viewer.cc Sun Feb 13 22:34:44 2011 +0900 +++ b/Renderer/Engine/viewer.cc Sun Feb 13 23:29:11 2011 +0900 @@ -329,7 +329,7 @@ { Viewer *viewer = (Viewer*)smanager->get_param(0); - HTaskPtr task_next = smanager->create_task(RENDERING_TASK, 0, 0, 0, 0); + HTaskPtr task_next = smanager->create_task(CREATE_PP_TASK, 0, 0, 0, 0); task_next->set_param(0, (void*)viewer); viewer->run_loop(task_next); @@ -344,34 +344,62 @@ { } -SchedDefineTask1(RENDERING_TASK, rendering_task); +SchedDefineTask1(CREATE_PP_TASK, create_pp_task); static int -rendering_task(SchedTask* smanager, void* rbuf, void* wbuf) +create_pp_task(SchedTask* smanager, void* rbuf, void* wbuf) +{ + + Viewer *viewer = (Viewer*)smanager->get_param(0); + HTaskPtr task_next = smanager->create_task(CREATE_SP_TASK, 0, 0, 0, 0); + task_next->set_param(0, (void*)viewer); + + viewer->create_pp(task_next); + + return 0; + +} + +void +Viewer::create_pp(HTaskPtr task_next) { + + rendering_pp(task_next, sgroot); + + // Barrier 同期 + // run_draw() を呼ぶ post2runDraw + task_next->spawn(); // create_sp_task + +} + + +SchedDefineTask1(CREATE_SP_TASK, create_sp_task); + +static int +create_sp_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); + viewer->create_sp(task_next); return 0; } void -Viewer::rendering(HTaskPtr task_next) { +Viewer::create_sp(HTaskPtr task_next) { - common_rendering(task_next, sgroot); + rendering_sp(task_next, sgroot); // Barrier 同期 // run_draw() を呼ぶ post2runDraw - task_next->spawn(); // rendering_task + task_next->spawn(); // draw_task - // TASK_CREATE_SPAN が全て終わったら DUMMY_TASK が Viewer::run_draw() を呼ぶ } + SchedDefineTask1(DRAW_TASK, draw_task); static int @@ -434,12 +462,9 @@ } - - void -Viewer::common_rendering(HTaskPtr task_next, SceneGraphRoot *sgroot) +Viewer::rendering_pp(HTaskPtr task_next, SceneGraphRoot *sgroot) { - HTaskPtr game_task_array = 0; /* GameTask の処理の終了を待ってからポリゴンを作る */ @@ -448,8 +473,6 @@ } PolygonPackPtr out_pp = r[ppi].ppack; - HTaskPtr task_create_pp = manager->create_task(Dummy); - task_create_pp->set_cpu(CPU_PPE); SceneGraphPtr t = (SceneGraphPtr)manager->allocate(sizeof(SceneGraph)); //多分このsg_remove_listであってる?。チェック対象かも @@ -481,22 +504,21 @@ create_pp->wait_for(game_task_array); } - task_create_pp->wait_for(create_pp); - PolygonPackPtr tmp_pp = (PolygonPackPtr)manager->allocate(sizeof(PolygonPack)); tmp_pp->init(); create_pp->set_param(0, (memaddr)tmp_pp); out_pp = tmp_pp; create_pp->set_cpu(SPE_ANY); + task_next->wait_for(create_pp); create_pp->spawn(); - } + } + } +} - - } - - task_next->wait_for(task_create_pp); - +void +Viewer::rendering_sp(HTaskPtr task_next, SceneGraphRoot *sgroot) +{ int range_base = spe_num; // 切り上げのつもり @@ -533,18 +555,14 @@ sizeof(SpanPack*)*r[spi].spackList_length_align); task_create_sp->add_inData(&r[spi].spackList[index_start], sizeof(SpanPack)); - task_create_sp->wait_for(task_create_pp); task_next->wait_for(task_create_sp); task_create_sp->set_cpu(SPE_ANY); task_create_sp->spawn(); } - task_create_pp->spawn(); - } - void Viewer::common_draw(HTaskPtr task_next) { diff -r 5addc6c1d5c4 -r 220f9032d2d2 Renderer/Engine/viewer.h --- a/Renderer/Engine/viewer.h Sun Feb 13 22:34:44 2011 +0900 +++ b/Renderer/Engine/viewer.h Sun Feb 13 23:29:11 2011 +0900 @@ -85,9 +85,12 @@ virtual void run_finish(); void run_move(HTaskPtr task_next); void run_collision(); - void rendering(HTaskPtr task_next); + void create_pp(HTaskPtr task_next); + void create_sp(HTaskPtr task_next); void common_draw(HTaskPtr task_next); - void common_rendering(HTaskPtr task_next, SceneGraphRoot *sgroot); + void rendering_pp(HTaskPtr task_next, SceneGraphRoot *sgroot); + void rendering_sp(HTaskPtr task_next, SceneGraphRoot *sgroot); + //void common_rendering(HTaskPtr task_next, SceneGraphRoot *sgroot); // void exchange_sgroot(TaskManager *manager);