annotate TaskManager/Test/test_render/task/DrawSpanRenew.cpp @ 186:f7ad032575ed

fix
author gongo@localhost.localdomain
date Tue, 06 Jan 2009 16:18:37 +0900
parents bdc08777197e
children 06f39635a9b0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
185
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
1 #include <stdlib.h>
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
2 #include <string.h>
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
3 #include "DrawSpanRenew.h"
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
4 #include "polygon_pack.h"
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
5 #include "SpanPack.h"
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
6 #include "texture.h"
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
7 #include "viewer_types.h"
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
8 #include "Func.h"
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
9
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
10 #define SPAN_PACK_LOAD 0
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
11 #define TEX_LOAD 1
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
12
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
13 SchedDefineTask(DrawSpanRenew);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
14
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
15 int
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
16 DrawSpanRenew::run(void *rbuf, void *wbuf)
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
17 {
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
18 hash = (TileHashPtr)smanager->global_get(GLOBAL_TEXTURE_HASH);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
19 tileList = (TileListPtr)smanager->global_get(GLOBAL_TILE_LIST);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
20
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
21 int rangex_start = smanager->get_param(0);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
22 int rangex_end = smanager->get_param(1);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
23
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
24 // このタスクが担当する x の範囲
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
25 int rangex = rangex_end - rangex_start + 1;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
26
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
27 // y の範囲 (render_y + rangey - 1)
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
28 int rangey = smanager->get_param(2);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
29
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
30 float *zRow = (float*)smanager->allocate(sizeof(float)*rangex*rangey);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
31
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
32 for (int i = 0; i < rangex*rangey; i++) {
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
33 zRow[i] = 65535.0f;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
34 }
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
35
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
36 int **linebuf = (int**)smanager->allocate(sizeof(int*)*rangey);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
37
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
38 for (int i = 0; i < rangey; i++) {
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
39 linebuf[i] = (int*)smanager->get_output(i);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
40 linebuf_init(linebuf[i], rangex, 0xffffffff);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
41 }
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
42
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
43 SpanPackPtr spack = (SpanPackPtr)smanager->get_param(3);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
44 SpanPackPtr next_spack = (SpanPackPtr)smanager->allocate(sizeof(SpanPack));
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
45 Span *span;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
46
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
47 // span->length_x の処理での再起動位置
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
48 int js_cont = smanager->get_param(4);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
49
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
50 do {
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
51 /**
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
52 * SpanPack->next が存在する場合、
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
53 * 現在の SpanPack を処理してる間に
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
54 * 次の SpanPack の DMA 転送を行う
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
55 */
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
56 if (spack->next != NULL) {
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
57 smanager->dma_load(next_spack, (uint32)spack->next,
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
58 sizeof(SpanPack), SPAN_PACK_LOAD);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
59 } else {
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
60 next_spack = NULL;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
61 }
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
62
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
63 for (int t = spack->info.start; t < spack->info.size; t++) {
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
64 span = &spack->span[t];
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
65
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
66 Uint32 rgb = 0x00ff00;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
67 float tex1 = span->tex_x1;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
68 float tex2 = span->tex_x2;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
69 float tey1 = span->tex_y1;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
70 float tey2 = span->tex_y2;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
71
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
72 /**
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
73 * Span が持つ 1 pixel 毎の
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
74 * テクスチャの座標
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
75 */
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
76 int tex_xpos;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
77 int tex_ypos;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
78
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
79 /**
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
80 * (tex_xpos, tex_ypos) の、ブロック内(上の図参照)での座標と
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
81 * そのブロックのアドレス(MainMemory)
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
82 */
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
83 int tex_localx;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
84 int tex_localy;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
85 uint32 *tex_addr;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
86
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
87 int x = span->x;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
88 int y = span->y;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
89 int x_len = span->length_x;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
90 float z = span->start_z;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
91 float zpos = span->end_z;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
92
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
93 // 座標が [0 .. split_screen_w-1] に入るように x,y を -1
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
94 int localx = getLocalX(x-1);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
95 int localy = getLocalY(y-1);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
96
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
97 if (x_len == 1) {
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
98 if (x < rangex_start || rangex_end < x) {
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
99 continue;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
100 }
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
101
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
102 tex_xpos = (int)((span->tex_width-1) * tex1);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
103 tex_ypos = (int)((span->tex_height-1) * tey1);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
104
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
105 if (zpos < zRow[localx + (rangex * localy)]) {
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
106 tex_addr = getTile(tex_xpos, tex_ypos,
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
107 span->tex_width, span->tex_addr);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
108 tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
109 tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
110
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
111 /**
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
112 * Tile が無い場合、一旦タスクはここで中断し、
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
113 * Tile をロードするタスクを走らせた後に再起動する
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
114 */
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
115 if (!isAvailableTile(tex_addr)) {
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
116 spack->info.start = t;
186
gongo@localhost.localdomain
parents: 185
diff changeset
117 set_rgb(tex_addr);
gongo@localhost.localdomain
parents: 185
diff changeset
118 //set_rgbs(tex_addr,
gongo@localhost.localdomain
parents: 185
diff changeset
119 //getTile(span->tex_width-1, tex_ypos,
gongo@localhost.localdomain
parents: 185
diff changeset
120 //span->tex_width, span->tex_addr));
gongo@localhost.localdomain
parents: 185
diff changeset
121 //reboot(spack, 0);
gongo@localhost.localdomain
parents: 185
diff changeset
122 //goto FINISH;
185
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
123 }
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
124
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
125 rgb = get_rgb(tex_localx, tex_localy, tex_addr);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
126
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
127 zRow[localx + (rangex * localy)] = zpos;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
128 linebuf[localy][localx] = rgb;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
129 }
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
130 } else {
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
131 int js = (x < rangex_start) ? rangex_start - x : 0;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
132 int je = (x + x_len > rangex_end) ? rangex_end - x : x_len;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
133 float tex_x, tex_y, tex_z;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
134
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
135 /**
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
136 * 一回比較すれば、以後再起動するまでは
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
137 * js_cont は使わないから 0 にしてるわけだけど、
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
138 * 最初の一回のためだけにこれはめんどくさいのー。
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
139 */
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
140 js = (js < js_cont) ? js_cont : js;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
141 js_cont = 0;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
142
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
143 for (int j = js; j <= je; j++) {
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
144 localx = getLocalX(x-1+j);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
145
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
146 tex_z = z*(x_len-1-j)/(x_len-1) + zpos*j/(x_len-1);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
147
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
148 tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
149 tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
150 if (tex_x > 1) tex_x = 1;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
151 if (tex_x < 0) tex_x = 0;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
152 if (tex_y > 1) tex_y = 1;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
153 if (tex_y < 0) tex_y = 0;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
154 tex_xpos = (int)((span->tex_width-1) * tex_x);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
155 tex_ypos = (int)((span->tex_height-1) * tex_y);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
156
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
157 if (tex_z < zRow[localx + (rangex*localy)]) {
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
158 tex_addr = getTile(tex_xpos, tex_ypos,
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
159 span->tex_width, span->tex_addr);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
160 tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
161 tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
162
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
163 if (!isAvailableTile(tex_addr)) {
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
164 spack->info.start = t;
186
gongo@localhost.localdomain
parents: 185
diff changeset
165 set_rgb(tex_addr);
gongo@localhost.localdomain
parents: 185
diff changeset
166 //set_rgbs(tex_addr,
gongo@localhost.localdomain
parents: 185
diff changeset
167 //getTile(span->tex_width-1, tex_ypos,
gongo@localhost.localdomain
parents: 185
diff changeset
168 //span->tex_width, span->tex_addr));
gongo@localhost.localdomain
parents: 185
diff changeset
169 //reboot(spack, j);
gongo@localhost.localdomain
parents: 185
diff changeset
170 //goto FINISH;
185
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
171 }
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
172
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
173 rgb = get_rgb(tex_localx, tex_localy, tex_addr);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
174
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
175 zRow[localx + (rangex*localy)] = tex_z;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
176 linebuf[localy][localx] = rgb;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
177 }
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
178 }
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
179 }
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
180 }
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
181
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
182 smanager->dma_wait(SPAN_PACK_LOAD);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
183
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
184 SpanPackPtr tmp_spack = spack;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
185 spack = next_spack;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
186 next_spack = tmp_spack;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
187 } while (spack);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
188
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
189
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
190 FINISH:
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
191 free(next_spack);
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
192 free(linebuf);
186
gongo@localhost.localdomain
parents: 185
diff changeset
193 free(zRow);
gongo@localhost.localdomain
parents: 185
diff changeset
194
gongo@localhost.localdomain
parents: 185
diff changeset
195 // Renew したタスクで allocate されたものなので、これも free
gongo@localhost.localdomain
parents: 185
diff changeset
196 free(spack);
185
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
197
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
198 return 0;
bdc08777197e add file
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
199 }