Mercurial > hg > Game > Cerium
changeset 84:c2e178b3415f
create SPUSPANLIST no use task/spu_span.cpp
author | chiaki |
---|---|
date | Tue, 26 Feb 2008 21:49:50 +0900 |
parents | 9b0b11bf4085 |
children | 9b96b190cb73 |
files | TaskManager/Test/simple_pack/polygon_pack.h TaskManager/Test/simple_pack/scene_graph_pack.h TaskManager/Test/simple_pack/span_pack.h TaskManager/Test/simple_pack/spu_span.h TaskManager/Test/simple_pack/task/create_pp.cpp TaskManager/Test/simple_pack/task/create_sgp.cpp TaskManager/Test/simple_pack/task/create_span.cpp TaskManager/Test/simple_pack/task/task_init.cpp TaskManager/Test/simple_pack/viewer.cpp |
diffstat | 9 files changed, 92 insertions(+), 152 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Test/simple_pack/polygon_pack.h Wed Feb 20 17:25:48 2008 +0900 +++ b/TaskManager/Test/simple_pack/polygon_pack.h Tue Feb 26 21:49:50 2008 +0900 @@ -1,8 +1,8 @@ #ifndef INCLUDED_POLYGON_PACK #define INCLUDED_POLYGON_PACK -#ifndef INCLUDED_SPAN_PACK -#include "span_pack.h" +#ifndef INCLUDED_SPU_SPAN +#include "spu_span.h" #endif typedef struct VertexPack { @@ -28,7 +28,8 @@ int light_pos[3]; int light_rgb[3]; }info; - SPANPACKLIST *spl; + //SPANPACKLIST *spl; + SPUSPANLIST *ssl; TrianglePack tri[128]; // Variable length array } PolygonPack, *PolygonPackPtr;
--- a/TaskManager/Test/simple_pack/scene_graph_pack.h Wed Feb 20 17:25:48 2008 +0900 +++ b/TaskManager/Test/simple_pack/scene_graph_pack.h Tue Feb 26 21:49:50 2008 +0900 @@ -1,8 +1,8 @@ #ifndef INCLUDED_SCENE_GRAPH_PACK #define INCLUDED_SCENE_GRAPH_PACK -#ifndef INCLUDED_SPAN_PACK -#include "span_pack.h" +#ifndef INCLUDED_SPU_SPAN +#include "spu_span.h" #endif /* @@ -33,7 +33,7 @@ }SceneGraphInfo; typedef struct SceneGraphPack { - SPANPACKLIST *spl; + SPUSPANLIST *ssl; SceneGraphInfo info; SceneGraphNode node[16]; // variable length array }SceneGraphPack;
--- a/TaskManager/Test/simple_pack/span_pack.h Wed Feb 20 17:25:48 2008 +0900 +++ b/TaskManager/Test/simple_pack/span_pack.h Tue Feb 26 21:49:50 2008 +0900 @@ -14,16 +14,17 @@ int light_pos[3]; int light_rgb[3]; } info; - //SPAN span[250]; SPAN span[70]; //SPAN *span; } SPANPACK, *SPANPACK_PTR; +/* typedef struct SpanPackList { int size; SPANPACK dline[60]; //SPANPACK dline[135]; //SPANPACK *dline; } SPANPACKLIST; +*/ #endif
--- a/TaskManager/Test/simple_pack/spu_span.h Wed Feb 20 17:25:48 2008 +0900 +++ b/TaskManager/Test/simple_pack/spu_span.h Tue Feb 26 21:49:50 2008 +0900 @@ -7,17 +7,19 @@ typedef struct SPUSPAN { int length; - SPANPACK_PTR spp[64]; - SPUSPAN *next; + //SPANPACK spp[23]; // window_height = 1080 ( 1080/8/6 = 22.5 ) + SPANPACK spp[10]; // window_height = 480 ( 480/8/6 = 10 ) + //SPUSPAN *next; } SPUSPAN; typedef struct SPUSPANLIST { - SPUSPAN ss[6]; + SPUSPAN ss[6]; // 6 = number of SPU } SPUSPANLIST; +/* typedef struct SPLSSL { SPUSPANLIST *ssl; SPANPACKLIST *spl; } SPLSSL; - +*/ #endif
--- a/TaskManager/Test/simple_pack/task/create_pp.cpp Wed Feb 20 17:25:48 2008 +0900 +++ b/TaskManager/Test/simple_pack/task/create_pp.cpp Tue Feb 26 21:49:50 2008 +0900 @@ -54,13 +54,13 @@ pp->tri[pt].ver3.tex_x = node->texture[nt+4]; pp->tri[pt].ver3.tex_y = node->texture[nt+4+1]; - pp->tri[pt].tex_addr = node->tex_addr; + //pp->tri[pt].tex_addr = node->tex_addr; pp->tri[pt].tex_width = node->tex_width; pp->tri[pt].tex_height = node->tex_height; } pp->info.size = pt; - pp->spl = sgp->spl; + pp->ssl = sgp->ssl; } return sizeof(PolygonPack); }
--- a/TaskManager/Test/simple_pack/task/create_sgp.cpp Wed Feb 20 17:25:48 2008 +0900 +++ b/TaskManager/Test/simple_pack/task/create_sgp.cpp Tue Feb 26 21:49:50 2008 +0900 @@ -45,7 +45,7 @@ node->interaction = 0; node->pn = nnpn; - node->tex_addr = t->texture_image->pixels; + //node->tex_addr = t->texture_image->pixels; node->tex_width = t->texture_image->w; node->tex_height = t->texture_image->h;
--- a/TaskManager/Test/simple_pack/task/create_span.cpp Wed Feb 20 17:25:48 2008 +0900 +++ b/TaskManager/Test/simple_pack/task/create_span.cpp Tue Feb 26 21:49:50 2008 +0900 @@ -1,6 +1,6 @@ #include <iostream> #include "polygon_pack.h" -#include "span_pack.h" +#include "spu_span.h" using namespace std; @@ -26,7 +26,7 @@ return vMid1; } -void half_triangle(SPANPACKLIST *spl, long *tex_addr, long tex_width, long tex_height, VertexPack *vMin, VertexPack *vMid, VertexPack *vMid1) { +void half_triangle(SPUSPANLIST *ssl, long *tex_addr, long tex_width, long tex_height, VertexPack *vMin, VertexPack *vMid, VertexPack *vMid1) { //void half_triangle(SPANPACK *sp, long *tex_addr, long tex_width, long tex_height, VertexPack *vMin, VertexPack *vMid, VertexPack *vMid1) { float tmp_z,tmp_tex1, tmp_tex2 ,tmp_tey1,tmp_tey2; float tmp_xpos,tmp_end,tmp_zpos; @@ -93,59 +93,33 @@ //add(tex_addr,tex_width,tex_height,x,y,length,start_z,end_z,start_tex_x,end_tex_x,start_tex_y,end_tex_y); + //y += 540; // window_height = 1080 (1080/2 = 540) + y += 240; // window_height = 480 (480/2 = 240) - y += 240; - int spu_no = y/8; - y -= 240; - - //int spu_no = 0; - int c = spl->dline[spu_no].info.size; - /* - if(c > 100) - { - cout << "over c = " << c << endl; - c = 0; - spl->dline[spu_no].info.size = 0; - } - */ + int line_set = y/8; + + //y -= 540; // window_height = 1080 (1080/2 = 540) + y -= 240; // window_height = 480 (480/2 = 240) + + int spu_no = line_set%6; + + int spp_no = line_set/6; + int span_no = ssl->ss[spu_no].spp[spp_no].info.size; - spl->dline[spu_no].span[c].tex_addr = tex_addr; - spl->dline[spu_no].span[c].tex_width = tex_width; - spl->dline[spu_no].span[c].tex_height = tex_height; - spl->dline[spu_no].span[c].x = x; - spl->dline[spu_no].span[c].y = y; - spl->dline[spu_no].span[c].length_x = length; - spl->dline[spu_no].span[c].start_z = start_z; - spl->dline[spu_no].span[c].end_z = end_z; - spl->dline[spu_no].span[c].tex_x1 = start_tex_x; - spl->dline[spu_no].span[c].tex_x2 = end_tex_x; - spl->dline[spu_no].span[c].tex_y1 = start_tex_y; - spl->dline[spu_no].span[c].tex_y2 = end_tex_y; - //if(c < 8) - { - spl->dline[spu_no].info.size++; - } - //cout << "spu_no : " << spu_no << endl; - //cout << "size : " <<spl->dline[spu_no].info.size << endl; - //cout << endl; - /* - int c = sp->info.size; - sp->span[c].tex_addr = tex_addr; - sp->span[c].tex_width = tex_width; - sp->span[c].tex_height = tex_height; - sp->span[c].x = x; - sp->span[c].y = y; - sp->span[c].length_x = length; - sp->span[c].start_z = start_z; - sp->span[c].end_z = end_z; - sp->span[c].tex_x1 = start_tex_x; - sp->span[c].tex_x2 = end_tex_x; - sp->span[c].tex_y1 = start_tex_y; - sp->span[c].tex_y2 = end_tex_y; - sp->info.size++; - //cout << sp->info.size << endl; - //cout << sp->span[0].x << endl; - */ + ssl->ss[spu_no].spp[spp_no].span[span_no].tex_addr = tex_addr; + ssl->ss[spu_no].spp[spp_no].span[span_no].tex_width = tex_width; + ssl->ss[spu_no].spp[spp_no].span[span_no].tex_height = tex_height; + ssl->ss[spu_no].spp[spp_no].span[span_no].x = x; + ssl->ss[spu_no].spp[spp_no].span[span_no].y = y; + ssl->ss[spu_no].spp[spp_no].span[span_no].length_x = length; + ssl->ss[spu_no].spp[spp_no].span[span_no].start_z = start_z; + ssl->ss[spu_no].spp[spp_no].span[span_no].end_z = end_z; + ssl->ss[spu_no].spp[spp_no].span[span_no].tex_x1 = start_tex_x; + ssl->ss[spu_no].spp[spp_no].span[span_no].tex_x2 = end_tex_x; + ssl->ss[spu_no].spp[spp_no].span[span_no].tex_y1 = start_tex_y; + ssl->ss[spu_no].spp[spp_no].span[span_no].tex_y2 = end_tex_y; + + ssl->ss[spu_no].spp[spp_no].info.size++; } } @@ -155,7 +129,8 @@ PolygonPack *polygon = (PolygonPack*)rbuf; //SPANPACK *sp = (SPANPACK*)wbuf; //SPANPACKLIST *spl = (SPANPACKLIST*)wbuf; - SPANPACKLIST *spl = polygon->spl; + //SPANPACKLIST *spl = polygon->spl; + SPUSPANLIST *ssl = polygon->ssl; VertexPack *vMin, *vMid, *vMax, *vMid10; VertexPack ver; vMid10 = &ver; @@ -164,11 +139,14 @@ //cout << "create_span:spl->dline[0].span = " << spl->dline[0].span << endl; //for(int i=0; i<spl->size; i++) - for(int i=0; i<60; i++) + for(int i=0; i<6; i++) // 6 = number of SPU { - spl->dline[i].info.size = 0; - //cout << i << endl; - //cout << spl->dline[i].info.size << endl; + ssl->ss[i].length = 0; + //for(int t=0; t<10; t++) // window_height = 1080 ( 1080/8/6 = 22.5 ) + for(int t=0; t<10; t++) // window_height = 480 (480/8/6 = 10) + { + ssl->ss[i].spp[t].info.size = 0; + } } //sp->info.size = 0; @@ -214,8 +192,8 @@ vMid1(vMid10,vMin,vMid,vMax); - half_triangle(spl,polygon->tri[a].tex_addr,polygon->tri[a].tex_width,polygon->tri[a].tex_height,vMin,vMid,vMid10); - half_triangle(spl,polygon->tri[0].tex_addr,polygon->tri[0].tex_width,polygon->tri[0].tex_height,vMax,vMid,vMid10); + half_triangle(ssl,polygon->tri[a].tex_addr,polygon->tri[a].tex_width,polygon->tri[a].tex_height,vMin,vMid,vMid10); + half_triangle(ssl,polygon->tri[0].tex_addr,polygon->tri[0].tex_width,polygon->tri[0].tex_height,vMax,vMid,vMid10); //printf("x:%d y:%d end:%d z:%f zpos:%f\n",sp->span[0].x,sp->span[0].y,sp->span[0].length_x,sp->span[0].start_z , sp->span[0].end_z); } //printf("create_span x:%d y:%d end:%d z:%f zpos:%f\n",sp->span[0].x,sp->span[0].y,sp->span[0].length_x,sp->span[0].start_z , sp->span[0].end_z);
--- a/TaskManager/Test/simple_pack/task/task_init.cpp Wed Feb 20 17:25:48 2008 +0900 +++ b/TaskManager/Test/simple_pack/task/task_init.cpp Tue Feb 26 21:49:50 2008 +0900 @@ -11,7 +11,7 @@ extern int create_pp(SceneGraphPack *sgp, PolygonPack *pp); extern int create_span(void *wbuf, void *rbuf); //extern int spu_span(SPANPACKLIST *spl, SPUSPANLIST *ssl); -extern int spu_span(SPLSSL *splssl, SPUSPANLIST *a); +//extern int spu_span(SPLSSL *splssl, SPUSPANLIST *a); void task_initialize() @@ -20,5 +20,5 @@ manager->set_symbol("UpdateSGP", (void*)update_sgp); manager->set_symbol("CreatePP", (void*)create_pp); manager->set_symbol("CreateSP", (void*)create_span); - manager->set_symbol("SpuSP", (void*)spu_span); + //manager->set_symbol("SpuSP", (void*)spu_span); }
--- a/TaskManager/Test/simple_pack/viewer.cpp Wed Feb 20 17:25:48 2008 +0900 +++ b/TaskManager/Test/simple_pack/viewer.cpp Tue Feb 26 21:49:50 2008 +0900 @@ -212,17 +212,17 @@ Polygon *p; SceneGraphPack *sgp; PolygonPack *pp; - SPANPACKLIST *spl; - SPANPACK *sp; - SPANPACK sps[135]; - SPAN s1[250]; - SPAN s2[250]; - SPAN s3[250]; - SPAN s4[250]; - SPAN s5[250]; - SPAN s6[250]; + //SPANPACKLIST *spl; + //SPANPACK *sp; + //SPANPACK sps[135]; + //SPAN s1[250]; + //SPAN s2[250]; + //SPAN s3[250]; + //SPAN s4[250]; + //SPAN s5[250]; + //SPAN s6[250]; SPUSPANLIST *ssl; - SPLSSL *splssl; + //SPLSSL *splssl; }; struct run_arg_t *arg; @@ -246,9 +246,9 @@ arg->sgp = new SceneGraphPack; //create_sgp(arg->p, arg->sgp); arg->pp = new PolygonPack; - arg->sp = new SPANPACK; - arg->spl = new SPANPACKLIST; - arg->spl->size = 60; + //arg->sp = new SPANPACK; + //arg->spl = new SPANPACKLIST; + //arg->spl->size = 60; //cout << sizeof(SPANPACKLIST) << endl; //cout << "run_init :spl->size = " << arg->spl->size << endl; //arg->spl->dline = arg->sps; @@ -269,13 +269,13 @@ */ arg->ssl = new SPUSPANLIST; - arg->splssl = new SPLSSL; + //arg->splssl = new SPLSSL; create_sgp(arg->p, arg->sgp); - arg->sgp->spl = arg->spl; + arg->sgp->ssl = arg->ssl; - arg->splssl->spl = arg->spl; - arg->splssl->ssl = arg->ssl; + //arg->splssl->spl = arg->spl; + //arg->splssl->ssl = arg->ssl; pixels = new Uint32[width*height]; @@ -316,12 +316,12 @@ HTaskPtr task_update_sgp = NULL; HTaskPtr task_create_pp = NULL; HTaskPtr task_create_sp = NULL; - HTaskPtr task_spu_sp = NULL; + //HTaskPtr task_spu_sp = NULL; HTaskPtr task_finish = NULL; int fd_update_sgp; int fd_create_pp; int fd_create_sp; - int fd_spu_sp; + //int fd_spu_sp; int fd_finish; HTaskPtr task; @@ -343,7 +343,7 @@ fd_update_sgp = manager->open("UpdateSGP"); fd_create_pp = manager->open("CreatePP"); fd_create_sp = manager->open("CreateSP"); - fd_spu_sp = manager->open("SpuSP"); + //fd_spu_sp = manager->open("SpuSP"); fd = manager->open("ViewerRunDraw"); task_update_sgp = manager->create_task(fd_update_sgp, sizeof(SceneGraphPack), @@ -360,28 +360,28 @@ task_create_sp = manager->create_task(fd_create_sp, sizeof(PolygonPack), (unsigned int)arg->pp, - (unsigned int)arg->spl, + 0, NULL); - + /* task_spu_sp = manager->create_task(fd_spu_sp, sizeof(SPLSSL), (unsigned int)arg->splssl, (unsigned int)arg->ssl, NULL); - + */ task = manager->create_task(fd, 0, 0, 0, NULL); manager->set_task_depend(task_update_sgp, task); manager->set_task_depend(task_create_pp, task); manager->set_task_depend(task_create_pp, task_create_sp); - manager->set_task_depend(task_create_sp, task_spu_sp); + //manager->set_task_depend(task_create_sp, task_spu_sp); manager->set_task_depend(task_create_sp, task); - manager->set_task_depend(task_spu_sp, task); + //manager->set_task_depend(task_spu_sp, task); manager->spawn_task(task_update_sgp); manager->spawn_task(task_create_pp); manager->spawn_task(task_create_sp); - manager->spawn_task(task_spu_sp); + //manager->spawn_task(task_spu_sp); manager->spawn_task(task); } @@ -391,59 +391,17 @@ HTaskPtr task; int fd; - //cout << "size = " << arg->sp->info.size << endl; - //cout << "span x = " << arg->sp->span[0].x << endl; - //printf("run_draw x:%d y:%d end:%d z:%f zpos:%f\n", arg->sp->span[0].x, arg->sp->span[0].y, arg->sp->span[0].length_x, arg->sp->span[0].start_z , arg->sp->span[0].end_z); - //cout << endl; - //arg->p->draw(arg->pp); // test draw of PolygonPack //arg->p->draw(arg->sp); // test draw of SpanPack - //arg->p->draw(&arg->spl->dline[0]); // test draw of SpanPackList - - - /* - arg->ssl->ss[0].length = 0; - arg->ssl->ss[1].length = 0; - arg->ssl->ss[2].length = 0; - arg->ssl->ss[3].length = 0; - arg->ssl->ss[4].length = 0; - arg->ssl->ss[5].length = 0; - - for(int i=0; i<arg->spl->size; i++) - { - int ss_size = arg->ssl->ss[i%6].length; - - arg->ssl->ss[i%6].spp[ss_size] = &arg->spl->dline[i]; - arg->ssl->ss[i%6].length++; - } - */ - - /* - for(int i=0; i<30; i++) - { - cout << arg->ssl->ss[0].spp[i]->span[0].x << endl; - } - */ - - //cout << "dline[30].info.size : " << arg->spl->dline[30].info.size << endl; - //cout << "ssl->ss[5].spp[0]->info.size : " << arg->ssl->ss[5].spp[0]->info.size << endl; - - /* - for(int i=0; i<arg->spl->size; i++) - //for(int i=0; i<60; i++) - { - //arg->p->draw(&arg->spl->dline[i]); // test draw of SpanPackList - } - */ for(int i=0; i<10; i++) { - arg->p->draw(arg->ssl->ss[0].spp[i]); // test draw of SpuSpanPackList - arg->p->draw(arg->ssl->ss[1].spp[i]); // test draw of SpuSpanPackList - arg->p->draw(arg->ssl->ss[2].spp[i]); // test draw of SpuSpanPackList - arg->p->draw(arg->ssl->ss[3].spp[i]); // test draw of SpuSpanPackList - arg->p->draw(arg->ssl->ss[4].spp[i]); // test draw of SpuSpanPackList - arg->p->draw(arg->ssl->ss[5].spp[i]); // test draw of SpuSpanPackList + arg->p->draw(&arg->ssl->ss[0].spp[i]); // test draw of SpuSpanPackList + arg->p->draw(&arg->ssl->ss[1].spp[i]); // test draw of SpuSpanPackList + arg->p->draw(&arg->ssl->ss[2].spp[i]); // test draw of SpuSpanPackList + arg->p->draw(&arg->ssl->ss[3].spp[i]); // test draw of SpuSpanPackList + arg->p->draw(&arg->ssl->ss[4].spp[i]); // test draw of SpuSpanPackList + arg->p->draw(&arg->ssl->ss[5].spp[i]); // test draw of SpuSpanPackList } SDL_BlitSurface(arg->bitmap, NULL, screen, NULL); @@ -469,8 +427,8 @@ delete arg->p; delete arg->sgp; delete arg->pp; - delete arg->spl; - delete arg->sp; + //delete arg->spl; + //delete arg->sp; quit(); delete arg;