Mercurial > hg > Game > Cerium
changeset 85:9b96b190cb73
*** empty log message ***
line wrap: on
line diff
--- a/TaskManager/Test/simple_render/Makefile Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/Makefile Wed Feb 27 04:25:04 2008 +0900 @@ -8,13 +8,13 @@ TASK_OBJS = $(TASK_SRCS:.cpp=.o) CC = g++ -CFLAGS = -O9 -g -Wall# -DDEBUG +CFLAGS = -O9 -g -Wall -DDEBUG INCLUDE = -I../../../include/TaskManager -I. EXTRA_CFLAGS = `sdl-config --cflags` `xml2-config --cflags`\ -EXTRA_LIBS = -lCellManager -lspe2 -lpthread -#EXTRA_LIBS = -lFifoManager +#EXTRA_LIBS = -lCellManager -lspe2 -lpthread +EXTRA_LIBS = -lFifoManager LIBS = `sdl-config --libs` -lSDL_image -lGL \ `xml2-config --libs` -L../.. $(EXTRA_LIBS)
--- a/TaskManager/Test/simple_render/base64_de.cpp Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/base64_de.cpp Wed Feb 27 04:25:04 2008 +0900 @@ -1,5 +1,4 @@ -#include <stdio.h> -//#include <iostream> +#include <iostream> #include <fstream> using namespace std;
--- a/TaskManager/Test/simple_render/main.cpp Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/main.cpp Wed Feb 27 04:25:04 2008 +0900 @@ -44,6 +44,9 @@ task_zrow_init = manager->create_task(fd_zrow_init, 0, 0, 0, NULL); task_run = manager->create_task(fd_run, 0, 0, 0, NULL); + //manager->set_task_depend(task_sdl_init, task_run); + //manager->set_task_depend(task_zrow_init, task_run); + task_run->set_depend(task_sdl_init); task_run->set_depend(task_zrow_init); @@ -96,7 +99,7 @@ int run_finish(void *r, void *w) { __debug("[%s]\n", __FUNCTION__); - //screen->run_finish(); + screen->run_finish(); return 0; } @@ -111,7 +114,7 @@ int main(int argc, char *argv[]) { - manager = new TaskManager(3); + manager = new TaskManager(1); manager->init(); task_initialize(); @@ -159,6 +162,7 @@ fd_init = manager->open("init"); task_init = manager->create_task(fd_init, 0, 0, 0, NULL); + //manager->spawn_task(task_init); task_init->spawn(); manager->run();
--- a/TaskManager/Test/simple_render/polygon.cpp Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/polygon.cpp Wed Feb 27 04:25:04 2008 +0900 @@ -187,7 +187,7 @@ //printf("x2:%f ,%f ,%f , %f, %f\n",xyz2[0],xyz2[1],xyz2[2],data[n+size*6+3],data[n+size*6+3+1]); //printf("x3:%f ,%f ,%f , %f, %f\n",xyz3[0],xyz3[1],xyz3[2],data[n+size*6+6],data[n+size*6+6+1]); Triangle *tri = new Triangle(ver1,ver2,ver3); - Span *span = new Span(); + Span_c *span = new Span_c(); span->viewer = viewer; span->p = this; span->create_span(tri,texture_image); @@ -317,7 +317,7 @@ Vertex *ver3 = new Vertex(xyz3[0],xyz3[1],xyz3[2],node.texture[nt+4],node.texture[nt+4+1]); Triangle *tri = new Triangle(ver1,ver2,ver3); - Span *span = new Span(); + Span_c *span = new Span_c(); span->viewer = viewer; span->p = this; span->create_span(tri,texture_image); @@ -333,31 +333,75 @@ void Polygon::draw(PolygonPack *pp) { - Vertex *ver1 = new Vertex(0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - Vertex *ver2 = new Vertex(0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - Vertex *ver3 = new Vertex(0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - - for (int n = 0; n < pp->info.size; n++) { - //Vertex *ver1 = new Vertex(pp->tri[n].x1,pp->tri[n].y1,pp->tri[n].z1,pp->tri[n].tex_x1,pp->tri[n].tex_y1); - //Vertex *ver2 = new Vertex(pp->tri[n].x2,pp->tri[n].y2,pp->tri[n].z2,pp->tri[n].tex_x2,pp->tri[n].tex_y2); - //Vertex *ver3 = new Vertex(pp->tri[n].x3,pp->tri[n].y3,pp->tri[n].z3,pp->tri[n].tex_x3,pp->tri[n].tex_y3); - - ver1->set(pp->tri[n].x1,pp->tri[n].y1,pp->tri[n].z1,pp->tri[n].tex_x1,pp->tri[n].tex_y1); - ver2->set(pp->tri[n].x2,pp->tri[n].y2,pp->tri[n].z2,pp->tri[n].tex_x2,pp->tri[n].tex_y2); - ver3->set(pp->tri[n].x3,pp->tri[n].y3,pp->tri[n].z3,pp->tri[n].tex_x3,pp->tri[n].tex_y3); - - Triangle *tri = new Triangle( ver1, ver2, ver3); - Span *span = new Span(); - span->viewer = viewer; - span->p = this; - span->create_span(tri,texture_image); - delete tri; - delete span; + for(int n=0; n<pp->info.size; n++) + { + Vertex *ver1 = new Vertex(pp->tri[n].ver1.x,pp->tri[n].ver1.y,pp->tri[n].ver1.z,pp->tri[n].ver1.tex_x,pp->tri[n].ver1.tex_y); + Vertex *ver2 = new Vertex(pp->tri[n].ver2.x,pp->tri[n].ver2.y,pp->tri[n].ver2.z,pp->tri[n].ver2.tex_x,pp->tri[n].ver2.tex_y); + Vertex *ver3 = new Vertex(pp->tri[n].ver3.x,pp->tri[n].ver3.y,pp->tri[n].ver3.z,pp->tri[n].ver3.tex_x,pp->tri[n].ver3.tex_y); + + Triangle *tri = new Triangle(ver1,ver2,ver3); + Span_c *span = new Span_c(); + span->viewer = viewer; + span->p = this; + span->create_span(tri,texture_image); + delete ver1; + delete ver2; + delete ver3; + delete tri; + delete span; } +} - delete ver1; - delete ver2; - delete ver3; + +void Polygon::draw(SPANPACK *sp) +{ + for(int n=0; n<sp->info.size; n++) + { + int end = sp->span[n].length_x; + Uint32 rgb; + float tex1 = sp->span[n].tex_x1; + float tex2= sp->span[n].tex_x2; + float tey1 = sp->span[n].tex_y1; + float tey2= sp->span[n].tex_y2; + int tex_xpos; + int tex_ypos; + int tex_zpos; + int x = sp->span[n].x; + int y = sp->span[n].y; + float z = sp->span[n].start_z; + float zpos = sp->span[n].end_z; + float tex_x,tex_y,tex_z; + + if(end == 1) { + //printf("end == 1\n"); + //printf("tex_x:%f tex_y:%f\n",tex1,tex2); + //if(tex1 > 1) tex1 = 1; + //if(tey1 > 1) tey1 = 1; + tex_xpos = (int)((sp->span[n].tex_height-1) * tex1); + tex_ypos = (int)((sp->span[n].tex_width-1) * tey1); + tex_zpos = (int)z; + //printf("tex_xpos:%d tex_ypos:%d\n",tex_xpos,tex_ypos); + //printf("image->h:%d tex_x:%f\n",(int)sp->span[n].tex_height,tex1); + rgb = get_rgb(tex_xpos,tex_ypos); + viewer->write_pixel(x,y,zpos,rgb); + }else { + //printf("end != 1\n"); + for(int j = 0; j < end; j++) { + tex_x = tex1*(end-1-j)/(end-1) + tex2*j/(end-1); + tex_y = tey1*(end-1-j)/(end-1) + tey2*j/(end-1); + tex_z = z*(end-1-j)/(end-1) + zpos*j/(end-1); + if(tex_x > 1) tex_x = 1; + if(tex_y > 1) tex_y = 1; + tex_xpos = (int)((sp->span[n].tex_height-1) * tex_x); + tex_ypos = (int)((sp->span[n].tex_width-1) * tex_y); + //printf("tex_xpos:%d tex_ypos:%d\n",tex_xpos,tex_ypos); + //printf("z:%f zpos:%f tex_z:%f\n",z,zpos,tex_z); + //printf("tex_x:%f tex_y:%f\n",tex_x,tex_y); + rgb = get_rgb(tex_xpos,tex_ypos); + viewer->write_pixel(j+x,y,tex_z,rgb); + } + } + } }
--- a/TaskManager/Test/simple_render/polygon.h Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/polygon.h Wed Feb 27 04:25:04 2008 +0900 @@ -15,6 +15,12 @@ #include "polygon_pack.h" #endif + +#ifndef INCLUDED_SPAN_PACK +#include "span_pack.h" +#endif + + class Polygon{ public: int size; @@ -46,6 +52,7 @@ void draw(float *stack); void draw(SceneGraphPack *sgp); void draw(PolygonPack *pp); + void draw(SPANPACK *sp); void tree_draw(); //void sgp_update(); //void sgp_draw();
--- a/TaskManager/Test/simple_render/polygon_pack.h Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/polygon_pack.h Wed Feb 27 04:25:04 2008 +0900 @@ -1,22 +1,42 @@ #ifndef INCLUDED_POLYGON_PACK #define INCLUDED_POLYGON_PACK +#ifndef INCLUDED_SPU_SPAN +#include "spu_span.h" +#endif + +typedef struct VertexPack { + float x; + float y; + float z; + float tex_x; + float tex_y; +}VertexPack, *VertexPack_ptr; + + typedef struct TrianglePack { - long tex_addr, tex_width, tex_height; - float x1, y1, z1, tex_x1, tex_y1; - float x2, y2, z2, tex_x2, tex_y2; - float x3, y3, z3, tex_x3, tex_y3; -} TrianglePack; + long *tex_addr, tex_width, tex_height; + VertexPack ver1; + VertexPack ver2; + VertexPack ver3; +} TrianglePack; -typedef struct PolygonInfo{ - int size; - float light_pos[3]; - float light_rgb[3]; -}PolygonInfo; typedef struct PolygonPack { - PolygonInfo info; + struct PORIGON_info { + int size; + int light_pos[3]; + int light_rgb[3]; + }info; + //SPANPACKLIST *spl; + SPUSPANLIST *ssl; TrianglePack tri[128]; // Variable length array -} PolygonPack; +} PolygonPack, *PolygonPackPtr; + +typedef struct PolygonPackList { + int size; + //PolygonPack *list[6]; + PolygonPack *list; +} PolygonPackList; #endif
--- a/TaskManager/Test/simple_render/scene_graph_pack.h Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/scene_graph_pack.h Wed Feb 27 04:25:04 2008 +0900 @@ -1,6 +1,10 @@ #ifndef INCLUDED_SCENE_GRAPH_PACK #define INCLUDED_SCENE_GRAPH_PACK +#ifndef INCLUDED_SPU_SPAN +#include "spu_span.h" +#endif + /* enum Tree{ PUSH, @@ -16,17 +20,20 @@ float obj_pos[4]; float angle[4]; float translation[16]; + long *tex_addr, tex_width, tex_height; int id; int move, interaction; + //void (*move)(); //int op[32]; // push pop shift => enum int pn; -} SceneGraphNode, *SceneGraphNodePtr; +}SceneGraphNode, *SceneGraphNodePtr; typedef struct SceneGraphInfo { int size; }SceneGraphInfo; typedef struct SceneGraphPack { + SPUSPANLIST *ssl; SceneGraphInfo info; SceneGraphNode node[16]; // variable length array }SceneGraphPack;
--- a/TaskManager/Test/simple_render/span.cpp Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/span.cpp Wed Feb 27 04:25:04 2008 +0900 @@ -42,7 +42,7 @@ void -Span::half_triangle(Vertex *vMin, Vertex *vMid, Vertex *vMid1, +Span_c::half_triangle(Vertex *vMin, Vertex *vMid, Vertex *vMid1, SDL_Surface *image) { @@ -169,7 +169,7 @@ } } -void Span::create_span(Triangle *tri,SDL_Surface *image) { +void Span_c::create_span(Triangle *tri,SDL_Surface *image) { Vertex *vMin , *vMid, *vMax; /* float tmp_z,tmp_tex1, tmp_tex2 ,tmp_tey1,tmp_tey2;
--- a/TaskManager/Test/simple_render/span_pack.h Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/span_pack.h Wed Feb 27 04:25:04 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_render/spe/CreatePolygonPack.cpp Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/spe/CreatePolygonPack.cpp Wed Feb 27 04:25:04 2008 +0900 @@ -8,6 +8,22 @@ //create_pp(SceneGraphPack *sgp, PolygonPack *pp) //create_pp(void *read, void *write) //CreatePolygonPack::run(SceneGraphPack *sgp, PolygonPack *pp) +inline float +CreatePolygonPack::sum_across_float4(vector float v) +{ + vector float c12, c2, c3, c4, c34; + vector float result; + + c2 = spu_rlqwbyte(v, 4); + c3 = spu_rlqwbyte(v, 8); + c4 = spu_rlqwbyte(v, 12); + c12 = spu_add(v, c2); + c34 = spu_add(c3, c4); + + result = spu_add(c12, c34); + return (spu_extract(result, 0)); +} + int CreatePolygonPack::run(void *rbuf, void *wbuf) { @@ -83,13 +99,15 @@ #else vector float *abc = (vector float *)xyz; float tmp[4]; - vector float *v_tmp = (vector float *)tmp; vector float matrixT0 = (vector float){matrix[0], matrix[4], matrix[8], matrix[12]}; vector float matrixT1 = (vector float){matrix[1], matrix[5], matrix[9], matrix[13]}; vector float matrixT2 = (vector float){matrix[2], matrix[6], matrix[10], matrix[14]}; vector float matrixT3 = (vector float){matrix[3], matrix[7], matrix[11], matrix[15]}; +#if 1 + vector float *v_tmp = (vector float *)tmp; + *v_tmp = spu_mul(*abc, matrixT0); xyz[0] = tmp[0] + tmp[1] + tmp[2] + tmp[3]; *v_tmp = spu_mul(*abc, matrixT1); @@ -98,6 +116,18 @@ xyz[2] = tmp[0] + tmp[1] + tmp[2] + tmp[3]; *v_tmp = spu_mul(*abc, matrixT3); xyz[3] = tmp[0] + tmp[1] + tmp[2] + tmp[3]; +#else + vector float v_tmp; + + v_tmp = spu_mul(*abc, matrixT0); + xyz[0] = sum_across_float4(v_tmp); + v_tmp = spu_mul(*abc, matrixT1); + xyz[1] = sum_across_float4(v_tmp); + v_tmp = spu_mul(*abc, matrixT2); + xyz[2] = sum_across_float4(v_tmp); + v_tmp = spu_mul(*abc, matrixT3); + xyz[3] = sum_across_float4(v_tmp); +#endif #endif }
--- a/TaskManager/Test/simple_render/spe/CreatePolygonPack.h Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/spe/CreatePolygonPack.h Wed Feb 27 04:25:04 2008 +0900 @@ -12,9 +12,10 @@ :SchedTask(_tlist, _task, _rbuf, _wbuf, _con) {} int run(void *readbuf, void *writebuf); - + private: void rotate(float *xyz, float *matrix); + inline float sum_across_float4(vector float v); }; #endif
--- a/TaskManager/Test/simple_render/spe/Makefile Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/spe/Makefile Wed Feb 27 04:25:04 2008 +0900 @@ -8,15 +8,18 @@ INCLUDE = -I../../../../include/TaskManager -I. -I.. LIBS = -L../../.. -lspemanager# -lm +#EXTRA_CFLAGS = `sdl-config --cflags` +#EXTRA_LIBS = `sdl-config --libs` + .SUFFIXES: .cpp .o .cpp.o: - $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ all: $(TARGET) $(TARGET): $(OBJS) - $(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS) + $(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS) $(EXTRA_LIBS) clean: rm -f $(TARGET) $(OBJS)
--- a/TaskManager/Test/simple_render/spe/spe-main.cpp Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/spe/spe-main.cpp Wed Feb 27 04:25:04 2008 +0900 @@ -1,210 +1,19 @@ #include "SchedTask.h" -#if 0 - -#include <stdio.h> -#include <string.h> -#include <math.h> -#include "polygon_pack.h" -#include "scene_graph_pack.h" -#include "sys.h" - -int -//create_pp(SceneGraphPack *sgp, PolygonPack *pp) -create_pp(void *read, void *write) -{ - SceneGraphPack *sgp = (SceneGraphPack*)read; - PolygonPack *pp = (PolygonPack*)write; - - float xyz1[4],xyz2[4],xyz3[4]; - - for (int i = 0; i < sgp->info.size; i++) { - SceneGraphNodePtr node = &sgp->node[i]; - - int n,nt,pt; - for(n=0,nt=0,pt=0; n<node->size*3; n+=9,nt+=6,pt++) { - xyz1[0] = node->vertex[n]; - xyz1[1] = node->vertex[n+1]; - xyz1[2] = node->vertex[n+2]*-1; - xyz1[3] = 1; - xyz2[0] = node->vertex[n+3]; - xyz2[1] = node->vertex[n+3+1]; - xyz2[2] = node->vertex[n+3+2]*-1; - xyz2[3] = 1; - xyz3[0] = node->vertex[n+6]; - xyz3[1] = node->vertex[n+6+1]; - xyz3[2] = node->vertex[n+6+2]*-1; - xyz3[3] = 1; - - rotate(xyz1, node->translation); - rotate(xyz2, node->translation); - rotate(xyz3, node->translation); - - pp->tri[pt].x1 = xyz1[0]; - pp->tri[pt].y1 = xyz1[1]; - pp->tri[pt].z1 = xyz1[2]; - pp->tri[pt].tex_x1 = node->texture[nt]; - pp->tri[pt].tex_y1 = node->texture[nt+1]; - - pp->tri[pt].x2 = xyz2[0]; - pp->tri[pt].y2 = xyz2[1]; - pp->tri[pt].z2 = xyz2[2]; - pp->tri[pt].tex_x2 = node->texture[nt+2]; - pp->tri[pt].tex_y2 = node->texture[nt+2+1]; - - pp->tri[pt].x3 = xyz3[0]; - pp->tri[pt].y3 = xyz3[1]; - pp->tri[pt].z3 = xyz3[2]; - pp->tri[pt].tex_x3 = node->texture[nt+4]; - pp->tri[pt].tex_y3 = node->texture[nt+4+1]; - - } - pp->info.size = pt; - } - - return sizeof(PolygonPack); -} - - -void rotate(float *xyz, float *matrix) -{ - float abc[4]; - abc[0] = xyz[0]; - abc[1] = xyz[1]; - abc[2] = xyz[2]; - abc[3] = xyz[3]; - - for(int i=0; i<4; i++) - { - xyz[i] = abc[0]*matrix[i] + abc[1]*matrix[i+4] + abc[2]*matrix[i+8] + abc[3]*matrix[i+12]; - } - -} - -void matrix4x4(float *xyz, float *xyz1, float *xyz2) //xyz[16] -{ - for(int t=0; t<16; t+=4) - { - for(int i=0; i<4; i++) - { - xyz[t+i] = xyz1[t]*xyz2[i] + xyz1[t+1]*xyz2[4+i] + xyz1[t+2]*xyz2[8+i] + xyz1[t+3]*xyz2[12+i]; - } - } -} - -void get_matrix( float *matrix, float *rxyz, float *txyz, float *stack) -{ - float radx,rady,radz; - radx = rxyz[0]*3.14/180; - rady = rxyz[1]*3.14/180; - radz = rxyz[2]*3.14/180; - -#if 0 - vector float rad = (vector float){radx, rady, radz, 0}; - vector float in_sin = _sinf4(rad); - vector float in_cos = _sinf4(rad); - float *sin_d = (float *)&in_sin; - float *cos_d = (float *)&in_cos; - - float sinx = sin_d[0]; - float cosx = cos_d[0]; - float siny = sin_d[1]; - float cosy = cos_d[1]; - float sinz = sin_d[2]; - float cosz = cos_d[2]; - -#else - float sinx = sin(radx); - float cosx = cos(radx); - float siny = sin(rady); - float cosy = cos(rady); - float sinz = sin(radz); - float cosz = cos(radz); -#endif - - matrix[0] = cosz*cosy+sinz*sinx*siny; - matrix[1] =sinz*cosx; - matrix[2] = -cosz*siny+sinz*sinx*cosy; - matrix[3] = 0; - matrix[4] = -sinz*cosy+cosz*sinx*siny; - matrix[5] = cosz*cosx; - matrix[6] = sinz*siny+cosz*sinx*cosy; - matrix[7] = 0; - matrix[8] = cosx*siny; - matrix[9] = -sinx; - matrix[10] = cosx*cosy; - matrix[11] = 0; - matrix[12] = txyz[0]; - matrix[13] = txyz[1]; - matrix[14] = txyz[2]; - matrix[15] = 1; - - float m[16]; - - for(int i=0; i<16; i++) - { - m[i] = matrix[i]; - } - - if(stack) - { - matrix4x4(matrix, m, stack); - } - -} - - -int -//update_sgp(SceneGraphPack *sgp, SceneGraphPack *_sgp) -update_sgp(void *rbuf, void *wbuf) -{ - - SceneGraphPack *sgp = (SceneGraphPack*)rbuf; - SceneGraphPack *_sgp = (SceneGraphPack*)wbuf; - - SceneGraphNodePtr node; - float y_angle; - - for (int i = 0; i < sgp->info.size; i++) { - //(*my_func[node->move])(node); - //(*my_func[node->interaction])(node, sgp); - - node = &sgp->node[i]; - - // ËÜÅö¤Ï¡¢¤³¤³¤Ï¾å¤Î my_func ¤Ç¹Ô¤¦ - y_angle = node->angle[1]; - y_angle += 1.0f; - if (y_angle > 360.0f) y_angle = 0.0f; - node->angle[1] = y_angle; - //node->obj_pos[0] += 0.5f; - //node->obj_pos[1] += 0.5f; - //node->obj_pos[2] += 0.5f; - - if (node->pn != -1) { - get_matrix(node->translation, - node->angle, node->obj_pos, - sgp->node[node->pn].translation); - } else { - get_matrix(node->translation, - node->angle, node->obj_pos, - NULL); - } - } - - // ¤Þ¤¢¤³¤ì¤Ï¿ʬÂÌÌܤʤó¤À¤±¤É¡£ - // in/out ¤È update ¤Ïʬ¤±¤ëɬÍפ¢¤ë¡© - // ¤½¤ì¤Ï¥æ¡¼¥¶Â¦¤Ç in/out ¤Ë¤Ê¤ë¤è¤¦¤Ë½ñ¤«¤»¤ë¤â¤Î¡© - memcpy(_sgp, sgp, sizeof(SceneGraphPack)); - - return sizeof(SceneGraphPack); -} - -int (*func_list[16])(void*, void*) = {0, update_sgp, create_pp, 0}; -//int (*func_list[16])(void*, void*) = {0, 0, create_pp, 0}; -#endif - extern SchedTask* createTask_createPolygonPack(TaskListPtr _taskList, TaskPtr _task, void *rbuff, void *wbuff, DmaManager *dma); -SchedTask* (*task_list[16])(TaskListPtr, TaskPtr, void*, void*, DmaManager*) = {0, 0, createTask_createPolygonPack, 0}; +SchedTask::TaskObject task_list[16] = {0, 0, createTask_createPolygonPack, 0}; + +static void +set_task(int cmd, SchedTask::TaskObject task) +{ + task_list[cmd] = task; +} + +void +task_init(void) +{ + set_task(2, createTask_createPolygonPack); +}
--- a/TaskManager/Test/simple_render/spu_span.h Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/spu_span.h Wed Feb 27 04:25:04 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_render/task/create_pp.cpp Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/task/create_pp.cpp Wed Feb 27 04:25:04 2008 +0900 @@ -36,27 +36,31 @@ rotate(xyz2, node->translation); rotate(xyz3, node->translation); - pp->tri[pt].x1 = xyz1[0]; - pp->tri[pt].y1 = xyz1[1]; - pp->tri[pt].z1 = xyz1[2]; - pp->tri[pt].tex_x1 = node->texture[nt]; - pp->tri[pt].tex_y1 = node->texture[nt+1]; + pp->tri[pt].ver1.x = xyz1[0]; + pp->tri[pt].ver1.y = xyz1[1]; + pp->tri[pt].ver1.z = xyz1[2]; + pp->tri[pt].ver1.tex_x = node->texture[nt]; + pp->tri[pt].ver1.tex_y = node->texture[nt+1]; - pp->tri[pt].x2 = xyz2[0]; - pp->tri[pt].y2 = xyz2[1]; - pp->tri[pt].z2 = xyz2[2]; - pp->tri[pt].tex_x2 = node->texture[nt+2]; - pp->tri[pt].tex_y2 = node->texture[nt+2+1]; + pp->tri[pt].ver2.x = xyz2[0]; + pp->tri[pt].ver2.y = xyz2[1]; + pp->tri[pt].ver2.z = xyz2[2]; + pp->tri[pt].ver2.tex_x = node->texture[nt+2]; + pp->tri[pt].ver2.tex_y = node->texture[nt+2+1]; - pp->tri[pt].x3 = xyz3[0]; - pp->tri[pt].y3 = xyz3[1]; - pp->tri[pt].z3 = xyz3[2]; - pp->tri[pt].tex_x3 = node->texture[nt+4]; - pp->tri[pt].tex_y3 = node->texture[nt+4+1]; + pp->tri[pt].ver3.x = xyz3[0]; + pp->tri[pt].ver3.y = xyz3[1]; + pp->tri[pt].ver3.z = xyz3[2]; + 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_width = node->tex_width; + pp->tri[pt].tex_height = node->tex_height; } pp->info.size = pt; + pp->ssl = sgp->ssl; } - return sizeof(PolygonPack); }
--- a/TaskManager/Test/simple_render/task/update_sgp.cpp Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/task/update_sgp.cpp Wed Feb 27 04:25:04 2008 +0900 @@ -12,7 +12,7 @@ SceneGraphNodePtr node; float y_angle; - __debug("[%s] sgp = 0x%x\n", __FUNCTION__, (unsigned int)sgp); + __debug("[%s]\n", __FUNCTION__); for (int i = 0; i < sgp->info.size; i++) { //(*my_func[node->move])(node);
--- a/TaskManager/Test/simple_render/vertex.cpp Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/vertex.cpp Wed Feb 27 04:25:04 2008 +0900 @@ -9,13 +9,3 @@ tex_x = tmp_tex_x; tex_y = tmp_tex_y; } - -void -Vertex::set(float tmp_x,float tmp_y, float tmp_z,float tmp_tex_x,float tmp_tex_y) { - x = tmp_x; - y = tmp_y; - z = tmp_z; - tex_x = tmp_tex_x; - tex_y = tmp_tex_y; -} -
--- a/TaskManager/Test/simple_render/vertex.h Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/vertex.h Wed Feb 27 04:25:04 2008 +0900 @@ -2,12 +2,10 @@ #define INCLUDE_VERTEX class Vertex { -public: - float x,y,z,tex_x,tex_y; - - Vertex(float tmp_x, float tmp_y, float tmp_z,float tmp_tex_x, float tmp_tex_y); + public: + float x,y,z,tex_x,tex_y; - void set(float, float, float, float, float); + Vertex(float tmp_x, float tmp_y, float tmp_z,float tmp_tex_x, float tmp_tex_y); }; #endif
--- a/TaskManager/Test/simple_render/viewer.cpp Tue Feb 26 21:49:50 2008 +0900 +++ b/TaskManager/Test/simple_render/viewer.cpp Wed Feb 27 04:25:04 2008 +0900 @@ -30,7 +30,7 @@ exit( 1 ); } -#ifndef _DEBUG +#ifdef _DEBUG screen = SDL_SetVideoMode( width, height, bpp, SDL_HWSURFACE); if (screen == NULL) { fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError()); @@ -211,8 +211,8 @@ } } -// run_arg_t ¤Ë½ñ¤¯¤Î¤¬¤á¤ó¤É¤¤¤«¤é¤Ã¤Æ -// global ¤Ë½ñ¤¯¤Î¤â¤É¤¦¤« +// run_arg_t ’¤Ë’½ñ’¤¯’¤Î’¤¬’¤á’¤ó’¤É’¤¤’¤«’¤é’¤Ã’¤Æ +// global ’¤Ë’½ñ’¤¯’¤Î’¤â’¤É’¤¦’¤« int start_time; int this_time; int frames; @@ -224,10 +224,8 @@ //PolygonPack *pp; DmaBuffer *sgp_buff; DmaBuffer *pp_buff; -DmaBuffer *spl_buff; DmaBuffer *sp_buff; DmaBuffer *ssl_buff; -DmaBuffer *splssl_buff; void @@ -237,8 +235,6 @@ int fd; SceneGraphPack *sgp; - SPANPACKLIST *spl; - SPLSSL *splssl; start_time = get_ticks(); this_time = 0; @@ -251,28 +247,13 @@ polygon->viewer = this; #if 1 - // ÄÌ¿®ÍÑ buffer ¤Î allocate - // ¤³¤ì¤¸¤ã¤Ê¤¤¤ÈÄÌ¿®ÍѤ˻Ȥ¨¤Ê¤¤(¤è¤¦¤Ë½èÍý¤ò½ñ¤«¤Ê¤¤¤È¡ª) sgp_buff = manager->allocate(sizeof(SceneGraphPack)); - - pp_buff = manager->allocate(sizeof(PolygonPack)); - + pp_buff = manager->allocate(sizeof(PolygonPack)); sp_buff = manager->allocate(sizeof(SPANPACK)); - spl_buff = manager->allocate(sizeof(SPANPACKLIST)); - - spl_buff->get_buffer(&spl); - spl->size = 60; - spl_buff->swap_buffer(); - spl_buff->get_buffer(&spl); - spl->size = 60; - spl_buff->swap_buffer(); ssl_buff = manager->allocate(sizeof(SPUSPANLIST)); - splssl_buff = manager->allocate(sizeof(SPLSSL)); sgp_buff->get_buffer(&sgp); - //spl_buff->get_buffer(&spl); - create_sgp(polygon, sgp); sgp_buff->swap_buffer(); @@ -280,9 +261,6 @@ create_sgp(polygon, sgp); sgp_buff->swap_buffer(); - - - #else //sgp = new SceneGraphPack; posix_memalign((void**)&sgp, DEFAULT_ALIGNMENT, sizeof(SceneGraphPack)); @@ -353,17 +331,30 @@ sgp_buff, pp_buff, NULL); #if 0 task_create_sp - = manager->create_task(fd_update_sgp, sizeof(SceneGraphPack), - sgp_buff, sgp_buff, NULL); - task_spu_sp + = manager->create_task(fd_create_sp, sizeof(SceneGraphPack), + pp_buff, spl_buff, NULL); + task_load_texture + = manager->create_task + task_spu_span = manager->create_task(fd_create_pp, sizeof(SceneGraphPack), sgp_buff, pp_buff, NULL); + + task_draw_finish = manager->create(); + for (int i = 0; i < draw_spe_num; i++) { + task_spu_draw[i] + = manager->create_task(fd_create_pp, sizeof(SceneGraphPack), + spuspan_buff, pp_buff, NULL); + task_spu_draw[i]->set_depend(task_spu_span); + task_draw_finish->set_depend(tas_spu_draw[i]); + } + #endif task = manager->create_task(fd, 0, 0, 0, NULL); task->set_depend(task_update_sgp); task->set_depend(task_create_pp); - + + //task_update_sgp->set_cpu(CPU_SPE); task_create_pp->set_cpu(CPU_SPE); @@ -395,6 +386,17 @@ task->spawn(); } +#if 0 +void +Viewer::draw_finish(void) +{ + // + + HTaskPtr task = manager->create(task_r); + +} +#endif + void Viewer::run_finish(void) {