Mercurial > hg > Game > Cerium
changeset 1026:9e19e988559c draft
create_pp_task fix.
author | tkaito |
---|---|
date | Tue, 09 Nov 2010 18:14:28 +0900 |
parents | 58b284d6506f |
children | a18b110af77b |
files | Renderer/Engine/spe/CreatePolygonFromSceneGraph.cc Renderer/Engine/viewer.cc |
diffstat | 2 files changed, 57 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/spe/CreatePolygonFromSceneGraph.cc Sun Nov 07 04:24:24 2010 +0900 +++ b/Renderer/Engine/spe/CreatePolygonFromSceneGraph.cc Tue Nov 09 18:14:28 2010 +0900 @@ -62,7 +62,6 @@ float *matrix = (float*)smanager->get_input(rbuf, 3); float *real_matrix = (float*)smanager->get_input(rbuf, 4); uint32 *pixels = (uint32*)smanager->get_input(rbuf, 5); - //TrianglePackPtr triangle = (TrianglePackPtr)smanager->get_input(rbuf, 6); int sg_size = (int)smanager->get_param(0); int width = (int)smanager->get_param(1); @@ -70,9 +69,42 @@ int scale_max = (int)smanager->get_param(3); // triangle を書き戻す - TrianglePackPtr triangle = (TrianglePackPtr)smanager->get_output(wbuf, 0); + //TrianglePackPtr triangle = (TrianglePackPtr)smanager->get_output(wbuf, 0); + + PolygonPackPtr pp + = (PolygonPackPtr)smanager->allocate(sizeof(PolygonPack)); + PolygonPackPtr send_pp + = (PolygonPackPtr)smanager->allocate(sizeof(PolygonPack)); + PolygonPackPtr pp_addr = (PolygonPackPtr)smanager->get_param(1); + PolygonPackPtr tmp_pp; + for (int i = 0; i < sg_size; i += 3) { + if (pp->info.size >= MAX_SIZE_TRIANGLE) { + PolygonPackPtr next; + + smanager->mainMem_alloc(0, sizeof(PolygonPack)); + smanager->mainMem_wait(); + next = (PolygonPackPtr)smanager->mainMem_get(0); + + pp->next = next; + + tmp_pp = pp; + pp = send_pp; + send_pp = tmp_pp; + + smanager->dma_wait(PP_STORE); + smanager->dma_store(send_pp, (memaddr)pp_addr, + sizeof(PolygonPack), PP_STORE); + + pp_addr = next; + + smanager->dma_wait(PP_LOAD); + smanager->dma_load(pp, (memaddr)pp_addr, + sizeof(PolygonPack), PP_LOAD); + smanager->dma_wait(PP_LOAD); + pp->init(); + } xyz1[0] = coord_xyz[(i+0)*3]; xyz1[1] = coord_xyz[(i+0)*3+1]; @@ -101,6 +133,8 @@ xyz3[0] /= xyz3[2]; xyz3[1] /= xyz3[2]; + TrianglePack *triangle = &pp->tri[pp->info.size++]; + triangle->ver1.x = xyz1[0]; triangle->ver1.y = xyz1[1]; triangle->ver1.z = xyz1[2]; @@ -167,5 +201,13 @@ triangle->tex_info.height = height; triangle->tex_info.scale_max = scale_max; } + smanager->dma_wait(PP_STORE); + smanager->dma_store(pp, (memaddr)pp_addr, + sizeof(PolygonPack), PP_STORE); + smanager->dma_wait(PP_STORE); + + free(pp); + free(send_pp); + return 0; }
--- a/Renderer/Engine/viewer.cc Sun Nov 07 04:24:24 2010 +0900 +++ b/Renderer/Engine/viewer.cc Tue Nov 09 18:14:28 2010 +0900 @@ -690,7 +690,7 @@ sg_division+residue,4,6,1); pptask[spe_num] = 0; - int count= 0; + //int count= 0; int k = 0; while (sg) { @@ -713,7 +713,7 @@ pptask[k]->set_param(2,(memaddr)sg->texture_info.t_h); pptask[k]->set_param(3,(memaddr)sg->texture_info.scale_max); - pptask[k]->set_outData(0, &pp->tri[pp->info.size++], sizeof(TrianglePack)); + //pptask[k]->set_outData(0, &pp->tri[pp->info.size++], sizeof(TrianglePack)); } if (sg->children != NULL) { sg = sg->children; @@ -734,9 +734,18 @@ } } } - count++; + k++; } - + for (int k = 0; k < spe_num; k++) { + task_array[k]->spawn_task_array(pptask[k]->next()); + task_array[k]->set_cpu(SPE_ANY); + task_array[k]->spawn(); + if (sgroot->gtask_array != NULL) { + HTaskPtr game_task_array = sgroot->gtask_array->get_task_array(); + task_create_pp->wait_for(game_task_array); + } + task_next->wait_for(task_create_pp); + } } void