Mercurial > hg > Members > kono > Cerium
changeset 746:307152e225a4
change viewer.cc / -cpu 0
author | hiroki |
---|---|
date | Tue, 19 Jan 2010 17:37:51 +0900 |
parents | bd467244f9ea |
children | 8e6fa21b116c |
files | Renderer/Engine/Makefile.def Renderer/Engine/viewer.cc TaskManager/Makefile.def |
diffstat | 3 files changed, 65 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/Makefile.def Wed Jan 13 16:54:56 2010 +0900 +++ b/Renderer/Engine/Makefile.def Tue Jan 19 17:37:51 2010 +0900 @@ -5,7 +5,7 @@ ABIBIT = 32 ABI = -m$(ABIBIT) CC = g++ -OPT = -g -O2 +OPT = -g #-O2 CFLAGS = -g -Wall $(ABI) $(OPT) # -DDEBUG INCLUDE = -I$(CERIUM)/include/TaskManager -I.
--- a/Renderer/Engine/viewer.cc Wed Jan 13 16:54:56 2010 +0900 +++ b/Renderer/Engine/viewer.cc Tue Jan 19 17:37:51 2010 +0900 @@ -115,15 +115,24 @@ 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)); + if (spe_num != 0) { + data_load->set_cpu((CPU_TYPE)((int)SPE_0)); + } data_load->spawn(); - - 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(); + + if (spe_num == 0) { + data_load = manager->create_task(DataLoad); + data_load->set_param(0,(memaddr)size); + data_load->set_param(1,(memaddr)Light); + 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); @@ -171,11 +180,17 @@ task_next = manager->create_task(Dummy); // ここは、Iterator を用意するべきだよね - 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(); + if (spe_num == 0) { + task_tex = manager->create_task(LoadTexture); + 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(); + } } return task_next; @@ -239,7 +254,7 @@ viewer->getKey(); HTaskPtr update_key = viewer->manager->create_task(UpdateKey); update_key->add_inData(viewer->keyPtr, sizeof(key_stat)); - update_key->set_cpu(SPE_0); + //update_key->set_cpu(SPE_0); update_key->spawn(); /* TASK_MOVE は外から引数で取ってくるべき */ @@ -415,8 +430,14 @@ task_create_pp->set_param(1,(memaddr)ppack); task_next->wait_for(task_create_pp); - - int range_base = spe_num; + + int range_base; + if (spe_num == 0) { + range_base = 1; + } else { + range_base = spe_num; + } + // 切り上げのつもり int range = (spackList_length + range_base - 1) / range_base; @@ -449,7 +470,9 @@ task_next->wait_for(task_create_sp); task_create_sp->wait_for(task_create_pp); - task_create_sp->set_cpu(SPE_ANY); + if (spe_num != 0) { + task_create_sp->set_cpu(SPE_ANY); + } task_create_sp->spawn(); } @@ -479,17 +502,27 @@ data_update_wait->add_inData(light_xyz,size); data_update_wait->set_param(0,size); data_update_wait->set_param(1,Light); - data_update_wait->set_cpu((CPU_TYPE)((int)SPE_0)); - + if (spe_num != 0) { + data_update_wait->set_cpu((CPU_TYPE)((int)SPE_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(); + if (spe_num == 0) { + 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_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(); @@ -533,7 +566,9 @@ break; } - task_draw->set_cpu(SPE_ANY); + if (spe_num != 0) { + task_draw->set_cpu(SPE_ANY); + } task_next->wait_for(task_draw); task_draw->wait_for(data_update_wait); task_draw->spawn();