annotate TaskManager/Test/test_render/spe/DrawSpan.cpp @ 192:6694da357750 draft

add example/renew_task
author gongo@localhost.localdomain
date Tue, 13 Jan 2009 10:41:05 +0900
parents fe854a6ee9e2
children 1ff24ca2f016
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
1 #include <stdlib.h>
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
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>
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
4 #include "DrawSpan.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
5 #include "polygon_pack.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
6 #include "texture.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
7 #include "viewer_types.h"
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
8 #include "Func.h"
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
9
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
10 #define SPAN_PACK_LOAD 0
120
13b43de5ef5d fix Load Texture
gongo@gendarme.local
parents: 109
diff changeset
11 #define TEX_LOAD 1
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
12
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
13 SchedDefineTask(DrawSpan);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
14
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
15 /**
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
16 * ƥϡTEXTURE_SPLIT_PIXEL^2 Υ֥åʬ䤹
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
17 *
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
18 * +---+---+---+---+---+---+
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
19 * | 0 | 1 | 2 | 3 | 4 | 5 |
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
20 * +---+---+---+---+---+---+
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
21 * | | | | | |11 |
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
22 * +---+---+---+---+---+---+
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
23 * | | | | | |17 |
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
24 * +---+---+---+---+---+---+
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
25 * | | | | | |23 |
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
26 * +---+---+---+---+---+---+
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
27 * | | | | | |29 |
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
28 * +---+---+---+---+---+---+
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
29 * | | | | | |35 |
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
30 * +---+---+---+---+---+---+
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
31 *
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
32 * դ TEXTURE_SPLIT Ȥ
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
33 * ƥ֥åο֥åIDȤʤ롣
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
34 */
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
35
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
36 /**
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
37 * ƥκɸ顢
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
38 * ƥΤɤΥ֥å
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
39 *
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
40 * @param[in] tx X coordinates of texture
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
41 * @param[in] tx Y coordinates of texture
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
42 * @param[in] twidth Width of texture
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
43 * @return block ID
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
44 */
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
45 int
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
46 DrawSpan::getTexBlock(int tx, int ty, int twidth)
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
47 {
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
48 int blockX, blockY;
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
49
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
50 blockX = tx / TEXTURE_SPLIT_PIXEL;
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
51 blockY = ty / TEXTURE_SPLIT_PIXEL;
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
52
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
53 return blockX + (twidth/TEXTURE_SPLIT_PIXEL)*blockY;
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
54 }
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
55
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
56 /**
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
57 * block ID ȡƥ TOP address
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
58 * (tx,ty) ǻȤƥ Tile addres
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
59 *
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
60 * @param[in] tx X coordinates of texture
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
61 * @param[in] tx Y coordinates of texture
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
62 * @param[in] tw Width of texture
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
63 * @param[in] tex_addr_top (tx,ty) ǻȤƥƬaddress
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
64 * @return block ID
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
65 */
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
66 uint32*
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
67 DrawSpan::getTile(int tx, int ty, int tw, uint32 *tex_addr_top)
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
68 {
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
69 int block = getTexBlock(tx, ty, tw);
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
70 return tex_addr_top + block*TEXTURE_BLOCK_SIZE;
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
71 }
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
72
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
73 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
74 DrawSpan::linebuf_init(int *buf, int x, int rgb)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
75 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
76 for (int i = 0; i < x; i++) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
77 buf[i] = rgb;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
78 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
79 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
80
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
81 /**
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
82 * Span Ȥ Texture Tile 뤫
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
83 *
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
84 * @retval != NULL ¸ߤ
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
85 * @retval NULL ¸ߤʤ
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
86 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
87 TilePtr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
88 DrawSpan::isAvailableTile(uint32 *addr)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
89 {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
90 return hash->get(addr);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
91 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
92
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
93 void
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
94 DrawSpan::set_rgb(uint32 *addr)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
95 {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
96 TilePtr tile;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
97
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
98 if (!isAvailableTile(addr)) {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
99 tile = tileList->nextTile();
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
100 /**
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
101 * FIFO ʤΤǡ⤷ΤĤäƤк
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
102 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
103 hash->remove(tile->texture_addr);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
104
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
105 tile->texture_addr = addr;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
106
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
107 hash->put(tile->texture_addr, tile);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
108
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
109 smanager->dma_load(tile->pixel, (uint32)addr,
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
110 sizeof(uint32)*TEXTURE_BLOCK_SIZE, TEX_LOAD);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
111
188
fe854a6ee9e2 メモりリーク箇所発見:TaskManager/Test/test_render/ChangeLog参照
gongo@localhost.localdomain
parents: 186
diff changeset
112 //smanager->dma_wait(TEX_LOAD);
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
113 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
114 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
115
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
116 void
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
117 DrawSpan::set_rgbs(uint32 *addr, uint32 *max_addr)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
118 {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
119 uint32 start = (uint32)addr;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
120 uint32 end = (uint32)max_addr;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
121 uint32 length = end-start;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
122 uint32 diff = sizeof(uint32)*TEXTURE_BLOCK_SIZE;
188
fe854a6ee9e2 メモりリーク箇所発見:TaskManager/Test/test_render/ChangeLog参照
gongo@localhost.localdomain
parents: 186
diff changeset
123 uint32 max_tile = 16;
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
124
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
125 for (uint32 i = 0, j = 0; i <= length && j < max_tile; i += diff, j++) {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
126 set_rgb((uint32*)(start + i));
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
127 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
128 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
129
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
130 Uint32
166
gongo@localhost.localdomain
parents: 165
diff changeset
131 DrawSpan::get_rgb(int tx, int ty, uint32 *addr)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
132 {
148
74341c8bf935 Span への Texture List の渡し。じゃっかん texture がバグってるので
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 147
diff changeset
133 TilePtr tile;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
134
167
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 166
diff changeset
135 tile = hash->get(addr);
168
f533a4104d41 Delete DrawSpan::get_pixel().
gongo@localhost.localdomain
parents: 167
diff changeset
136 return tile->pixel[(TEXTURE_SPLIT_PIXEL)*ty+tx];
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
137 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
138
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
139 /**
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
140 * DrawSpan κƵư (DrawSpanRenew )
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
141 *
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
142 * @param[in] spack ߽Ƥ SpanPack
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
143 * @param[in] cur_span_x span->length_x != 1 λ Span ν
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
144 * ɤޤǿʤǤ뤫
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
145 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
146 void
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
147 DrawSpan::reboot(SpanPackPtr spack, int cur_span_x)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
148 {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
149 TaskPtr renew_task = smanager->create_task(TASK_DRAW_SPAN2);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
150 int rangey = smanager->get_param(2);
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
151
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
152 /**
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
153 * ̤ outData, param ϤΤޤϤ
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
154 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
155 for (int i = 0; i < rangey; i++) {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
156 renew_task->add_outData(smanager->get_outputAddr(i),
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
157 smanager->get_outputSize(i));
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
158 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
159
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
160 // rangex_start, rangex_end, rangey
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
161 renew_task->add_param(smanager->get_param(0));
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
162 renew_task->add_param(smanager->get_param(1));
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
163 renew_task->add_param(smanager->get_param(2));
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
164
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
165 /**
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
166 * SpanPack ³鳫ϤΤǡ
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
167 * ߤξ֤򥳥ԡƤ
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
168 * spack rbuf Ƥǽ
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
169 * rbuf ϥƥबưŪ free() 뤿
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
170 * ɥ쥹ϤΤNG
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
171 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
172 SpanPackPtr curr = (SpanPackPtr)smanager->allocate(sizeof(SpanPack));
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
173 memcpy(curr, spack, sizeof(SpanPack));
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
174 renew_task->add_param((int)curr);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
175 renew_task->add_param(cur_span_x);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
176
192
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents: 188
diff changeset
177 fprintf(stderr, "[%p] start %u\n",
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents: 188
diff changeset
178 curr, spu_readch(SPU_RdDec));
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents: 188
diff changeset
179
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
180 /**
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
181 * ƵưԤ
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
182 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
183 smanager->wait_task(renew_task);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
185 // next_spack free() Τ wait
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
186 smanager->dma_wait(SPAN_PACK_LOAD);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
187 }
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
188
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
189 int
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
190 DrawSpan::run(void *rbuf, void *wbuf)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
191 {
167
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 166
diff changeset
192 hash = (TileHashPtr)smanager->global_get(GLOBAL_TEXTURE_HASH);
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 166
diff changeset
193 tileList = (TileListPtr)smanager->global_get(GLOBAL_TILE_LIST);
128
95e2046eb46f texture load use hash table
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 126
diff changeset
194
182
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
195 int rangex_start = smanager->get_param(0);
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
196 int rangex_end = smanager->get_param(1);
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
197
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
198 // Υô x ϰ
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
199 int rangex = rangex_end - rangex_start + 1;
182
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
200
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
201 // y ϰ (render_y + rangey - 1)
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
202 int rangey = smanager->get_param(2);
177
deb02b0e6291 zRow の生成、初期化の変更
gongo@localhost.localdomain
parents: 174
diff changeset
203
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
204 float *zRow = (float*)smanager->allocate(sizeof(float)*rangex*rangey);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
205
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
206 for (int i = 0; i < rangex*rangey; i++) {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
207 zRow[i] = 65535.0f;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
208 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
209
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
210 int **linebuf = (int**)smanager->allocate(sizeof(int*)*rangey);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
211
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
212 for (int i = 0; i < rangey; i++) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
213 linebuf[i] = (int*)smanager->get_output(i);
170
5a4f2497c22d fix ViewerSDL
gongo@localhost.localdomain
parents: 168
diff changeset
214 linebuf_init(linebuf[i], rangex, 0xffffffff);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
215 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
216
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
217 SpanPackPtr spack = (SpanPackPtr)smanager->get_input(0);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
218 SpanPackPtr next_spack = (SpanPackPtr)smanager->allocate(sizeof(SpanPack));
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
219 SpanPackPtr free_spack = next_spack; // next_spack free()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
220 Span *span;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
221
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
222 do {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
223 /**
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
224 * SpanPack->next ¸ߤ硢
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
225 * ߤ SpanPack Ƥ֤
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
226 * SpanPack DMA žԤ
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
227 */
182
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
228 if (spack->next != NULL) {
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
229 smanager->dma_load(next_spack, (uint32)spack->next,
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
230 sizeof(SpanPack), SPAN_PACK_LOAD);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
231 } else {
182
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
232 next_spack = NULL;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
233 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
234
182
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
235 for (int t = 0; t < spack->info.size; t++) {
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
236 span = &spack->span[t];
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
237
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
238 Uint32 rgb = 0x00ff00;
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
239 float tex1 = span->tex_x1;
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
240 float tex2 = span->tex_x2;
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
241 float tey1 = span->tex_y1;
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
242 float tey2 = span->tex_y2;
147
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
243
166
gongo@localhost.localdomain
parents: 165
diff changeset
244 /**
gongo@localhost.localdomain
parents: 165
diff changeset
245 * Span 1 pixel
gongo@localhost.localdomain
parents: 165
diff changeset
246 * ƥκɸ
gongo@localhost.localdomain
parents: 165
diff changeset
247 */
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
248 int tex_xpos;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
249 int tex_ypos;
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
250
166
gongo@localhost.localdomain
parents: 165
diff changeset
251 /**
gongo@localhost.localdomain
parents: 165
diff changeset
252 * (tex_xpos, tex_ypos) Ρ֥å(ο޻)Ǥκɸ
gongo@localhost.localdomain
parents: 165
diff changeset
253 * Υ֥åΥɥ쥹(MainMemory)
gongo@localhost.localdomain
parents: 165
diff changeset
254 */
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
255 int tex_localx;
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
256 int tex_localy;
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
257 uint32 *tex_addr;
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
258
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
259 int x = span->x;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
260 int y = span->y;
133
8f1419174cdf DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 131
diff changeset
261 int x_len = span->length_x;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
262 float z = span->start_z;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
263 float zpos = span->end_z;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
264
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
265 // ɸ [0 .. split_screen_w-1] 褦 x,y -1
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
266 int localx = getLocalX(x-1);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
267 int localy = getLocalY(y-1);
131
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 128
diff changeset
268
133
8f1419174cdf DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 131
diff changeset
269 if (x_len == 1) {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
270 if (x < rangex_start || rangex_end < x) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
271 continue;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
272 }
148
74341c8bf935 Span への Texture List の渡し。じゃっかん texture がバグってるので
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 147
diff changeset
273
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
274 tex_xpos = (int)((span->tex_width-1) * tex1);
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
275 tex_ypos = (int)((span->tex_height-1) * tey1);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
276
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
277 if (zpos < zRow[localx + (rangex * localy)]) {
166
gongo@localhost.localdomain
parents: 165
diff changeset
278 tex_addr = getTile(tex_xpos, tex_ypos,
gongo@localhost.localdomain
parents: 165
diff changeset
279 span->tex_width, span->tex_addr);
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
280 tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL;
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
281 tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL;
166
gongo@localhost.localdomain
parents: 165
diff changeset
282
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
283 /**
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
284 * Tile ̵硢öϤǤ
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
285 * Tile ɤ륿餻˺Ƶư
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
286 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
287 if (!isAvailableTile(tex_addr)) {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
288 spack->info.start = t;
192
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents: 188
diff changeset
289 set_rgb(tex_addr);
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents: 188
diff changeset
290 //set_rgbs(tex_addr,
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents: 188
diff changeset
291 //getTile(span->tex_width-1, tex_ypos,
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents: 188
diff changeset
292 //span->tex_width, span->tex_addr));
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents: 188
diff changeset
293 //reboot(spack, 0);
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents: 188
diff changeset
294 //goto FINISH;
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
295 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
296
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
297 rgb = get_rgb(tex_localx, tex_localy, tex_addr);
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
298
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
299 zRow[localx + (rangex * localy)] = zpos;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
300 linebuf[localy][localx] = rgb;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
301 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
302 } else {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
303 int js = (x < rangex_start) ? rangex_start - x : 0;
133
8f1419174cdf DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 131
diff changeset
304 int je = (x + x_len > rangex_end) ? rangex_end - x : x_len;
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
305 float tex_x, tex_y, tex_z;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
306
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
307 for (int j = js; j <= je; j++) {
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
308 localx = getLocalX(x-1+j);
148
74341c8bf935 Span への Texture List の渡し。じゃっかん texture がバグってるので
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 147
diff changeset
309
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
310 tex_z = z*(x_len-1-j)/(x_len-1) + zpos*j/(x_len-1);
133
8f1419174cdf DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 131
diff changeset
311
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
312 tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1);
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
313 tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1);
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
314 if (tex_x > 1) tex_x = 1;
165
gongo@localhost.localdomain
parents: 164
diff changeset
315 if (tex_x < 0) tex_x = 0;
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
316 if (tex_y > 1) tex_y = 1;
165
gongo@localhost.localdomain
parents: 164
diff changeset
317 if (tex_y < 0) tex_y = 0;
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
318 tex_xpos = (int)((span->tex_width-1) * tex_x);
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
319 tex_ypos = (int)((span->tex_height-1) * tex_y);
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
320
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
321 if (tex_z < zRow[localx + (rangex*localy)]) {
166
gongo@localhost.localdomain
parents: 165
diff changeset
322 tex_addr = getTile(tex_xpos, tex_ypos,
gongo@localhost.localdomain
parents: 165
diff changeset
323 span->tex_width, span->tex_addr);
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
324 tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL;
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
325 tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL;
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
326
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
327 if (!isAvailableTile(tex_addr)) {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
328 spack->info.start = t;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
329 //set_rgb(tex_addr);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
330 set_rgbs(tex_addr,
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
331 getTile(span->tex_width-1, tex_ypos,
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
332 span->tex_width, span->tex_addr));
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
333 reboot(spack, j);
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
334 goto FINISH;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
335 }
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
336
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
337 rgb = get_rgb(tex_localx, tex_localy, tex_addr);
168
f533a4104d41 Delete DrawSpan::get_pixel().
gongo@localhost.localdomain
parents: 167
diff changeset
338
164
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
339 zRow[localx + (rangex*localy)] = tex_z;
dc7d10ae7460 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
340 linebuf[localy][localx] = rgb;
147
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
341 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
342 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
343 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
344 }
147
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
345
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
346 smanager->dma_wait(SPAN_PACK_LOAD);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
347
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
348 SpanPackPtr tmp_spack = spack;
182
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
349 spack = next_spack;
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
350 next_spack = tmp_spack;
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
351 } while (spack);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
352
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
353
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 182
diff changeset
354 FINISH:
182
8e9ada0c1ed0 add get_inputAddr, get_outputAddr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
355 free(free_spack);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
356 free(linebuf);
186
gongo@localhost.localdomain
parents: 184
diff changeset
357 free(zRow);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
358
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
359 return 0;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
360 }