Mercurial > hg > Members > kono > Cerium
diff TaskManager/Test/simple_render/viewer.cpp @ 105:3e331f7576a1
*** empty log message ***
author | gongo |
---|---|
date | Mon, 03 Mar 2008 18:55:28 +0900 |
parents | 62679f4cae18 |
children | c9efdb17e8d2 |
line wrap: on
line diff
--- a/TaskManager/Test/simple_render/viewer.cpp Mon Mar 03 17:21:20 2008 +0900 +++ b/TaskManager/Test/simple_render/viewer.cpp Mon Mar 03 18:55:28 2008 +0900 @@ -4,6 +4,7 @@ #include "viewer.h" #include "sys.h" #include "spu_span.h" +#include "Func.h" using namespace std; #define redMask 0x00ff0000 @@ -12,8 +13,6 @@ #define alphaMask 0 extern int create_sgp(Polygon *sg, SceneGraphPack *sgp); -extern int update_sgp(SceneGraphPack *sgp, SceneGraphPack *_sgp); -extern int create_pp(SceneGraphPack *sgp, PolygonPack *pp); Viewer::Viewer(int b, int w, int h) { @@ -242,11 +241,6 @@ Viewer::run_init() { HTaskPtr task; - int fd; - - //SceneGraphPack *sgp; - //PolygonPack *pp; - //SPUSPANLIST *ssl; start_time = get_ticks(); this_time = 0; @@ -293,13 +287,14 @@ width*4, redMask, greenMask, blueMask, alphaMask); - fd = manager->open("ViewerRunLoop"); - task = manager->create_task(fd, 0, 0, 0, NULL); + task = manager->create_task(VIEWER_RUN_LOOP, 0, 0, 0, NULL); task->spawn(); posix_memalign((void**)&__texture, 16, 128*128*3); memcpy(__texture, polygon->texture_image->pixels, 128*128*3); - HTaskPtr task_init_tex = manager->create_task(0, 0, (uint32)__texture, 0, NULL); + HTaskPtr task_init_tex + = manager->create_task(TASK_INIT_TEXTURE, 0, + (uint32)__texture, 0, NULL); task_init_tex->set_cpu(CPU_SPE); task_init_tex->spawn(); } @@ -311,21 +306,15 @@ HTaskPtr task_create_pp = NULL; HTaskPtr task_create_sp = NULL; HTaskPtr task_finish = NULL; - int fd_update_sgp; - int fd_create_pp; - int fd_create_sp; - int fd_finish; HTaskPtr task; - int fd; bool quit_flg; quit_flg = quit_check(); if (quit_flg == true) { this_time = get_ticks(); - fd_finish = manager->open("ViewerRunFinish"); - task_finish = manager->create_task(fd_finish, 0, 0, 0, NULL); + task_finish = manager->create_task(VIEWER_RUN_FINISH, 0, 0, 0, NULL); task_finish->spawn(); return; } @@ -339,32 +328,15 @@ // これ自身、一つのタスクとして回す方がよいか //graph_line(); - fd_update_sgp = manager->open("UpdateSGP"); - fd_create_pp = manager->open("CreatePP"); - fd_create_sp = manager->open("CreateSP"); - fd = manager->open("ViewerRunDraw"); - -#if 0 // USE DOUBLE BUFFER task_update_sgp - = manager->create_task(fd_update_sgp, sizeof(SceneGraphPack), - sgp_buff, sgp_buff, NULL); - task_create_pp - = manager->create_task(fd_create_pp, sizeof(SceneGraphPack), - sgp_buff, pp_buff, NULL); - task_create_sp - = manager->create_task(fd_create_sp, sizeof(SceneGraphPack), - pp_buff, ssl_buff, NULL); -#else - task_update_sgp - = manager->create_task(fd_update_sgp, sizeof(SceneGraphPack), + = manager->create_task(TASK_UPDATE_SGP, sizeof(SceneGraphPack), (uint32)sgp, (uint32)sgp, NULL); task_create_pp - = manager->create_task(fd_create_pp, sizeof(SceneGraphPack), + = manager->create_task(TASK_CREATE_PP, sizeof(SceneGraphPack), (uint32)sgp, (uint32)pp, NULL); task_create_sp - = manager->create_task(fd_create_sp, sizeof(PolygonPack), + = manager->create_task(TASK_CREATE_SPAN, sizeof(PolygonPack), (uint32)pp, 0, NULL); -#endif #if 0 @@ -377,7 +349,7 @@ task_draw_finish->set_depend(tas_spu_draw[i]); } #endif - task = manager->create_task(fd, 0, 0, 0, NULL); + task = manager->create_task(VIEWER_RUN_DRAW, 0, 0, 0, NULL); task->set_depend(task_update_sgp); task->set_depend(task_create_pp); @@ -407,18 +379,20 @@ { HTaskPtr task; HTaskPtr task_draw[6][10]; - int fd; - fd = manager->open("ViewerRunLoop"); - task = manager->create_task(fd, 0, 0, 0, NULL); + //fd = manager->open("ViewerRunLoop"); + //task = manager->create_task(fd, 0, 0, 0, NULL); + task = manager->create_task(VIEWER_RUN_LOOP, 0, 0, 0, NULL); #if 1 for (int j = 0; j < 6; j++) { for (int i = 0; i < 10; i++) { if (ssl->ss[j].spp[i].info.size < 1) continue; + // memcpy はもちろんだめ。だけど。。。 + // SPUSPAN->ss は配列で、各要素がアライメントとれてないと駄目。 memcpy(&send_pack[j][i], &ssl->ss[j].spp[i], sizeof(SPANPACK)); task_draw[j][i] - = manager->create_task(1, sizeof(SPANPACK), + = manager->create_task(TASK_DRAW, sizeof(SPANPACK), (uint32)&send_pack[j][i], fbdev_addr, NULL); task_draw[j][i]->set_cpu(CPU_SPE); task->set_depend(task_draw[j][i]);