annotate Renderer/Engine/viewer.cc @ 1319:31455d34e502 draft

collada file reader minor changes.
author Taiki TAIRA <e095767@ie.u-ryukyu.ac.jp>
date Sun, 18 Dec 2011 09:39:14 +0900
parents ab9b7d21b32b
children e51127dbd63c
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"
1050
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1045
diff changeset
7 #include "matrix_calc.h"
539
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"
1097
185f025f7ce5 not yet done
yutaka@localhost.localdomain
parents: 1096
diff changeset
15 #include "SchedTask.h"
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 /* measure for FPS (Frame Per Second) */
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
18 static int start_time;
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
19 static int this_time;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 int frames;
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
21 // static void post2speRunLoop(void *viewer);
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
22 //static void post2runMove(void *viewer);
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
23 //static void post2exchange_sgroot(void *viewer);
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
24 //static void post2speRunLoop(void *viewer);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 //SceneGraphRootPtr sgroot_2;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 /* Data Pack sent to Other CPUs (ex. SPE) */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29
1160
Yutaka_Kinjyo
parents: 1159
diff changeset
30 RenderingData r[2];
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
994
56c3b9dd37a7 SDL mode fix
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 989
diff changeset
32 int ppi, spi = 0;
907
03e60cf2e4c2 collect matrix..
Yutaka_Kinjyo
parents: 900
diff changeset
33
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
34 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
35 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 spe_num = _num;
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
37 manager = m;
895
b662e9dd26b0 add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 891
diff changeset
38
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
39 dev = vd;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
40 pixels = dev->video_init(manager, b, w, h);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
41
895
b662e9dd26b0 add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 891
diff changeset
42 width = dev->width;
b662e9dd26b0 add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 891
diff changeset
43 height = dev->height;
b662e9dd26b0 add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 891
diff changeset
44 bpp = dev->bpp;
b662e9dd26b0 add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 891
diff changeset
45
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 }
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 int
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 Viewer::get_ticks(void)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 int time;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 time = SDL_GetTicks();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 return time;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 bool
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 Viewer::quit_check(void)
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 SDL_Event event;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 while(SDL_PollEvent(&event)) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 if (event.type==SDL_QUIT) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 return true;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 }
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 Uint8 *keys=SDL_GetKeyState(NULL);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 if (keys[SDLK_q] == SDL_PRESSED) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 return true;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 }
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 return false;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 Viewer::quit(void)
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 SDL_Quit();
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
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 void
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
84 Viewer::run_init(TaskManager *manager, Application *app)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 this->manager = manager;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
88 if (spe_num == 0) spe_num = 1;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
89
1143
786e800abfb4 minor fix
Yutaka_Kinjyo
parents: 1142
diff changeset
90 sgroot = new SceneGraphRoot(this->width, this->height, manager);
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
91
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
92 int light_num = 4;
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
93 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
94 int light_size = size / sizeof(float);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
95
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
96 light_xyz = (float *)manager->allocate(size);
1129
a8bffdb5d2e3 bus error
yutaka@localhost.localdomain
parents: 1128
diff changeset
97
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
98 for (int i = 0; i < light_size ; i++) {
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
99 light_xyz[i] = 0.0f;
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
100 }
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
101
1160
Yutaka_Kinjyo
parents: 1159
diff changeset
102
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
103 for(int i = 0; i < spe_num; i++) {
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
104 HTaskPtr data_load = manager->create_task(DataAllocate);
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
105 data_load->set_param(0,(memaddr)3); // num of allocate block
988
da1cec21f0c9 fix for double buffer
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 986
diff changeset
106 data_load->set_param(1,(memaddr)(sizeof(float)*4*light_num)); // 1st allocate size
da1cec21f0c9 fix for double buffer
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 986
diff changeset
107 data_load->set_param(2,(memaddr)Light); // 1st id
da1cec21f0c9 fix for double buffer
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 986
diff changeset
108 data_load->set_param(3,(memaddr)(light_num * sizeof(int))); // 2nd size
da1cec21f0c9 fix for double buffer
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 986
diff changeset
109 data_load->set_param(4,(memaddr)LightSwitch); // 2nd id
da1cec21f0c9 fix for double buffer
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 986
diff changeset
110 data_load->set_param(5,(memaddr)16); // 3rd size
da1cec21f0c9 fix for double buffer
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 986
diff changeset
111 data_load->set_param(6,(memaddr)LightSysSwitch); // 3rd id
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
112 data_load->set_cpu((CPU_TYPE)((int)SPE_0 + i));
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
113 data_load->spawn();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
114 }
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
115
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
116 light_switch = (int*)manager->allocate(size);
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
117
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
118 for (int i = 0; i < light_num; i++) {
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
119 light_switch[i] = 0;
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
120 }
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
121
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
122 size = 16; // LightSysSwitch は 4byte. 残り 12byte は DMA転送の為のパディング
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
123
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
124 light_sysswitch = (int*)manager->allocate(size);
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
125
843
de64695a7f02 cleanup unused variables and fix warning.
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 842
diff changeset
126 for (unsigned int i = 0; i < size / sizeof(int); i++) {
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
127 light_sysswitch[i] = 0;
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
128 }
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
129
984
dbebc7afd08e minor fix
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 983
diff changeset
130 start_time = get_ticks();
dbebc7afd08e minor fix
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 983
diff changeset
131 this_time = 0;
dbebc7afd08e minor fix
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 983
diff changeset
132 frames = 0;
1160
Yutaka_Kinjyo
parents: 1159
diff changeset
133 pp_sum_num = 0;
984
dbebc7afd08e minor fix
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 983
diff changeset
134
1033
a9581a9df440 add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1004
diff changeset
135 this->app = app;
543
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 542
diff changeset
136 MainLoop *mainloop = app->init(this, this->width, this->height);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 542
diff changeset
137 mainloop->mainLoop();
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
139
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
140
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 HTaskPtr
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 Viewer::initLoop()
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 HTaskPtr task_next;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 HTaskPtr task_tex;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
146
1163
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
147 /*
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
148
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
149 こうかな
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
150
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
151 manager->createMemList(sizeof(SpanPack), POOL_SPANPACK);
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
152
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
153
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
154 */
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
155
1160
Yutaka_Kinjyo
parents: 1159
diff changeset
156
Yutaka_Kinjyo
parents: 1159
diff changeset
157
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
158 for(int i=0;i<2;i++) {
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
159 r[i].ppack = (PolygonPack*)manager->allocate(sizeof(PolygonPack));
989
1ff34456944d ppack initialization fix
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 988
diff changeset
160 r[i].ppack->next = 0;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
161
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
162 r[i].spackList_length = (this->height + split_screen_h - 1) / split_screen_h;
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
163 r[i].spackList = (SpanPack*)manager->allocate(sizeof(SpanPack)*r[i].spackList_length);
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
164 // printf("spackList %0lx height %d\n",(unsigned long)r[i].spackList, this->height);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
165
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
166 /**
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
167 * SPU に送る address list は 16 バイト倍数でないといけない。
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
168 * spackList_length*sizeof(SpanPack*) が 16 バイト倍数になるような
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
169 * length_align を求めている。はみ出した部分は使われない
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
170 * (ex) spackList_length が 13 の場合
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
171 * spackList_length_align = 16;
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
172 * 実際に送るデータは64バイトになるのでOK
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
173 * 14,15,16 の部分は何も入らない。
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
174 */
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
175 r[i].spackList_length_align = (r[i].spackList_length + 3)&(~3);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
176
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
177 /* 各 SPU が持つ、SpanPack の address list */
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
178 r[i].spackList_ptr =
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
179 (SpanPack**)manager->allocate(sizeof(SpanPack*)*r[i].spackList_length_align);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
180
988
da1cec21f0c9 fix for double buffer
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 986
diff changeset
181 for (int j = 0; j < r[i].spackList_length; j++) {
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
182 r[i].spackList_ptr[j] = &r[i].spackList[j];
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
183 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
184
988
da1cec21f0c9 fix for double buffer
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 986
diff changeset
185 for (int j = 1; j <= r[i].spackList_length; j++) {
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
186 r[i].spackList[j-1].init(j*split_screen_h);
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
187 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
189
1096
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
190 task_next = manager->create_task(RUN_LOOP_TASK,0,0,0,0);
1097
185f025f7ce5 not yet done
yutaka@localhost.localdomain
parents: 1096
diff changeset
191 task_next->set_param(0, (void*)this);
1096
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
192
659
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
193 // ここは、Iterator を用意するべきだよね
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
194 for (int j = 0; j < spe_num; j++) {
1162
8917aff8629c global allocate
Yutaka_Kinjyo
parents: 1161
diff changeset
195 task_tex = manager->create_task(AllocateSegment,0,0,0,0);
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
196 task_tex->set_cpu((CPU_TYPE)((int)SPE_0 + j));
826
d98371202f1d RenderingEngine's Task -> Simple Task
Yutaka_Kinjyo
parents: 801
diff changeset
197 task_next->wait_for(task_tex);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
198 task_tex->spawn();
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
200
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
201
1096
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
202 task_next->spawn();
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
203
1097
185f025f7ce5 not yet done
yutaka@localhost.localdomain
parents: 1096
diff changeset
204 return 0;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
206
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
207
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
209 Viewer::getKey()
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 Pad *pad = sgroot->getController();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 if (pad->right.isHold()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 keyPtr->right = HOLD;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
214 } else if (pad->right.isPush()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 keyPtr->right = PUSH;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
216 } else {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 keyPtr->right = NONE;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 }
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 if (pad->left.isHold()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 keyPtr->left = HOLD;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 } else if (pad->left.isPush()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 keyPtr->left = PUSH;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 } else {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
225 keyPtr->left = NONE;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
226 }
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 if (pad->up.isHold()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 keyPtr->up = HOLD;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
230 } else if (pad->up.isPush()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
231 keyPtr->up = PUSH;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 } else {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 keyPtr->up = NONE;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
234 }
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 if (pad->down.isHold()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
237 keyPtr->down = HOLD;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
238 } else if (pad->down.isPush()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
239 keyPtr->down = PUSH;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
240 } else {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
241 keyPtr->down = NONE;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
242 }
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 if (pad->circle.isHold()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
245 keyPtr->circle = HOLD;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
246 } else if (pad->circle.isPush()) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 keyPtr->circle = PUSH;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
248 } else {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 keyPtr->circle = NONE;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 }
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
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
254 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
255 Viewer::mainLoop()
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
256 {
1112
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
257 if (pixels) {
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
258 initLoop();
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
259 } else {
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
260 HTaskPtr task_next = manager->create_task(EXEC_ONLY_TASK, 0, 0, 0, 0);
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
261 task_next->set_param(0, (void*)this);
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
262
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
263 task_next->spawn();
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
264 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
265 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
266
1112
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
267 bool
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
268 Viewer::main_exec(HTaskPtr task_next)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
269 {
1096
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
270 psx_sync_n();
1112
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
271
1045
11a9bc9928d0 mainLoop is not a part of mainLoop in viwer.... move application_task
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1043
diff changeset
272 task_next = app->application_task(task_next, this);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
273 dev->clear_screen();
1112
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
274
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
275 bool quit_flg;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
276 quit_flg = quit_check();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
277 if (quit_flg == true) {
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
278 this_time = get_ticks();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
279 run_finish();
1112
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
280 return false;
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
281 }
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
282
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
283 dev->clean_pixels();
1112
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
284 pixels = dev->flip_screen(pixels);
994
56c3b9dd37a7 SDL mode fix
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 989
diff changeset
285
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
286 sgroot->updateControllerState();
1043
3a49a0825963 Merged ( app_loop should return 1, if you want to use allExecute )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1042 1041
diff changeset
287 if (app->app_loop(this)) {
1042
d0bb27bf985b AllExecute speparation.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1035
diff changeset
288 //TaskArray を使うか使わないか
d0bb27bf985b AllExecute speparation.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1035
diff changeset
289 if (sgroot->gtask_array != NULL) {
d0bb27bf985b AllExecute speparation.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1035
diff changeset
290 sgroot->create_task_array();
d0bb27bf985b AllExecute speparation.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1035
diff changeset
291 sgroot->allExecute(width, height);
d0bb27bf985b AllExecute speparation.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1035
diff changeset
292 sgroot->task_array_finish();
d0bb27bf985b AllExecute speparation.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1035
diff changeset
293 } else {
d0bb27bf985b AllExecute speparation.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1035
diff changeset
294 sgroot->allExecute(width, height);
d0bb27bf985b AllExecute speparation.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1035
diff changeset
295 }
1254
34944900f266 minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1163
diff changeset
296 } else {
34944900f266 minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1163
diff changeset
297 sgroot->treeApply(width, height);
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
298 }
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
299
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
300 light_xyz_stock = sgroot->getLightVector();
1292
90efd2aac2cb add matrix test and debug light vector
Yutaka_Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 1254
diff changeset
301
90efd2aac2cb add matrix test and debug light vector
Yutaka_Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 1254
diff changeset
302
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
303 light_switch_stock = sgroot->getLightSwitch();
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
304 light_sysswitch_stock = sgroot->getLightSysSwitch();
1112
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
305
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
306 return true;
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
307 }
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
308
1112
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
309 void
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
310 Viewer::run_loop(HTaskPtr task_next)
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
311 {
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
312 if (main_exec(task_next)) {
1118
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
313 //rendering(task_next);
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
314 task_next->spawn();
1111
c9d0683c9b39 add non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1085
diff changeset
315 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 }
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
317
1112
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
318 SchedDefineTask1(EXEC_ONLY_TASK,exec_only_task);
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
319
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
320 static int
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
321 exec_only_task(SchedTask *smanager, void *rbuf, void *wbuf)
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
322 {
1096
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
323
1112
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
324 Viewer *viewer = (Viewer*)smanager->get_param(0);
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
325 HTaskPtr task_next = smanager->create_task(EXEC_ONLY_TASK, 0, 0, 0, 0);
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
326 task_next->set_param(0, (void*)viewer);
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
327
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
328 if (viewer->main_exec(task_next)) {
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
329 task_next->spawn();
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
330 }
fa1f4a1c47bf fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1111 1107
diff changeset
331 return 0;
1096
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
332 }
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
333
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
334 SchedDefineTask1(RUN_LOOP_TASK,run_loop_task);
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
335
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
336 static int
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
337 run_loop_task(SchedTask *smanager, void *rbuf, void *wbuf)
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
338 {
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
339
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
340 Viewer *viewer = (Viewer*)smanager->get_param(0);
1131
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
341 HTaskPtr task_next = smanager->create_task(CREATE_PP_TASK, 0, 0, 0, 0);
1096
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
342 task_next->set_param(0, (void*)viewer);
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
343
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
344 viewer->run_loop(task_next);
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
345
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
346 return 0;
539
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
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
351 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
352 Viewer::run_collision()
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
353 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
354 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
355
1131
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
356 SchedDefineTask1(CREATE_PP_TASK, create_pp_task);
1118
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
357
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
358 static int
1131
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
359 create_pp_task(SchedTask* smanager, void* rbuf, void* wbuf)
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
360 {
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
361
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
362 Viewer *viewer = (Viewer*)smanager->get_param(0);
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
363 HTaskPtr task_next = smanager->create_task(CREATE_SP_TASK, 0, 0, 0, 0);
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
364 task_next->set_param(0, (void*)viewer);
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
365
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
366 viewer->create_pp(task_next);
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
367
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
368 return 0;
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
369
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
370 }
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
371
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
372 void
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
373 Viewer::create_pp(HTaskPtr task_next) {
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
374
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
375 rendering_pp(task_next, sgroot);
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
376
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
377 // Barrier 同期
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
378 // run_draw() を呼ぶ post2runDraw
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
379 task_next->spawn(); // create_sp_task
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
380
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
381 }
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
382
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
383
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
384 SchedDefineTask1(CREATE_SP_TASK, create_sp_task);
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
385
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
386 static int
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
387 create_sp_task(SchedTask* smanager, void* rbuf, void* wbuf)
1118
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
388 {
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
389
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
390 Viewer *viewer = (Viewer*)smanager->get_param(0);
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
391 HTaskPtr task_next = smanager->create_task(DRAW_TASK, 0, 0, 0, 0);
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
392 task_next->set_param(0, (void*)viewer);
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
393
1131
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
394 viewer->create_sp(task_next);
1118
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
395
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
396 return 0;
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
397
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
398 }
539
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 void
1131
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
401 Viewer::create_sp(HTaskPtr task_next) {
1129
a8bffdb5d2e3 bus error
yutaka@localhost.localdomain
parents: 1128
diff changeset
402
1131
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
403 rendering_sp(task_next, sgroot);
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 // Barrier 同期
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
406 // run_draw() を呼ぶ post2runDraw
1131
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
407 task_next->spawn(); // draw_task
539
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 }
1152
df293d433633 measure
yutaka@localhost.localdomain
parents: 1147
diff changeset
410
1131
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
411
1118
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
412 SchedDefineTask1(DRAW_TASK, draw_task);
1096
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
413
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
414 static int
1118
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
415 draw_task(SchedTask* smanager, void* rbuf, void* wbuf)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
416 {
994
56c3b9dd37a7 SDL mode fix
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 989
diff changeset
417
1097
185f025f7ce5 not yet done
yutaka@localhost.localdomain
parents: 1096
diff changeset
418 Viewer* viewer = (Viewer*)smanager->get_param(0);
1107
25d3cfb85439 debug use post task
Yutaka_Kinjyo
parents: 1097
diff changeset
419 HTaskPtr task_next = smanager->create_task(RUN_LOOP_TASK, 0, 0, 0, 0);
1096
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
420 task_next->set_param(0, (void*)viewer);
1097
185f025f7ce5 not yet done
yutaka@localhost.localdomain
parents: 1096
diff changeset
421 viewer->run_draw(task_next);
1122
ec6b55aed337 CreateSpan ver 1118. (can work Mac)
tkaito
parents: 1118
diff changeset
422
1096
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
423 return 0;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
424
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
425 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
426
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
427 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
428 Viewer::run_draw(HTaskPtr task_next) // 引数に post2runLoop を入れるようにする
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
429 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
430 common_draw(task_next);
1096
d18b605e431f add task, run_loop, run_draw, rendering, ...
yutaka@localhost.localdomain
parents: 1095
diff changeset
431
1118
7ba266bb54d3 DRAW_TASK add.(Mac)
tkaito
parents: 1116
diff changeset
432 task_next->spawn(); // run_loop_task
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
433 // TASK_DRAW_SPAN が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
434
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
435 frames++;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
436 }
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
860
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 857
diff changeset
439 void
1131
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
440 Viewer::rendering_pp(HTaskPtr task_next, SceneGraphRoot *sgroot)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
441 {
1160
Yutaka_Kinjyo
parents: 1159
diff changeset
442
1161
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
443
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
444 /*
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
445
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
446 sg->pp をもっと細かく分けるか?
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
447
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
448 DataSegment seg1;
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
449
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
450 (ObjectPolygonPtr)seg1->in = (ObjectPolygonPtr)makeSegment(pp_sum_num);
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
451 (SpanPackPtr)seg1->out = (SpanPackPtr)makeSegment(pp_sum_num);
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
452
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
453 HTaskPtr create_pp = manager->create_task(CreatePolygon,seg1);
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
454 create_pp->spawn();
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
455
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
456 DataSegment seg;
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
457
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
458 */
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
459
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
460
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
461
1127
c4287bf771a0 CreatePolygonFromSceneGraph can work on Mac OSX.
Yutaka_Kinjyo
parents: 1126
diff changeset
462 HTaskPtr game_task_array = 0;
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
463
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
464 /* GameTask の処理の終了を待ってからポリゴンを作る */
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
465 if (sgroot->gtask_array != NULL) {
1127
c4287bf771a0 CreatePolygonFromSceneGraph can work on Mac OSX.
Yutaka_Kinjyo
parents: 1126
diff changeset
466 game_task_array = sgroot->gtask_array->get_task_array();
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
467 }
1126
6043da6e48f1 complete compile but not work yet.
yutaka@localhost.localdomain
parents: 1122
diff changeset
468
1128
293b36802714 code cleanup
Yutaka_Kinjyo
parents: 1127
diff changeset
469 PolygonPackPtr out_pp = r[ppi].ppack;
1140
3975c384ff93 SceneGraph initalize... can worked on Mac OS X. not check Cell arch.
Yutaka_Kinjyo
parents: 1139
diff changeset
470 out_pp->init();
1302
ab9b7d21b32b removed real_matrix. sparated screen matrix from camera matrix.
Yutaka_Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 1292
diff changeset
471
ab9b7d21b32b removed real_matrix. sparated screen matrix from camera matrix.
Yutaka_Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 1292
diff changeset
472 CameraPtr camera = sgroot->getCamera();
1130
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1129
diff changeset
473
1127
c4287bf771a0 CreatePolygonFromSceneGraph can work on Mac OSX.
Yutaka_Kinjyo
parents: 1126
diff changeset
474 //多分このsg_remove_listであってる?。チェック対象かも
1136
f326494ffdc7 not work ieshoot. not check Cell
Yutaka_Kinjyo
parents: 1131
diff changeset
475 for (SceneGraphPtr t = sgroot->sg_remove_list; t != NULL; t = t->next) {
1142
801d57ae1e29 cut compile CreatePolygonTask on spe side because not enough spe memory. We have to use code loading.
yutaka@localhost.localdomain
parents: 1140
diff changeset
476 if (t->size > 0) {
1160
Yutaka_Kinjyo
parents: 1159
diff changeset
477 pp_sum_num += t->pp_num;
Yutaka_Kinjyo
parents: 1159
diff changeset
478 for (int i = 0; i < t->pp_num; i++) {
Yutaka_Kinjyo
parents: 1159
diff changeset
479
1138
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
480 HTaskPtr create_pp = manager->create_task(CreatePolygonFromSceneGraph);
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
481
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
482 create_pp->add_inData(&t->pp[i], sizeof(PolygonPack));
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
483 create_pp->add_inData(t->matrix, sizeof(float)*16);
1302
ab9b7d21b32b removed real_matrix. sparated screen matrix from camera matrix.
Yutaka_Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 1292
diff changeset
484 create_pp->add_inData(camera->m_screen, sizeof(float)*16);
1138
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
485 create_pp->add_inData(t->texture_info, sizeof(texture_list));
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
486
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
487 if ( (unsigned long)t->matrix % 16) {
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
488 printf("marix not aligned\n");
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
489 }
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
490
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
491 if ((unsigned long)t->texture_info % 16) {
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
492 printf("texture_info not aligned\n");
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
493 }
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
494
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
495 create_pp->add_outData(out_pp, sizeof(PolygonPack));
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
496
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
497 if (game_task_array != NULL) {
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
498 create_pp->wait_for(game_task_array);
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
499 }
1142
801d57ae1e29 cut compile CreatePolygonTask on spe side because not enough spe memory. We have to use code loading.
yutaka@localhost.localdomain
parents: 1140
diff changeset
500
801d57ae1e29 cut compile CreatePolygonTask on spe side because not enough spe memory. We have to use code loading.
yutaka@localhost.localdomain
parents: 1140
diff changeset
501 PolygonPackPtr tmp_pp = (PolygonPackPtr)manager->allocate(sizeof(PolygonPack));
1129
a8bffdb5d2e3 bus error
yutaka@localhost.localdomain
parents: 1128
diff changeset
502
1138
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
503 tmp_pp->init();
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
504 create_pp->set_param(0, (memaddr)tmp_pp);
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
505 out_pp = tmp_pp;
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
506
1142
801d57ae1e29 cut compile CreatePolygonTask on spe side because not enough spe memory. We have to use code loading.
yutaka@localhost.localdomain
parents: 1140
diff changeset
507 //create_pp->set_cpu(SPE_ANY);
801d57ae1e29 cut compile CreatePolygonTask on spe side because not enough spe memory. We have to use code loading.
yutaka@localhost.localdomain
parents: 1140
diff changeset
508 create_pp->set_cpu(CPU_PPE);
1138
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
509 task_next->wait_for(create_pp);
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
510 create_pp->spawn();
8e494f602e45 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
511 }
1142
801d57ae1e29 cut compile CreatePolygonTask on spe side because not enough spe memory. We have to use code loading.
yutaka@localhost.localdomain
parents: 1140
diff changeset
512 }
1131
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
513 }
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
514 }
1126
6043da6e48f1 complete compile but not work yet.
yutaka@localhost.localdomain
parents: 1122
diff changeset
515
1139
67927f3a6655 minor fix
Yutaka_Kinjyo
parents: 1138
diff changeset
516
1131
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
517 void
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
518 Viewer::rendering_sp(HTaskPtr task_next, SceneGraphRoot *sgroot)
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1130
diff changeset
519 {
1160
Yutaka_Kinjyo
parents: 1159
diff changeset
520
Yutaka_Kinjyo
parents: 1159
diff changeset
521 #ifdef CreateSpanDivi
Yutaka_Kinjyo
parents: 1159
diff changeset
522
Yutaka_Kinjyo
parents: 1159
diff changeset
523 /*
Yutaka_Kinjyo
parents: 1159
diff changeset
524
Yutaka_Kinjyo
parents: 1159
diff changeset
525 CreateSpan -> SortSpan -> DrawSpan
Yutaka_Kinjyo
parents: 1159
diff changeset
526 | |
Yutaka_Kinjyo
parents: 1159
diff changeset
527 v v
Yutaka_Kinjyo
parents: 1159
diff changeset
528 Data Data
Yutaka_Kinjyo
parents: 1159
diff changeset
529
Yutaka_Kinjyo
parents: 1159
diff changeset
530 Bestなデータ構造ってどういうのだろう。
Yutaka_Kinjyo
parents: 1159
diff changeset
531 今のデータ構造は「良い」とは言えないだろうなぁ。
Yutaka_Kinjyo
parents: 1159
diff changeset
532 間に wait_for もいまいち見たいだから、Taskで挟むのがいいか
Yutaka_Kinjyo
parents: 1159
diff changeset
533
Yutaka_Kinjyo
parents: 1159
diff changeset
534 CreateSpan -> BridgeTask -> SortSpan -> BridgeTask -> DrawSpan
Yutaka_Kinjyo
parents: 1159
diff changeset
535
Yutaka_Kinjyo
parents: 1159
diff changeset
536 みたいな感じ? この wait for は見づらいしね。んで上の図みたな依存性がみれたり、
Yutaka_Kinjyo
parents: 1159
diff changeset
537 実行のガントチャートが見れたりすると嬉しいって話は前からある。
Yutaka_Kinjyo
parents: 1159
diff changeset
538
1161
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
539 以下妄想
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1160
diff changeset
540
1160
Yutaka_Kinjyo
parents: 1159
diff changeset
541 CreateSpan(SegID in) {
Yutaka_Kinjyo
parents: 1159
diff changeset
542
Yutaka_Kinjyo
parents: 1159
diff changeset
543 SpanPack out = makeSegment();
Yutaka_Kinjyo
parents: 1159
diff changeset
544 PolygonPack pp = getSegment(in);
Yutaka_Kinjyo
parents: 1159
diff changeset
545
Yutaka_Kinjyo
parents: 1159
diff changeset
546 --処理--
Yutaka_Kinjyo
parents: 1159
diff changeset
547
Yutaka_Kinjyo
parents: 1159
diff changeset
548 return SortTask(out);
Yutaka_Kinjyo
parents: 1159
diff changeset
549
Yutaka_Kinjyo
parents: 1159
diff changeset
550 }
Yutaka_Kinjyo
parents: 1159
diff changeset
551
Yutaka_Kinjyo
parents: 1159
diff changeset
552 SortSpan(SegID in) {
Yutaka_Kinjyo
parents: 1159
diff changeset
553
Yutaka_Kinjyo
parents: 1159
diff changeset
554 SpanPack out = makeSegment();
Yutaka_Kinjyo
parents: 1159
diff changeset
555 SpanPack sp = getSegment(in):
Yutaka_Kinjyo
parents: 1159
diff changeset
556
Yutaka_Kinjyo
parents: 1159
diff changeset
557 --処理--
Yutaka_Kinjyo
parents: 1159
diff changeset
558
Yutaka_Kinjyo
parents: 1159
diff changeset
559 return DrawSpan(out);
Yutaka_Kinjyo
parents: 1159
diff changeset
560
Yutaka_Kinjyo
parents: 1159
diff changeset
561 }
Yutaka_Kinjyo
parents: 1159
diff changeset
562
Yutaka_Kinjyo
parents: 1159
diff changeset
563 DrawSpan() {
Yutaka_Kinjyo
parents: 1159
diff changeset
564
Yutaka_Kinjyo
parents: 1159
diff changeset
565
Yutaka_Kinjyo
parents: 1159
diff changeset
566
Yutaka_Kinjyo
parents: 1159
diff changeset
567 return Start(); //Startは同期するん?
Yutaka_Kinjyo
parents: 1159
diff changeset
568
Yutaka_Kinjyo
parents: 1159
diff changeset
569 }
Yutaka_Kinjyo
parents: 1159
diff changeset
570
Yutaka_Kinjyo
parents: 1159
diff changeset
571 main() {
Yutaka_Kinjyo
parents: 1159
diff changeset
572
Yutaka_Kinjyo
parents: 1159
diff changeset
573 --処理--
Yutaka_Kinjyo
parents: 1159
diff changeset
574
Yutaka_Kinjyo
parents: 1159
diff changeset
575 PolygonPack out = makeSegment(3); //個数なのか?
Yutaka_Kinjyo
parents: 1159
diff changeset
576
Yutaka_Kinjyo
parents: 1159
diff changeset
577 out[0] = pp[0];
Yutaka_Kinjyo
parents: 1159
diff changeset
578 out[1] = pp[1];
Yutaka_Kinjyo
parents: 1159
diff changeset
579 out[2] = pp[2];
Yutaka_Kinjyo
parents: 1159
diff changeset
580
Yutaka_Kinjyo
parents: 1159
diff changeset
581 return CreateSpan(out); //3スレッドできるのか?
Yutaka_Kinjyo
parents: 1159
diff changeset
582
Yutaka_Kinjyo
parents: 1159
diff changeset
583 }
Yutaka_Kinjyo
parents: 1159
diff changeset
584
Yutaka_Kinjyo
parents: 1159
diff changeset
585
Yutaka_Kinjyo
parents: 1159
diff changeset
586 下みたいにはもう書きたくないか・・・
Yutaka_Kinjyo
parents: 1159
diff changeset
587 うーんだいぶ書きなおすか。
Yutaka_Kinjyo
parents: 1159
diff changeset
588
Yutaka_Kinjyo
parents: 1159
diff changeset
589 */
Yutaka_Kinjyo
parents: 1159
diff changeset
590
Yutaka_Kinjyo
parents: 1159
diff changeset
591
Yutaka_Kinjyo
parents: 1159
diff changeset
592 PolygonPackPtr pp = r[ppi].ppack;
Yutaka_Kinjyo
parents: 1159
diff changeset
593 SpanPackPtr* spackList = (SpanPackPtr*)manager->allocate(sizeof(SpanPackPtr)*pp_sum_num);
Yutaka_Kinjyo
parents: 1159
diff changeset
594
Yutaka_Kinjyo
parents: 1159
diff changeset
595 for (PolygonPackPtr t = pp; t->next != NULL; t = t->next) {
Yutaka_Kinjyo
parents: 1159
diff changeset
596
Yutaka_Kinjyo
parents: 1159
diff changeset
597 int span_num = t->info.span_num;
Yutaka_Kinjyo
parents: 1159
diff changeset
598 int spack_num = (span_num + MAX_SIZE_SPAN -1) / MAX_SIZE_SPAN;
Yutaka_Kinjyo
parents: 1159
diff changeset
599
Yutaka_Kinjyo
parents: 1159
diff changeset
600 SpanPackPtr spack = (SpanPackPtr)manager->allocate(sizeof(SpanPack)*spack_num);
Yutaka_Kinjyo
parents: 1159
diff changeset
601 spackList[i] = spack;
Yutaka_Kinjyo
parents: 1159
diff changeset
602
Yutaka_Kinjyo
parents: 1159
diff changeset
603 for (int i = 0; i < spack_num; i++) {
Yutaka_Kinjyo
parents: 1159
diff changeset
604 HTaskPtr task_create_sp = manager->create_task(CreateSpan);
Yutaka_Kinjyo
parents: 1159
diff changeset
605 task_create_sp->set_inData(0, t, sizeof(PolygonPack));
Yutaka_Kinjyo
parents: 1159
diff changeset
606 task_create_sp->set_outData(0, &spack[i], sizeof(SpanPack));
Yutaka_Kinjyo
parents: 1159
diff changeset
607
Yutaka_Kinjyo
parents: 1159
diff changeset
608 task_create_sp->spawn();
Yutaka_Kinjyo
parents: 1159
diff changeset
609 task_next->wait_for(task_create_sp);
Yutaka_Kinjyo
parents: 1159
diff changeset
610 }
Yutaka_Kinjyo
parents: 1159
diff changeset
611
Yutaka_Kinjyo
parents: 1159
diff changeset
612 }
Yutaka_Kinjyo
parents: 1159
diff changeset
613
Yutaka_Kinjyo
parents: 1159
diff changeset
614 HTaskPtr sort_span = (SortSpanPtr)manager->allocate(sizeof(SortSpan));
Yutaka_Kinjyo
parents: 1159
diff changeset
615
Yutaka_Kinjyo
parents: 1159
diff changeset
616 /*まだ途中*/
Yutaka_Kinjyo
parents: 1159
diff changeset
617
Yutaka_Kinjyo
parents: 1159
diff changeset
618 #else
Yutaka_Kinjyo
parents: 1159
diff changeset
619
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
620 int range_base = spe_num;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
621
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
622 // 切り上げのつもり
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
623 int range = (r[spi].spackList_length + range_base - 1) / range_base;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
624
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
625 for (int i = 0; i < range_base; i++) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
626 int index_start = range*i;
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
627 int index_end = (index_start + range >= r[spi].spackList_length)
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
628 ? r[spi].spackList_length : index_start + range;
1056
4955cedb17e5 endy overflow in common rendering
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1050
diff changeset
629 int starty = index_start*split_screen_h + 1;
4955cedb17e5 endy overflow in common rendering
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1050
diff changeset
630 int endy = index_end*split_screen_h;
4955cedb17e5 endy overflow in common rendering
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1050
diff changeset
631 if (starty<=0) starty = 1;
4955cedb17e5 endy overflow in common rendering
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1050
diff changeset
632 if (endy>height) endy = height;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
633
659
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
634 HTaskPtr task_create_sp = manager->create_task(CreateSpan);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
635
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 617
diff changeset
636 task_create_sp->set_param(0,index_start);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
637
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
638 /**
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
639 * ex. screen_height が 480, spenum が 6 の場合、各SPEのy担当範囲
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
640 * [ 1.. 80] [ 81..160] [161..240]
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
641 * [241..320] [321..400] [401..480]
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
642 *
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
643 * ex. screen_height が 1080, spenum が 5 の場合、
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
644 * [ 1..216] [217..432] [433..648]
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
645 * [649..864] [865..1080]
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
646 */
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
647
1056
4955cedb17e5 endy overflow in common rendering
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1050
diff changeset
648 task_create_sp->set_param(1,starty);
4955cedb17e5 endy overflow in common rendering
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1050
diff changeset
649 task_create_sp->set_param(2,endy);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
650
1128
293b36802714 code cleanup
Yutaka_Kinjyo
parents: 1127
diff changeset
651 task_create_sp->add_inData(r[ppi].ppack, sizeof(PolygonPack));
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
652 task_create_sp->add_inData(r[spi].spackList_ptr,
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
653 sizeof(SpanPack*)*r[spi].spackList_length_align);
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
654 task_create_sp->add_inData(&r[spi].spackList[index_start], sizeof(SpanPack));
659
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
655
1107
25d3cfb85439 debug use post task
Yutaka_Kinjyo
parents: 1097
diff changeset
656 task_next->wait_for(task_create_sp);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
657
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
658 task_create_sp->set_cpu(SPE_ANY);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
659 task_create_sp->spawn();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
660 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
661
1160
Yutaka_Kinjyo
parents: 1159
diff changeset
662 #endif
Yutaka_Kinjyo
parents: 1159
diff changeset
663
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
664 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
665
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
666 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
667 Viewer::common_draw(HTaskPtr task_next)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
668 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
669
615
184d6d3f0cd9 remove uncessary Task Name definision
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 603
diff changeset
670 //task_next = manager->create_task(Dummy);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
671 //task_next->set_post(post2runLoop, (void*)this);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
672
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
673 //Light info update
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
674
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
675 int light_num = 4;
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
676 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
677 int light_size = size / sizeof(float);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
678
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
679 for (int i = 0; i < light_size; i++) {
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
680 light_xyz[i] = light_xyz_stock[i];
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
681 }
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
682
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
683 for (int i = 0; i < light_num; i++) {
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
684 light_switch[i] = light_switch_stock[i];
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
685 }
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
686
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
687 light_sysswitch[0] = light_sysswitch_stock;
985
37bd2b0694e2 fix light data update
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 984
diff changeset
688
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1145
diff changeset
689 #if 1
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1145
diff changeset
690
985
37bd2b0694e2 fix light data update
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 984
diff changeset
691 HTask *data_update_wait = 0;
37bd2b0694e2 fix light data update
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 984
diff changeset
692 for (int i = 0; i < spe_num; i++) {
37bd2b0694e2 fix light data update
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 984
diff changeset
693 data_update_wait = manager->create_task(DataUpdate);
37bd2b0694e2 fix light data update
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 984
diff changeset
694 data_update_wait->set_param(0,3);
37bd2b0694e2 fix light data update
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 984
diff changeset
695 data_update_wait->set_param(1,Light); // GlobalSet ID base
37bd2b0694e2 fix light data update
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 984
diff changeset
696 data_update_wait->set_inData(0,light_xyz,size); // Light
37bd2b0694e2 fix light data update
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 984
diff changeset
697 data_update_wait->set_inData(1,light_switch,light_num * sizeof(int)); // LightSwitch = Light+1
37bd2b0694e2 fix light data update
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 984
diff changeset
698 data_update_wait->set_inData(2,light_sysswitch,16); // LightSysSwitch = Light+2
37bd2b0694e2 fix light data update
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 984
diff changeset
699 data_update_wait->set_cpu((CPU_TYPE)(SPE_0+i));
37bd2b0694e2 fix light data update
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 984
diff changeset
700 data_update_wait->spawn();
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1145
diff changeset
701 }
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1145
diff changeset
702
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1145
diff changeset
703 #else
1145
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
704
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
705 HTask *data_update_wait = manager->create_task(Dummy);
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
706 for (int i = 0; i < spe_num; i++) {
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
707
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
708 HTaskPtr data_update = manager->create_task(DataUpdate);
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
709 data_update->set_param(0,3);
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
710 data_update->set_param(1,Light); // GlobalSet ID base
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
711 data_update->set_inData(0,light_xyz,size); // Light
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
712 data_update->set_inData(1,light_switch,light_num * sizeof(int)); // LightSwitch = Light+1
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
713 data_update->set_inData(2,light_sysswitch,16); // LightSysSwitch = Light+2
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
714 data_update->set_cpu((CPU_TYPE)(SPE_0+i));
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
715 data_update->wait_for(data_update_wait);
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
716 data_update->spawn();
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1145
diff changeset
717 }
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1145
diff changeset
718
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1145
diff changeset
719 #endif
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
720
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
721 ppi ^= 1;
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
722 r[ppi].ppack->clear();
914
6286b3baf744 0 is filled on the spe side.
yutaka@localhost.localdomain
parents: 913
diff changeset
723
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
724 for (int i = 0; i < r[spi].spackList_length; i++) {
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
725 SpanPack *spack = &r[spi].spackList[i];
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
726 int startx = 1;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
727 int endx = split_screen_w;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
728
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
729 int starty = spack->info.y_top - split_screen_h + 1;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
730 //int endy = spack->info.y_top;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
731 int rangey = (starty + split_screen_h - 1 > this->height)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
732 ? this->height - starty + 1 : split_screen_h;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
733
1152
df293d433633 measure
yutaka@localhost.localdomain
parents: 1147
diff changeset
734 #ifdef USE_TASKARRAY
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
735
1157
ea68d54411a7 not yet
Yutaka_Kinjyo
parents: 1154
diff changeset
736 int array_task_num = (this->width + split_screen_w - 1) / split_screen_w;
ea68d54411a7 not yet
Yutaka_Kinjyo
parents: 1154
diff changeset
737 HTaskPtr task_draw_array = manager->create_task_array(DrawSpan, array_task_num, 6, 1, rangey);
ea68d54411a7 not yet
Yutaka_Kinjyo
parents: 1154
diff changeset
738 Task *task_draw = 0;
ea68d54411a7 not yet
Yutaka_Kinjyo
parents: 1154
diff changeset
739
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
740 while (startx < this->width) {
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
741
839
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
742 // Draw SpanPack
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
743
839
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
744 task_draw = task_draw_array->next_task_array(DrawSpan,task_draw);
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
745 task_draw->set_param(0,(memaddr)&pixels[(startx-1) + this->width*(starty-1)]);
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
746 task_draw->set_param(1,this->width);
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
747 task_draw->set_param(2,startx);
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
748 task_draw->set_param(3,endx);
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
749 task_draw->set_param(4,rangey);
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
750 task_draw->set_param(5,spack->info.size);
838
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
751
839
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
752 task_draw->set_inData(0,spack, sizeof(SpanPack));
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
753
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
754 for (int i = 0; i < rangey; i++) {
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
755 task_draw->set_outData(i,
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
756 &pixels[(startx-1) + this->width*(starty-1 + i) ],
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
757 (endx-startx+1)*sizeof(int));
839
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
758 }
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
759
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
760 startx += split_screen_w;
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
761 endx += split_screen_w;
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
762
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
763 if (endx > this->width) {
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
764 endx = this->width;
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
765 }
1001c4bea1a0 if unnecessary
Yutaka_Kinjyo
parents: 838
diff changeset
766
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
767 }
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
768
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
769 task_draw_array->spawn_task_array(task_draw->next());
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
770 task_draw_array->set_cpu(SPE_ANY);
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1145
diff changeset
771 //task_draw_array->wait_for(data_update_wait);
1152
df293d433633 measure
yutaka@localhost.localdomain
parents: 1147
diff changeset
772 #ifndef USE_PIPELINE
df293d433633 measure
yutaka@localhost.localdomain
parents: 1147
diff changeset
773 task_next->wait_for(task_draw_array);
df293d433633 measure
yutaka@localhost.localdomain
parents: 1147
diff changeset
774 #endif
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
775 task_draw_array->spawn();
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
776 #else
838
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
777
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
778 HTaskPtr task_draw;
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
779
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
780 while (startx < this->width) {
1154
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
781 if (spack->info.size > 0 || mem_flag == 1) {
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
782 // Draw SpanPack
615
184d6d3f0cd9 remove uncessary Task Name definision
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 603
diff changeset
783 task_draw = manager->create_task(DrawSpan);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
784
625
94d82f2c842f 64bit mode worked on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 617
diff changeset
785 task_draw->set_param(0,
603
57ec231bc8ac long -> memaddr (64 or 32)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 602
diff changeset
786 (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
787 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
788 task_draw->set_param(2,startx);
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
789 task_draw->set_param(3,endx);
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
790 task_draw->set_param(4,rangey);
838
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
791 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
792
c7199f162b64 bulk task list start.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
793 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
794
617
df618a956eb9 Rendering not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 616
diff changeset
795 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
796 task_draw->add_outData(
617
df618a956eb9 Rendering not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 616
diff changeset
797 &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
798 (endx-startx+1)*sizeof(int));
616
350b9b8c985f First addOutput rendering try failed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 615
diff changeset
799 }
838
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
800
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
801 } else {
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
802 // 7.7.3 SL1 Data Cache Range Set to Zero コマンド
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
803 // を使って、DMAでclearするべき... ということは、
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
804 // それもSPEでやる方が良い?
857
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
805 memset(&pixels[(startx-1)+this->width*(starty-1)],
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
806 0, (this->width)*sizeof(int)*rangey);
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
807 break;
2fa8943d989a DrawSpan taskArray bug fix
yutaka@localhost.localdomain
parents: 854
diff changeset
808 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
809
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
810 task_draw->set_cpu(SPE_ANY);
1152
df293d433633 measure
yutaka@localhost.localdomain
parents: 1147
diff changeset
811 #ifndef USE_PIPELINE
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
812 task_next->wait_for(task_draw);
1152
df293d433633 measure
yutaka@localhost.localdomain
parents: 1147
diff changeset
813 #endif
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
814 task_draw->spawn();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
815
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
816 startx += split_screen_w;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
817 endx += split_screen_w;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
818
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
819 if (endx > this->width) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
820 endx = this->width;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
821 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
822 }
838
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
823 #endif
92bf8fc6a2a9 Draw Span Task -> Task Array
Yutaka_Kinjyo
parents: 826
diff changeset
824
1145
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
825 }
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
826
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1145
diff changeset
827 //data_update_wait->spawn();
1145
4e898dca4ab9 light bug fix.
yutaka@localhost.localdomain
parents: 1144
diff changeset
828
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
829 spi ^= 1;
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
830 for (int i = 1; i <= r[spi].spackList_length; i++) {
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
831 r[spi].spackList[i-1].reinit(i*split_screen_h);
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
832 }
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 985
diff changeset
833
925
292bb8c79cdb add profile in Redering Engine
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 918
diff changeset
834 if (profile) {
983
ad2bc8afc7b9 minor fix
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 982
diff changeset
835 if (frames % 50 == 49) {
998
c79bb1c5d9ce add fb_test, minor fix
yutaka@localhost.localdomain
parents: 994
diff changeset
836 manager->show_profile();
983
ad2bc8afc7b9 minor fix
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 982
diff changeset
837 this_time = get_ticks();
ad2bc8afc7b9 minor fix
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 982
diff changeset
838 if (this_time != start_time) {
984
dbebc7afd08e minor fix
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 983
diff changeset
839 printf("\n%f FPS\n", ((((float)frames)*1000.0)/(this_time-start_time)));
983
ad2bc8afc7b9 minor fix
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 982
diff changeset
840 start_time = this_time; frames = 0;
ad2bc8afc7b9 minor fix
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 982
diff changeset
841 }
982
9f5e6bfb1c09 avoid WAIT in virtual console
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 981
diff changeset
842 }
925
292bb8c79cdb add profile in Redering Engine
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 918
diff changeset
843 }
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
844 }
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
845
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
846 void
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
847 Viewer::run_finish()
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
848 {
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
849 dev->free_device();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
850 if (this_time != start_time) {
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
851 printf("%f FPS\n", (((float)frames)/(this_time-start_time))*1000.0);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
852 }
925
292bb8c79cdb add profile in Redering Engine
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 918
diff changeset
853 if (profile) {
292bb8c79cdb add profile in Redering Engine
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 918
diff changeset
854 manager->show_profile();
292bb8c79cdb add profile in Redering Engine
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 918
diff changeset
855 }
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
856
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
857 delete sgroot;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
858 // delete sgroot_2;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 659
diff changeset
859 quit();
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
860 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
861
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
862 /* end */