annotate TaskManager/Test/test_render/spe/CreateSpan.cpp @ 314:2ddf79a7c5fb

debugging
author root@localhost.localdomain
date Tue, 09 Jun 2009 01:22:11 +0900
parents 59c3b9df3c67
children 7efc5ede2c03
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
314
2ddf79a7c5fb debugging
root@localhost.localdomain
parents: 244
diff changeset
1 #define DEBUG
2ddf79a7c5fb debugging
root@localhost.localdomain
parents: 244
diff changeset
2 #include "error.h"
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
3 #include "CreateSpan.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
4 #include "viewer_types.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
5
244
59c3b9df3c67 mail modify
e065746@localhost.localdomain
parents: 233
diff changeset
6 // DMA channel
164
38cbb7aecc70 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
7 static const int SPAN_PACK_LOAD = 5;
38cbb7aecc70 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
8 static const int SPAN_PACK_STORE = 6;
38cbb7aecc70 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
9 static const int POLYGON_PACK_LOAD = 7;
38cbb7aecc70 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
10 static const int TILE_ALLOCATE = 8;
38cbb7aecc70 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
11 static const int TILE_LOAD = 9;
38cbb7aecc70 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
12 static const int TILE_STORE = 10;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
13
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
14 static SpanPackPtr spack = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
15 static SpanPackPtr send_spack = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
16 static int prev_index = 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
17
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
18 SchedDefineTask(CreateSpan);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
19
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
20 static float
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
21 calc(float f1, float f2,int i, float base)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
22 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
23 float ans;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
24 ans = f1/f2*i + base;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
25 return ans;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
26 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
27
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
28
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
29 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
30 * TrianglePack から、vMin, vMid, vMax を求める
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
31 *
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
32 * @param [triPack] TrianglePack
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
33 * @param [vMin] [vMid] [vMax]
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
34 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
35 static void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
36 make_vertex(TrianglePack *triPack,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
37 VertexPackPtr *vMin, VertexPackPtr *vMid, VertexPackPtr *vMax)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
38 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
39 if (triPack->ver1.y <= triPack->ver2.y) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
40 if (triPack->ver2.y <= triPack->ver3.y) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
41 *vMin = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
42 *vMid = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
43 *vMax = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
44 } else if (triPack->ver3.y <= triPack->ver1.y) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
45 *vMin = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
46 *vMid = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
47 *vMax = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
48 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
49 *vMin = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
50 *vMid = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
51 *vMax = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
52 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
53 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
54 if (triPack->ver1.y <= triPack->ver3.y) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
55 *vMin = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
56 *vMid = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
57 *vMax = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
58 } else if (triPack->ver3.y <= triPack->ver2.y) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
59 *vMin = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
60 *vMid = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
61 *vMax = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
62 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
63 *vMin = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
64 *vMid = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
65 *vMax = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
66 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
67 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
68 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
69
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
70 static void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
71 make_vMid10(VertexPack *v, VertexPack *vMin,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
72 VertexPack *vMid, VertexPack *vMax)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
73 {
146
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
74 //int d, d1;
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
75 float d;
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
76 int d1;
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
77
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
78 d = vMax->y - vMin->y;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
79 d1 = (int)(vMid->y - vMin->y);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
80
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
81 v->tex_x = calc(vMax->tex_x - vMin->tex_x, d, d1, vMin->tex_x);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
82 v->tex_y = calc(vMax->tex_y - vMin->tex_y, d, d1, vMin->tex_y);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
83 v->x = calc(vMax->x - vMin->x, d, d1, vMin->x);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
84 v->y = vMid->y;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
85 v->z = calc(vMax->z - vMin->z, d, d1, vMin->z);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
86 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
87
156
gongo@gendarme.local
parents: 155
diff changeset
88 /**
174
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
89 * 与えられた scale から、実際に使うテクスチャの Tapestry を選択する
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
90 *
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
91 * テクスチャは、オリジナルのサイズから、可能なかぎり 1/2 で縮小していき、
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
92 * 下の図の様に連続した領域に入れられる
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
93 *
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
94 * Tapestry (1)
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
95 * +---+---+---+---+
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
96 * | 0 | 1 | 2 | 3 |
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
97 * +---+---+---+---+
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
98 * | 4 | 5 | 6 | 7 | (2)
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
99 * +---+---+---+---+ +---+---+
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
100 * | 8 | 9 | 10| 11| | 16| 17| (3)
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
101 * +---+---+---+---+ +---+---+ +---+
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
102 * | 12| 13| 14| 15| | 18| 19| | 20|
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
103 * +---+---+---+---+ +---+---+ +---|
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
104 *
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
105 * (1) (2) (3)
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
106 * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
107 * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * | * | * | 14| 15| 16| 17| 18| 19| 20|
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
108 * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
109 *
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
110 * scale の値から、各 Tapestry の先頭アドレスを返す
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
111 *
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
112 * @param[in] tw Width of texture
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
113 * @param[in] th Height of texture
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
114 * @param[in] scale テクスチャの縮小率 (= 2^n)
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
115 * @param[in] addr_top テクスチャの先頭アドレス (上の図での (1)
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
116 * @return scale に対応する Tapestry のアドレス (上の図での (1) or (2) or(3)
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
117 */
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
118 static uint32*
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
119 getTapestry(int tw, int th, int scale, uint32 *addr_top)
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
120 {
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
121 int index = 0;
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
122
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
123 for (int s = 1; s < scale; s <<= 1) {
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
124 index += tw*th;
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
125 tw >>= 1; /* tw /= 2 */
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
126 th >>= 1;
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
127 }
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
128
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
129 return addr_top + index;
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
130 }
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
131
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
132
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
133 /**
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 180
diff changeset
134 * span の width,height と texture の width,height を比べて
172
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
135 * span を描画する際に使う texture の比率を求める
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
136 *
175
3cc5f0000e29 add file "ChangeLog"
gongo@localhost.localdomain
parents: 174
diff changeset
137 * @param[in] width Width of span
3cc5f0000e29 add file "ChangeLog"
gongo@localhost.localdomain
parents: 174
diff changeset
138 * @param[in] height Height of span
3cc5f0000e29 add file "ChangeLog"
gongo@localhost.localdomain
parents: 174
diff changeset
139 * @param[in] tex_width Width of 1/1 texture that span use
3cc5f0000e29 add file "ChangeLog"
gongo@localhost.localdomain
parents: 174
diff changeset
140 * @param[in] tex_height Height of 1/1 texture that span use
3cc5f0000e29 add file "ChangeLog"
gongo@localhost.localdomain
parents: 174
diff changeset
141 * @param[in] scale_max この Span で使う texture の最大縮小率
174
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
142 * 計算結果が scale_max 以上になるのを防ぐ
172
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
143 * @return 描画に使う texture の比率
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
144 * width と height は 1/scale の画像を使う
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
145 *
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
146 */
169
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 164
diff changeset
147 static int
174
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
148 getScale(int width, int height, int tex_width, int tex_height, int scale_max)
169
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 164
diff changeset
149 {
172
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
150 int base, tex_base;
169
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 164
diff changeset
151 int scale = 1;
172
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
152
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
153 /**
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
154 * width と height で、長い方を基準に、
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
155 * texture の scale を決める
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
156 */
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
157 if (width > height) {
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
158 base = width;
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
159 tex_base = tex_width;
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
160 } else {
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
161 base = height;
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
162 tex_base = tex_height;
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
163 }
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
164
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
165 if (tex_base > base) {
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
166 int t_scale = tex_base/base;
169
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 164
diff changeset
167 while (t_scale >>= 1) {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 164
diff changeset
168 scale <<= 1;
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 164
diff changeset
169 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 164
diff changeset
170 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 164
diff changeset
171
174
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
172 return (scale > scale_max) ? scale_max : scale;
194
gongo@localhost.localdomain
parents: 184
diff changeset
173 //return scale_max;
169
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 164
diff changeset
174 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 164
diff changeset
175
141
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
176 /**
133
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
177 * x軸に水平な辺を持つ三角形ポリゴンから、
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
178 * Span を抜き出す
172
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
179 *
175
3cc5f0000e29 add file "ChangeLog"
gongo@localhost.localdomain
parents: 174
diff changeset
180 * @param[in] spackList triangle から生成された span を格納する List
3cc5f0000e29 add file "ChangeLog"
gongo@localhost.localdomain
parents: 174
diff changeset
181 * @param[in] charge_y_top 担当する y の範囲開始地点
3cc5f0000e29 add file "ChangeLog"
gongo@localhost.localdomain
parents: 174
diff changeset
182 * @param[in] charge_y_end 担当する y の範囲終了地点
3cc5f0000e29 add file "ChangeLog"
gongo@localhost.localdomain
parents: 174
diff changeset
183 * @param[in] tex_addr triangle が参照するテクスチャの先頭アドレス
3cc5f0000e29 add file "ChangeLog"
gongo@localhost.localdomain
parents: 174
diff changeset
184 * @param[in] tex_width テクスチャの width
3cc5f0000e29 add file "ChangeLog"
gongo@localhost.localdomain
parents: 174
diff changeset
185 * @param[in] tex_height テクスチャの height
176
gongo@localhost.localdomain
parents: 175
diff changeset
186 * @param[in] tex_scale_max テクスチャの最大縮小率 (2^n)
175
3cc5f0000e29 add file "ChangeLog"
gongo@localhost.localdomain
parents: 174
diff changeset
187 * @param[in] vMin triangle の座標
3cc5f0000e29 add file "ChangeLog"
gongo@localhost.localdomain
parents: 174
diff changeset
188 * @param[in] vMid triangle の座標。triangle を二つに分けて出来た新しい座標
3cc5f0000e29 add file "ChangeLog"
gongo@localhost.localdomain
parents: 174
diff changeset
189 * @param[in] vMid10 triangle の座標
176
gongo@localhost.localdomain
parents: 175
diff changeset
190 * @param[in] length_y 分割する前の Triangle の y の長さ
gongo@localhost.localdomain
parents: 175
diff changeset
191 * @param[in] tex_y_len 分割する前の Triangle に貼られている Texture の
gongo@localhost.localdomain
parents: 175
diff changeset
192 * 長さの割合 (0 ... 1)
133
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
193 */
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
194 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
195 CreateSpan::half_triangle(SpanPackPtr *spackList,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
196 int charge_y_top, int charge_y_end,
210
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
197 TriangleTexInfoPtr tex_info,
172
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
198 VertexPack *vMin,VertexPack *vMid,VertexPack *vMid10,
176
gongo@localhost.localdomain
parents: 175
diff changeset
199 int length_y, float tex_y_len)
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
200 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
201 float tmp_z,tmp_tex1, tmp_tex2 ,tmp_tey1,tmp_tey2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
202 float tmp_xpos,tmp_end,tmp_zpos;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
203 float start_z, end_z;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
204 float start_tex_x, end_tex_x, start_tex_y, end_tex_y;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
205 int x, y, length;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
206
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
207 #if 1
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
208 // これじゃないと
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
209 // テクスチャの貼りに微妙に隙間が。謎だ
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
210 int start_y = (int)vMid->y;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
211 int end_y = (int)vMin->y;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
212 #else
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
213 float start_y = vMid->y;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
214 float end_y = vMin->y;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
215 #endif
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
216 float div_y = start_y - end_y;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
217 int k = 0;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
218 int l = 1;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
219
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
220 SpanPackPtr tmp_spack;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
221
135
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
222 /**
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
223 * 三角形ポリゴンをx軸に水平に二つに分けようとして
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
224 * ある一辺がすでに水平だった場合、つまり
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
225 *
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
226 * |\
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
227 * | \
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
228 * | \
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
229 * -----
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
230 *
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
231 *
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
232 * 上のようなポリゴンだった場合は、本来なら上の部分の三角形にだけ
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
233 * half_triangle の処理をするべきだが、現在の処理だと
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
234 * この half_triangle に「上の部分の三角形」と、
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
235 * 「『下の部分の三角形と判断してしまった』直線」が来てしまう。
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
236 * 直線の部分が来ると、calc() で 0 除算とかで、値不定で暴走するので
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
237 * 現在はこれで代用。
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
238 * half_triangle 呼ぶ前にこれを判断できれば良いかもしれない。
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
239 * てかこんなんでいいのかよ。。。
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
240 */
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
241 #if 1
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
242 if ((int)div_y == 0) {
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
243 return;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
244 }
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
245 #else
135
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
246 if (vMid10->x == vMin->x && vMid10->y == vMin->y) {
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
247 return;
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
248 }
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
249 #endif
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
250
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
251 if (div_y < 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
252 div_y = -div_y;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
253 k = 1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
254 l = -1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
255 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
256
135
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
257 for (int i = k; i < (int)div_y+1; i++) {
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
258 y = (int)vMin->y + i*l;
210
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
259 #if 1
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
260
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
261 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
262 * 担当 y 範囲内
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
263 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
264 if (charge_y_top <= y && y <= charge_y_end) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
265 // 1..8 を index0, 9..16 を index1 にするために y を -1
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
266 int index = (y-1) / split_screen_h;
164
38cbb7aecc70 TilePtr は SPE で計算した方がいいと判断して変更。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 161
diff changeset
267
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
268 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
269 * 違う SpanPack を扱う場合、
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
270 * 現在の SpanPack をメインメモリに送り、
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
271 * 新しい SpanPack を取ってくる
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
272 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
273 if (index != prev_index) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
274 tmp_spack = spack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
275 spack = send_spack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
276 send_spack = tmp_spack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
277
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
278 smanager->dma_wait(SPAN_PACK_STORE);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
279 smanager->dma_store(send_spack, (uint32)spackList[prev_index],
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
280 sizeof(SpanPack), SPAN_PACK_STORE);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
281
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
282 smanager->dma_load(spack, (uint32)spackList[index],
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
283 sizeof(SpanPack), SPAN_PACK_LOAD);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
284 prev_index = index;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
285 smanager->dma_wait(SPAN_PACK_LOAD);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
286 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
287
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
288 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
289 * 書き込む SpanPack が満杯だったら
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
290 * メインメモリで allocate した領域 (next) を持ってきて
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
291 * 現在の spack->next につなぎ、next を次の spack とする。
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
292 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
293 if (spack->info.size >= MAX_SIZE_SPAN) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
294 SpanPackPtr next;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
295
314
2ddf79a7c5fb debugging
root@localhost.localdomain
parents: 244
diff changeset
296 __debug_spe("CreateSpan mainMem_alloc 0x%x\n", (unsigned int)sizeof(SpanPack));
141
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
297 smanager->mainMem_alloc(0, sizeof(SpanPack));
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
298 smanager->mainMem_wait();
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
299 next = (SpanPackPtr)smanager->mainMem_get(0);
314
2ddf79a7c5fb debugging
root@localhost.localdomain
parents: 244
diff changeset
300 __debug_spe("CreateSpan mainMem_allocated 0x%x\n", (unsigned int)next);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
301
244
59c3b9df3c67 mail modify
e065746@localhost.localdomain
parents: 233
diff changeset
302 spack->next = next; // この部分は TaskManager でやる
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
303
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
304 tmp_spack = spack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
305 spack = send_spack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
306 send_spack = tmp_spack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
307
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
308 smanager->dma_wait(SPAN_PACK_STORE);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
309 smanager->dma_store(send_spack, (uint32)spackList[index],
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
310 sizeof(SpanPack), SPAN_PACK_STORE);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
311
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
312 spackList[index] = next;
141
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
313
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
314 smanager->dma_load(spack, (uint32)spackList[index],
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
315 sizeof(SpanPack), SPAN_PACK_LOAD);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
316 smanager->dma_wait(SPAN_PACK_LOAD);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
317 spack->init((index+1)*split_screen_h);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
318 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
319 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
320 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
321 * 担当範囲外だったら無視
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
322 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
323 continue;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
324 }
146
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
325
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
326 tmp_xpos = calc(vMid10->x - vMin->x ,div_y, i, vMin->x);
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
327 tmp_end = calc(vMid->x - vMin->x ,div_y, i, vMin->x);
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
328 tmp_z = calc(vMid10->z - vMin->z ,div_y, i, vMin->z);
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
329 tmp_zpos = calc(vMid->z - vMin->z ,div_y, i, vMin->z);
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
330
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
331 length = (tmp_xpos > tmp_end)
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
332 ? (int)tmp_xpos - (int)tmp_end : (int)tmp_end - (int)tmp_xpos;
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
333 if (length == 0) {
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
334 continue;
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
335 }
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
336
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
337 tmp_tex1 =((i/(div_y)) * vMid10->tex_x) +
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
338 ( ((div_y - i)/(div_y)) * vMin->tex_x);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
339 tmp_tex2 =( (i/(div_y)) * vMid->tex_x) +
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
340 ( ((div_y - i)/(div_y)) * vMin->tex_x);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
341
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
342 tmp_tey1 =( (i/(div_y)) * vMid10->tex_y) +
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
343 ( ((div_y - i)/(div_y)) * vMin->tex_y);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
344 tmp_tey2 =( (i/(div_y)) * vMid->tex_y) +
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
345 ( ((div_y - i)/(div_y)) * vMin->tex_y);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
346
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
347 if (tmp_xpos > tmp_end) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
348 x = (int)tmp_end;
172
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
349 length = (int)(tmp_xpos)-(int)(tmp_end)+1;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
350 start_z = tmp_zpos;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
351 end_z = tmp_z;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
352 start_tex_x = tmp_tex2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
353 end_tex_x = tmp_tex1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
354 start_tex_y = tmp_tey2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
355 end_tex_y = tmp_tey1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
356 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
357 x = (int)tmp_xpos;
172
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
358 length = (int)(tmp_end)-(int)(tmp_xpos)+1;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
359 start_z = tmp_z;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
360 end_z = tmp_zpos;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
361 start_tex_x = tmp_tex1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
362 end_tex_x = tmp_tex2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
363 start_tex_y = tmp_tey1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
364 end_tex_y = tmp_tey2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
365 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
366
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
367 smanager->dma_wait(SPAN_PACK_LOAD);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
368
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
369 Span *span = &spack->span[spack->info.size++];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
370
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
371 span->x = x;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
372 span->y = y;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
373 span->length_x = length;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
374 span->start_z = start_z;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
375 span->end_z = end_z;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
376 span->tex_x1 = start_tex_x;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
377 span->tex_x2 = end_tex_x;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
378 span->tex_y1 = start_tex_y;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
379 span->tex_y2 = end_tex_y;
172
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
380
176
gongo@localhost.localdomain
parents: 175
diff changeset
381
gongo@localhost.localdomain
parents: 175
diff changeset
382 float tex_x_len = span->tex_x2 - span->tex_x1;
174
559b48b69b76 getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
gongo@localhost.localdomain
parents: 172
diff changeset
383
176
gongo@localhost.localdomain
parents: 175
diff changeset
384 /**
gongo@localhost.localdomain
parents: 175
diff changeset
385 * tex_x_len, tex_y_len を掛ける理由は
gongo@localhost.localdomain
parents: 175
diff changeset
386 * Changelog の 2008-12-16 を参照
gongo@localhost.localdomain
parents: 175
diff changeset
387 */
gongo@localhost.localdomain
parents: 175
diff changeset
388 int scale = getScale(span->length_x, length_y,
gongo@localhost.localdomain
parents: 175
diff changeset
389 (int)(span->tex_width*tex_x_len),
210
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
390 (int)(span->tex_height*tex_y_len),
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
391 tex_info->scale_max);
233
gongo@localhost.localdomain
parents: 212
diff changeset
392 //scale = tex_info->scale_max;
176
gongo@localhost.localdomain
parents: 175
diff changeset
393
210
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
394 uint32 *tapestry = getTapestry(tex_info->width,
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
395 tex_info->height, scale,
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
396 tex_info->addr);
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
397 span->tex_addr = tapestry;
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
398 span->tex_width = tex_info->width/scale;
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
399 span->tex_height = tex_info->height/scale;
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
400 }
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
401 #else
233
gongo@localhost.localdomain
parents: 212
diff changeset
402
gongo@localhost.localdomain
parents: 212
diff changeset
403 /**
gongo@localhost.localdomain
parents: 212
diff changeset
404 * ここに SIMD 化した記述をしようとして断念
gongo@localhost.localdomain
parents: 212
diff changeset
405 */
203
5c6c9667ac61 fix CreateSpan::run
gongo@localhost.localdomain
parents: 194
diff changeset
406
210
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
407 #endif
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
408
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
409 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
410
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
411
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
412 int
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
413 CreateSpan::run(void *rbuf, void *wbuf)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
414 {
314
2ddf79a7c5fb debugging
root@localhost.localdomain
parents: 244
diff changeset
415 __debug_spe("CreateSpan\n");
2ddf79a7c5fb debugging
root@localhost.localdomain
parents: 244
diff changeset
416
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
417 PolygonPack *pp = (PolygonPack*)smanager->get_input(0);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
418 PolygonPack *next_pp =
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
419 (PolygonPack*)smanager->allocate(sizeof(PolygonPack));
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
420 PolygonPack *free_pp = next_pp;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
421 PolygonPack *tmp_pp;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
422
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
423 TrianglePackPtr triPack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
424 VertexPackPtr vMin, vMid, vMax;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
425 VertexPackPtr vMid10
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
426 = (VertexPackPtr)smanager->allocate(sizeof(VertexPack));
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
427
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
428 SpanPackPtr *spackList = (SpanPackPtr*)smanager->get_input(1);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
429 spack = (SpanPackPtr)smanager->get_input(2);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
430 send_spack = (SpanPackPtr)smanager->allocate(sizeof(SpanPack));
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
431 prev_index = get_param(0);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
432
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
433 // spack と send_spack は swap しながら DMA を繰り返すので
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
434 // 自分で allocate した send_spack を覚えてないといけない
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
435 SpanPackPtr free_spack = send_spack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
436
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
437 int charge_y_top = get_param(1);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
438 int charge_y_end = get_param(2);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
439
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
440 do {
314
2ddf79a7c5fb debugging
root@localhost.localdomain
parents: 244
diff changeset
441 __debug_spe("CreateSpan allocated 0x%x\n",(uint32)next_pp);
2ddf79a7c5fb debugging
root@localhost.localdomain
parents: 244
diff changeset
442
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
443 if (pp->next != NULL) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
444 smanager->dma_load(next_pp, (uint32)pp->next,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
445 sizeof(PolygonPack), POLYGON_PACK_LOAD);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
446 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
447 next_pp = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
448 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
449
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
450 for (int i = 0; i < pp->info.size; i++) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
451 triPack = &pp->tri[i];
210
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
452
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
453 TriangleTexInfoPtr tri_tex_info = &triPack->tex_info;
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
454
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
455 make_vertex(triPack, &vMin, &vMid, &vMax);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
456 make_vMid10(vMid10, vMin, vMid, vMax);
133
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
457
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
458 /**
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
459 * ポリゴンを、x軸に水平に分割して二つの三角形を作り、
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
460 * それぞれから Span を求める
172
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
461 *
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
462 * vMax
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
463 * |\
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
464 * | \
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
465 * | \
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
466 * | \
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
467 * vMid10 ------ vMid
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
468 * | /
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
469 * | /
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
470 * | /
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
471 * |/
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
472 * vMin
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
473 *
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
474 * (vMax, vMid, vMin) という triangle を
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
475 * (vMax, vMid, vMid10) (vMin, vMid, vMid10) という
c09f506bf5c9 CreateSpan に getScale を追加
gongo@localhost.localdomain
parents: 170
diff changeset
476 * 二つの Triangle に分けている
133
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
477 */
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
478 half_triangle(spackList, charge_y_top, charge_y_end,
210
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
479 tri_tex_info, vMin, vMid, vMid10,
176
gongo@localhost.localdomain
parents: 175
diff changeset
480 (int)(vMax->y - vMin->y), vMax->tex_y - vMin->tex_y);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
481 half_triangle(spackList, charge_y_top, charge_y_end,
210
204b03ca98f8 fix DrawSpan
gongo@localhost.localdomain
parents: 203
diff changeset
482 tri_tex_info, vMax, vMid, vMid10,
176
gongo@localhost.localdomain
parents: 175
diff changeset
483 (int)(vMax->y - vMin->y), vMax->tex_y - vMin->tex_y);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
484 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
485
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
486 smanager->dma_wait(POLYGON_PACK_LOAD);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
487
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
488 tmp_pp = pp;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
489 pp = next_pp;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
490 next_pp = tmp_pp;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
491 } while (pp);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
492
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
493 smanager->dma_wait(SPAN_PACK_STORE);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
494 smanager->dma_store(spack, (uint32)spackList[prev_index],
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
495 sizeof(SpanPack), SPAN_PACK_STORE);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
496 smanager->dma_wait(SPAN_PACK_STORE);
314
2ddf79a7c5fb debugging
root@localhost.localdomain
parents: 244
diff changeset
497 __debug_spe("CreateSpan spack_stored 0x%x\n",(uint32)spackList[prev_index]);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
498
244
59c3b9df3c67 mail modify
e065746@localhost.localdomain
parents: 233
diff changeset
499 // smanager で allocate したのだから free も smanager でやるべき
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
500 free(free_pp);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
501 free(free_spack);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
502 free(vMid10);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
503
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
504 return 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
505 }