comparison TaskManager/Test/test_render/viewer.cpp @ 167:508beb59e0eb draft

DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
author gongo@localhost.localdomain
date Tue, 09 Dec 2008 15:07:31 +0900 (2008-12-09)
parents 4d792df6ebf2
children 831e534608f4
comparison
equal deleted inserted replaced
166:8831c058a1ff 167:508beb59e0eb
26 PolygonPack *ppack; 26 PolygonPack *ppack;
27 SpanPackPtr spackList; 27 SpanPackPtr spackList;
28 SpanPackPtr *spackList_ptr; 28 SpanPackPtr *spackList_ptr;
29 int spackList_length; 29 int spackList_length;
30 int spackList_length_align; 30 int spackList_length_align;
31
32 void *__texture;
33
34 31
35 /** 32 /**
36 * Joystick があればそれを使い、 33 * Joystick があればそれを使い、
37 * 無ければキーボードを返す 34 * 無ければキーボードを返す
38 */ 35 */
110 107
111 void 108 void
112 Viewer::run_init(char *xml, int sg_number) 109 Viewer::run_init(char *xml, int sg_number)
113 { 110 {
114 HTaskPtr task_next; 111 HTaskPtr task_next;
112 HTaskPtr task_tex;
115 113
116 start_time = get_ticks(); 114 start_time = get_ticks();
117 this_time = 0; 115 this_time = 0;
118 frames = 0; 116 frames = 0;
119 117
160 // spackList_length*sizeof(SpanPack*) が 16 倍数になるような 158 // spackList_length*sizeof(SpanPack*) が 16 倍数になるような
161 // length_align を求めている。 159 // length_align を求めている。
162 spackList_length_align = (spackList_length + 3)&(~3); 160 spackList_length_align = (spackList_length + 3)&(~3);
163 161
164 /* 各 SPU が持つ、SpanPack の address list */ 162 /* 各 SPU が持つ、SpanPack の address list */
165 spackList_ptr = (SpanPack**)manager->malloc(sizeof(SpanPack*)*spackList_length_align); 163 spackList_ptr =
164 (SpanPack**)manager->malloc(sizeof(SpanPack*)*spackList_length_align);
166 165
167 for (int i = 0; i < spackList_length; i++) { 166 for (int i = 0; i < spackList_length; i++) {
168 spackList_ptr[i] = &spackList[i]; 167 spackList_ptr[i] = &spackList[i];
169 } 168 }
170 169
188 187
189 int tex_width = scene_graph->texture_image->w; 188 int tex_width = scene_graph->texture_image->w;
190 int tex_height = scene_graph->texture_image->h; 189 int tex_height = scene_graph->texture_image->h;
191 int tex_blocksize = tex_width*tex_height*4; 190 int tex_blocksize = tex_width*tex_height*4;
192 191
193 __texture = (void*)manager->malloc(tex_blocksize); 192 for (int i = 0; i < spe_num; i++) {
194 memcpy(__texture, scene_graph->texture_image->pixels, tex_blocksize); 193 task_tex = manager->create_task(TASK_INIT_TEXTURE);
194 task_tex->set_cpu((CPU_TYPE)((int)SPE_0 + i));
195 task_next->wait_for(task_tex);
196 task_tex->spawn();
197 }
195 198
196 task_next->spawn(); 199 task_next->spawn();
197 } 200 }
198 201
199 void 202 void
357 360
358 scene_graph->delete_data(); 361 scene_graph->delete_data();
359 scene_graph->controller->close(); 362 scene_graph->controller->close();
360 delete scene_graph; 363 delete scene_graph;
361 364
362 free(__texture);
363 quit(); 365 quit();
364 } 366 }