annotate TaskManager/Test/test_render/spe/DrawSpan.cpp @ 188:fe854a6ee9e2 draft

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