Mercurial > hg > Members > kono > Cerium
comparison TaskManager/Test/simple_render/viewer.cpp @ 71:475e04db46c0
*** empty log message ***
author | gongo |
---|---|
date | Mon, 18 Feb 2008 01:52:30 +0900 |
parents | 178459e03f5c |
children | 811ffebd8deb |
comparison
equal
deleted
inserted
replaced
70:178459e03f5c | 71:475e04db46c0 |
---|---|
30 if (SDL_Init( SDL_INIT_VIDEO ) < 0) { | 30 if (SDL_Init( SDL_INIT_VIDEO ) < 0) { |
31 fprintf(stderr,"Couldn't initialize SDL: %s\n",SDL_GetError()); | 31 fprintf(stderr,"Couldn't initialize SDL: %s\n",SDL_GetError()); |
32 exit( 1 ); | 32 exit( 1 ); |
33 } | 33 } |
34 | 34 |
35 #if DEBUG | 35 #ifndef DEBUG |
36 screen = SDL_SetVideoMode( width, height, bpp, SDL_HWSURFACE); | 36 screen = SDL_SetVideoMode( width, height, bpp, SDL_HWSURFACE); |
37 if (screen == NULL) { | 37 if (screen == NULL) { |
38 fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError()); | 38 fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError()); |
39 SDL_Quit(); | 39 SDL_Quit(); |
40 exit(1); | 40 exit(1); |
41 } | 41 } |
42 #else | 42 #else |
43 //void *pixels; | 43 void *_pixels = new Uint32[width*height*32/8]; |
44 void *_pixels = new Uint32[width*height]; | |
45 //posix_memalign(&pixels, width*heigh/8, DEFAULT_ALIGNMENT); | 44 //posix_memalign(&pixels, width*heigh/8, DEFAULT_ALIGNMENT); |
46 screen = SDL_CreateRGBSurfaceFrom(_pixels, width, height, 32, | 45 screen = SDL_CreateRGBSurfaceFrom(_pixels, width, height, 32, |
47 width*4, redMask, greenMask, | 46 width*4, redMask, greenMask, |
48 blueMask, alphaMask); | 47 blueMask, alphaMask); |
49 #endif | 48 #endif |
256 | 255 |
257 sgp_buff->get_buffer(&sgp); | 256 sgp_buff->get_buffer(&sgp); |
258 create_sgp(polygon, sgp); | 257 create_sgp(polygon, sgp); |
259 sgp_buff->swap_buffer(); | 258 sgp_buff->swap_buffer(); |
260 | 259 |
261 //pp = new PolygonPack; | |
262 pp_buff = manager->allocate(sizeof(PolygonPack)); | 260 pp_buff = manager->allocate(sizeof(PolygonPack)); |
263 | 261 |
264 pixels = new Uint32[width*height]; | 262 pixels = new Uint32[width*height]; |
265 | 263 |
266 graph_line(); | 264 graph_line(); |
299 | 297 |
300 zRow_init(); | 298 zRow_init(); |
301 graph_line(); | 299 graph_line(); |
302 | 300 |
303 fd_update_sgp = manager->open("UpdateSGP"); | 301 fd_update_sgp = manager->open("UpdateSGP"); |
304 //fd_update_sgp = 0; | |
305 fd_create_pp = manager->open("CreatePP"); | 302 fd_create_pp = manager->open("CreatePP"); |
306 //fd_create_pp = 1; | |
307 fd = manager->open("ViewerRunDraw"); | 303 fd = manager->open("ViewerRunDraw"); |
308 task_update_sgp = manager->create_task(fd_update_sgp, | 304 task_update_sgp = manager->create_task(fd_update_sgp, |
309 sizeof(SceneGraphPack), | 305 sizeof(SceneGraphPack), |
310 sgp_buff, sgp_buff, NULL); | 306 sgp_buff, sgp_buff, NULL); |
311 task_create_pp = manager->create_task(fd_create_pp, | 307 task_create_pp = manager->create_task(fd_create_pp, |
313 sgp_buff, pp_buff, NULL); | 309 sgp_buff, pp_buff, NULL); |
314 task = manager->create_task(fd, 0, 0, 0, NULL); | 310 task = manager->create_task(fd, 0, 0, 0, NULL); |
315 | 311 |
316 task->set_depend(task_update_sgp); | 312 task->set_depend(task_update_sgp); |
317 task->set_depend(task_create_pp); | 313 task->set_depend(task_create_pp); |
318 | 314 |
319 task_update_sgp->set_cpu(CPU_SPE); | 315 task_update_sgp->set_cpu(CPU_SPE); |
320 task_create_pp->set_cpu(CPU_SPE); | 316 task_create_pp->set_cpu(CPU_SPE); |
321 | |
322 printf("fd = %d\n", fd); | |
323 | 317 |
324 task_update_sgp->spawn(); | 318 task_update_sgp->spawn(); |
325 task_create_pp->spawn(); | 319 task_create_pp->spawn(); |
326 task->spawn(); | 320 task->spawn(); |
327 | 321 |