annotate Renderer/Engine/viewer.cc @ 895:b662e9dd26b0 draft

add alignment of classes in SPU width and height are automatically set in frame buffer API
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 16 Jul 2010 17:23:49 +0900
parents 5e4962b28ceb
children 1b9418af3127
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include <SDL.h>
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include "viewer.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 #include "viewer_types.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 #include "SceneGraph.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 #include "SceneGraphRoot.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 #include "scene_graph_pack.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 #include "sys.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 #include "Func.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 #include "error.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 #include "TaskManager.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 #include <wchar.h>
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 #include "Pad.h"
543
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 542
diff changeset
13 #include "Application.h"
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 572
diff changeset
14 #include "lindaapi.h"
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
555
c5e09e9bbfa5 half finish for Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 550
diff changeset
16 static void post2runLoop(SchedTask *s,void *viewer,void *s1);
c5e09e9bbfa5 half finish for Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 550
diff changeset
17 static void post2runDraw(SchedTask *s,void *viewer,void *s1);
c5e09e9bbfa5 half finish for Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 550
diff changeset
18 static void post2speRendering(SchedTask *s,void *viewer,void *s1);
c5e09e9bbfa5 half finish for Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 550
diff changeset
19 static void post2speDraw(SchedTask *s,void *viewer,void *s1);
c5e09e9bbfa5 half finish for Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 550
diff changeset
20 static void post2runMoveDrawLoop(SchedTask *s,void *viewer,void *s1);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 /* measure for FPS (Frame Per Second) */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 int start_time;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 int this_time;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 int frames;
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
26 // static void post2speRunLoop(void *viewer);
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
27 //static void post2runMove(void *viewer);
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
28 //static void post2exchange_sgroot(void *viewer);
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
29 //static void post2speRunLoop(void *viewer);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 //SceneGraphRootPtr sgroot_2;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 /* Data Pack sent to Other CPUs (ex. SPE) */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 SceneGraphPack *sgpack;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 PolygonPack *ppack;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 SpanPackPtr spackList;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 SpanPackPtr *spackList_ptr;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 int spackList_length;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 int spackList_length_align;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 /**
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 *
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
46 Viewer::Viewer(TaskManager *m, ViewerDevice *vd, int b, int w, int h, int _num)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 spe_num = _num;
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
49 manager = m;
895
b662e9dd26b0 add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 891
diff changeset
50
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
51 dev = vd;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
52 pixels = dev->video_init(manager, b, w, h);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
53
895
b662e9dd26b0 add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 891
diff changeset
54 width = dev->width;
b662e9dd26b0 add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 891
diff changeset
55 height = dev->height;
b662e9dd26b0 add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 891
diff changeset
56 bpp = dev->bpp;
b662e9dd26b0 add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 891
diff changeset
57
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 int
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 Viewer::get_ticks(void)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 int time;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 time = SDL_GetTicks();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 return time;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 bool
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 Viewer::quit_check(void)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 SDL_Event event;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 while(SDL_PollEvent(&event)) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 if (event.type==SDL_QUIT) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 return true;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 Uint8 *keys=SDL_GetKeyState(NULL);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 if (keys[SDLK_q] == SDL_PRESSED) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 return true;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 return false;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 Viewer::quit(void)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 SDL_Quit();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 void
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
96 Viewer::run_init(TaskManager *manager, Application *app)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 this->manager = manager;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
99
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 start_time = get_ticks();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 this_time = 0;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 frames = 0;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
103
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
104 if (spe_num == 0) spe_num = 1;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
105
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 sgroot = new SceneGraphRoot(this->width, this->height);
572
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
107 sgroot->tmanager = manager;
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
108
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
109
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
110 int light_num = 4;
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
111 int size = sizeof(float)*4*light_num; //xyz+alfa(4) * light_num(4)
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
112 int light_size = size / sizeof(float);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
113
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 747
diff changeset
114 light_xyz_stock = (float *)manager->allocate(size);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
115 light_xyz = (float *)manager->allocate(size);
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
116
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
117 for (int i = 0; i < light_size ; i++) {
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
118 light_xyz[i] = 0.0f;
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
119 }
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
120
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
121 for(int i = 0; i < spe_num; i++) {
826
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
122
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
123 HTaskPtr data_load = manager->create_task(DataLoad);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
124 data_load->set_param(0,(memaddr)size);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
125 data_load->set_param(1,(memaddr)Light);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
126 data_load->set_cpu((CPU_TYPE)((int)SPE_0 + i));
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
127 data_load->spawn();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
128 }
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
129
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
130 size = light_num * sizeof(int);
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
131 light_switch = (int*)manager->allocate(size);
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
132
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
133 for (int i = 0; i < light_num; i++) {
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
134 light_switch[i] = 0;
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
135 }
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
136
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
137 for(int i = 0; i < spe_num; i++) {
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
138 HTaskPtr data_load = manager->create_task(DataLoad);
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
139 data_load->set_param(0,(memaddr)size);
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
140 data_load->set_param(1,(memaddr)LightSwitch);
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
141 data_load->set_cpu((CPU_TYPE)((int)SPE_0 + i));
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
142 data_load->spawn();
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
143 }
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
144
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
145 size = 16; // LightSysSwitch は 4byte. 残り 12byte は DMA転送の為のパディング
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
146
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
147 light_sysswitch = (int*)manager->allocate(size);
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
148
843
de64695a7f02 cleanup unused variables and fix warning.
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 842
diff changeset
149 for (unsigned int i = 0; i < size / sizeof(int); i++) {
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
150 light_sysswitch[i] = 0;
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
151 }
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
152
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
153 for(int i = 0; i < spe_num; i++) {
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
154 HTaskPtr data_load = manager->create_task(DataLoad);
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
155 data_load->set_param(0,(memaddr)size);
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
156 data_load->set_param(1,(memaddr)LightSysSwitch);
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
157 data_load->set_cpu((CPU_TYPE)((int)SPE_0 + i));
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
158 data_load->spawn();
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
159 }
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
160
543
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 542
diff changeset
161 MainLoop *mainloop = app->init(this, this->width, this->height);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 542
diff changeset
162 mainloop->mainLoop();
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
164
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
165
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 HTaskPtr
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 Viewer::initLoop()
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 HTaskPtr task_next;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 HTaskPtr task_tex;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
171
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 sgpack = (SceneGraphPack*)manager->allocate(sizeof(SceneGraphPack));
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 sgpack->init();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 ppack = (PolygonPack*)manager->allocate(sizeof(PolygonPack));
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
175
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 spackList_length = (this->height + split_screen_h - 1) / split_screen_h;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 spackList = (SpanPack*)manager->allocate(sizeof(SpanPack)*spackList_length);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
178
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 /**
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 * SPU に送る address list は 16 バイト倍数でないといけない。
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 * spackList_length*sizeof(SpanPack*) が 16 バイト倍数になるような
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 * length_align を求めている。はみ出した部分は使われない
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 * (ex) spackList_length が 13 の場合
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 * spackList_length_align = 16;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 * 実際に送るデータは64バイトになるのでOK
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 * 14,15,16 の部分は何も入らない。
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 spackList_length_align = (spackList_length + 3)&(~3);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
189
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 /* 各 SPU が持つ、SpanPack の address list */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
191 spackList_ptr =
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 (SpanPack**)manager->allocate(sizeof(SpanPack*)*spackList_length_align);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
193
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 for (int i = 0; i < spackList_length; i++) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
195 spackList_ptr[i] = &spackList[i];
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
196 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
197
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 for (int i = 1; i <= spackList_length; i++) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 spackList[i-1].init(i*split_screen_h);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
201
826
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
202 task_next = manager->create_task(Dummy,0,0,0,0);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
203
659
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
204 // ここは、Iterator を用意するべきだよね
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 for (int i = 0; i < spe_num; i++) {
826
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
206 task_tex = manager->create_task(LoadTexture,0,0,0,0);
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
207 task_tex->set_cpu((CPU_TYPE)((int)SPE_0 + i));
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
208 task_next->wait_for(task_tex);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
209 task_tex->spawn();
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
211
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
212
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 return task_next;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
214 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
215
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
216
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 Viewer::getKey()
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
219 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 Pad *pad = sgroot->getController();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 if (pad->right.isHold()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 keyPtr->right = HOLD;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 } else if (pad->right.isPush()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 keyPtr->right = PUSH;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
225 } else {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
226 keyPtr->right = NONE;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
228
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 if (pad->left.isHold()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
230 keyPtr->left = HOLD;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
231 } else if (pad->left.isPush()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 keyPtr->left = PUSH;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 } else {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
234 keyPtr->left = NONE;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
235 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
236
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
237 if (pad->up.isHold()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
238 keyPtr->up = HOLD;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
239 } else if (pad->up.isPush()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
240 keyPtr->up = PUSH;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
241 } else {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
242 keyPtr->up = NONE;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
243 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
244
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
245 if (pad->down.isHold()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
246 keyPtr->down = HOLD;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 } else if (pad->down.isPush()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
248 keyPtr->down = PUSH;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 } else {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 keyPtr->down = NONE;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
252
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
253 if (pad->circle.isHold()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
254 keyPtr->circle = HOLD;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
255 } else if (pad->circle.isPush()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
256 keyPtr->circle = PUSH;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
257 } else {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
258 keyPtr->circle = NONE;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
259 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
260 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
261
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
262 static void
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
263 post2runMoveDrawLoop(SchedTask *m, void *viewer_, void *arg)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
264 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
265 Viewer *viewer = (Viewer*)viewer_;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
266
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 617
diff changeset
267 // 同じ PPE 上なので sgroot(ポインタ) を set_param で送る。
615
184d6d3f0cd9 remove uncessary Task Name definision
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 603
diff changeset
268 //HTaskPtr send_key_task = viewer->manager->create_task(SendKey);
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 617
diff changeset
269 //send_key_task->set_param((int)sgroot);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
270 // set input data -> viewer keyPtr
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
271 viewer->getKey();
826
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
272 //HTaskPtr update_key = viewer->manager->create_task(UpdateKey,viewer->keyPtr, sizeof(key_stat),0,0);
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
273 HTaskPtr update_key = viewer->manager->create_task(UpdateKey,0,0,0,0);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
274 update_key->add_inData(viewer->keyPtr, sizeof(key_stat));
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
275 //update_key->set_cpu(SPE_0);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
276 update_key->spawn();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
277
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
278 /* TASK_MOVE は外から引数で取ってくるべき */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 //HTaskPtr move_task = viewer->manager->create_task(viewer->app->move_taskid);
826
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
280 HTaskPtr move_task = viewer->manager->create_task(Move,0,0,0,0);
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 617
diff changeset
281 //move_task->set_param(sgroot);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
282
615
184d6d3f0cd9 remove uncessary Task Name definision
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 603
diff changeset
283 //HTaskPtr draw_task = viewer->manager->create_task(Draw);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
284
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 /* rendering task test */
826
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
286 HTaskPtr draw_task = viewer->manager->create_task(Dummy,0,0,0,0);
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
287 HTaskPtr draw_dummy = viewer->manager->create_task(Dummy,0,0,0,0);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
288
826
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
289 HTaskPtr switch_task = viewer->manager->create_task(Switch,0,0,0,0);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
290 viewer->draw_dummy = draw_dummy;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
291 switch_task->wait_for(draw_dummy);
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
292 draw_task->set_post(post2speRendering, (void*)viewer, 0);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
293
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
294 switch_task->wait_for(move_task);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
295 switch_task->wait_for(draw_task);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
296 move_task->spawn();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
297 draw_task->spawn();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
298
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
299 switch_task->set_post(post2runMoveDrawLoop, (void*)viewer, 0);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
300 switch_task->spawn();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
301
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
302 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
303
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
304 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
305 Viewer::mainLoop()
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
306 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
307 HTaskPtr task_next = initLoop();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
308
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
309 task_next->set_post(&post2runLoop, (void *)this, 0); // set_post(function(this->run_loop()), NULL)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
310 task_next->spawn();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
311 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
312
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
313 void
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
314 Viewer::run_loop(HTaskPtr task_next)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
315 {
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
316 dev->clear_screen();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
317
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
318 bool quit_flg;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
319 quit_flg = quit_check();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
320 if (quit_flg == true) {
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
321 this_time = get_ticks();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
322 run_finish();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
323 return;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
324 }
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
325
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
326 dev->clean_pixels();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
327
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
328 for (int i = 1; i <= spackList_length; i++) {
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
329 spackList[i-1].reinit(i*split_screen_h);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
330 }
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
331
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
332 sgroot->updateControllerState();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
333 sgroot->allExecute(width, height);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
334 light_xyz_stock = sgroot->getLightVector();
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
335 light_switch_stock = sgroot->getLightSwitch();
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
336 light_sysswitch_stock = sgroot->getLightSysSwitch();
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
337 //sgroot->checkRemove();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
338
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
339 // ここから下は Rendering という関数にする
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
340 rendering(task_next);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
341 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
342
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
343
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
344
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
345 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
346 Viewer::run_collision()
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
347 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
348 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
349
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
350 void
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
351 post2rendering(SchedTask *s, void *viewer_, void *arg)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
352 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
353 Viewer *viewer = (Viewer *)viewer_;
826
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
354 HTaskPtr task_next = viewer->manager->create_task(Dummy,0,0,0,0);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
355 viewer->rendering(task_next);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
356 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
357
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
358 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
359 Viewer::rendering(HTaskPtr task_next)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
360 {
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
361 common_rendering(task_next, sgroot);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
362
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
363 // Barrier 同期
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
364 // run_draw() を呼ぶ post2runDraw
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
365 task_next->set_post(post2runDraw, (void*)this, 0); // set_post(function(this->run_draw()), NULL)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
366 task_next->spawn();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
367
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
368 // TASK_CREATE_SPAN が全て終わったら DUMMY_TASK が Viewer::run_draw() を呼ぶ
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
369 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
370
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
371 static void
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
372 post2runLoop(SchedTask *s, void *viewer_, void *arg)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
373 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
374 Viewer *viewer = (Viewer*)viewer_;
826
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
375 HTaskPtr task_next = viewer->manager->create_task(Dummy,0,0,0,0);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
376 viewer->run_loop(task_next);
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 572
diff changeset
377 psx_sync_n();
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
378 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
379
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
380 static void
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
381 post2runDraw(SchedTask *s, void *viewer_, void *arg)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
382 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
383 Viewer *viewer = (Viewer*)viewer_;
826
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
384 HTaskPtr task_next = viewer->manager->create_task(Dummy,0,0,0,0);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
385 viewer->run_draw(task_next);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
386
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
387 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
388
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
389 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
390 Viewer::run_draw(HTaskPtr task_next) // 引数に post2runLoop を入れるようにする
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
391 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
392 common_draw(task_next);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
393
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
394 task_next->set_post(post2runLoop, (void*)this, 0); // set_post(function(this->run_loop()), NULL)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
395 task_next->spawn();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
396 // TASK_DRAW_SPAN が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
397
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
398 frames++;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
399 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
400
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
401
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
402 static void
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
403 post2speRendering(SchedTask *s, void *viewer_, void *arg)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
404 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
405 Viewer *viewer = (Viewer*)viewer_;
826
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
406 HTaskPtr task_next = viewer->manager->create_task(Dummy,0,0,0,0);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
407 viewer->spe_rendering(task_next);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
408 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
409
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
410 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
411 Viewer::spe_rendering(HTaskPtr task_next)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
412 {
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
413 common_rendering(task_next, sgroot);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
414
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
415 this->draw_dummy->wait_for(task_next);
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
416 task_next->set_post(post2speDraw, (void*)this, 0);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
417 task_next->spawn();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
418
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
419 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
420
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
421 static void
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
422 post2speDraw(SchedTask *s, void *viewer_, void *arg)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
423 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
424 Viewer *viewer = (Viewer*)viewer_;
826
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
425 HTaskPtr task_next = viewer->manager->create_task(Dummy,0,0,0,0);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
426 viewer->spe_draw(task_next);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
427 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
428
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
429 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
430 Viewer::spe_draw(HTaskPtr task_next)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
431 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
432 common_draw(task_next);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
433
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
434 this->draw_dummy->wait_for(task_next);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
435 task_next->spawn();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
436 this->draw_dummy->spawn();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
437
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
438 frames++;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
439 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
440
861
fda7b71c3cc6 Still on the way
yutaka@localhost.localdomain
parents: 860
diff changeset
441 #if SPE_CREATE_POLYGON
fda7b71c3cc6 Still on the way
yutaka@localhost.localdomain
parents: 860
diff changeset
442
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
443 void
860
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
444 Viewer::create_pp_task(SceneGraphPtr sg, PolygonPackPtr pp_cur, HTaskPtr create_pp_wait,
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
445 int &pp_index, int &sg_index, int tri_num)
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
446 {
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
447
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
448 HTaskPtr create_pp = manager->create_task(CreatePolygon);
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
449 create_pp->set_inData(0, &sg->tri_pack[sg_index], sizeof(TrianglePack)*tri_num);
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
450 create_pp->set_inData(1, sg->texture_info, sizeof(texture_list));
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
451 create_pp->set_inData(2, sg->sg_matrix, sizeof(float)*32); //わーい、マジックナンバー
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
452 create_pp->set_outData(0, &pp_cur->tri[pp_index], sizeof(TrianglePack)*tri_num);
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
453 create_pp->set_param(0, (memaddr)tri_num);
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
454 //create_pp->set_cpu(SPE_ANY);
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
455 create_pp_wait->wait_for(create_pp);
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
456 create_pp->spawn();
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
457
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
458 pp_index += tri_num;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
459 sg_index += tri_num;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
460 }
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
461
861
fda7b71c3cc6 Still on the way
yutaka@localhost.localdomain
parents: 860
diff changeset
462 #endif
860
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
463
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
464 void
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
465 Viewer::common_rendering(HTaskPtr task_next, SceneGraphRoot *sgroot)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
466 {
860
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
467
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
468 #if SPE_CREATE_POLYGON
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
469
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
470 SceneGraphPtr sg = sgroot->getDrawSceneGraph();
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
471 PolygonPackPtr pp_cur = ppack;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
472 HTaskPtr create_pp_wait = manager->create_task(Dummy);
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
473 int pp_index = 0;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
474
891
Yutaka_Kinjyo
parents: 889
diff changeset
475 pp_cur->init();
Yutaka_Kinjyo
parents: 889
diff changeset
476
885
Yutaka_Kinjyo
parents: 861
diff changeset
477 task_next->wait_for(create_pp_wait);
Yutaka_Kinjyo
parents: 861
diff changeset
478
860
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
479 while (sg) {
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
480
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
481 if (sg->flag_drawable) {
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
482
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
483 int sum_size = sg->size;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
484 int tri_cur_num = MAX_SIZE_TRIANGLE;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
485 int sg_index = 0;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
486
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
487 while (sum_size) {
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
488
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
489 tri_cur_num -= sg->size/3;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
490
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
491 if (tri_cur_num < 0) {
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
492
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
493 tri_cur_num = MAX_SIZE_TRIANGLE;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
494 create_pp_task(sg, pp_cur, create_pp_wait,
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
495 pp_index, sg_index, tri_cur_num);
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
496
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
497 PolygonPackPtr next = (PolygonPackPtr)manager->allocate(sizeof(PolygonPack));
891
Yutaka_Kinjyo
parents: 889
diff changeset
498 next->init();
Yutaka_Kinjyo
parents: 889
diff changeset
499
860
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
500 pp_cur->next = next;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
501 pp_cur = next;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
502 pp_index = 0;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
503
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
504 } else {
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
505
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
506 create_pp_task(sg, pp_cur, create_pp_wait,
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
507 pp_index, sg_index, tri_cur_num);
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
508
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
509 }
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
510
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
511 sum_size -= tri_cur_num*3;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
512
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
513 }
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
514
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
515
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
516 }
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
517
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
518
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
519
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
520 if (sg->children != NULL) {
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
521 sg = sg->children;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
522 } else if (sg->brother != NULL) {
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
523 sg = sg->brother;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
524 } else {
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
525 while (sg) {
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
526 if (sg->brother != NULL) {
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
527 sg = sg->brother;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
528 break;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
529 } else {
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
530 if (sg->parent == NULL) {
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
531 sg = NULL;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
532 break;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
533 } else {
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
534 sg = sg->parent;
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
535 }
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
536 }
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
537 }
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
538 }
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
539 }
885
Yutaka_Kinjyo
parents: 861
diff changeset
540
Yutaka_Kinjyo
parents: 861
diff changeset
541
Yutaka_Kinjyo
parents: 861
diff changeset
542 int range_base = spe_num;
Yutaka_Kinjyo
parents: 861
diff changeset
543
Yutaka_Kinjyo
parents: 861
diff changeset
544 // 切り上げのつもり
Yutaka_Kinjyo
parents: 861
diff changeset
545 int range = (spackList_length + range_base - 1) / range_base;
Yutaka_Kinjyo
parents: 861
diff changeset
546
Yutaka_Kinjyo
parents: 861
diff changeset
547 for (int i = 0; i < range_base; i++) {
Yutaka_Kinjyo
parents: 861
diff changeset
548 int index_start = range*i;
Yutaka_Kinjyo
parents: 861
diff changeset
549 int index_end = (index_start + range >= spackList_length)
Yutaka_Kinjyo
parents: 861
diff changeset
550 ? spackList_length : index_start + range;
860
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
551
885
Yutaka_Kinjyo
parents: 861
diff changeset
552 HTaskPtr task_create_sp = manager->create_task(CreateSpan);
Yutaka_Kinjyo
parents: 861
diff changeset
553
Yutaka_Kinjyo
parents: 861
diff changeset
554 task_create_sp->set_param(0,index_start);
Yutaka_Kinjyo
parents: 861
diff changeset
555
Yutaka_Kinjyo
parents: 861
diff changeset
556 /**
Yutaka_Kinjyo
parents: 861
diff changeset
557 * ex. screen_height が 480, spenum が 6 の場合、各SPEのy担当範囲
Yutaka_Kinjyo
parents: 861
diff changeset
558 * [ 1.. 80] [ 81..160] [161..240]
Yutaka_Kinjyo
parents: 861
diff changeset
559 * [241..320] [321..400] [401..480]
Yutaka_Kinjyo
parents: 861
diff changeset
560 *
Yutaka_Kinjyo
parents: 861
diff changeset
561 * ex. screen_height が 1080, spenum が 5 の場合、
Yutaka_Kinjyo
parents: 861
diff changeset
562 * [ 1..216] [217..432] [433..648]
Yutaka_Kinjyo
parents: 861
diff changeset
563 * [649..864] [865..1080]
Yutaka_Kinjyo
parents: 861
diff changeset
564 */
Yutaka_Kinjyo
parents: 861
diff changeset
565
Yutaka_Kinjyo
parents: 861
diff changeset
566 task_create_sp->set_param(1,index_start*split_screen_h + 1);
Yutaka_Kinjyo
parents: 861
diff changeset
567 task_create_sp->set_param(2,index_end*split_screen_h);
Yutaka_Kinjyo
parents: 861
diff changeset
568
Yutaka_Kinjyo
parents: 861
diff changeset
569 task_create_sp->add_inData(ppack, sizeof(PolygonPack));
Yutaka_Kinjyo
parents: 861
diff changeset
570 task_create_sp->add_inData(spackList_ptr,
Yutaka_Kinjyo
parents: 861
diff changeset
571 sizeof(SpanPack*)*spackList_length_align);
Yutaka_Kinjyo
parents: 861
diff changeset
572 task_create_sp->add_inData(&spackList[index_start], sizeof(SpanPack));
Yutaka_Kinjyo
parents: 861
diff changeset
573
Yutaka_Kinjyo
parents: 861
diff changeset
574 task_next->wait_for(task_create_sp);
Yutaka_Kinjyo
parents: 861
diff changeset
575 task_create_sp->wait_for(create_pp_wait);
Yutaka_Kinjyo
parents: 861
diff changeset
576
Yutaka_Kinjyo
parents: 861
diff changeset
577 task_create_sp->set_cpu(SPE_ANY);
Yutaka_Kinjyo
parents: 861
diff changeset
578 task_create_sp->spawn();
Yutaka_Kinjyo
parents: 861
diff changeset
579 }
Yutaka_Kinjyo
parents: 861
diff changeset
580
860
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
581 #else
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
582
615
184d6d3f0cd9 remove uncessary Task Name definision
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 603
diff changeset
583 HTaskPtr task_create_pp = manager->create_task(CreatePolygonFromSceneGraph);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
584
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
585 // SceneGraph(木構造) -> PolygonPack
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
586
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 617
diff changeset
587 task_create_pp->set_param(0,(memaddr)sgroot->getDrawSceneGraph());
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 617
diff changeset
588 task_create_pp->set_param(1,(memaddr)ppack);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
589
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
590 task_next->wait_for(task_create_pp);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
591
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
592 int range_base = spe_num;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
593
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
594 // 切り上げのつもり
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
595 int range = (spackList_length + range_base - 1) / range_base;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
596
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
597 for (int i = 0; i < range_base; i++) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
598 int index_start = range*i;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
599 int index_end = (index_start + range >= spackList_length)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
600 ? spackList_length : index_start + range;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
601
659
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
602 HTaskPtr task_create_sp = manager->create_task(CreateSpan);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
603
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 617
diff changeset
604 task_create_sp->set_param(0,index_start);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
605
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
606 /**
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
607 * ex. screen_height が 480, spenum が 6 の場合、各SPEのy担当範囲
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
608 * [ 1.. 80] [ 81..160] [161..240]
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
609 * [241..320] [321..400] [401..480]
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
610 *
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
611 * ex. screen_height が 1080, spenum が 5 の場合、
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
612 * [ 1..216] [217..432] [433..648]
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
613 * [649..864] [865..1080]
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
614 */
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
615
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 617
diff changeset
616 task_create_sp->set_param(1,index_start*split_screen_h + 1);
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 617
diff changeset
617 task_create_sp->set_param(2,index_end*split_screen_h);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
618
659
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
619 task_create_sp->add_inData(ppack, sizeof(PolygonPack));
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
620 task_create_sp->add_inData(spackList_ptr,
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
621 sizeof(SpanPack*)*spackList_length_align);
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
622 task_create_sp->add_inData(&spackList[index_start], sizeof(SpanPack));
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
623
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
624 task_next->wait_for(task_create_sp);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
625 task_create_sp->wait_for(task_create_pp);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
626
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
627 task_create_sp->set_cpu(SPE_ANY);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
628 task_create_sp->spawn();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
629 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
630
860
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
631 task_create_pp->spawn();
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
632
860
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
633 #endif
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
634
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
635 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
636
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
637 HTaskPtr
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
638 Viewer::update_task_create(void *data, int size,
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
639 int load_id, int spe_id, HTaskPtr wait)
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
640 {
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
641
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
642 HTaskPtr data_update = manager->create_task(DataUpdate);
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
643 data_update->add_inData(data,size);
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
644 data_update->set_param(0,size);
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
645 data_update->set_param(1,load_id);
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
646 data_update->set_cpu((CPU_TYPE)(spe_id));
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
647 if (wait != NULL) {
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
648 wait->wait_for(data_update);
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
649 }
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
650 data_update->spawn();
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
651
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
652 return data_update;
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
653
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
654 }
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
655
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
656 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
657 Viewer::common_draw(HTaskPtr task_next)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
658 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
659
615
184d6d3f0cd9 remove uncessary Task Name definision
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 603
diff changeset
660 //task_next = manager->create_task(Dummy);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
661 //task_next->set_post(post2runLoop, (void*)this);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
662
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
663 //Light info update
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
664
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
665 //HTaskPtr data_update;
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
666 HTaskPtr data_update_wait;
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
667 int light_num = 4;
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
668 int size = sizeof(float)*4*light_num; //xyz+alpha(4) * light_num(4)
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
669 int light_size = size / sizeof(float);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
670
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
671 for (int i = 0; i < light_size; i++) {
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
672 light_xyz[i] = light_xyz_stock[i];
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
673 }
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
674
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
675 for (int i = 0; i < light_num; i++) {
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
676 light_switch[i] = light_switch_stock[i];
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
677 }
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
678
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
679 light_sysswitch[0] = light_sysswitch_stock;
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
680
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
681 data_update_wait = manager->create_task(DataUpdate);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
682 data_update_wait->add_inData(light_xyz,size);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
683 data_update_wait->set_param(0,size);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
684 data_update_wait->set_param(1,Light);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
685 data_update_wait->set_cpu((CPU_TYPE)((int)SPE_0));
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
686
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
687 for (int i = 1; i < spe_num; i++) {
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
688 update_task_create(light_xyz,size,Light,(int)SPE_0+i,data_update_wait);
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
689 }
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
690
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
691 size = light_num * sizeof(int);
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
692
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
693 for (int i = 0; i < spe_num; i++) {
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
694 update_task_create(light_switch,size,LightSwitch,(int)SPE_0+i,data_update_wait);
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
695 }
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
696
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
697 size = 16; // LightSysSwitch は 4byte. 残り 12byte は DMA転送の為のパディング
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
698
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
699 for (int i = 0; i < spe_num; i++) {
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
700 update_task_create(light_sysswitch,size,LightSysSwitch,(int)SPE_0+i,data_update_wait);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
701 }
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
702
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
703 ppack->clear();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
704 for (int i = 0; i < spackList_length; i++) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
705 SpanPack *spack = &spackList[i];
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
706 int startx = 1;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
707 int endx = split_screen_w;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
708
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
709 int starty = spack->info.y_top - split_screen_h + 1;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
710 //int endy = spack->info.y_top;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
711 int rangey = (starty + split_screen_h - 1 > this->height)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
712 ? this->height - starty + 1 : split_screen_h;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
713
889
5f5301028e29 minor fix. Redering Engine not worked yet.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 885
diff changeset
714 #if 1
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
715
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
716 if(spack->info.size > 0) {
838
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
717
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
718 int array_task_num = (this->width + split_screen_w - 1) / split_screen_w;
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
719 HTaskPtr task_draw_array = manager->create_task_array(DrawSpan, array_task_num, 6, 1, rangey);
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
720 Task *task_draw = 0;
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
721
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
722 while (startx < this->width) {
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
723
839
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
724 // Draw SpanPack
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
725
839
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
726 task_draw = task_draw_array->next_task_array(DrawSpan,task_draw);
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
727 task_draw->set_param(0,(memaddr)&pixels[(startx-1) + this->width*(starty-1)]);
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
728 task_draw->set_param(1,this->width);
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
729 task_draw->set_param(2,startx);
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
730 task_draw->set_param(3,endx);
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
731 task_draw->set_param(4,rangey);
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
732 task_draw->set_param(5,spack->info.size);
838
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
733
839
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
734 task_draw->set_inData(0,spack, sizeof(SpanPack));
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
735
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
736 for (int i = 0; i < rangey; i++) {
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
737 task_draw->set_outData(i,
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
738 &pixels[(startx-1) + this->width*(starty-1 + i) ],
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
739 (endx-startx+1)*sizeof(int));
839
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
740 }
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
741
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
742 startx += split_screen_w;
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
743 endx += split_screen_w;
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
744
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
745 if (endx > this->width) {
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
746 endx = this->width;
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
747 }
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
748
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
749 }
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
750
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
751 task_draw_array->spawn_task_array(task_draw->next());
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
752 task_draw_array->set_cpu(SPE_ANY);
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
753 task_next->wait_for(task_draw_array);
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
754 task_draw_array->wait_for(data_update_wait);
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
755 task_draw_array->spawn();
854
293fcceaac36 may be need ppeManager
yutaka@localhost.localdomain
parents: 843
diff changeset
756
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
757 } else {
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
758
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
759 memset(&pixels[(startx-1)+this->width*(starty-1)],
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
760 0, (this->width)*sizeof(int)*rangey);
838
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
761
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
762 }
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
763
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
764 #else
838
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
765
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
766 HTaskPtr task_draw;
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
767
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
768 while (startx < this->width) {
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
769 if (spack->info.size > 0) {
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
770 // Draw SpanPack
615
184d6d3f0cd9 remove uncessary Task Name definision
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 603
diff changeset
771 task_draw = manager->create_task(DrawSpan);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
772
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 617
diff changeset
773 task_draw->set_param(0,
603
57ec231bc8ac long -> memaddr (64 or 32)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 602
diff changeset
774 (memaddr)&pixels[(startx-1) + this->width*(starty-1)]);
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 617
diff changeset
775 task_draw->set_param(1,this->width);
659
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
776 task_draw->set_param(2,startx);
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
777 task_draw->set_param(3,endx);
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
778 task_draw->set_param(4,rangey);
838
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
779 task_draw->set_param(5,spack->info.size);
659
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
780
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
781 task_draw->add_inData(spack, sizeof(SpanPack));
616
350b9b8c985f First addOutput rendering try failed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 615
diff changeset
782
617
df618a956eb9 Rendering not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 616
diff changeset
783 for (int i = 0; i < rangey; i++) {
616
350b9b8c985f First addOutput rendering try failed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 615
diff changeset
784 task_draw->add_outData(
617
df618a956eb9 Rendering not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 616
diff changeset
785 &pixels[(startx-1) + this->width*(starty-1 + i) ],
df618a956eb9 Rendering not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 616
diff changeset
786 (endx-startx+1)*sizeof(int));
616
350b9b8c985f First addOutput rendering try failed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 615
diff changeset
787 }
838
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
788
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
789 } else {
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
790 // 7.7.3 SL1 Data Cache Range Set to Zero コマンド
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
791 // を使って、DMAでclearするべき... ということは、
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
792 // それもSPEでやる方が良い?
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
793 memset(&pixels[(startx-1)+this->width*(starty-1)],
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
794 0, (this->width)*sizeof(int)*rangey);
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
795 break;
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
796 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
797
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
798 task_draw->set_cpu(SPE_ANY);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
799 task_next->wait_for(task_draw);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
800 task_draw->wait_for(data_update_wait);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
801 task_draw->spawn();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
802
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
803 startx += split_screen_w;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
804 endx += split_screen_w;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
805
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
806 if (endx > this->width) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
807 endx = this->width;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
808 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
809 }
838
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
810 #endif
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
811
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
812 }
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
813
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
814 data_update_wait->spawn();
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
815
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
816 }
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
817
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
818 void
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
819 Viewer::run_finish()
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
820 {
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
821 dev->free_device();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
822 if (this_time != start_time) {
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
823 printf("%f FPS\n", (((float)frames)/(this_time-start_time))*1000.0);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
824 }
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
825
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
826 delete sgroot;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
827 // delete sgroot_2;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
828 quit();
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
829 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
830
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
831 /* end */