annotate TaskManager/Test/test_render/spe/DrawSpanRenew.cpp @ 210:e75f9eb97180 draft

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