annotate TaskManager/Test/test_render/task/DrawSpanRenew.cpp @ 238:443c7ae1c7a7 draft

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