comparison Renderer/Engine/viewer.cc @ 1004:67ff44a08090

add GTaskArray and merge.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Tue, 26 Oct 2010 17:34:41 +0900
parents 295b3c79fb44 ad5232ad4952
children 34a9ba655fbe 431936c0cc96
comparison
equal deleted inserted replaced
1003:295b3c79fb44 1004:67ff44a08090
32 32
33 /* Data Pack sent to Other CPUs (ex. SPE) */ 33 /* Data Pack sent to Other CPUs (ex. SPE) */
34 34
35 RederingData r[2]; 35 RederingData r[2];
36 36
37 int ppi, spi; 37 int ppi, spi = 0;
38 38
39 /** 39 /**
40 * 40 *
41 */ 41 */
42 42
290 void 290 void
291 Viewer::mainLoop() 291 Viewer::mainLoop()
292 { 292 {
293 HTaskPtr task_next = initLoop(); 293 HTaskPtr task_next = initLoop();
294 294
295 task_next->set_post(&post2runLoop, (void *)this, 0); // set_post(function(this->run_loop()), NULL) 295 task_next->set_post(&post2runLoop, (void *)this, (void*)pixels); // set_post(function(this->run_loop()), NULL)
296 task_next->spawn(); 296 task_next->spawn();
297 } 297 }
298 298
299 void 299 void
300 Viewer::run_loop(HTaskPtr task_next) 300 Viewer::run_loop(HTaskPtr task_next)
308 run_finish(); 308 run_finish();
309 return; 309 return;
310 } 310 }
311 311
312 dev->clean_pixels(); 312 dev->clean_pixels();
313
313 pixels = dev->flip_screen(pixels); 314 pixels = dev->flip_screen(pixels);
314 315
315 sgroot->updateControllerState(); 316 sgroot->updateControllerState();
316 317
317 //TaskArray を使うか使わないか 318 //TaskArray を使うか使わないか
361 } 362 }
362 363
363 static void 364 static void
364 post2runLoop(SchedTask *s, void *viewer_, void *arg) 365 post2runLoop(SchedTask *s, void *viewer_, void *arg)
365 { 366 {
367
368
366 Viewer *viewer = (Viewer*)viewer_; 369 Viewer *viewer = (Viewer*)viewer_;
367 HTaskPtr task_next = viewer->manager->create_task(Dummy,0,0,0,0); 370 HTaskPtr task_next = viewer->manager->create_task(Dummy,0,0,0,0);
368 viewer->run_loop(task_next); 371 viewer->run_loop(task_next);
369 psx_sync_n(); 372 psx_sync_n();
370 } 373 }
381 void 384 void
382 Viewer::run_draw(HTaskPtr task_next) // 引数に post2runLoop を入れるようにする 385 Viewer::run_draw(HTaskPtr task_next) // 引数に post2runLoop を入れるようにする
383 { 386 {
384 common_draw(task_next); 387 common_draw(task_next);
385 388
386 task_next->set_post(post2runLoop, (void*)this, 0); // set_post(function(this->run_loop()), NULL) 389 task_next->set_post(post2runLoop, (void*)this, (void*)pixels); // set_post(function(this->run_loop()), NULL)
387 task_next->spawn(); 390 task_next->spawn();
388 // TASK_DRAW_SPAN が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ 391 // TASK_DRAW_SPAN が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ
389 392
390 frames++; 393 frames++;
391 } 394 }
907 } 910 }
908 911
909 912
910 if (profile) { 913 if (profile) {
911 if (frames % 50 == 49) { 914 if (frames % 50 == 49) {
912 manager->show_profile(); 915 manager->show_profile();
913 this_time = get_ticks(); 916 this_time = get_ticks();
914 if (this_time != start_time) { 917 if (this_time != start_time) {
915 printf("\n%f FPS\n", ((((float)frames)*1000.0)/(this_time-start_time))); 918 printf("\n%f FPS\n", ((((float)frames)*1000.0)/(this_time-start_time)));
916 start_time = this_time; frames = 0; 919 start_time = this_time; frames = 0;
917 } 920 }