Mercurial > hg > Game > Cerium
changeset 746:de3bf3bbcbb3 draft
fix viewer.cc work with "-cpu 0" option
author | hiroki |
---|---|
date | Tue, 19 Jan 2010 19:09:32 +0900 |
parents | 6c3601a46e83 |
children | 922c0133c61c |
files | Renderer/Engine/viewer.cc |
diffstat | 1 files changed, 18 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/viewer.cc Tue Jan 19 17:37:51 2010 +0900 +++ b/Renderer/Engine/viewer.cc Tue Jan 19 19:09:32 2010 +0900 @@ -100,6 +100,8 @@ this_time = 0; frames = 0; + if (spe_num == 0) spe_num = 1; + sgroot = new SceneGraphRoot(this->width, this->height); sgroot->tmanager = manager; @@ -115,24 +117,15 @@ data_load = manager->create_task(DataLoad); data_load->set_param(0,(memaddr)size); data_load->set_param(1,(memaddr)Light); - if (spe_num != 0) { - data_load->set_cpu((CPU_TYPE)((int)SPE_0)); - } + data_load->set_cpu((CPU_TYPE)((int)SPE_0)); data_load->spawn(); - if (spe_num == 0) { + for(int i = 1; i < spe_num; i++) { data_load = manager->create_task(DataLoad); data_load->set_param(0,(memaddr)size); data_load->set_param(1,(memaddr)Light); + data_load->set_cpu((CPU_TYPE)((int)SPE_0 + i)); data_load->spawn(); - } else { - for(int i = 1; i < spe_num; i++) { - data_load = manager->create_task(DataLoad); - data_load->set_param(0,(memaddr)size); - data_load->set_param(1,(memaddr)Light); - data_load->set_cpu((CPU_TYPE)((int)SPE_0 + i)); - data_load->spawn(); - } } MainLoop *mainloop = app->init(this, this->width, this->height); @@ -180,17 +173,11 @@ task_next = manager->create_task(Dummy); // ここは、Iterator を用意するべきだよね - if (spe_num == 0) { - task_tex = manager->create_task(LoadTexture); + for (int i = 0; i < spe_num; i++) { + task_tex = manager->create_task(LoadTexture); + task_tex->set_cpu((CPU_TYPE)((int)SPE_0 + i)); task_next->wait_for(task_tex); - task_tex->spawn(); - } else { - for (int i = 0; i < spe_num; i++) { - task_tex = manager->create_task(LoadTexture); - task_tex->set_cpu((CPU_TYPE)((int)SPE_0 + i)); - task_next->wait_for(task_tex); - task_tex->spawn(); - } + task_tex->spawn(); } return task_next; @@ -431,12 +418,7 @@ task_next->wait_for(task_create_pp); - int range_base; - if (spe_num == 0) { - range_base = 1; - } else { - range_base = spe_num; - } + int range_base = spe_num; // 切り上げのつもり int range = (spackList_length + range_base - 1) / range_base; @@ -449,7 +431,7 @@ HTaskPtr task_create_sp = manager->create_task(CreateSpan); task_create_sp->set_param(0,index_start); - + /** * ex. screen_height が 480, spenum が 6 の場合、各SPEのy担当範囲 * [ 1.. 80] [ 81..160] [161..240] @@ -459,6 +441,7 @@ * [ 1..216] [217..432] [433..648] * [649..864] [865..1080] */ + task_create_sp->set_param(1,index_start*split_screen_h + 1); task_create_sp->set_param(2,index_end*split_screen_h); @@ -470,12 +453,11 @@ task_next->wait_for(task_create_sp); task_create_sp->wait_for(task_create_pp); - if (spe_num != 0) { - task_create_sp->set_cpu(SPE_ANY); - } + task_create_sp->set_cpu(SPE_ANY); task_create_sp->spawn(); } + task_create_pp->spawn(); } @@ -502,27 +484,16 @@ data_update_wait->add_inData(light_xyz,size); data_update_wait->set_param(0,size); data_update_wait->set_param(1,Light); - if (spe_num != 0) { - data_update_wait->set_cpu((CPU_TYPE)((int)SPE_0)); - } + data_update_wait->set_cpu((CPU_TYPE)((int)SPE_0)); - if (spe_num == 0) { + for (int i = 1; i < spe_num; i++) { data_update = manager->create_task(DataUpdate); data_update->add_inData(light_xyz,sizeof(float)*size); data_update->set_param(0,size); data_update->set_param(1,Light); + data_update->set_cpu((CPU_TYPE)((int)SPE_0 + i)); data_update_wait->wait_for(data_update); data_update->spawn(); - } else { - for (int i = 1; i < spe_num; i++) { - data_update = manager->create_task(DataUpdate); - data_update->add_inData(light_xyz,sizeof(float)*size); - data_update->set_param(0,size); - data_update->set_param(1,Light); - data_update->set_cpu((CPU_TYPE)((int)SPE_0 + i)); - data_update_wait->wait_for(data_update); - data_update->spawn(); - } } data_update_wait->spawn(); @@ -566,9 +537,7 @@ break; } - if (spe_num != 0) { - task_draw->set_cpu(SPE_ANY); - } + task_draw->set_cpu(SPE_ANY); task_next->wait_for(task_draw); task_draw->wait_for(data_update_wait); task_draw->spawn();