Mercurial > hg > Game > Cerium
changeset 354:cfd20d609ace draft
add example/get_segment and change spe/DrawSpan.cpp
line wrap: on
line diff
--- a/Document/Cerium_2009.mm Fri Jun 05 17:07:35 2009 +0900 +++ b/Document/Cerium_2009.mm Wed Jul 15 17:39:51 2009 +0900 @@ -17,6 +17,8 @@ <icon BUILTIN="full-1"/> <icon BUILTIN="button_ok"/> <node CREATED="1243578499039" ID="Freemind_Link_1478568979" MODIFIED="1243944044789" TEXT="hiroki"/> +<node CREATED="1244544615331" ID="Freemind_Link_314435740" MODIFIED="1244544645999" TEXT="test_render でボタンが押されたときに表示するTaskを起動する"/> +<node CREATED="1244544654035" ID="Freemind_Link_1019324151" MODIFIED="1244544685192" TEXT="SPU 0 〜 5 に表示する Task を生成する"/> </node> </node> <node CREATED="1243334733712" ID="Freemind_Link_1055841346" MODIFIED="1243334790932" TEXT="CodeのLoad"> @@ -29,7 +31,6 @@ </node> <node CREATED="1243584255924" ID="Freemind_Link_784128675" MODIFIED="1243767918303" TEXT="dma_wait 後落ちる"> <icon BUILTIN="button_ok"/> -<node CREATED="1243584287314" ID="Freemind_Link_1653925279" MODIFIED="1243584287314" TEXT=""/> </node> <node CREATED="1243584369566" HGAP="26" ID="Freemind_Link_1788139696" MODIFIED="1243943459201" TEXT="code_load をどこに入れる?" VSHIFT="4"> <icon BUILTIN="full-1"/> @@ -56,19 +57,31 @@ </node> <node CREATED="1243334967348" HGAP="23" ID="Freemind_Link_728996277" MODIFIED="1243334981305" TEXT="Rendering" VSHIFT="-5"> <node CREATED="1243334991181" ID="Freemind_Link_151269429" MODIFIED="1243334997520" TEXT="Z sort"/> -<node CREATED="1243335004925" ID="Freemind_Link_1543200827" MODIFIED="1243335017960" TEXT="Texture抜きのWrite"/> +<node CREATED="1243335004925" ID="Freemind_Link_1543200827" MODIFIED="1244544966902" TEXT="Texture抜きのWrite"> +<icon BUILTIN="full-2"/> +<node CREATED="1244544974228" ID="Freemind_Link_1606682245" MODIFIED="1244544978721" TEXT="yutaka"/> +<node CREATED="1244544996712" ID="Freemind_Link_1723799405" MODIFIED="1244545001518" TEXT="色の指定"/> +</node> <node CREATED="1243335087307" ID="Freemind_Link_675827042" MODIFIED="1243943707646" TEXT="光源"> <icon BUILTIN="full-1"/> -<node CREATED="1243943756522" ID="Freemind_Link_1524342007" MODIFIED="1243943778264" TEXT="SpanPack に光の方向をいれる"> +<node CREATED="1243943756522" ID="Freemind_Link_1524342007" MODIFIED="1244544596362" TEXT="SpanPack に光の方向をいれる"> +<icon BUILTIN="button_ok"/> <node CREATED="1243944032110" ID="Freemind_Link_1186115113" MODIFIED="1243944036836" TEXT="yutaka"/> </node> +<node CREATED="1244544567403" ID="Freemind_Link_1562932476" MODIFIED="1244544588759" TEXT="複数の光源をglobal_get"/> </node> <node CREATED="1243335102555" ID="Freemind_Link_300667458" MODIFIED="1243335111239" TEXT="perspective"/> <node CREATED="1243335124792" ID="Freemind_Link_373044243" MODIFIED="1243335127788" TEXT="camera"/> </node> <node CREATED="1243334938485" ID="Freemind_Link_952011832" MODIFIED="1243334941904" TEXT="実装例"> -<node CREATED="1243334942821" ID="Freemind_Link_1640545704" MODIFIED="1243334951264" TEXT="Super_Dandy"/> -<node CREATED="1243335414034" ID="Freemind_Link_175851707" MODIFIED="1243335427461" TEXT="Racing Game"/> +<node CREATED="1243334942821" ID="Freemind_Link_1640545704" MODIFIED="1244545471110" TEXT="Super_Dandy"> +<icon BUILTIN="full-3"/> +<node CREATED="1244545462124" ID="Freemind_Link_1671391521" MODIFIED="1244545465039" TEXT="KoBa"/> +</node> +<node CREATED="1243335414034" ID="Freemind_Link_175851707" MODIFIED="1244545506517" TEXT="Racing Game"> +<icon BUILTIN="full-3"/> +<node CREATED="1244545492395" ID="Freemind_Link_1846997152" MODIFIED="1244545498749" TEXT="ショウシー"/> +</node> </node> <node CREATED="1243335132056" ID="Freemind_Link_966536257" MODIFIED="1243335158564" TEXT="Network"> <node CREATED="1243335159672" ID="Freemind_Link_710888232" MODIFIED="1243335177852" TEXT="Federated Linda"/> @@ -97,7 +110,11 @@ <node CREATED="1243767262537" ID="Freemind_Link_507081989" MODIFIED="1243943546127" TEXT="SceneGraph の変形を copy base にする"> <icon BUILTIN="full-1"/> <node CREATED="1243767288336" ID="Freemind_Link_388959053" MODIFIED="1243767306119" TEXT="drawing と SceneGraph の演算を並列に"/> -<node CREATED="1243943934419" ID="Freemind_Link_1634946486" MODIFIED="1243943944585" TEXT="tagano"/> +<node CREATED="1244544869860" ID="Freemind_Link_660333063" MODIFIED="1244544908063" TEXT="SPU上で動作するようにする(CreatePolygonPP2)"/> +<node CREATED="1244544908668" ID="Freemind_Link_56800585" MODIFIED="1244544927456" TEXT="Taskの中でdma_loadしない"> +<node CREATED="1244544928324" ID="Freemind_Link_690247851" MODIFIED="1244544946964" TEXT="そのために必要なTaskのAPIを用意する"/> +</node> +<node CREATED="1243943934419" ID="Freemind_Link_1634946486" MODIFIED="1244544830283" TEXT="Kaito"/> </node> <node CREATED="1243767320557" ID="Freemind_Link_830109616" MODIFIED="1243767357291" TEXT="アーキテクチャに依存した Task の scheduling"> <node CREATED="1243767364243" ID="Freemind_Link_683952054" MODIFIED="1243767371836" TEXT="Task の定義の外に出す"/> @@ -110,16 +127,121 @@ <icon BUILTIN="full-1"/> <node CREATED="1243943627426" ID="Freemind_Link_57266388" MODIFIED="1243943646050" TEXT="autoconf"/> <node CREATED="1243943652122" ID="Freemind_Link_1676705308" MODIFIED="1243943682172" TEXT="Architecture の specialization"/> -<node CREATED="1243943991903" ID="Freemind_Link_447888194" MODIFIED="1243943997324" TEXT="hiroki"/> +<node CREATED="1243943991903" ID="Freemind_Link_447888194" MODIFIED="1244544760508" TEXT="KoBa"/> </node> <node CREATED="1243943883125" ID="Freemind_Link_722594854" MODIFIED="1243944098553" TEXT="例題の整理"> <icon BUILTIN="full-1"/> <node CREATED="1243943799623" ID="Freemind_Link_478163251" MODIFIED="1243943825181" TEXT="test_render 解体"> <node CREATED="1243943832806" ID="Freemind_Link_1334546525" MODIFIED="1243943841025" TEXT="作り直す"/> +<node CREATED="1244545355198" ID="Freemind_Link_1395032705" MODIFIED="1244545390920" TEXT="test_render の Task のテスト"> +<icon BUILTIN="full-2"/> +<node CREATED="1244545380854" ID="Freemind_Link_448813750" MODIFIED="1244545383481" TEXT="KoBa"/> +</node> </node> <node CREATED="1243943907996" ID="Freemind_Link_766522959" MODIFIED="1243943926580" TEXT="example を今の ver にする"/> <node CREATED="1243944111117" ID="Freemind_Link_640625182" MODIFIED="1243944122505" TEXT="all member"/> +<node CREATED="1244544770134" ID="Freemind_Link_479862774" MODIFIED="1244544796668" TEXT="SchedTaskの継承をしない"/> +<node CREATED="1244544801340" ID="Freemind_Link_1114791749" MODIFIED="1244545319507" TEXT="runの引数でSchedTaskを渡す"> +<icon BUILTIN="button_ok"/> </node> </node> </node> +<node CREATED="1244545101880" ID="Freemind_Link_1259956700" MODIFIED="1244545274916" POSITION="left" TEXT="CbC"> +<icon BUILTIN="full-2"/> +<node CREATED="1244545115592" ID="Freemind_Link_1164269640" MODIFIED="1244545145257" TEXT="PPUのindirect_jump"/> +<node CREATED="1244545152040" ID="Freemind_Link_302170687" MODIFIED="1244545170201" TEXT="引数のレジスタへのmapping"/> +<node CREATED="1244545172417" ID="Freemind_Link_1870383582" MODIFIED="1244545180564" TEXT="関数内部のgoto"> +<node CREATED="1244545182016" ID="Freemind_Link_1408393906" MODIFIED="1244545204164" TEXT="環境をセーブする場所をThread localにする"/> +</node> +<node CREATED="1244545215705" ID="Freemind_Link_1068131680" MODIFIED="1244545227748" TEXT="Data Segment の定義"/> +<node CREATED="1244545229768" ID="Freemind_Link_1164262083" MODIFIED="1244545251172" TEXT="Data Segment を転送する Code Segment の定義"/> +</node> +<node CREATED="1244193625986" HGAP="21" ID="Freemind_Link_701330739" MODIFIED="1245756488562" POSITION="left" TEXT="Task と Renderer の整理" VSHIFT="51"> +<icon BUILTIN="full-1"/> +<node CREATED="1244193645575" ID="Freemind_Link_1173374726" MODIFIED="1244193670426" TEXT="複数の Task が生成される"> +<node CREATED="1244193727669" ID="Freemind_Link_1268929487" MODIFIED="1244193736216" TEXT="Linux 用"/> +<node CREATED="1244193737941" ID="Freemind_Link_368325310" MODIFIED="1244193742504" TEXT="SPE 用"/> +</node> +<node CREATED="1244193689878" ID="Freemind_Link_639973478" MODIFIED="1244193700240" TEXT="複数の Project"/> +<node CREATED="1244193708704" ID="Freemind_Link_1528860920" MODIFIED="1244193724594" TEXT="TaskManager は別 dir"/> +<node CREATED="1244193761741" ID="Freemind_Link_382768400" MODIFIED="1244193770786" TEXT="単純な Link ではできない"> +<node CREATED="1244193774725" ID="Freemind_Link_1257872906" MODIFIED="1244193796261" TEXT="SPU の Task は fixpic.pl"/> +<node CREATED="1244193800916" ID="Freemind_Link_1452077817" MODIFIED="1244194144503" TEXT="Overlay 用に ld script 生成"/> +<node CREATED="1244193822003" ID="Freemind_Link_180312868" MODIFIED="1244193836444" TEXT="同様の動作をする Linux 用 Task"/> +<node CREATED="1244193839763" ID="Freemind_Link_684133611" MODIFIED="1244193845032" TEXT="Makefile の生成"/> +<node CREATED="1244193862979" ID="Freemind_Link_1572825155" MODIFIED="1244193877683" TEXT="他の Project の Task include"/> +</node> +<node CREATED="1244193888042" ID="Freemind_Link_77829001" MODIFIED="1244193907388" TEXT="生成 script"> +<node CREATED="1244193925330" ID="Freemind_Link_62306375" MODIFIED="1244193973558" TEXT="何を読み込むのか"> +<node CREATED="1244193980897" ID="Freemind_Link_1309775877" MODIFIED="1244194019677" TEXT="Task dirrectly 下の Task"> +<node CREATED="1244194079990" ID="Freemind_Link_1832183795" MODIFIED="1244194097528" TEXT="SPU 用に特殊化した Task"> +<node CREATED="1244194429596" ID="Freemind_Link_1864588466" MODIFIED="1244194442368" TEXT="spe の下に置く"/> +</node> +</node> +<node CREATED="1244194022848" ID="Freemind_Link_340021666" MODIFIED="1244194042054" TEXT="Task の property"> +<node CREATED="1244194318241" ID="Freemind_Link_1694330225" MODIFIED="1244194347986" TEXT="Task の source file に書くか"/> +<node CREATED="1244194332595" ID="Freemind_Link_297529046" MODIFIED="1244194344283" TEXT="Task.xml に書くか"> +<node CREATED="1244194401141" ID="Freemind_Link_324450065" MODIFIED="1244194424397" TEXT="task name"/> +</node> +</node> +<node CREATED="1244194048671" ID="Freemind_Link_83841604" MODIFIED="1244194067046" TEXT="include する Project の指定"> +<node CREATED="1244194367558" ID="Freemind_Link_1248430118" MODIFIED="1244194384513" TEXT="Project.xml を作る"/> +<node CREATED="1244194525525" ID="Freemind_Link_1218365852" MODIFIED="1244194544099" TEXT="OS によって include する Project を代える"/> +<node CREATED="1244194546253" ID="Freemind_Link_1082915051" MODIFIED="1244194553260" TEXT="fifo Manager"/> +<node CREATED="1244194553613" ID="Freemind_Link_94805969" MODIFIED="1244194559318" TEXT="cell Manager"/> +</node> +</node> +<node CREATED="1244193974881" ID="Freemind_Link_537320432" MODIFIED="1244193978202" TEXT="何を生成するのか"> +<node CREATED="1244194112790" ID="Freemind_Link_78213203" MODIFIED="1244194119354" TEXT="Makefile"/> +<node CREATED="1244194121558" ID="Freemind_Link_761598913" MODIFIED="1244194131416" TEXT="ld script"/> +<node CREATED="1244194133933" ID="Freemind_Link_1723085633" MODIFIED="1244194136337" TEXT="func.h"/> +<node CREATED="1244194452419" ID="Freemind_Link_508292863" MODIFIED="1244194459954" TEXT="生成 object"> +<node CREATED="1244194461651" ID="Freemind_Link_1774977667" MODIFIED="1244194472599" TEXT="spu main"> +<node CREATED="1244194474203" ID="Freemind_Link_588029435" MODIFIED="1244194482439" TEXT="embeded"/> +</node> +<node CREATED="1244194489939" ID="Freemind_Link_938154914" MODIFIED="1244194495136" TEXT="ppu.o"/> +</node> +</node> +<node CREATED="1244194166653" ID="Freemind_Link_420595528" MODIFIED="1244194172741" TEXT="使い方"> +<node CREATED="1244194174708" ID="Freemind_Link_913924057" MODIFIED="1244194244825" TEXT="make の代わりに使う"> +<node CREATED="1244194245536" ID="Freemind_Link_1610936977" MODIFIED="1244194253425" TEXT="中で make を呼ぶ"/> +</node> +<node CREATED="1244195022249" ID="Freemind_Link_1184501567" MODIFIED="1244195031444" TEXT="script の名前"> +<node CREATED="1244195031857" ID="Freemind_Link_1095160292" MODIFIED="1244195111267" TEXT="cerium_make" VSHIFT="1"/> +</node> +</node> +<node CREATED="1244194582752" ID="Freemind_Link_1486772533" MODIFIED="1244194586419" TEXT="例題"> +<node CREATED="1244194593606" ID="Freemind_Link_1794484768" MODIFIED="1244194599178" TEXT="test_render"> +<node CREATED="1244194601902" ID="Freemind_Link_960793768" MODIFIED="1244194614986" TEXT="Renderer"/> +<node CREATED="1244194634757" ID="Freemind_Link_894031439" MODIFIED="1244194641573" TEXT="分離"/> +<node CREATED="1244194615309" ID="Freemind_Link_722552679" MODIFIED="1244194663568" TEXT="Test"> +<node CREATED="1244194673020" ID="Freemind_Link_1810212132" MODIFIED="1244194680930" TEXT="video-mode check"/> +<node CREATED="1244194687908" ID="Freemind_Link_213845842" MODIFIED="1244194693407" TEXT="no-video-mode"/> +</node> +</node> +<node CREATED="1244194736313" ID="Freemind_Link_1103784183" MODIFIED="1244194740124" TEXT="場所"> +<node CREATED="1244194740493" ID="Freemind_Link_1667247959" MODIFIED="1244194880277" TEXT="Cerium/Renderer/fb"> +<node CREATED="1244194913168" ID="Freemind_Link_120515783" MODIFIED="1244194920364" TEXT="Task"/> +<node CREATED="1244194920784" ID="Freemind_Link_1570615471" MODIFIED="1244194930992" TEXT="spe"/> +</node> +<node CREATED="1244194881478" ID="Freemind_Link_1372200566" MODIFIED="1244194891874" TEXT="Cerium/Renderer/openGL"/> +<node CREATED="1244194966158" ID="Freemind_Link_1011475234" MODIFIED="1244194977821" TEXT="Cerium/example"> +<node CREATED="1244194978654" ID="Freemind_Link_1112549863" MODIFIED="1244194994365" TEXT="SceneGraph"> +<node CREATED="1244194996614" ID="Freemind_Link_693836946" MODIFIED="1244194999210" TEXT="test1"/> +<node CREATED="1244195011830" ID="Freemind_Link_1012481793" MODIFIED="1244195013459" TEXT="test2"/> +</node> +</node> +</node> +</node> +<node CREATED="1244195176485" ID="Freemind_Link_1222059690" MODIFIED="1244195201879" TEXT="Directly 構成" VSHIFT="-10"> +<node CREATED="1244195202706" ID="Freemind_Link_425257332" MODIFIED="1244195219282" TEXT="/usr/local/Cerium"> +<node CREATED="1244195220338" ID="Freemind_Link_1882319906" MODIFIED="1244195223092" TEXT="include"/> +<node CREATED="1244195223681" ID="Freemind_Link_234949444" MODIFIED="1244195226509" TEXT="lib"/> +<node CREATED="1244195227025" ID="Freemind_Link_1748375798" MODIFIED="1244195232312" TEXT="bin"/> +</node> +</node> +</node> +<node CREATED="1244197635639" ID="Freemind_Link_1051100294" MODIFIED="1244197639458" TEXT="kono"/> +</node> +</node> </map>
--- a/Renderer/DataPack/Test/SpanPack/polygonpack.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/Renderer/DataPack/Test/SpanPack/polygonpack.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -84,7 +84,7 @@ int end_y = (int)vMin->y; if (start_y<end_y) { - int i; i=end_y; end_y=start_y; start_y = i; //y$B$NF~$lBX$((B + int i; i=end_y; end_y=start_y; start_y = i; //yャ帥 k = 1; l = -1; } @@ -92,13 +92,13 @@ div_y = start_y - end_y; // > 0 for(i = k; i < div_y+1; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B + //span綏腴勆x,z羆 tmp_xpos = calc(vMid1->x - vMin->x ,div_y, i, vMin->x); tmp_end = calc(vMid->x - vMin->x ,div_y, i, vMin->x); tmp_z = calc(vMid1->z - vMin->z ,div_y, i, vMin->z); tmp_zpos = calc(vMid->z - vMin->z ,div_y, i, vMin->z); //printf("x:%f end:%f z:%f zpos:%f\n",tmp_xpos,tmp_end,tmp_z,tmp_zpos); - //$B$3$3$+$i(Bspan$B$N:8C<$H1&C<$KBP1~$9$k%F%/%9%A%c$r7W;;$9$k(B + //span綏腴勆絲上鴻c荐膊 tmp_tex1 =((i/(div_y)) * vMid1->tex_x) + \ ( ((div_y - i)/(div_y)) * vMin->tex_x); tmp_tex2 =( (i/(div_y)) * vMid->tex_x) + \
--- a/Renderer/test_render/SpanC.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/Renderer/test_render/SpanC.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -5,7 +5,7 @@ using namespace std; -// f1:x$B$NA}2CNL(B f2:y$B$NA}2CNL(B i:....... base:$B4pK\$H$J$kD:E@$N(By$B:BI8(B +// f1:x紜 f2:y紜 i:....... base:堺鴻y綺ф static float calc(float f1, float f2,int i, float base){ float ans; ans = f1/f2*i + base; @@ -78,7 +78,7 @@ int end_y = (int)vMin->y; if (start_y<end_y) { - int i; i=end_y; end_y=start_y; start_y = i; //y$B$NF~$lBX$((B + int i; i=end_y; end_y=start_y; start_y = i; //yャ帥 //Vertex *v; v = vMin; vMin = vMid; vMid = v; /* incli_x1 = vMin->x - vMid->x; incli_x2 = vMin->x - vMid1->x; @@ -96,13 +96,13 @@ //if(div_y < 1 && div_y > -1) div_y = 1; for(i = k; i < div_y+1; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B + //span綏腴勆x,z羆 tmp_xpos = calc(vMid1->x - vMin->x ,div_y, i, vMin->x); tmp_end = calc(vMid->x - vMin->x ,div_y, i, vMin->x); tmp_z = calc(vMid1->z - vMin->z ,div_y, i, vMin->z); tmp_zpos = calc(vMid->z - vMin->z ,div_y, i, vMin->z); //printf("x:%f end:%f z:%f zpos:%f\n",tmp_xpos,tmp_end,tmp_z,tmp_zpos); - //$B$3$3$+$i(Bspan$B$N:8C<$H1&C<$KBP1~$9$k%F%/%9%A%c$r7W;;$9$k(B + //span綏腴勆絲上鴻c荐膊 tmp_tex1 =((i/(div_y)) * vMid1->tex_x) + \ ( ((div_y - i)/(div_y)) * vMin->tex_x); tmp_tex2 =( (i/(div_y)) * vMid->tex_x) + \ @@ -113,7 +113,7 @@ tmp_tey2 =( (i/(div_y)) * vMid->tex_y) + \ ( ((div_y - i)/(div_y)) * vMin->tex_y); - //$B$3$3$G:8C<$,(Bxpos$B$+(Bend$B$rH=CG$7!"IA2h$9$k(Bspan$B$r:n$k(B + //у窪腴xposendゆ祉span篏 if(tmp_xpos > tmp_end) { x = (int)tmp_end; y = (int)vMin->y + i*l; @@ -236,13 +236,13 @@ if(div_y < 1 && div_y > -1) div_y = 1; for(i = 0; i < div_x+1; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B + //span綏腴勆x,z羆 tmp_xpos = calc(vMax->x - vMin->x,div_y, i, vMin->x); tmp_end = calc(vMid->x - vMin->x,div_x, i, vMin->x); tmp_z = calc(vMax->z - vMin->z,div_y, i, vMin->z); tmp_zpos = calc(vMid->z - vMin->z,div_x, i, vMin->z); - //$B$3$3$+$i(Bspan$B$N:8C<$H1&C<$KBP1~$9$k%F%/%9%A%c$r7W;;$9$k(B + //span綏腴勆絲上鴻c荐膊 tmp_tex1 =( (i/(div_y)) * vMax->tex_x) + \ ( ((div_y - i)/(div_y)) * vMin->tex_x); tmp_tex2 =( (i/(div_x)) * vMid->tex_x) + \ @@ -253,7 +253,7 @@ tmp_tey2 =( (i/(div_x)) * vMid->tex_y) + \ ( ((div_x - i)/(div_x)) * vMin->tex_y); - //$B$3$3$G:8C<$,(Bxpos$B$+(Bend$B$rH=CG$7!"IA2h$9$k(Bspan$B$r:n$k(B + //у窪腴xposendゆ祉span篏 if(tmp_xpos > tmp_end) { x = (int)tmp_end; y = (int)vMin->y + i; @@ -315,7 +315,7 @@ if(div_y < 1 && div_y > -1) div_y = 1; for(i = 0; i < div_x; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B + //span綏腴勆x,z羆 tmp_xpos = calc(vMax->x-vMin->x, div_y, (i+1+top_triangle), vMin->x); tmp_end = calc(vMax->x-vMid->x, div_x, (i+1), vMid->x); tmp_z = calc(vMax->z-vMin->z, div_y, (i+1+top_triangle), vMin->z); @@ -389,7 +389,7 @@ #endif } -// i:$BJ,;R!"(Bf1:$BD9$5(B f2:$BBP1~$9$kD:E@(B1 f3:$BBP1~$9$kD:E@(B2 +// i:絖f1:激 f2:絲上1 f3:絲上2 /* float Span::calc2(int i, float f1, float f2, float f3) { float ans;
--- a/Renderer/test_render/enemy_action.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/Renderer/test_render/enemy_action.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -31,7 +31,7 @@ if(judge == HIT) { E_PLANE->set_move_collision(null_move, enemy_collision); - printf("ENEMY_hit!!!_n"); + printf("ENEMY_hit!!!鐚n"); //scene_graph->delete_object(node, node->next,node->prev); } #endif
--- a/Renderer/test_render/fb.h Fri Jun 05 17:07:35 2009 +0900 +++ b/Renderer/test_render/fb.h Wed Jul 15 17:39:51 2009 +0900 @@ -31,7 +31,7 @@ int xres,yres,vbpp,line_len; //unsigned short tcolor ; - /* 読み書き用にファイルを開く */ + /* 茯炊吾<ゃ */ fd_framebuffer = open( DEVICE_NAME , O_RDWR); if ( !fd_framebuffer ) { send_current_error_msg("Framebuffer device open error !"); @@ -39,13 +39,13 @@ } send_current_information("The framebuffer device was opened !"); - /* 固定スクリーン情報取得 */ + /* 阪鴻若恰怨緇 */ if ( ioctl( fd_framebuffer , FBIOGET_FSCREENINFO , &finfo ) ) { send_current_error_msg("Fixed information not gotton !"); exit(2); } - /* 変動スクリーン情報取得 */ + /* 紊鴻若恰怨緇 */ if ( ioctl( fd_framebuffer , FBIOGET_VSCREENINFO , &vinfo ) ) { send_current_error_msg("Variable information not gotton !"); exit(3); @@ -57,10 +57,10 @@ sprintf( tmp , "%d(pixel)x%d(line), %dbpp(bits per pixel)",xres,yres,vbpp); send_current_information( tmp ); - /* バイト単位でのスクリーンのサイズを計算 */ + /* ゃ篏с鴻若潟泣ゃ冴荐膊 */ screensize = xres * yres * vbpp / DIV_BYTE ; - /* デバイスをメモリにマップする */ + /* ゃ鴻<≪ */ fbptr = (char *)mmap(0,screensize,PROT_READ | PROT_WRITE,MAP_SHARED,fd_framebuffer,0); if ( (int)fbptr == -1 ) { send_current_error_msg("Don't get framebuffer device to memory !");
--- a/Renderer/test_render/spe/DrawSpanRenew.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/Renderer/test_render/spe/DrawSpanRenew.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -26,18 +26,18 @@ renew_task->add_param((int)curr); renew_task->add_param(cur_span_x); - // linebuf と zRow も引き継がせる + // linebuf zRow 綣膓 renew_task->add_param((int)linebuf); renew_task->add_param((int)zRow); //fprintf(stderr, "[%p] start %u\n", curr, spu_readch(SPU_RdDec)); /** - * 再起動したタスクを待つ + * 莎桁帥鴻緇 */ smanager->wait_task(renew_task); - // next_spack は free() するので wait する + // next_spack free() wait smanager->dma_wait(SPAN_PACK_LOAD); } @@ -56,10 +56,10 @@ int rangex_start = args->rangex_start; int rangex_end = args->rangex_end; - // このタスクが担当する x の範囲 + // 帥鴻綵 x 膀 int rangex = rangex_end - rangex_start + 1; - // y の範囲 (render_y + rangey - 1) + // y 膀 (render_y + rangey - 1) int rangey = args->rangey; hash = (TileHashPtr)smanager->global_get(GLOBAL_TEXTURE_HASH); @@ -70,7 +70,7 @@ doneWrite = 0; - // span->length_x の処理での再起動位置 + // span->length_x с莎桁篏臀 int js_cont = smanager->get_param(2); //fprintf(stderr, "[%p] end %u\n", spack, spu_readch(SPU_RdDec)); @@ -79,9 +79,9 @@ do { /** - * SpanPack->next が存在する場合、 - * 現在の SpanPack を処理してる間に - * 次の SpanPack の DMA 転送を行う + * SpanPack->next 絖翫 + * 憜 SpanPack + * 罨< SpanPack DMA 荵∫茵 */ if (spack->next != NULL) { smanager->dma_load(next_spack, (uint32)spack->next, @@ -100,15 +100,15 @@ float tey2 = span->tex_y2; /** - * Span が持つ 1 pixel 毎の - * テクスチャの座標 + * Span 1 pixel 罸 + * 鴻c綺ф */ int tex_xpos; int tex_ypos; /** - * (tex_xpos, tex_ypos) の、ブロック内(上の図参照)での座標と - * そのブロックのアドレス(MainMemory) + * (tex_xpos, tex_ypos) (筝喝)с綺ф + * ≪(MainMemory) */ int tex_localx; int tex_localy; @@ -120,7 +120,7 @@ float z = span->start_z; float zpos = span->end_z; - // 座標が [0 .. split_screen_w-1] に入るように x,y を -1 + // 綺ф [0 .. split_screen_w-1] ャ x,y -1 int localx = getLocalX(x-1); int localy = getLocalY(y-1); @@ -154,9 +154,9 @@ float tex_x, tex_y, tex_z; /** - * 一回比較すれば、以後再起動するまでは - * js_cont は使わないから 0 にしてるわけだけど、 - * 最初の一回のためだけにこれはめんどくさいのー。 + * 筝罸莠違篁ュ莎桁障с + * js_cont 篏帥 0 + * 筝若 */ js = (js < js_cont) ? js_cont : js; js_cont = 0; @@ -217,7 +217,7 @@ free(args); /** - * linebuf, zRow, args は RenewTask が引き継ぐ + * linebuf, zRow, args RenewTask 綣膓 */ free(free_spack1); free(free_spack2);
--- a/Renderer/test_render/task/DrawSpanRenew.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/Renderer/test_render/task/DrawSpanRenew.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -25,18 +25,18 @@ renew_task->add_param((int)curr); renew_task->add_param(cur_span_x); - // linebuf と zRow も引き継がせる + // linebuf zRow 綣膓 renew_task->add_param((int)linebuf); renew_task->add_param((int)zRow); //fprintf(stderr, "[%p] start %u\n", curr, spu_readch(SPU_RdDec)); /** - * 再起動したタスクを待つ + * 莎桁帥鴻緇 */ smanager->wait_task(renew_task); - // next_spack は free() するので wait する + // next_spack free() wait smanager->dma_wait(SPAN_PACK_LOAD); } @@ -55,10 +55,10 @@ int rangex_start = args->rangex_start; int rangex_end = args->rangex_end; - // このタスクが担当する x の範囲 + // 帥鴻綵 x 膀 int rangex = rangex_end - rangex_start + 1; - // y の範囲 (render_y + rangey - 1) + // y 膀 (render_y + rangey - 1) int rangey = args->rangey; hash = (TileHashPtr)smanager->global_get(GLOBAL_TEXTURE_HASH); @@ -69,7 +69,7 @@ doneWrite = 0; - // span->length_x の処理での再起動位置 + // span->length_x с莎桁篏臀 int js_cont = smanager->get_param(2); //fprintf(stderr, "[%p] end %u\n", spack, spu_readch(SPU_RdDec)); @@ -78,9 +78,9 @@ do { /** - * SpanPack->next が存在する場合、 - * 現在の SpanPack を処理してる間に - * 次の SpanPack の DMA 転送を行う + * SpanPack->next 絖翫 + * 憜 SpanPack + * 罨< SpanPack DMA 荵∫茵 */ if (spack->next != NULL) { smanager->dma_load(next_spack, (uint32)spack->next, @@ -99,15 +99,15 @@ float tey2 = span->tex_y2; /** - * Span が持つ 1 pixel 毎の - * テクスチャの座標 + * Span 1 pixel 罸 + * 鴻c綺ф */ int tex_xpos; int tex_ypos; /** - * (tex_xpos, tex_ypos) の、ブロック内(上の図参照)での座標と - * そのブロックのアドレス(MainMemory) + * (tex_xpos, tex_ypos) (筝喝)с綺ф + * ≪(MainMemory) */ int tex_localx; int tex_localy; @@ -119,7 +119,7 @@ float z = span->start_z; float zpos = span->end_z; - // 座標が [0 .. split_screen_w-1] に入るように x,y を -1 + // 綺ф [0 .. split_screen_w-1] ャ x,y -1 int localx = getLocalX(x-1); int localy = getLocalY(y-1); @@ -153,9 +153,9 @@ float tex_x, tex_y, tex_z; /** - * 一回比較すれば、以後再起動するまでは - * js_cont は使わないから 0 にしてるわけだけど、 - * 最初の一回のためだけにこれはめんどくさいのー。 + * 筝罸莠違篁ュ莎桁障с + * js_cont 篏帥 0 + * 筝若 */ js = (js < js_cont) ? js_cont : js; js_cont = 0; @@ -217,7 +217,7 @@ //FINISH: /** - * linebuf, zRow, args は RenewTask が引き継ぐ + * linebuf, zRow, args RenewTask 綣膓 */ free(free_spack1); free(free_spack2);
--- a/Renderer/test_render/task/task_init.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/Renderer/test_render/task/task_init.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -17,7 +17,7 @@ SchedExternTask(Dummy); /** - * set_cpu(CPU_PPE) で動作する task + * set_cpu(CPU_PPE) у篏 task */ void task_initialize()
--- a/Renderer/test_render/task/update_sgp.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/Renderer/test_render/task/update_sgp.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -17,7 +17,7 @@ //int screen_width = get_param(0); //int screen_height = get_param(1); - // 本当はここでやるもんじゃないんだが。。。 + // 綵с for (int i = 0; i < sgp->info.size && i < 3; i++) { node = &sgp->node[i];
--- a/Renderer/test_render/viewer_types.h Fri Jun 05 17:07:35 2009 +0900 +++ b/Renderer/test_render/viewer_types.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,12 +1,12 @@ #ifndef INCLUDED_VIEWER_TYPES #define INCLUDED_VIEWER_TYPES -// texture は 8x8 に分割 -// この値は、SpanPack にも使う +// texture 8x8 +// ゃSpanPack 篏帥 const int TEXTURE_SPLIT_PIXEL = 8; const int TEXTURE_BLOCK_SIZE = TEXTURE_SPLIT_PIXEL*TEXTURE_SPLIT_PIXEL; -// 一個の SPE が描画担当する width, height (pixel) +// 筝 SPE 紙綵 width, height (pixel) const int split_screen_w = 256; const int split_screen_h = 8;
--- a/SceneGraph/BlenderScript/export_xml.py Fri Jun 05 17:07:35 2009 +0900 +++ b/SceneGraph/BlenderScript/export_xml.py Wed Jul 15 17:39:51 2009 +0900 @@ -21,6 +21,9 @@ from Blender import sys as bsys, Mathutils, Draw, BGL from Blender.sys import * +global images, imageCount +images = {} +imageCount = 0 def info(object, spacing=10, collapse=1): """Print methods and doc strings. @@ -45,7 +48,7 @@ # Functions ###################################################### - +# Image Get ? # New name based on old with a different extension def newFName(ext): return Blender.Get('filename')[: -len(Blender.Get('filename').split('.', -1)[-1]) ] + ext @@ -202,20 +205,15 @@ ### get texture_image and change base64 data texture = mesh.faces[0].image if texture: - file.write("\t\t<image name=\"%s\">\n" %(texture.getName()) ) - image_path = texture.getFilename() - input = open(expandpath(image_path), 'r') - output = open('output.txt', 'w') - base64.encode(input,output) - input.close() - output.close() - input = open('output.txt', 'r') - for b64 in input.readlines(): - file.write("\t\t\t%s" %b64) - input.close() + file.write(loadTexture(texture)) + + else: + file.write("\t\t<image name=\"%s\">\n" %("sample_white.png") ) + + file.write("\t\t\tiVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAAAAADhZOFXAAAAEElEQVQImWP8zwABTAwUMQBJQQEP\n"); + file.write("\t\t\tlYH+agAAAABJRU5ErkJggg==\n"); + file.write("\t\t</image>\n") - else: - file.write("\t\t<image/>\n") #return str @@ -445,6 +443,29 @@ if evt: Draw.Redraw() + +def loadTexture(texture): + global images, imageCount + name = texture.getName() + if name in images: + return "\t\t<image name=\"" + name + "\"/>\n" + out = "\t\t<image name=\"" + name + "\">\n" + imageCount += 1 + images[name] = imageCount + image_path = texture.getFilename() + input = open(expandpath(image_path), 'r') + output = open('output.txt', 'w') + base64.encode(input,output) + input.close() + output.close() + input = open('output.txt', 'r') + for b64 in input.readlines(): + out += "\t\t\t%s" %b64 + input.close() + os.remove('output.txt') + out += "\t\t</image>\n" + return out + Draw.Register(gui, event, buttonEvt)
--- a/TaskManager/Cell/CellBufferManager.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Cell/CellBufferManager.cc Wed Jul 15 17:39:51 2009 +0900 @@ -7,8 +7,8 @@ { BufferManager::init(); - // なんつーか。。。 - // おかしいよな・・・ + // ゃ若 + // 祉祉 delete taskListImpl; taskListImpl = new CellTaskListInfo; taskListImpl->init(machineNum*2);
--- a/TaskManager/Cell/CellTaskManagerImpl.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.cc Wed Jul 15 17:39:51 2009 +0900 @@ -1,3 +1,5 @@ +#define DEBUG +#include "error.h" #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -5,7 +7,6 @@ #include "CellBufferManager.h" #include "PpeScheduler.h" #include "types.h" -#include "error.h" CellTaskManagerImpl::~CellTaskManagerImpl(void) { @@ -13,8 +14,8 @@ delete [] speTaskList; delete [] speTaskList_bg; /** - * bufferManager は - * ppeManager のなかで delete してもらう + * bufferManager + * ppeManager delete */ // delete bufferManager; delete [] flag_sendTaskList; @@ -43,7 +44,7 @@ flag_sendTaskList[i] = 1; } - // PPE 側の管理をする Manager + // PPE 眼膊∞ Manager ppeManager = new FifoTaskManagerImpl(machineNum); ppeManager->init(new PpeScheduler, bufferManager); } @@ -61,22 +62,22 @@ } } -// SPE_ANY が指定されていた時に -// これをインクリメントしつつ呼ぶことにする。 -// 乱数使ってもいいけどさ。 +// SPE_ANY 絎 +// ゃ潟<潟ゃゅ若吟 +// 箙掩遺戎c int cur_anySpeid = 0; /** - * ActiveTaskQueue から Task を - * 各 SPE に渡す TaskList に入れる + * ActiveTaskQueue Task + * SPE 羝< TaskList ャ * - * ここの activeTaskQueue は FifoTaskManagerImpl のと意味が違い、 - * spe に渡される Task だけ入っている + * activeTaskQueue FifoTaskManagerImpl 潟 + * spe 羝< Task ャc */ void CellTaskManagerImpl::set_runTaskList(void) { - // ここ...直すかな + // ...眼 TaskListPtr list; TaskQueuePtr queue; TaskQueuePtr d; @@ -99,16 +100,16 @@ cur_anySpeid = (cur_anySpeid < machineNum) ? cur_anySpeid : 0; } else { - // -1 してるのは - // htask->cpu_type - CPU_SPE で - // SPE0 = 1, SPE1 = 2, ... SPE5 = 6 ってなってるので - // 配列的 (SPE0 = arr[0], SPE1 = arr[1]) にするため + // -1 + // htask->cpu_type - CPU_SPE + // SPE0 = 1, SPE1 = 2, ... SPE5 = 6 cc + // (SPE0 = arr[0], SPE1 = arr[1]) speid = htask->cpu_type - CPU_SPE - 1; - // SPU の数以上が指定されていれば - // とりあえず MAX_USE_SPE_NUM (実際に動く SPE の最大数) で - // あまり求めてそれを使うことにする。 - // ここで判定するもんでもないか? + // SPU 遺札筝絎 + // MAX_USE_SPE_NUM (絎 SPE 紊ф) + // 障羆篏帥 + // уゅс鐚 if (speid >= machineNum) { speid %= machineNum; } @@ -145,18 +146,18 @@ TaskListPtr ppeTaskList = NULL; MailQueuePtr ppeMail = NULL; - // PPE 側で動く TaskList です - // FifoTaskManagerImpl::run と上手く合うように - // こんなことやってますよ + // PPE 眼у TaskList с + // FifoTaskManagerImpl::run 筝 + // c障 ppeTaskList = ppeManager->get_runTaskList(); if (!ppeTaskList) { goto cont; } - // SPE からの Mailbox Check は - // PPE 側の schedule から抜けて来たときに行う - // (speThreads で Blocking Mailbox read と - // セマフォとか使ってやってもいいが、今はこの方式で) + // SPE Mailbox Check + // PPE 眼 schedule ャ茵 + // (speThreads Blocking Mailbox read + // 祉篏帥cc篁劫) do { ppeMail = ppeManager->schedule(ppeTaskList); cont: @@ -165,45 +166,45 @@ } /** - * SPE からのメールをチェックする + * SPE <若с * * @param [mail_list] - * PPE 側で動く Scheduler からのメールリスト - * この中で PPE 側の mail check も行う + * PPE 眼у Scheduler <若鴻 + * 筝 PPE 眼 mail check 茵 * - * @return PPE Scheduler に対してのメール。 - * 次に実行する TaskList のアドレスや、終了コマンドを送る + * @return PPE Scheduler 絲障<若 + * 罨<絎茵 TaskList ≪鴻腟篋潟潟 */TaskListPtr CellTaskManagerImpl::mail_check(MailQueuePtr mail_list) { - // PPE Scheduler からの mail check + // PPE Scheduler mail check ppeManager->mail_check(mail_list, &waitTaskQueue); do { unsigned int data; - // SPE Scheduler からの mail check + // SPE Scheduler mail check for (int id = 0; id < machineNum; id++) { while (speThreads->check_mail(id, 1, &data)) { /** - * MY_SPE_STATUS_READY: SPE が持ってた Task 全て終了 - * MY_SPE_NOP: 特に意味のないコマンド - * それ以外:終了したタスク(PPEにあるのでアドレス + * MY_SPE_STATUS_READY: SPE c Task 腟篋 + * MY_SPE_NOP: 鴻潟潟潟 + * 篁ュ鐚腟篋帥鴻(PPEс≪ * - * MY_SPE_NOP が 0 なので、 - * 下のように data > MY_SPE_NOP とかしています。 - * 一目でよくわからない書き方なんで、直したいところですが。。。 + * MY_SPE_NOP 0 с + * 筝 data > MY_SPE_NOP 障 + * 筝с吾鴻с眼с */ - // 名前あとでちゃんと決めよう => MY_SPE_... とかじゃなくて + // с<羆冴 => MY_SPE_... if (data == MY_SPE_STATUS_READY) { - __debug_ppe("[SPE %d] finish\n", id); + //__debug_ppe("[SPE %d] finish\n", id); flag_sendTaskList[id] = 1; } else if (data == MY_SPE_COMMAND_MALLOC) { - __debug_ppe("[PPE] MALLOC COMMAND from [SPE %d]\n", id); + //__debug_ppe("[PPE] MALLOC COMMAND from [SPE %d]\n", id); /** - * info[0] = alloc_id; (CellScheduler::mainMem_alloc 参照) + * info[0] = alloc_id; (CellScheduler::mainMem_alloc ) * info[1] = alloc_addr; */ unsigned int alloc_info[3]; @@ -217,51 +218,52 @@ alloc_info[1] = (unsigned int)allocate(alloc_size); /* - * allocate された領域は今の SPE buffer にリンクとして接続する - * ここでは TaskList を allocate(new) して登録してやろうか + * allocate 篁 SPE buffer 潟・膓 + * с TaskList allocate(new) 脂蚊 */ + //__debug_ppe("[PPE] MALLOCED 0x%x from [SPE %d]\n", alloc_info[1],id); speThreads->add_output_tasklist(command, alloc_info[1], alloc_size); speThreads->send_mail(id, 2, alloc_info); } else if (data > MY_SPE_NOP) { - __debug_ppe("[PPE] recv from [SPE %d] : 0x%x\n", id, data); + //__debug_ppe("[PPE] recv from [SPE %d] : 0x%x\n", id, data); check_task_finish((HTaskPtr)data); } } } - // 依存関係を満たしたタスクをアクティブに + // 箴絖≫羣帥鴻≪c wakeup_waitTask(); - // SPE に送る TaskList の準備 + // SPE TaskList 羣 set_runTaskList(); - // TaskList 待ちの SPE に TaskList を送る + // TaskList 緇< SPE TaskList for (int i = 0; i < machineNum; i++) { if (flag_sendTaskList[i] == 1 && speTaskList_bg[i]->length >= 1 ) { send_taskList(i); } } - // 現在の FifoTaskManager の仕様では - // ・PPE で実行するタスクが無くなれば終了する - // であり、この場合もし SPE にタスクが残っていても - // メインループから抜けてプログラム終了となってしまうので - // ここでストップかけてます。 + // 憜 FifoTaskManager 篁罕с + // PPE у茵帥鴻<亥篋 + // с翫 SPE 帥鴻罧c + // <ゃ潟若違腟篋c障 + // с鴻障 } while (!ppeManager->activeTaskQueue && waitTaskQueue); return ppeManager->get_runTaskList(); } /** - * 条件を満たしたら SPE に TaskList を送信する - * 条件1. SPE が持ってた TaskList を終了して、次の TaskList を待ってる - * 条件2. SPE に送る TaskList に Task がある + * >散羣 SPE TaskList 篆< + * >散1. SPE c TaskList 腟篋罨< TaskList 緇c + * >散2. SPE TaskList Task * - * SPE で実行終了した TaskList [speTaskList] と - * これから実行する TaskList [speTaskList_bg] のバッファを入れ替える - * ついでに実行終了したやつは clear しておく。 + * SPE у茵腟篋 TaskList [speTaskList] + * 絎茵 TaskList [speTaskList_bg] <ャ帥 + * ゃс絎茵腟篋ゃ clear */ void CellTaskManagerImpl::send_taskList(int id) @@ -286,7 +288,7 @@ posix_memalign(&buff, DEFAULT_ALIGNMENT, size); - // bzero はコストが高いのでやりたくない + // bzero 潟鴻蕭с bzero(buff, size); return buff;
--- a/TaskManager/Cell/SpeThreads.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Cell/SpeThreads.cc Wed Jul 15 17:39:51 2009 +0900 @@ -69,8 +69,8 @@ pthread_create(&thread, NULL, &spe_thread_run, (void*)arg_t->ctx); - // mail read の blocking ができれば - // ここで呼んだ方が早い。 + // mail read blocking с + // у若鴻 pthread_exit(NULL); } @@ -109,7 +109,7 @@ /** - * SPE からのメールを受信する。 + * SPE <若篆< * * @param [speid] SPE ID * @@ -119,13 +119,16 @@ int SpeThreads::get_mail(int speid, int count, unsigned int* ret) { - while(spe_out_mbox_status(spe_ctx[speid]) < count); return spe_out_mbox_read(spe_ctx[speid], ret, count); } int SpeThreads::check_mail(int speid, int count, unsigned int* ret) { +/* + * spe_out_mbox_status return only 1, waiting for multiple length + * does not work. + */ if (spe_out_mbox_status(spe_ctx[speid]) >= count) { return spe_out_mbox_read(spe_ctx[speid], ret, count); } else { @@ -135,13 +138,13 @@ /** * Inbound Mailbox - * メール送信 PPE -> SPE + * <若篆 PPE -> SPE * - * なるべく NONBLOCKING なんだけど、 - * Inbound Mailbox キューに空きがないと送信できないので - * 送信する数だけ空いているか確認してから送る。空いて無い場合は待つ。 + * 鴻 NONBLOCKING + * Inbound Mailbox ャ若腥冴篆<с + * 篆<違腥冴腆肴腥冴<翫緇ゃ * - * 結局待つんだよな。しかも ALL_BLOCKING って実は busy wait だったりするし + * 腟絮緇ゃ ALL_BLOCKING c絎 busy wait c * * @param [speid] SPE ID * @param [data] Send 32-bit mailbox messages @@ -157,10 +160,10 @@ SpeThreads::add_output_tasklist(int command, unsigned int buff, int alloc_size) { /* - * output TaskList が無ければ新しく作る - * あれば TaskList に allocate した Task を追加 - * command に対応した Task の初期化を実行する - * SPE に data が書き出し終わった後に PPE 側で初期化 + * output TaskList <井違鋎 + * TaskList allocate Task 菴遵 + * command 絲上 Task 絎茵 + * SPE data 吾冴腟c緇 PPE 眼у */ }
--- a/TaskManager/Cell/spe/CellScheduler.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Cell/spe/CellScheduler.cc Wed Jul 15 17:39:51 2009 +0900 @@ -4,8 +4,8 @@ #include "CellDmaManager.h" #include "error.h" -// ユーザプログラムで定義 -// なんだけど、それは微妙じゃね? +// 若吟違у臂 +// 緇絋鐚 extern void task_init(void); void @@ -15,7 +15,9 @@ mainMemNum = 0; - task_init(); + task_init(); // PPE眼сUser 眼ф≪若с... + // SPE眼у若喝冴綽荀 + // Fifo сSPE<у若喝冴 } void* @@ -25,11 +27,11 @@ } /** - * メインメモリ領域を allocate する。 - * allocate した領域のアドレスは mainMem_get で取得するが、 - * mainMem_get を実行できるのは - * Renew Task (タスク内で create した Task) から。 - * alloc してすぐ get しても、アドレス何も入ってないです。 + * <ゃ潟<≪ allocate + * allocate ≪鴻 mainMem_get у緇 + * mainMem_get 絎茵с + * Renew Task (帥鴻 create Task) + * alloc get ≪剛ャcс */ void CellScheduler::mainMem_alloc(int id, int size)
--- a/TaskManager/Cell/spe/Task.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Cell/spe/Task.cc Wed Jul 15 17:39:51 2009 +0900 @@ -1,7 +1,7 @@ #include "Task.h" /** - * タスクの入力データを追加する + * 帥鴻ュ若帥菴遵 * * @param [addr] add input data * @param [size] size of data at [addr] @@ -21,12 +21,12 @@ } /** - * エラーの時に -1 を返す、ってことするよりは - * perror みたいにしたほうがわかりやすいかな。 + * 若 -1 菴c + * perror 帥祉 * - * 現在は 3 個まで。 - * 本当は、3個以上にすると task->param[] には アドレスが入り - * そのアドレスは メインメモリでアロケートされた int の集合。 + * 憜 3 障с + * 綵3篁ヤ task->param[] ≪鴻ャ + * ≪鴻 <ゃ潟<≪с≪宴若 int */ int Task::add_param(int _param) @@ -38,8 +38,8 @@ } /* - * エラーの時に -1 を返す、ってことするよりは - * perror みたいにしたほうがわかりやすいかな。 + * 若 -1 菴c + * perror 帥祉 */ int Task::add_data(ListDataPtr list, uint32 addr, int size) @@ -48,7 +48,7 @@ list->bound[list->length] = list->size; - // size でも制限かけるべき? + // size с狗鴻鐚 list->size += size; ListElementPtr elm = &list->element[list->length++];
--- a/TaskManager/ChangeLog Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/ChangeLog Wed Jul 15 17:39:51 2009 +0900 @@ -1,3 +1,30 @@ +2009-07-15 Yusuke KOBAYASHI <koba@cr.ie.u-ryukyu.ac.jp> + + PPU MainMemory Resource Access API + 激ャ freeList 筝 HashTable х∞ + + set_rgb 後 + uint32 segment_id = smanager->get_segment(uint32 addr, uint32 size) + id hashゃ後 + + smanager->put_segment(wait_id); + + + addr ф絎 PPU Address Hash 茯帥鴻< dma_load 絎 id 菴 + void* smanager->wait_segment(uint32 segment_id) + id ф絎 PPU segment copy Address 菴綽荀 dma_wait 茵 + +2009-06-8 Shinji KONO <kono@ie.u-ryukyu.ac.jp> + + SchedTask/SchedTaskImpl ≪障潟c + SchedTaskBase ≪ + __list private + ScheTaskImple 篏c膓帥private + warning 冴 User Task space 腥咲腟絮羆障 + + delegate 鴻SchedTaskBase с + indirect 紜с<c + 2009-06-4 Shinji KONO <kono@ie.u-ryukyu.ac.jp> set_symbol ?
--- a/TaskManager/Fifo/FifoDmaManager.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Fifo/FifoDmaManager.cc Wed Jul 15 17:39:51 2009 +0900 @@ -18,7 +18,7 @@ } /** - * mask で設定した DMA 転送の完了を待つ + * mask ц┃絎 DMA 荵∫絎篋緇 */ void FifoDmaManager::dma_wait(uint32 mask) @@ -44,7 +44,7 @@ q = mail_recvQueue; if (q == NULL) { - return 0; // error か 正しい値か判断できないな・・・ + return 0; // error 罩cゃゆс祉祉 } mail_recvQueue = mail_recvQueue->next;
--- a/TaskManager/Fifo/FifoTaskManagerImpl.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Fifo/FifoTaskManagerImpl.cc Wed Jul 15 17:39:51 2009 +0900 @@ -13,9 +13,9 @@ } /** - * MailManager は PPE スケジューラとのメール交換、 - * FifoScheduler は PPE 側のスケジューラ - * BufferManager は Task、TaskList などのメモリ管理(大層なことしてないが + * MailManager PPE 鴻宴吾ャ若<若篋ゆ + * FifoScheduler PPE 眼鴻宴吾ャ若 + * BufferManager TaskTaskList <≪膊∞(紊у韻 */ void FifoTaskManagerImpl::init(void) @@ -35,10 +35,10 @@ } /** - * これは CellTaskManagerImpl から呼ばれる。 - * BufferManager は共用で使うので引数に。 - * CellTaskManagerImpl と FifoTaskManagerImpl が同時に - * 上のデータにアクセスする事は(今は)ないのでこれでおk + * CellTaskManagerImpl 若違 + * BufferManager 援т戎у違 + * CellTaskManagerImpl FifoTaskManagerImpl + * 筝若帥≪祉鴻篋(篁)ссk */ void FifoTaskManagerImpl::init(MainScheduler *_sched, BufferManager *buff) @@ -57,12 +57,12 @@ } /** - * スケジューラに渡す TaskList を取得する。 + * 鴻宴吾ャ若羝< TaskList 緇 * - * @return 実行タスクリスト + * @return 絎茵帥鴻鴻 * - * ActiveTaskQueue (依存条件は満たし済み) のタスクを - * 実行タスクリストに入れる + * ActiveTaskQueue (箴絖>散羣羝) 帥鴻 + * 絎茵帥鴻鴻ャ */ TaskListPtr FifoTaskManagerImpl::get_runTaskList(void) @@ -70,18 +70,18 @@ TaskListPtr list, list_top; TaskQueuePtr queue; TaskQueuePtr d; - HTaskPtr htask; // HTask (PPE にある) - TaskPtr task; // Task (SPE に送る Task) + HTaskPtr htask; // HTask (PPE ) + TaskPtr task; // Task (SPE Task) queue = activeTaskQueue; if (queue == NULL) { return NULL; } - // PPE 側で実行される TaskList + // PPE 眼у茵 TaskList list_top = mainTaskList; - // list_top->clear() とかの方がいいかもしれん。 + // list_top->clear() 鴻 list_top = bufferManager->clear_taskList(list_top); list = list_top; @@ -126,41 +126,41 @@ list = get_runTaskList(); do { - // list を実行する + // list 絎茵 mail = schedule(list); - // mail には、ppe scheduler からの mail がある + // mail ppe scheduler mail mail_check(mail); - // 依存関係を満たしたものは実行可能キューへ + // 箴絖≫羣絎茵純ャ若 wakeup_waitTask(); list = get_runTaskList(); } while (list); } /** - * @param [list] 実行タスクリスト - * @return FifoScheduler からのメール + * @param [list] 絎茵帥鴻鴻 + * @return FifoScheduler <若 * - * [Tasklist] -> [番兵] -> scheduler->run を抜ける + * [Tasklist] -> [] -> scheduler->run */ MailQueuePtr FifoTaskManagerImpl::schedule(TaskListPtr list) { MailQueuePtr list_mail; // task list - MailQueuePtr sentinel; // 番兵 + MailQueuePtr sentinel; // MailQueuePtr in_mail_list = NULL; MailQueuePtr out_mail_list = NULL; - // TaskList のアドレス + // TaskList ≪ list_mail = mailManager->create((unsigned int)list); in_mail_list = MailManager::append_mailQueue(in_mail_list, list_mail); - // EXIT_COMMAND (番兵的な意味で) + // EXIT_COMMAND (窮潟) sentinel = mailManager->create(MY_SPE_COMMAND_EXIT); in_mail_list = MailManager::append_mailQueue(in_mail_list, sentinel); - // scheduler は受け取ったメールを元に実行する + // scheduler c<若絎茵 scheduler->send_mailList(in_mail_list); scheduler->run(); out_mail_list = scheduler->recv_mailList(); @@ -169,14 +169,14 @@ } /** - * PPE Scheduler からのメールをチェックする + * PPE Scheduler <若с * * @param [mail_list] - * PPE 側で動く Scheduler からのメールリスト - * 終了した Task や、その他(今はまだ実装してないけど)の情報が入ってる + * PPE 眼у Scheduler <若鴻 + * 腟篋 Task 篁(篁障絎茖)宴ャc * - * @return Scheduler が次に実行する Task List - * NULL なら全てのタスクが実行終了したということ + * @return Scheduler 罨<絎茵 Task List + * NULL 帥鴻絎茵腟篋 */ void FifoTaskManagerImpl::mail_check(MailQueuePtr mail_list) @@ -189,13 +189,13 @@ data = q->data; /** - * MY_SPE_STATUS_READY: SPE が持ってた Task 全て終了 - * MY_SPE_NOP: 特に意味のないコマンド - * それ以外:終了したタスク(PPEにあるのでアドレス + * MY_SPE_STATUS_READY: SPE c Task 腟篋 + * MY_SPE_NOP: 鴻潟潟潟 + * 篁ュ鐚腟篋帥鴻(PPEс≪ * - * MY_SPE_NOP が 0 なので、 - * 下のように data > MY_SPE_NOP とかしています。 - * 一目でよくわからない書き方なんで、直したいところですが。。。 + * MY_SPE_NOP 0 с + * 筝 data > MY_SPE_NOP 障 + * 筝с吾鴻с眼с */ if (data == MY_SPE_STATUS_READY) { __debug_ppe("mail_check(): Task List finish\n"); @@ -225,9 +225,9 @@ } /** - * こういう使い方を + * 篏帥鴻 * Abstract Factory Pattern - * というらしい。 + * */ #ifdef __CERIUM_FIFO__ TaskManagerImpl*
--- a/TaskManager/Fifo/MainScheduler.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Fifo/MainScheduler.cc Wed Jul 15 17:39:51 2009 +0900 @@ -17,8 +17,8 @@ } /** - * PPE TaskManager から TaskList やその他コマンドが格納された - * メールキューが送られてくる + * PPE TaskManager TaskList 篁潟潟主 + * <若ャ若 */ void MainScheduler::send_mailList(MailQueuePtr mail_list) @@ -28,8 +28,8 @@ } /** - * PPE TaskManager が、 Task の終了やその他コマンドが格納された - * メールキューを受け取る + * PPE TaskManager Task 腟篋篁潟潟主 + * <若ャ若 */ MailQueuePtr MainScheduler::recv_mailList(void) @@ -49,8 +49,8 @@ /** - * メインメモリ領域を allocate する。 - * Fifo バージョンだから、まあ普通に malloc でおk + * <ゃ潟<≪ allocate + * Fifo 若吾с潟障 malloc сk */ void MainScheduler::mainMem_alloc(int id, int size) @@ -60,11 +60,11 @@ #if 0 /** - * MainScheduler.h に書いてます + * MainScheduler.h 吾障 */ void MainScheduler::mainMem_wait(void) { - // 何もしねえ + // 篏 } #endif
--- a/TaskManager/Makefile.cell Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Makefile.cell Wed Jul 15 17:39:51 2009 +0900 @@ -4,8 +4,28 @@ SPETARGET = libspemanager.a CELL_SPE_DIR = $(IMPL_CELL_DIR)/spe -CELL_SPE_SRCS = $(wildcard $(CELL_SPE_DIR)/*.cc) -CELL_SPE_OBJS = $(CELL_SPE_SRCS:.cc=.o) + +CELL_SPE_SCHEDULE_SRC = $(CELL_SPE_DIR)/SchedExit.cc \ + $(CELL_SPE_DIR)/SchedNop2Ready.cc \ + $(CELL_SPE_DIR)/SchedTaskList.cc \ + $(CELL_SPE_DIR)/SchedMail.cc \ + $(CELL_SPE_DIR)/SchedTask.cc \ + $(CELL_SPE_DIR)/Scheduler.cc\ + $(CELL_SPE_DIR)/SchedNop.cc \ + $(CELL_SPE_DIR)/TaskGroup.cc +CELL_SPE_SCHEDULE_OBJ = $(CELL_SPE_SCHEDULE_SRC:.cc=.o) + +CELL_SPE_SRCS = \ + $(CELL_SPE_DIR)/CellDmaManager.cc \ + $(CELL_SPE_DIR)/TaskList.cc \ + $(CELL_SPE_DIR)/CellScheduler.cc \ + $(CELL_SPE_DIR)/TaskQueue.cc \ + $(CELL_SPE_DIR)/Task.cc \ + $(CELL_SPE_DIR)/main.cc + +# $(wildcard $(CELL_SPE_DIR)/*.cc) + +CELL_SPE_OBJS = $(CELL_SPE_SRCS:.cc=.o) $(CELL_SPE_SCHEDULE_OBJ) SPUCC = spu-g++ @@ -14,7 +34,8 @@ SPE_CFLAGS = -fno-exceptions -fno-rtti all: default -default: $(TARGET) $(SPETARGET) + +default: $(CELL_SPE_SCHEDULE_SRC) $(TARGET) $(SPETARGET) PPE_ALL_OBJS = $(KERN_MAIN_OBJS) $(KERN_PPE_OBJS) $(KERN_SCHED_OBJS) $(KERN_SYSTASK_OBJS) $(IMPL_CELL_OBJS) @@ -27,6 +48,9 @@ $(SPETARGET): $(CELL_SPE_OBJS) ar crus $@ $(CELL_SPE_OBJS) +$(CELL_SPE_SCHEDULE_SRC): kernel/schedule/*.cc + cp kernel/schedule/*.cc $(CELL_SPE_DIR)/ + $(CELL_SPE_OBJS): %.o : %.cc $(SPUCC) $(CFLAGS) $(SPE_CFLAGS) $(INCLUDE) -c $< -o $@ @@ -35,5 +59,8 @@ rm -f $(SPETARGET) cellclean: - rm -f $(CELL_SPE_OBJS) - cd $(CELL_SPE_DIR); rm -f *~ \#* + rm -f $(CELL_SPE_OBJS) $(CELL_SPE_SCHEDULE_SRC) + (cd $(CELL_SPE_DIR); rm -f *~ \#*) + + +
--- a/TaskManager/Test/simple_pack/main.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/simple_pack/main.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -59,8 +59,8 @@ } -// クラス関数は単純にポインタで扱えないので -// 現状は間接的に呼ぶことに +// 拷∽違膣ゃ潟帥ф宴 +// 憟吟・若吟 int sdl_init(void *r, void *w) { __debug("[%s]\n", __FUNCTION__); @@ -119,8 +119,8 @@ task_initialize(); - // 本当は、dlsym みたいなものを使いたいんだけど - // 静的なやつはできないん? + // 綵dlsym 帥篏帥 + // ゃс鐚 manager->set_symbol("init", (void*)init); manager->set_symbol("sdl_init", (void*)sdl_init); manager->set_symbol("zRow_init", (void*)zRow_init); @@ -150,9 +150,9 @@ } } - // 一番最初に行われる init 専用の task_run があってもいいけど。。 - // その場合は引数とか固定か。まあ引数は argc, argv を持つ - // 構造体で固定しても問題はない・・・か? + // 筝茵 init 絨 task_run c + // 翫綣違阪障綣違 argc, argv + // 罕篏у阪馹祉祉祉鐚 HTaskPtr task_init; int fd_init; initArg = new struct init_arg;
--- a/TaskManager/Test/simple_pack/span.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/simple_pack/span.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -5,7 +5,7 @@ using namespace std; -// f1:x$B$NA}2CNL(B f2:y$B$NA}2CNL(B i:....... base:$B4pK\$H$J$kD:E@$N(By$B:BI8(B +// f1:x紜 f2:y紜 i:....... base:堺鴻y綺ф static float calc(float f1, float f2,int i, float base){ float ans; ans = f1/f2*i + base; @@ -78,7 +78,7 @@ int end_y = (int)vMin->y; if (start_y<end_y) { - int i; i=end_y; end_y=start_y; start_y = i; //y$B$NF~$lBX$((B + int i; i=end_y; end_y=start_y; start_y = i; //yャ帥 //Vertex *v; v = vMin; vMin = vMid; vMid = v; /* incli_x1 = vMin->x - vMid->x; incli_x2 = vMin->x - vMid1->x; @@ -96,13 +96,13 @@ //if(div_y < 1 && div_y > -1) div_y = 1; for(i = k; i < div_y+1; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B + //span綏腴勆x,z羆 tmp_xpos = calc(vMid1->x - vMin->x ,div_y, i, vMin->x); tmp_end = calc(vMid->x - vMin->x ,div_y, i, vMin->x); tmp_z = calc(vMid1->z - vMin->z ,div_y, i, vMin->z); tmp_zpos = calc(vMid->z - vMin->z ,div_y, i, vMin->z); //printf("x:%f end:%f z:%f zpos:%f\n",tmp_xpos,tmp_end,tmp_z,tmp_zpos); - //$B$3$3$+$i(Bspan$B$N:8C<$H1&C<$KBP1~$9$k%F%/%9%A%c$r7W;;$9$k(B + //span綏腴勆絲上鴻c荐膊 tmp_tex1 =((i/(div_y)) * vMid1->tex_x) + \ ( ((div_y - i)/(div_y)) * vMin->tex_x); tmp_tex2 =( (i/(div_y)) * vMid->tex_x) + \ @@ -113,7 +113,7 @@ tmp_tey2 =( (i/(div_y)) * vMid->tex_y) + \ ( ((div_y - i)/(div_y)) * vMin->tex_y); - //$B$3$3$G:8C<$,(Bxpos$B$+(Bend$B$rH=CG$7!"IA2h$9$k(Bspan$B$r:n$k(B + //у窪腴xposendゆ祉span篏 if(tmp_xpos > tmp_end) { x = (int)tmp_end; y = (int)vMin->y + i*l; @@ -236,13 +236,13 @@ if(div_y < 1 && div_y > -1) div_y = 1; for(i = 0; i < div_x+1; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B + //span綏腴勆x,z羆 tmp_xpos = calc(vMax->x - vMin->x,div_y, i, vMin->x); tmp_end = calc(vMid->x - vMin->x,div_x, i, vMin->x); tmp_z = calc(vMax->z - vMin->z,div_y, i, vMin->z); tmp_zpos = calc(vMid->z - vMin->z,div_x, i, vMin->z); - //$B$3$3$+$i(Bspan$B$N:8C<$H1&C<$KBP1~$9$k%F%/%9%A%c$r7W;;$9$k(B + //span綏腴勆絲上鴻c荐膊 tmp_tex1 =( (i/(div_y)) * vMax->tex_x) + \ ( ((div_y - i)/(div_y)) * vMin->tex_x); tmp_tex2 =( (i/(div_x)) * vMid->tex_x) + \ @@ -253,7 +253,7 @@ tmp_tey2 =( (i/(div_x)) * vMid->tex_y) + \ ( ((div_x - i)/(div_x)) * vMin->tex_y); - //$B$3$3$G:8C<$,(Bxpos$B$+(Bend$B$rH=CG$7!"IA2h$9$k(Bspan$B$r:n$k(B + //у窪腴xposendゆ祉span篏 if(tmp_xpos > tmp_end) { x = (int)tmp_end; y = (int)vMin->y + i; @@ -315,7 +315,7 @@ if(div_y < 1 && div_y > -1) div_y = 1; for(i = 0; i < div_x; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B + //span綏腴勆x,z羆 tmp_xpos = calc(vMax->x-vMin->x, div_y, (i+1+top_triangle), vMin->x); tmp_end = calc(vMax->x-vMid->x, div_x, (i+1), vMid->x); tmp_z = calc(vMax->z-vMin->z, div_y, (i+1+top_triangle), vMin->z); @@ -389,7 +389,7 @@ #endif } -// i:$BJ,;R!"(Bf1:$BD9$5(B f2:$BBP1~$9$kD:E@(B1 f3:$BBP1~$9$kD:E@(B2 +// i:絖f1:激 f2:絲上1 f3:絲上2 /* float Span::calc2(int i, float f1, float f2, float f3) { float ans;
--- a/TaskManager/Test/simple_pack/task/update_sgp.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/simple_pack/task/update_sgp.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -16,7 +16,7 @@ node = &sgp->node[i]; - // 本当は、ここは上の my_func で行う + // 綵筝 my_func ц y_angle = node->angle[1]; y_angle += 1.0f; if (y_angle > 360.0f) y_angle = 0.0f; @@ -36,9 +36,9 @@ } } - // まあこれは多分駄目なんだけど。 - // in/out と update は分ける必要ある? - // それはユーザ側で in/out になるように書かせるもの? + // 障紊薈 + // in/out update 綽荀鐚 + // 若九眼 in/out 吾鐚 memcpy(_sgp, sgp, sizeof(SceneGraphPack)); return sizeof(SceneGraphPack);
--- a/TaskManager/Test/simple_render/SpanC.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/simple_render/SpanC.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -5,7 +5,7 @@ using namespace std; -// f1:x$B$NA}2CNL(B f2:y$B$NA}2CNL(B i:....... base:$B4pK\$H$J$kD:E@$N(By$B:BI8(B +// f1:x紜 f2:y紜 i:....... base:堺鴻y綺ф static float calc(float f1, float f2,int i, float base){ float ans; ans = f1/f2*i + base; @@ -78,7 +78,7 @@ int end_y = (int)vMin->y; if (start_y<end_y) { - int i; i=end_y; end_y=start_y; start_y = i; //y$B$NF~$lBX$((B + int i; i=end_y; end_y=start_y; start_y = i; //yャ帥 //Vertex *v; v = vMin; vMin = vMid; vMid = v; /* incli_x1 = vMin->x - vMid->x; incli_x2 = vMin->x - vMid1->x; @@ -96,13 +96,13 @@ //if(div_y < 1 && div_y > -1) div_y = 1; for(i = k; i < div_y+1; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B + //span綏腴勆x,z羆 tmp_xpos = calc(vMid1->x - vMin->x ,div_y, i, vMin->x); tmp_end = calc(vMid->x - vMin->x ,div_y, i, vMin->x); tmp_z = calc(vMid1->z - vMin->z ,div_y, i, vMin->z); tmp_zpos = calc(vMid->z - vMin->z ,div_y, i, vMin->z); //printf("x:%f end:%f z:%f zpos:%f\n",tmp_xpos,tmp_end,tmp_z,tmp_zpos); - //$B$3$3$+$i(Bspan$B$N:8C<$H1&C<$KBP1~$9$k%F%/%9%A%c$r7W;;$9$k(B + //span綏腴勆絲上鴻c荐膊 tmp_tex1 =((i/(div_y)) * vMid1->tex_x) + \ ( ((div_y - i)/(div_y)) * vMin->tex_x); tmp_tex2 =( (i/(div_y)) * vMid->tex_x) + \ @@ -113,7 +113,7 @@ tmp_tey2 =( (i/(div_y)) * vMid->tex_y) + \ ( ((div_y - i)/(div_y)) * vMin->tex_y); - //$B$3$3$G:8C<$,(Bxpos$B$+(Bend$B$rH=CG$7!"IA2h$9$k(Bspan$B$r:n$k(B + //у窪腴xposendゆ祉span篏 if(tmp_xpos > tmp_end) { x = (int)tmp_end; y = (int)vMin->y + i*l; @@ -236,13 +236,13 @@ if(div_y < 1 && div_y > -1) div_y = 1; for(i = 0; i < div_x+1; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B + //span綏腴勆x,z羆 tmp_xpos = calc(vMax->x - vMin->x,div_y, i, vMin->x); tmp_end = calc(vMid->x - vMin->x,div_x, i, vMin->x); tmp_z = calc(vMax->z - vMin->z,div_y, i, vMin->z); tmp_zpos = calc(vMid->z - vMin->z,div_x, i, vMin->z); - //$B$3$3$+$i(Bspan$B$N:8C<$H1&C<$KBP1~$9$k%F%/%9%A%c$r7W;;$9$k(B + //span綏腴勆絲上鴻c荐膊 tmp_tex1 =( (i/(div_y)) * vMax->tex_x) + \ ( ((div_y - i)/(div_y)) * vMin->tex_x); tmp_tex2 =( (i/(div_x)) * vMid->tex_x) + \ @@ -253,7 +253,7 @@ tmp_tey2 =( (i/(div_x)) * vMid->tex_y) + \ ( ((div_x - i)/(div_x)) * vMin->tex_y); - //$B$3$3$G:8C<$,(Bxpos$B$+(Bend$B$rH=CG$7!"IA2h$9$k(Bspan$B$r:n$k(B + //у窪腴xposendゆ祉span篏 if(tmp_xpos > tmp_end) { x = (int)tmp_end; y = (int)vMin->y + i; @@ -315,7 +315,7 @@ if(div_y < 1 && div_y > -1) div_y = 1; for(i = 0; i < div_x; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B + //span綏腴勆x,z羆 tmp_xpos = calc(vMax->x-vMin->x, div_y, (i+1+top_triangle), vMin->x); tmp_end = calc(vMax->x-vMid->x, div_x, (i+1), vMid->x); tmp_z = calc(vMax->z-vMin->z, div_y, (i+1+top_triangle), vMin->z); @@ -389,7 +389,7 @@ #endif } -// i:$BJ,;R!"(Bf1:$BD9$5(B f2:$BBP1~$9$kD:E@(B1 f3:$BBP1~$9$kD:E@(B2 +// i:絖f1:激 f2:絲上1 f3:絲上2 /* float Span::calc2(int i, float f1, float f2, float f3) { float ans;
--- a/TaskManager/Test/simple_render/fb.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/simple_render/fb.h Wed Jul 15 17:39:51 2009 +0900 @@ -46,7 +46,7 @@ int xres,yres,vbpp,line_len; //unsigned short tcolor ; - /* 読み書き用にファイルを開く */ + /* 茯炊吾<ゃ */ fd_framebuffer = open( DEVICE_NAME , O_RDWR); if ( !fd_framebuffer ) { send_current_error_msg("Framebuffer device open error !"); @@ -54,13 +54,13 @@ } send_current_information("The framebuffer device was opened !"); - /* 固定スクリーン情報取得 */ + /* 阪鴻若恰怨緇 */ if ( ioctl( fd_framebuffer , FBIOGET_FSCREENINFO , &finfo ) ) { send_current_error_msg("Fixed information not gotton !"); exit(2); } - /* 変動スクリーン情報取得 */ + /* 紊鴻若恰怨緇 */ if ( ioctl( fd_framebuffer , FBIOGET_VSCREENINFO , &vinfo ) ) { send_current_error_msg("Variable information not gotton !"); exit(3); @@ -72,10 +72,10 @@ sprintf( tmp , "%d(pixel)x%d(line), %dbpp(bits per pixel)",xres,yres,vbpp); send_current_information( tmp ); - /* バイト単位でのスクリーンのサイズを計算 */ + /* ゃ篏с鴻若潟泣ゃ冴荐膊 */ screensize = xres * yres * vbpp / DIV_BYTE ; - /* デバイスをメモリにマップする */ + /* ゃ鴻<≪ */ fbptr = (char *)mmap(0,screensize,PROT_READ | PROT_WRITE,MAP_SHARED,fd_framebuffer,0); if ( (int)fbptr == -1 ) { send_current_error_msg("Don't get framebuffer device to memory !");
--- a/TaskManager/Test/simple_render/main.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/simple_render/main.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -9,8 +9,8 @@ #include "error.h" -// あとで直す -// 引数からできるように +// х眼 +// 綣違с #define SPENUM 6 /* prototype */ @@ -33,8 +33,8 @@ struct init_arg *initArg; -// クラス関数は単純にポインタで扱えないので -// 現状は間接的に呼ぶことに +// 拷∽違膣ゃ潟帥ф宴 +// 憟吟・若吟 int run_loop(void *r, void *w) { __debug("[%s] start\n", __FUNCTION__);
--- a/TaskManager/Test/simple_render/spe/CreatePolygonPack.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/simple_render/spe/CreatePolygonPack.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -89,7 +89,7 @@ abc[2] = xyz[2]; abc[3] = xyz[3]; - // SIMD 使えるよね + // SIMD 篏帥 for (int i=0; i<4; i++) { xyz[i] = abc[0]*matrix[i] + abc[1]*matrix[i+4]
--- a/TaskManager/Test/simple_render/spe/SpuDraw.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/simple_render/spe/SpuDraw.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -12,21 +12,21 @@ #define PIXELSIZE 11520 //32 line pixel size -// 本来なら PPE から受け取る情報です +// ャ PPE 宴с #define FRAMEBUFFER_X 1920 #define FRAMEBUFFER_Y 1080 -// IMG_MAX_X x 8 が、spe が持てる 最大 -// 現在、1920x8の zBuf は持てない +// IMG_MAX_X x 8 spe 紊 +// 憜1920x8 zBuf #define IMG_MAX_X 720 #define SPAN_PACK_LOAD 20 /** - * SpanPack にある Span が持つ y 座標は + * SpanPack Span y 綺ф * .. [-16 ~ -9] [-8 ~ -1] [0 ~ 7] [8 ~ 16] .. - * のどれかの区域に入るように Pack されている。 - * sp->span[0].y から、その区域の一番上の y 座標を求める。 + * 阪ャ Pack + * sp->span[0].y 阪筝筝 y 綺ф羆 */ #define YTOP(y) (y &~(TEXTURE_SPLIT_PIXEL-1)) #define YOFF(y) (y & (TEXTURE_SPLIT_PIXEL-1)) @@ -45,9 +45,9 @@ linebuf = (int*)memalign(DEFAULT_ALIGNMENT, sizeof(int)*x*y); #if 1 - // memset は 1 バイトで描き込むから - // 0x12345678 とか渡しても 0x12 (0x78だったかな) でしか - // 描かないんだなー + // memset 1 ゃф莨若 + // 0x12345678 羝< 0x12 (0x78c) с + // memset(linebuf, rgb, sizeof(int)*x*y); //bzero(linebuf, sizeof(int)*x*y); #else @@ -123,7 +123,7 @@ SpanPack *sp = (SpanPack*)rbuf; SpanPack *next_sp = (SpanPack*)memalign(16, sizeof(SpanPack)); - SpanPack *free_sp = next_sp; // free()用 + SpanPack *free_sp = next_sp; // free() SpanPack *tmp_sp = NULL; unsigned int fbdev_addr = task->out_addr; Span *span; @@ -143,9 +143,9 @@ //render_y += FRAMEBUFFER_Y/2; if (sp->info.size < 0) { - // 塗りつぶしSpan - // あとでちゃんと定義すべし - // むしろ別Class で作る方がいいか。 + // 紂ゃ吟Span + // с<絎臂鴻 + // Class т鴻 linebuf_rgb = 0xffffff; linebuf_init(linebuf_rgb); goto WRITE; @@ -157,9 +157,9 @@ /** - * SpanPack->next が存在する場合が有るので - * 現在の SpanPack を処理してる間に - * 次の SpanPack の DMA 転送を行っています + * SpanPack->next 絖翫 + * 憜 SpanPack + * 罨< SpanPack DMA 荵∫茵c障 */ do { if (sp->next != NULL) { @@ -238,9 +238,9 @@ int end_y; int start_y; - // 画面上の領域に描き込まないように - // ・・・なんか変だな。 - // とりあえず if 文どうにかしようぜ俺 + // 脂≫莨若障 + // 祉祉祉紊 + // if 篆 if (y < 0) { if (y + TEXTURE_SPLIT_PIXEL < 0) { @@ -252,7 +252,7 @@ start_y = 0; } - // 画面下の領域に書き込まないように + // 脂≫吾莨若障 end_y = FRAMEBUFFER_Y - y + TEXTURE_SPLIT_PIXEL; end_y = (end_y < 0) ? TEXTURE_SPLIT_PIXEL + end_y : TEXTURE_SPLIT_PIXEL;
--- a/TaskManager/Test/simple_render/task/create_span.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/simple_render/task/create_span.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -16,7 +16,7 @@ { int d, d1; - // float2int のマクロとか書く? + // float2int 吾鐚 #if 0 d = (int)vMax->y - (int)vMin->y; d1 = (int)vMid->y - (int)vMin->y; @@ -99,8 +99,8 @@ end_tex_y = tmp_tey2; } - // 画面外のものはここで - // この判定で当たってるのかな? + // 脂√ + // ゅуc鐚 #if 0 real_x = x + Viewer::width/2; real_y = y + Viewer::height/2; @@ -164,12 +164,12 @@ SpanPack *spack = &ssl->list[spu_no].packs[spp_no]; - // 既に Span がある場合はスルー + // ≪ Span 翫鴻 if (spack->info.size > 0) continue; - // 塗りつぶし用 Span は info.size = -1 + // 紂ゃ吟 Span info.size = -1 // - // ってことにしたけど、わかりづらいか・・・・ + // cャ祉祉祉 spack->info.size = -1; Span *span = &spack->span[0]; span->y = y;
--- a/TaskManager/Test/simple_render/task/span_pack_draw.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/simple_render/task/span_pack_draw.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -71,9 +71,9 @@ int end_y; int start_y; - // 画面上の領域に描き込まないように - // ・・・なんか変だな。 - // とりあえず if 文どうにかしようぜ俺 + // 脂≫莨若障 + // 祉祉祉紊 + // if 篆 if (y < 0) { if (y + TEXTURE_SPLIT_PIXEL < 0) { return; @@ -84,14 +84,14 @@ start_y = 0; } - // 画面下の領域に書き込まないように - // ってことは start_y も必要か。 + // 脂≫吾莨若障 + // c start_y 綽荀 end_y = FRAMEBUFFER_Y - y + TEXTURE_SPLIT_PIXEL; end_y = (end_y < 0) ? TEXTURE_SPLIT_PIXEL + end_y : TEXTURE_SPLIT_PIXEL; - // 本家 write_pixel では、 y を y = height -y にしている。 - // こうすると、画面的に、 y++ すると 上に進むようになる。 - // でも、framebuffer は上から下で y++ になるから、混乱しそう + // 絎 write_pixel с y y = height -y + // 脂∝ y++ 筝蚊 + // сframebuffer 筝筝 y++ 羞隙恒 for (int i = start_y; i < end_y; i++) { memcpy((void*)(fbdev_addr + (4*FRAMEBUFFER_X*(y+i))), &linebuf[i*IMG_MAX_X], sizeof(int)*IMG_MAX_X); @@ -126,11 +126,11 @@ zRow_init(); do { - // 次の pack があれば - // 現在の pack の処理をしている間に - // DMA でロードしておく。入るかな・・・ + // 罨< pack + // 憜 pack + // DMA с若ャ祉祉 if (spack->next != NULL) { - // Cell ではこんな感じ? + // Cell с鐚 // dma_load(next_spack, spack->next, sizeof(SpanPack)); next_spack = spack->next; } else { @@ -186,7 +186,7 @@ } } - // Cell ではこんな感じ? + // Cell с鐚 // dma_wait(SPAN_PACK_LOAD); spack = next_spack; } while (spack);
--- a/TaskManager/Test/simple_render/task/task_init.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/simple_render/task/task_init.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -14,7 +14,7 @@ extern int dummy(void* wbuf, void *rbuf); /** - * set_cpu(CPU_PPE) で動作する task + * set_cpu(CPU_PPE) у篏 task */ void task_initialize()
--- a/TaskManager/Test/simple_render/task/update_sgp.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/simple_render/task/update_sgp.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -15,7 +15,7 @@ SceneGraphNodePtr node; float y_angle; - // 本当はここでやるもんじゃないんだが。。。 + // 綵с static float dest_x = 0.3f; static float dest_y = 0.5f; @@ -27,7 +27,7 @@ node = &sgp->node[i]; - // 本当は、ここは上の my_func で行う + // 綵筝 my_func ц y_angle = node->angle[1]; y_angle += 1.0f; if (y_angle > 360.0f) y_angle = 0.0f; @@ -60,9 +60,9 @@ } } - // まあこれは多分駄目なんだけど。 - // in/out と update は分ける必要ある? - // それはユーザ側で in/out になるように書かせるもの? + // 障紊薈 + // in/out update 綽荀鐚 + // 若九眼 in/out 吾鐚 memcpy(_sgp, sgp, sizeof(SceneGraphPack)); return sizeof(SceneGraphPack);
--- a/TaskManager/Test/simple_render/test/LoadTexture/polygon.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/simple_render/test/LoadTexture/polygon.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -100,7 +100,7 @@ memcpy(_pixels, texture_image->pixels, 3*128*128); - // screen を返すけど、いつか free して + // screen 菴ゃ free //screen = SDL_CreateRGBSurfaceFrom(_pixels, width, height, 32, //width*4, redMask, greenMask, // blueMask,alphaMask);
--- a/TaskManager/Test/simple_render/viewer_types.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/simple_render/viewer_types.h Wed Jul 15 17:39:51 2009 +0900 @@ -3,8 +3,8 @@ #define SPE_NUM_MAX 6 -// texture は 8x8 に分割 -// なんか変数名、これでいいんかい? +// texture 8x8 +// 紊医с鐚 #define TEXTURE_SPLIT_PIXEL 8 //#define TEXTURE_SPLIT_PIXEL 4
--- a/TaskManager/Test/test_render/Camera.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/Camera.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -2,6 +2,8 @@ #include "SceneGraphRoot.h" #include "Camera.h" #include "sys.h" +#include "Scheduler.h" +#include "show_time.h" static void camera_move(SceneGraphPtr _node, int screen_w, int screen_h) @@ -23,6 +25,14 @@ } #endif + /* + * show_dma_wait 茵腓冴 + */ + + if (pad->r1.isPush()) { + show_time(); + } + if (pad->r1.isPush() || pad->r1.isHold()) { node->xyz[2] += 10.0f; } else if (pad->l1.isPush() || pad->l1.isHold()) { @@ -156,7 +166,6 @@ m_view[ 5] = cy[1]; m_view[ 6] = cz[1]; m_view[ 7] = 0.0f; - m_view[ 8] = cx[2]; m_view[ 9] = cy[2]; m_view[10] = cz[2];
--- a/TaskManager/Test/test_render/Func.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/Func.h Wed Jul 15 17:39:51 2009 +0900 @@ -20,4 +20,6 @@ TASK_DRAW_BACK, TASK_SET_TEXTURE, TASK_DUMMY, + + SHOW_TIME, };
--- a/TaskManager/Test/test_render/Makefile Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/Makefile Wed Jul 15 17:39:51 2009 +0900 @@ -31,3 +31,11 @@ SGList.h: xml_file/*.xml perl tools/create_sglist.pl xml_file/*.xml + +run-ps3: + ps3-video-mode -v 133 + ./test_nogl -video fb -width 1920 -height 1080 + +run-ps3tv: + ./test_nogl -video fb -width 576 -height 384 -bpp 32 +
--- a/TaskManager/Test/test_render/Makefile.macosx Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/Makefile.macosx Wed Jul 15 17:39:51 2009 +0900 @@ -21,10 +21,10 @@ .cpp.o: $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ -all: $(TARGET) +all: SGList.o $(TARGET) -$(TARGET): SGList.o $(OBJS) $(TASK_OBJS) - $(CC) -o $@ SGList.o $(OBJS) $(TASK_OBJS) $(LIBS) +$(TARGET): $(OBJS) $(TASK_OBJS) + $(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS) SGList.o: create_sg_list @@ -52,4 +52,4 @@ rm -f *~ \#* rm -f SGList.h SGList.cpp --include depend.inc \ No newline at end of file +-include depend.inc
--- a/TaskManager/Test/test_render/SceneGraph.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraph.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -18,9 +18,6 @@ static TextureHash texture_hash; struct texture_list list[TABLE_SIZE]; -// TextureHash.cpp -extern int id_count; - extern int decode(char *cont, FILE *outfile); static void @@ -28,7 +25,7 @@ static void no_collision(SceneGraphPtr self, int screen_w, int screen_h, - SceneGraphPtr tree) {} + SceneGraphPtr tree) {} /** * 篋荐膊鴻c紊х軒絨 scale 障с @@ -64,33 +61,33 @@ */ static uint32* makeTapestry(int tex_w, int tex_h, uint32 *tex_src, - int all_pixel_num, int scale_cnt) + int all_pixel_num, int scale_cnt) { uint32 *tex_dest; int t = 0; int diff = TEXTURE_SPLIT_PIXEL; int p_diff = 1; - + tex_dest = (uint32*)manager->allocate(sizeof(int)*all_pixel_num); while (scale_cnt) { - for (int y = 0; y < tex_h; y += diff) { - for (int x = 0; x < tex_w; x += diff) { - for (int j = 0; j < diff; j += p_diff) { - for (int i = 0; i < diff; i += p_diff) { - tex_dest[t++] - = tex_src[(x+i) + tex_w*(y+j)]; - } - } - } - } - - diff <<= 1; - p_diff <<= 1; - scale_cnt >>= 1; + for (int y = 0; y < tex_h; y += diff) { + for (int x = 0; x < tex_w; x += diff) { + for (int j = 0; j < diff; j += p_diff) { + for (int i = 0; i < diff; i += p_diff) { + tex_dest[t++] + = tex_src[(x+i) + tex_w*(y+j)]; + } + } + } + } + + diff <<= 1; + p_diff <<= 1; + scale_cnt >>= 1; } - + return tex_dest; } @@ -130,7 +127,7 @@ finalize = &SceneGraph::finalize_copy; - frame = 0; + frame = 0; } @@ -185,6 +182,7 @@ flag_remove = 0; flag_drawable = 1; sgid = -1; + gid = -1; frame = 0; } @@ -216,167 +214,6 @@ { } -/* XML<ゃ眼潟篏 */ -void -SceneGraph::createFromXMLfile(const char *xmlfile) -{ - xmlDocPtr doc; - xmlNodePtr cur; - SceneGraphPtr root = NULL, tmp = NULL, parent; - - /* 若 DOM */ - doc = xmlParseFile(xmlfile); - cur = xmlDocGetRootElement(doc); - - /* ?? */ - xmlStrcmp(cur->name,(xmlChar*)"OBJECT-3D"); - - /* XML若筝ゃよВ */ - for (cur=cur->children; cur; cur=cur->next) { - /* 宴surface潟 */ - //if (xmlStrcmp(cur->name,(xmlChar*)"surface") != 0) { - // continue; - //} - if (!xmlStrcmp(cur->name,(xmlChar*)"surface")) { - /* 眼(SceneGraph) */ - tmp = new SceneGraph(cur); - if ( tmp->parent_name==NULL || 0==strcmp(tmp->parent_name, "NULL")) { - /* surfaceroot */ - root = tmp; - scene_graph = tmp; - } else { - /* 荀surface絎臂 (?) */ - // parent_name c - // *cur->properties->children 「鴻 kono - parent = root->searchSceneGraph(tmp->parent_name); - if (parent==NULL) { - fprintf(stderr, "[%s] No such parent %s\n", - tmp->name, tmp->parent_name); - root->addChild(tmp); - } else { - parent->addChild(tmp); - } - - scene_graph->add_next(tmp); - } - }else if (!xmlStrcmp(cur->name,(xmlChar*)"image")) { - - char *cont; - char image_name[20] = "/tmp/image_XXXXXX"; - char *filename = (char *)xmlGetProp(cur, (xmlChar *)"name"); - int fd = mkstemp(image_name); - FILE *outfile = fdopen(fd, "wb"); - if(NULL == outfile) - { - cout << "error open file\n"; - } - cont = (char *)xmlNodeGetContent(cur); - decode(cont, outfile); - fclose(outfile); - - int tex_id = texture_hash.hash_regist(filename); - if (tex_id < 0) - { - - texture_image = IMG_Load(image_name); - - /** - * image 32bit(RGBA) 紊 - */ - - SDL_Surface *tmpImage - = SDL_CreateRGBSurface(SDL_HWSURFACE, texture_image->w, - texture_image->h, 32, redMask, - greenMask, blueMask, alphaMask); - SDL_Surface *converted; - converted = SDL_ConvertSurface(texture_image, tmpImage->format, - SDL_HWSURFACE); - if (converted != NULL) { - SDL_FreeSurface(texture_image); - texture_image = converted; - } - - uint32 *tapestry; - int scale = 1; - int tex_w = texture_image->w; - int tex_h = texture_image->h; - int all_pixel_num = 0; - - /** - * 鴻c w or h 8 pixel у蚊с - * 1/2 膰絨糸篏 - * с紊с scale (1/scale) 荀ゃ - * - * (ex) - * (128,128) => 64,64 : 32,32: 16,16 : 8,8 - * scale = 16 - * (128, 64) => 64,32 : 32,16: 16,8 - * scale = 8 - */ - - while (tex_w % TEXTURE_SPLIT_PIXEL == 0 && - tex_h % TEXTURE_SPLIT_PIXEL == 0) { - all_pixel_num += tex_w*tex_h; - tex_w >>= 1; /* tex_w /= 2 */ - - tex_h >>= 1; - scale <<= 1; /* scale *= 2 */ - - } - - scale >>= 1; - - tapestry = makeTapestry(texture_image->w, texture_image->h, - (uint32*)texture_image->pixels, - all_pixel_num, - scale); - - list[id_count-1].t_w = texture_image->w; - list[id_count-1].t_h = texture_image->h; - list[id_count-1].pixels_orig = (Uint32*)texture_image->pixels; - list[id_count-1].pixels = tapestry; - list[id_count-1].scale_max = scale; - - tmp->texture_id = id_count-1; - tmp->texture_info.t_w = texture_image->w; - tmp->texture_info.t_h = texture_image->h; - tmp->texture_info.pixels_orig = (Uint32*)texture_image->pixels; - tmp->texture_info.pixels = tapestry; - tmp->texture_info.scale_max = scale; - - if (unlink(image_name)) - { - cout << "unlink error\n"; - } - - } else { - /** - * 篁ュ Load Texture 援 - */ - - tmp->texture_id = tex_id; - - // list[] 帥若 - // 緇絋ф吾 by gongo - - tmp->texture_info.t_w = list[tex_id].t_w; - tmp->texture_info.t_h = list[tex_id].t_h;; - tmp->texture_info.pixels_orig = list[tex_id].pixels_orig; - tmp->texture_info.pixels = list[tex_id].pixels; - tmp->texture_info.scale_max = list[tex_id].scale_max; - - } - }else { - continue; - } - } - - xmlFreeDoc(doc); - - //return root; - scene_graph_viewer = root; -} - /** * add Children @@ -389,14 +226,14 @@ { /* children鴻緇 (brother )*/ if (this->lastChild != NULL) { - SceneGraphPtr last = this->lastChild; - last->brother = child; + SceneGraphPtr last = this->lastChild; + last->brother = child; } this->lastChild = child; if (this->children == NULL) { - this->children = child; + this->children = child; } child->parent = this; @@ -415,10 +252,10 @@ SceneGraph::addBrother(SceneGraphPtr bro) { if (this->parent) { - parent->addChild(bro); + parent->addChild(bro); } else { - fprintf(stderr, "error : SceneGraph::%s : %s doesn't have parent\n", - __FUNCTION__, this->name); + fprintf(stderr, "error : SceneGraph::%s : %s doesn't have parent\n", + __FUNCTION__, this->name); } return bro; @@ -436,8 +273,8 @@ /* 絖箴絽亥「 */ for(tmp = this->children; tmp; tmp = tmp->next) { - if ((result=tmp->searchSceneGraph(name)) != NULL) - return result; + if ((result=tmp->searchSceneGraph(name)) != NULL) + return result; } /* <c NULL. */ @@ -451,37 +288,37 @@ while(t) { - cout << "my_name : " << t->name << endl; - if(t->children != NULL) - { - cout << "--move children : " << t->children->name << endl; - t = t->children; - } - else if(t->brother != NULL) - { - cout << "--move brother : " << t->brother->name << endl; - t = t->brother; - } - else - { - while(t) - { - if(t->brother != NULL) - { - cout << "--move brother : " << t->brother->name << endl; - t = t->brother; - break; - } - else - { - if(t->parent) - { - cout << "--move parent : " << t->parent->name << endl; - } - t = t->parent; - } - } - } + cout << "my_name : " << t->name << endl; + if(t->children != NULL) + { + cout << "--move children : " << t->children->name << endl; + t = t->children; + } + else if(t->brother != NULL) + { + cout << "--move brother : " << t->brother->name << endl; + t = t->brother; + } + else + { + while(t) + { + if(t->brother != NULL) + { + cout << "--move brother : " << t->brother->name << endl; + t = t->brother; + break; + } + else + { + if(t->parent) + { + cout << "--move parent : " << t->parent->name << endl; + } + t = t->parent; + } + } + } } } @@ -494,11 +331,11 @@ cout << "parent_name = " << parent_name << endl; if (parent != NULL) { - cout << "parent->name = " << parent->name << endl; + cout << "parent->name = " << parent->name << endl; } if (children != NULL) { - cout << "children->name = " << children->name << endl; + cout << "children->name = " << children->name << endl; } } @@ -509,133 +346,158 @@ void SceneGraph::get_data(xmlNodePtr cur) { - char *cont; //char *image_name; for(;cur;cur=cur->next) { - if(!xmlStrcmp(cur->name,(xmlChar*)"coordinate")) + if(!xmlStrcmp(cur->name,(xmlChar*)"coordinate")) { - cont = (char *)xmlNodeGetContent(cur); - pickup_coordinate(cont); + char *cont = (char *)xmlNodeGetContent(cur); + pickup_coordinate(cont); } - else if(!xmlStrcmp(cur->name,(xmlChar*)"normal")) + else if(!xmlStrcmp(cur->name,(xmlChar*)"normal")) { - cont = (char *)xmlNodeGetContent(cur); - pickup_normal(cont); + char *cont = (char *)xmlNodeGetContent(cur); + pickup_normal(cont); } - else if(!xmlStrcmp(cur->name,(xmlChar*)"model")) + else if(!xmlStrcmp(cur->name,(xmlChar*)"model")) { - cont = (char *)xmlNodeGetContent(cur); - pickup_model(cont); + char *cont = (char *)xmlNodeGetContent(cur); + pickup_model(cont); } - else if(!xmlStrcmp(cur->name,(xmlChar*)"texture")) + else if(!xmlStrcmp(cur->name,(xmlChar*)"texture")) { - cont = (char *)xmlNodeGetContent(cur); - pickup_texture(cont); - } - else if(!xmlStrcmp(cur->name,(xmlChar*)"imageflag")) + char *cont = (char *)xmlNodeGetContent(cur); + pickup_texture(cont); + } + else if(!xmlStrcmp(cur->name,(xmlChar*)"imageflag")) + { + int id; + char *filename = (char *)xmlGetProp(cur, (xmlChar *)"name"); + texture_hash.hash_regist(filename, id); + } + else if(!xmlStrcmp(cur->name,(xmlChar*)"image")) { - char *filename = (char *)xmlGetProp(cur, (xmlChar *)"name"); - texture_hash.hash_regist(filename); - } - else if(!xmlStrcmp(cur->name,(xmlChar*)"image")) - { - char image_name[20] = "/tmp/image_XXXXXX"; - char *filename = (char *)xmlGetProp(cur, (xmlChar *)"name"); - int fd = mkstemp(image_name); - FILE *outfile = fdopen(fd, "wb"); - if(NULL == outfile) - { - cout << "error open file\n"; - } - cont = (char *)xmlNodeGetContent(cur); - //decode(cont, image_name); - decode(cont, outfile); - fclose(outfile); + get_image(cur); + } + } +} + +SDL_Surface* +SceneGraph::load_decode_image(char *image_name, xmlNodePtr cur) +{ + int fd = mkstemp(image_name); + FILE *outfile = fdopen(fd, "wb"); + + if (NULL == outfile) { + cout << "error open file\n"; + return 0; + } - /** - * image_name ≪ Load 遺 - */ - int tex_id = texture_hash.hash_regist(filename); - if (tex_id < 0) { + char *cont = (char *)xmlNodeGetContent(cur); + //decode(cont, image_name); + decode(cont, outfile); + fclose(outfile); + + +/** + * image 32bit(RGBA) 紊 + */ + SDL_Surface *texture_image = IMG_Load(image_name); + SDL_Surface *tmpImage + = SDL_CreateRGBSurface(SDL_HWSURFACE, texture_image->w, + texture_image->h, 32, redMask, + greenMask, blueMask, alphaMask); + SDL_Surface *converted; + converted = SDL_ConvertSurface(texture_image, tmpImage->format, + SDL_HWSURFACE); + if (converted != NULL) { + SDL_FreeSurface(texture_image); + texture_image = converted; + } + + return texture_image; +} - texture_image = IMG_Load(image_name); - - /** - * image 32bit(RGBA) 紊 - */ - SDL_Surface *tmpImage - = SDL_CreateRGBSurface(SDL_HWSURFACE, texture_image->w, - texture_image->h, 32, redMask, - greenMask, blueMask, alphaMask); - SDL_Surface *converted; - converted = SDL_ConvertSurface(texture_image, tmpImage->format, - SDL_HWSURFACE); - if (converted != NULL) { - SDL_FreeSurface(texture_image); - texture_image = converted; - } +int +SceneGraph::makeTapestries(SDL_Surface *texture_image, int id) { + uint32 *tapestry; + int scale = 1; + int tex_w = texture_image->w; + int tex_h = texture_image->h; + int all_pixel_num = 0; - uint32 *tapestry; - int scale = 1; - int tex_w = texture_image->w; - int tex_h = texture_image->h; - int all_pixel_num = 0; + /** + * 鴻c w or h 8 pixel у蚊с + * 1/2 膰絨糸篏 + * с紊с scale (1/scale) 荀ゃ + * + * (ex) + * (128,128) => 64,64 : 32,32: 16,16 : 8,8 + * scale = 16 + * (128, 64) => 64,32 : 32,16: 16,8 + * scale = 8 + */ + while (tex_w % TEXTURE_SPLIT_PIXEL == 0 && + tex_h % TEXTURE_SPLIT_PIXEL == 0) { + all_pixel_num += tex_w*tex_h; + tex_w >>= 1; /* tex_w /= 2 */ + tex_h >>= 1; + scale <<= 1; /* scale *= 2 */ + } + + scale >>= 1; + + tapestry = makeTapestry(texture_image->w, texture_image->h, + (uint32*)texture_image->pixels, + all_pixel_num, scale); + + list[id].t_w = texture_image->w; + list[id].t_h = texture_image->h; + list[id].pixels_orig = (Uint32*)texture_image->pixels; + list[id].pixels = tapestry; + list[id].scale_max = scale; - /** - * 鴻c w or h 8 pixel у蚊с - * 1/2 膰絨糸篏 - * с紊с scale (1/scale) 荀ゃ - * - * (ex) - * (128,128) => 64,64 : 32,32: 16,16 : 8,8 - * scale = 16 - * (128, 64) => 64,32 : 32,16: 16,8 - * scale = 8 - */ - while (tex_w % TEXTURE_SPLIT_PIXEL == 0 && - tex_h % TEXTURE_SPLIT_PIXEL == 0) { - all_pixel_num += tex_w*tex_h; - tex_w >>= 1; /* tex_w /= 2 */ - tex_h >>= 1; - scale <<= 1; /* scale *= 2 */ - } + return id; + } + +void +SceneGraph::get_image(xmlNodePtr cur) +{ + char image_name[20] = "/tmp/image_XXXXXX"; + char *filename = (char *)xmlGetProp(cur, (xmlChar *)"name"); - scale >>= 1; + if (filename == NULL || filename[0] == 0) { + return; + } - tapestry = makeTapestry(texture_image->w, texture_image->h, - (uint32*)texture_image->pixels, - all_pixel_num, scale); + /** + * image_name ≪ Load 遺 + */ + int tex_id; + if (!texture_hash.hash_regist(filename, tex_id)) { - list[id_count-1].t_w = texture_image->w; - list[id_count-1].t_h = texture_image->h; - list[id_count-1].pixels_orig = (Uint32*)texture_image->pixels; - list[id_count-1].pixels = tapestry; - list[id_count-1].scale_max = scale; - - texture_id = id_count-1; + SDL_Surface *texture_image = load_decode_image(image_name, cur); + + texture_id = makeTapestries(texture_image, tex_id); - if (unlink(image_name)) - { - cout << "unlink error\n"; - } - } else { - /** - * 篁ュ Load Texture 援 - */ - texture_id = tex_id; - } - - // list[] 帥若 - // 緇絋ф吾 by gongo - texture_info.t_w = list[texture_id].t_w; - texture_info.t_h = list[texture_id].t_h;; - texture_info.pixels_orig = list[texture_id].pixels_orig; - texture_info.pixels = list[texture_id].pixels; - texture_info.scale_max = list[texture_id].scale_max; - } + if (unlink(image_name)) { + cout << "unlink error\n"; + } + } else { + /** + * 篁ュ Load Texture 援 + */ + texture_id = tex_id; } + + // list[] 帥若 + // 緇絋ф吾 by gongo + texture_info.t_w = list[texture_id].t_w; + texture_info.t_h = list[texture_id].t_h;; + texture_info.pixels_orig = list[texture_id].pixels_orig; + texture_info.pixels = list[texture_id].pixels; + texture_info.scale_max = list[texture_id].scale_max; } @@ -648,11 +510,11 @@ //delete [] n->data; if (next) { - while (n) { - m = n->next; - delete n; - n = m; - } + while (n) { + m = n->next; + delete n; + n = m; + } } } @@ -675,42 +537,42 @@ SceneGraphPtr t = top; while (t) { - t->move_execute(screen_w, screen_h); - t->collision_check(screen_w, screen_h, top); + t->move_execute(screen_w, screen_h); + t->collision_check(screen_w, screen_h, top); - t->frame++; + t->frame++; - if (t->parent != NULL) { - get_matrix(t->matrix, t->angle, t->xyz, t->parent->matrix); - } else { - get_matrix(t->matrix, t->angle, t->xyz, NULL); - } + if (t->parent != NULL) { + get_matrix(t->matrix, t->angle, t->xyz, t->parent->matrix); + } else { + get_matrix(t->matrix, t->angle, t->xyz, NULL); + } - if (t->children != NULL) { - t = t->children; - } else if (t->brother != NULL) { - t = t->brother; - } else { - while (t) { - if (t->brother != NULL) { - t = t->brother; - break; - } else { - if (t->parent == NULL) { - t = NULL; - break; - } else { - t = t->parent; - } - } - } - } + if (t->children != NULL) { + t = t->children; + } else if (t->brother != NULL) { + t = t->brother; + } else { + while (t) { + if (t->brother != NULL) { + t = t->brother; + break; + } else { + if (t->parent == NULL) { + t = NULL; + break; + } else { + t = t->parent; + } + } + } + } } } void SceneGraph::set_move_collision(SceneGraphPtr node, move_func new_move, - collision_func new_collision) + collision_func new_collision) { node->move = new_move; node->collision = new_collision; @@ -718,7 +580,7 @@ void SceneGraph::set_move_collision(move_func new_move, - collision_func new_collision) + collision_func new_collision) { this->move = new_move; this->collision = new_collision; @@ -729,10 +591,10 @@ { /* next 鴻緇 */ if (this->next != NULL) { - SceneGraphPtr tmp = this->last; - tmp->next = next; + SceneGraphPtr tmp = this->last; + tmp->next = next; } else { - this->next = next; + this->next = next; } this->last = next; @@ -769,7 +631,7 @@ /** * tree node ゃ - * + * * @param tree SceneGraphTree * @return nodeゅ SceneGraphTree */ @@ -781,38 +643,38 @@ SceneGraphPtr ret = tree; if (parent) { - SceneGraphPtr brother = parent->children; - SceneGraphPtr p, p1 = NULL; + SceneGraphPtr brother = parent->children; + SceneGraphPtr p, p1 = NULL; - p = brother; - if (p) { - if (p == node) { - parent->children = NULL; - parent->lastChild = NULL; - } else { - p1 = p->brother; + p = brother; + if (p) { + if (p == node) { + parent->children = NULL; + parent->lastChild = NULL; + } else { + p1 = p->brother; + + while (p1 && p1 != node) { + p1 = p1->brother; + p = p->brother; + } - while (p1 && p1 != node) { - p1 = p1->brother; - p = p->brother; - } - - if (p1) { - p->brother = p1->brother; + if (p1) { + p->brother = p1->brother; - // node 緇絨障lastChild 紊 - if (parent->lastChild == p1) { - parent->lastChild = p; - } - } else { - // Can't find remove node - } - } - } + // node 緇絨障lastChild 紊 + if (parent->lastChild == p1) { + parent->lastChild = p; + } + } else { + // Can't find remove node + } + } + } } else { - // 荀絮 = tree root - // NULL 菴 - ret = NULL; + // 荀絮 = tree root + // NULL 菴 + ret = NULL; } return ret; @@ -820,7 +682,7 @@ /** * list node ゃ - * + * * @param list SceneGraphList * @return nodeゅ SceneGraphList */ @@ -831,15 +693,15 @@ SceneGraphPtr prev = node->prev; SceneGraphPtr next = node->next; SceneGraphPtr ret = list; - + if (prev) { - prev->next = next; + prev->next = next; } else { - ret = next; + ret = next; } if (next) { - next->prev = prev; + next->prev = prev; } return ret;
--- a/TaskManager/Test/test_render/SceneGraph.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraph.h Wed Jul 15 17:39:51 2009 +0900 @@ -13,7 +13,7 @@ typedef void (*move_func)(SceneGraph* node, int screen_w, int screen_h); typedef void (*collision_func)(SceneGraph* node, int screen_w, int screen_h, - SceneGraph* tree); + SceneGraph* tree); typedef SceneGraph* SceneGraphPtr; class SceneGraph : public Polygon { @@ -51,6 +51,9 @@ // anime frame num int frame; + // Group ID + int gid; + // ∽違ゃ潟 move_func move; collision_func collision; @@ -72,14 +75,13 @@ SceneGraphPtr clone(void *buf); SceneGraphPtr searchSceneGraph(const char *name); void set_move_collision(SceneGraphPtr node, - move_func new_move, collision_func new_collision); + move_func new_move, collision_func new_collision); void set_move_collision(move_func new_move, collision_func new_collision); void remove(void); SceneGraphPtr realRemoveFromTree(SceneGraphPtr tree); SceneGraphPtr realRemoveFromList(SceneGraphPtr list); int isRemoved(void); - static void createFromXMLfile(const char *); static SceneGraphPtr createSceneGraph(int id); void translate(float x, float y, float z); @@ -92,6 +94,10 @@ void print_member(void); void get_data(xmlNodePtr cur); void delete_data(void); + + SDL_Surface* load_decode_image(char *image_name, xmlNodePtr cur); + int makeTapestries(SDL_Surface *texture_image, int id); + void get_image(xmlNodePtr cur); }; #endif
--- a/TaskManager/Test/test_render/SceneGraphIterator.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraphIterator.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -39,6 +39,26 @@ return 0; } +/*! + 絎違若篁ラ絖 + + @param id 罎膣≪ Group ID + @retval 1 next + @retval 0 next + */ +int +SceneGraphIterator::hasNextGroup(int id) +{ + SceneGraphPtr p; + for (p = cur->next; p; p = p->next) { + if (p->gid == id) { + return 1; + } + } + + return 0; +} + /** * iterator 罨<蚊 */ @@ -68,6 +88,25 @@ cur = p; } +/*! + iterator 絎 Group ID SceneGraph 障ч蚊 + + @param id 罎膣≪ SceneGraph Group ID + */ +void +SceneGraphIterator::nextGroup(int id) +{ + SceneGraphPtr p; + + for (p = cur->next; p; p = p->next) { + if (p->gid == id) { + break; + } + } + + cur = p; +} + /** * т賢 SceneGraph ゃ */
--- a/TaskManager/Test/test_render/SceneGraphIterator.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraphIterator.h Wed Jul 15 17:39:51 2009 +0900 @@ -16,8 +16,10 @@ void set(SceneGraphPtr list); int hasNext(void); int hasNext(int id); + int hasNextGroup(int id); void next(void); void next(int id); + void nextGroup(int id); void remove(void); SceneGraphPtr get(void); };
--- a/TaskManager/Test/test_render/SceneGraphRoot.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraphRoot.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -184,38 +184,41 @@ camera->children = NULL; camera->lastChild = NULL; - while (t) { - SceneGraphPtr c = t->clone(); + /*障篏*/ + while (list) { - addNext(c); - cur_parent->addChild(c); - c->frame = t->frame; + list->move_execute(screen_w, screen_h); + list->collision_check(screen_w, screen_h, list); + + list->frame++; + list = list->next; - c->move_execute(screen_w, screen_h); - c->collision_check(screen_w, screen_h, list); + } - if (c->isRemoved()) { - sg_exec_tree = c->realRemoveFromTree(cur_parent); - sg_available_list = c->realRemoveFromList(sg_available_list); - delete c; - cnt--; - t->children = NULL; - t->parent = cur_parent; - } else { - c->frame++; - get_matrix(c->matrix, c->angle, c->xyz, c->parent->matrix); - } + if(sg_exec_tree != NULL) { + return; + } - if (t->children != NULL) { + /*removeflagtree綵∽*/ + while (t) { + SceneGraphPtr c = NULL; + if (!t->isRemoved()) { + c = t->clone(); + addNext(c); + cur_parent->addChild(c); + c->frame = t->frame; + /*荀荵≪綺ф絖荵≪綺ф膊*/ + get_matrix(c->matrix, c->angle, c->xyz, cur_parent->matrix); + } + + if (t->children != NULL && c != NULL) { cur_parent = c; t = t->children; } else if (t->brother != NULL) { - cur_parent = c->parent; t = t->brother; } else { while (t) { if (t->brother != NULL) { - cur_parent = t->parent; t = t->brother; break; } else { @@ -223,15 +226,25 @@ t = NULL; break; } else { - t = t->parent; + cur_parent = cur_parent->parent; + t = t->parent; + } } - } + } } } + + // 憜allExecute 腟c鴻с // camera->children User SceneGraph root + + /** + * NULL csetSceneData 若違 + * c<罨< Scene + */ + sg_exec_tree = camera->children; }
--- a/TaskManager/Test/test_render/Span.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/Span.h Wed Jul 15 17:39:51 2009 +0900 @@ -45,6 +45,9 @@ float tex_x2; float tex_y1; float tex_y2; + float normal_x; + float normal_y; + float normal_z; #if 0 TileInfoListPtr tilelist;
--- a/TaskManager/Test/test_render/SpanC.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/SpanC.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -5,7 +5,7 @@ using namespace std; -// f1:x$B$NA}2CNL(B f2:y$B$NA}2CNL(B i:....... base:$B4pK\$H$J$kD:E@$N(By$B:BI8(B +// f1:x紜 f2:y紜 i:....... base:堺鴻y綺ф static float calc(float f1, float f2,int i, float base){ float ans; ans = f1/f2*i + base; @@ -78,7 +78,7 @@ int end_y = (int)vMin->y; if (start_y<end_y) { - int i; i=end_y; end_y=start_y; start_y = i; //y$B$NF~$lBX$((B + int i; i=end_y; end_y=start_y; start_y = i; //yャ帥 //Vertex *v; v = vMin; vMin = vMid; vMid = v; /* incli_x1 = vMin->x - vMid->x; incli_x2 = vMin->x - vMid1->x; @@ -96,13 +96,13 @@ //if(div_y < 1 && div_y > -1) div_y = 1; for(i = k; i < div_y+1; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B + //span綏腴勆x,z羆 tmp_xpos = calc(vMid1->x - vMin->x ,div_y, i, vMin->x); tmp_end = calc(vMid->x - vMin->x ,div_y, i, vMin->x); tmp_z = calc(vMid1->z - vMin->z ,div_y, i, vMin->z); tmp_zpos = calc(vMid->z - vMin->z ,div_y, i, vMin->z); //printf("x:%f end:%f z:%f zpos:%f\n",tmp_xpos,tmp_end,tmp_z,tmp_zpos); - //$B$3$3$+$i(Bspan$B$N:8C<$H1&C<$KBP1~$9$k%F%/%9%A%c$r7W;;$9$k(B + //span綏腴勆絲上鴻c荐膊 tmp_tex1 =((i/(div_y)) * vMid1->tex_x) + \ ( ((div_y - i)/(div_y)) * vMin->tex_x); tmp_tex2 =( (i/(div_y)) * vMid->tex_x) + \ @@ -113,7 +113,7 @@ tmp_tey2 =( (i/(div_y)) * vMid->tex_y) + \ ( ((div_y - i)/(div_y)) * vMin->tex_y); - //$B$3$3$G:8C<$,(Bxpos$B$+(Bend$B$rH=CG$7!"IA2h$9$k(Bspan$B$r:n$k(B + //у窪腴xposendゆ祉span篏 if(tmp_xpos > tmp_end) { x = (int)tmp_end; y = (int)vMin->y + i*l; @@ -236,13 +236,13 @@ if(div_y < 1 && div_y > -1) div_y = 1; for(i = 0; i < div_x+1; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B + //span綏腴勆x,z羆 tmp_xpos = calc(vMax->x - vMin->x,div_y, i, vMin->x); tmp_end = calc(vMid->x - vMin->x,div_x, i, vMin->x); tmp_z = calc(vMax->z - vMin->z,div_y, i, vMin->z); tmp_zpos = calc(vMid->z - vMin->z,div_x, i, vMin->z); - //$B$3$3$+$i(Bspan$B$N:8C<$H1&C<$KBP1~$9$k%F%/%9%A%c$r7W;;$9$k(B + //span綏腴勆絲上鴻c荐膊 tmp_tex1 =( (i/(div_y)) * vMax->tex_x) + \ ( ((div_y - i)/(div_y)) * vMin->tex_x); tmp_tex2 =( (i/(div_x)) * vMid->tex_x) + \ @@ -253,7 +253,7 @@ tmp_tey2 =( (i/(div_x)) * vMid->tex_y) + \ ( ((div_x - i)/(div_x)) * vMin->tex_y); - //$B$3$3$G:8C<$,(Bxpos$B$+(Bend$B$rH=CG$7!"IA2h$9$k(Bspan$B$r:n$k(B + //у窪腴xposendゆ祉span篏 if(tmp_xpos > tmp_end) { x = (int)tmp_end; y = (int)vMin->y + i; @@ -315,7 +315,7 @@ if(div_y < 1 && div_y > -1) div_y = 1; for(i = 0; i < div_x; i++) { - //$B$3$3$G(Bspan$B$N:8C<$H1&C<$N(Bx,z$B$r5a$a$F$k(B + //span綏腴勆x,z羆 tmp_xpos = calc(vMax->x-vMin->x, div_y, (i+1+top_triangle), vMin->x); tmp_end = calc(vMax->x-vMid->x, div_x, (i+1), vMid->x); tmp_z = calc(vMax->z-vMin->z, div_y, (i+1+top_triangle), vMin->z); @@ -389,7 +389,7 @@ #endif } -// i:$BJ,;R!"(Bf1:$BD9$5(B f2:$BBP1~$9$kD:E@(B1 f3:$BBP1~$9$kD:E@(B2 +// i:絖f1:激 f2:絲上1 f3:絲上2 /* float Span::calc2(int i, float f1, float f2, float f3) { float ans;
--- a/TaskManager/Test/test_render/TextureHash.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/TextureHash.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -2,15 +2,15 @@ #include <stdlib.h> #include "TextureHash.h" -int id_count; +static int id_count; TextureHash::TextureHash(void) { table = (hashtable*)malloc(sizeof(hashtable)*TABLE_SIZE); for (int i = 0; i < TABLE_SIZE; i++) { - table[i].tx_id = -1; - table[i].key = NULL; + table[i].tx_id = -1; + table[i].key = NULL; } } @@ -26,26 +26,28 @@ int value = 0; for (int i = 0; key[i]; i++) { - value += key[i]*(i+1)*17+1; + value += key[i]*(i+1)*17+1; } return value%TABLE_SIZE; } int -TextureHash::hash_regist(const char* key) +TextureHash::hash_regist(const char* key, int &id) { int hash = hash_function(key); - + for (int i = 0; ; i++) { - if (table[hash].tx_id == -1) { - table[hash].key = (char*)key; - table[hash].tx_id = id_count++; - return -1; - } else if (strcmp(key, table[hash].key) == 0 - && table[hash].tx_id != -1){ - return table[hash].tx_id; - } - hash = ((37*hash)^(11*i)) % TABLE_SIZE; + if (table[hash].tx_id == -1) { + table[hash].key = (char*)key; + id = id_count++; + return 0; + + } else if (strcmp(key, table[hash].key) == 0 + && table[hash].tx_id != -1){ + id = table[hash].tx_id; + return 1; + } + hash = ((37*hash)^(11*i)) % TABLE_SIZE; } }
--- a/TaskManager/Test/test_render/TextureHash.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/TextureHash.h Wed Jul 15 17:39:51 2009 +0900 @@ -14,8 +14,8 @@ TextureHash(void); ~TextureHash(void); - int hash_function(const char*); - int hash_regist(const char*); + int hash_function(const char* image_name); + int hash_regist(const char* image_name, int &tx_id); }; #endif
--- a/TaskManager/Test/test_render/ball_bound.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/ball_bound.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -108,6 +108,8 @@ { SceneGraphPtr ball; + // 阪ゃ srandom 罸random() + // random ゃ罨蚊man random 号吾障 srandom(100); sgroot->createFromXMLfile("xml_file/Ball.xml");
--- a/TaskManager/Test/test_render/enemy_action.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/enemy_action.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -31,7 +31,7 @@ if(judge == HIT) { E_PLANE->set_move_collision(null_move, enemy_collision); - printf("ENEMY_hit!!!_n"); + printf("ENEMY_hit!!!鐚n"); //scene_graph->delete_object(node, node->next,node->prev); } #endif
--- a/TaskManager/Test/test_render/fb.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/fb.h Wed Jul 15 17:39:51 2009 +0900 @@ -31,7 +31,7 @@ int xres,yres,vbpp,line_len; //unsigned short tcolor ; - /* 読み書き用にファイルを開く */ + /* 茯炊吾<ゃ */ fd_framebuffer = open( DEVICE_NAME , O_RDWR); if ( !fd_framebuffer ) { send_current_error_msg("Framebuffer device open error !"); @@ -39,13 +39,13 @@ } send_current_information("The framebuffer device was opened !"); - /* 固定スクリーン情報取得 */ + /* 阪鴻若恰怨緇 */ if ( ioctl( fd_framebuffer , FBIOGET_FSCREENINFO , &finfo ) ) { send_current_error_msg("Fixed information not gotton !"); exit(2); } - /* 変動スクリーン情報取得 */ + /* 紊鴻若恰怨緇 */ if ( ioctl( fd_framebuffer , FBIOGET_VSCREENINFO , &vinfo ) ) { send_current_error_msg("Variable information not gotton !"); exit(3); @@ -57,10 +57,10 @@ sprintf( tmp , "%d(pixel)x%d(line), %dbpp(bits per pixel)",xres,yres,vbpp); send_current_information( tmp ); - /* バイト単位でのスクリーンのサイズを計算 */ + /* ゃ篏с鴻若潟泣ゃ冴荐膊 */ screensize = xres * yres * vbpp / DIV_BYTE ; - /* デバイスをメモリにマップする */ + /* ゃ鴻<≪ */ fbptr = (char *)mmap(0,screensize,PROT_READ | PROT_WRITE,MAP_SHARED,fd_framebuffer,0); if ( (int)fbptr == -1 ) { send_current_error_msg("Don't get framebuffer device to memory !");
--- a/TaskManager/Test/test_render/node.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/node.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -1,4 +1,5 @@ #include <stdlib.h> +#include "SceneGraphRoot.h" #include "SceneGraph.h" #include "xml_file/cube.h" @@ -44,7 +45,8 @@ if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) { // 絎緇絋潟< - srandom(random()); + // c<с + // srandom(random()); SceneGraphPtr p = node->clone(); p->position_init(); @@ -63,7 +65,7 @@ void node_init(void) { - SceneGraph::createFromXMLfile("xml_file/cube.xml"); + sgroot->createFromXMLfile("xml_file/cube.xml"); Cube->set_move_collision(cube_move, cube_collision); Cube->stack_xyz[0] = 2.0f; Cube->stack_xyz[1] = 2.0f;
--- a/TaskManager/Test/test_render/polygon.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/polygon.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -18,8 +18,6 @@ extern int decode(char *cont, FILE *outfile); -SDL_Surface* Polygon::texture_image; - Polygon::Polygon(void) { xyz[0] = 0; @@ -36,7 +34,7 @@ angle[3] = 1; for (int i = 0; i < 16; i++) { - matrix[i] = 0; + matrix[i] = 0; } } @@ -57,7 +55,7 @@ angle[3] = 1; for (int i = 0; i < 16; i++) { - matrix[i] = 0; + matrix[i] = 0; } } @@ -69,43 +67,43 @@ /***SceneGraphUpdate***/ //sgp_update(); for (int i = 0; i < sgp->info.size; i++) { - SceneGraphNode node = sgp->node[i]; + SceneGraphNode node = sgp->node[i]; - /***draw***/ - int n,nt; - for(n=0,nt=0; n<node.size*3; n+=9,nt+=6) { - xyz1[0] = node.vertex[n]; - xyz1[1] = node.vertex[n+1]; - xyz1[2] = node.vertex[n+2]*-1; - xyz1[3] = 1; - xyz2[0] = node.vertex[n+3]; - xyz2[1] = node.vertex[n+3+1]; - xyz2[2] = node.vertex[n+3+2]*-1; - xyz2[3] = 1; - xyz3[0] = node.vertex[n+6]; - xyz3[1] = node.vertex[n+6+1]; - xyz3[2] = node.vertex[n+6+2]*-1; - xyz3[3] = 1; + /***draw***/ + int n,nt; + for(n=0,nt=0; n<node.size*3; n+=9,nt+=6) { + xyz1[0] = node.vertex[n]; + xyz1[1] = node.vertex[n+1]; + xyz1[2] = node.vertex[n+2]*-1; + xyz1[3] = 1; + xyz2[0] = node.vertex[n+3]; + xyz2[1] = node.vertex[n+3+1]; + xyz2[2] = node.vertex[n+3+2]*-1; + xyz2[3] = 1; + xyz3[0] = node.vertex[n+6]; + xyz3[1] = node.vertex[n+6+1]; + xyz3[2] = node.vertex[n+6+2]*-1; + xyz3[3] = 1; - rotate(xyz1, node.translation); - rotate(xyz2, node.translation); - rotate(xyz3, node.translation); + rotate(xyz1, node.translation); + rotate(xyz2, node.translation); + rotate(xyz3, node.translation); - Vertex *ver1 = new Vertex(xyz1[0],xyz1[1],xyz1[2],node.texture[nt],node.texture[nt+1]); - Vertex *ver2 = new Vertex(xyz2[0],xyz2[1],xyz2[2],node.texture[nt+2],node.texture[nt+2+1]); - Vertex *ver3 = new Vertex(xyz3[0],xyz3[1],xyz3[2],node.texture[nt+4],node.texture[nt+4+1]); + Vertex *ver1 = new Vertex(xyz1[0],xyz1[1],xyz1[2],node.texture[nt],node.texture[nt+1]); + Vertex *ver2 = new Vertex(xyz2[0],xyz2[1],xyz2[2],node.texture[nt+2],node.texture[nt+2+1]); + Vertex *ver3 = new Vertex(xyz3[0],xyz3[1],xyz3[2],node.texture[nt+4],node.texture[nt+4+1]); - Triangle *tri = new Triangle(ver1,ver2,ver3); - Span_c *span = new Span_c(); - span->viewer = viewer; - span->p = this; - span->create_span(tri,texture_image); - delete ver1; - delete ver2; - delete ver3; - delete tri; - delete span; - } + Triangle *tri = new Triangle(ver1,ver2,ver3); + Span_c *span = new Span_c(); + span->viewer = viewer; + span->p = this; + span->create_span(tri,texture_image); + delete ver1; + delete ver2; + delete ver3; + delete tri; + delete span; + } } } @@ -114,20 +112,20 @@ { for(int n=0; n<pp->info.size; n++) { - Vertex *ver1 = new Vertex(pp->tri[n].ver1.x,pp->tri[n].ver1.y,pp->tri[n].ver1.z,pp->tri[n].ver1.tex_x,pp->tri[n].ver1.tex_y); - Vertex *ver2 = new Vertex(pp->tri[n].ver2.x,pp->tri[n].ver2.y,pp->tri[n].ver2.z,pp->tri[n].ver2.tex_x,pp->tri[n].ver2.tex_y); - Vertex *ver3 = new Vertex(pp->tri[n].ver3.x,pp->tri[n].ver3.y,pp->tri[n].ver3.z,pp->tri[n].ver3.tex_x,pp->tri[n].ver3.tex_y); + Vertex *ver1 = new Vertex(pp->tri[n].ver1.x,pp->tri[n].ver1.y,pp->tri[n].ver1.z,pp->tri[n].ver1.tex_x,pp->tri[n].ver1.tex_y); + Vertex *ver2 = new Vertex(pp->tri[n].ver2.x,pp->tri[n].ver2.y,pp->tri[n].ver2.z,pp->tri[n].ver2.tex_x,pp->tri[n].ver2.tex_y); + Vertex *ver3 = new Vertex(pp->tri[n].ver3.x,pp->tri[n].ver3.y,pp->tri[n].ver3.z,pp->tri[n].ver3.tex_x,pp->tri[n].ver3.tex_y); - Triangle *tri = new Triangle(ver1,ver2,ver3); - Span_c *span = new Span_c(); - span->viewer = viewer; - span->p = this; - span->create_span(tri,texture_image); - delete ver1; - delete ver2; - delete ver3; - delete tri; - delete span; + Triangle *tri = new Triangle(ver1,ver2,ver3); + Span_c *span = new Span_c(); + span->viewer = viewer; + span->p = this; + span->create_span(tri,texture_image); + delete ver1; + delete ver2; + delete ver3; + delete tri; + delete span; } } @@ -136,42 +134,42 @@ Span *span; for (int n = 0; n < sp->info.size; n++) { - span = &sp->span[n]; + span = &sp->span[n]; - //int x = span->x; - //int y = span->y; - float z = span->start_z; - int end = span->length_x; - float zpos = span->end_z; - float tex1 = span->tex_x1; - float tex2 = span->tex_x2; - float tey1 = span->tex_y1; - float tey2 = span->tex_y2; - Uint32 rgb; - int tex_xpos; - int tex_ypos; - int tex_zpos; - float tex_x, tex_y, tex_z; + //int x = span->x; + //int y = span->y; + float z = span->start_z; + int end = span->length_x; + float zpos = span->end_z; + float tex1 = span->tex_x1; + float tex2 = span->tex_x2; + float tey1 = span->tex_y1; + float tey2 = span->tex_y2; + Uint32 rgb; + int tex_xpos; + int tex_ypos; + int tex_zpos; + float tex_x, tex_y, tex_z; - if (end == 1) { - tex_xpos = (int)((span->tex_height-1) * tex1); - tex_ypos = (int)((span->tex_width-1) * tey1); - tex_zpos = (int)z; - rgb = get_rgb(tex_xpos, tex_ypos); - //viewer->write_pixel(x, y, zpos, rgb); - } else { - for (int j = 0; j < end; j++) { - tex_x = tex1*(end-1-j)/(end-1) + tex2*j/(end-1); - tex_y = tey1*(end-1-j)/(end-1) + tey2*j/(end-1); - tex_z = z*(end-1-j)/(end-1) + zpos*j/(end-1); - if (tex_x > 1) tex_x = 1; - if (tex_y > 1) tex_y = 1; - tex_xpos = (int)((span->tex_height-1) * tex_x); - tex_ypos = (int)((span->tex_width-1) * tex_y); - rgb = get_rgb(tex_xpos,tex_ypos); - //viewer->write_pixel(j + x, y, tex_z, rgb); - } - } + if (end == 1) { + tex_xpos = (int)((span->tex_height-1) * tex1); + tex_ypos = (int)((span->tex_width-1) * tey1); + tex_zpos = (int)z; + rgb = get_rgb(tex_xpos, tex_ypos); + //viewer->write_pixel(x, y, zpos, rgb); + } else { + for (int j = 0; j < end; j++) { + tex_x = tex1*(end-1-j)/(end-1) + tex2*j/(end-1); + tex_y = tey1*(end-1-j)/(end-1) + tey2*j/(end-1); + tex_z = z*(end-1-j)/(end-1) + zpos*j/(end-1); + if (tex_x > 1) tex_x = 1; + if (tex_y > 1) tex_y = 1; + tex_xpos = (int)((span->tex_height-1) * tex_x); + tex_ypos = (int)((span->tex_width-1) * tex_y); + rgb = get_rgb(tex_xpos,tex_ypos); + //viewer->write_pixel(j + x, y, tex_z, rgb); + } + } } } @@ -181,14 +179,14 @@ { for(int n=0; n<size*3; n+=3) { - cont = pickup_float(cont, coord_xyz+n); - cont = pickup_float(cont, coord_xyz+n+1); - cont = pickup_float(cont, coord_xyz+n+2); - - if (cont == NULL) - { - cout << "Analyzing obj data failed coordinate\n"; - } + cont = pickup_float(cont, coord_xyz+n); + cont = pickup_float(cont, coord_xyz+n+1); + cont = pickup_float(cont, coord_xyz+n+2); + + if (cont == NULL) + { + cout << "Analyzing obj data failed coordinate\n"; + } } } @@ -196,14 +194,14 @@ { for (int n = 0; n<size*3; n += 3) { - cont = pickup_float(cont, normal+n); - cont = pickup_float(cont, normal+n+1); - cont = pickup_float(cont, normal+n+2); - - if (cont == NULL) - { - cout << "Analyzing obj data failed normal\n"; - } + cont = pickup_float(cont, normal+n); + cont = pickup_float(cont, normal+n+1); + cont = pickup_float(cont, normal+n+2); + + if (cont == NULL) + { + cout << "Analyzing obj data failed normal\n"; + } } } @@ -212,10 +210,10 @@ cont = pickup_float(cont,c_xyz); cont = pickup_float(cont,c_xyz+1); cont = pickup_float(cont,c_xyz+2); - + if (cont == NULL) { - cout << "Analyzing obj data failed model\n"; + cout << "Analyzing obj data failed model\n"; } } @@ -223,14 +221,14 @@ { for (int n = 0; n < size*3; n += 3) { - cont = pickup_float(cont, coord_tex+n); - cont = pickup_float(cont, coord_tex+n+1); - coord_tex[n+2] = 1.0; - - if (cont == NULL) - { - cout << "Analyzing obj data failed texture\n"; - } + cont = pickup_float(cont, coord_tex+n); + cont = pickup_float(cont, coord_tex+n+1); + coord_tex[n+2] = 1.0; + + if (cont == NULL) + { + cout << "Analyzing obj data failed texture\n"; + } } } @@ -261,7 +259,7 @@ SDL_PixelFormat *fmt; //Uint32 temp, pixel; Uint8 red, green, blue; - + fmt = texture_image->format; if (tx<0) tx = 0; @@ -278,17 +276,17 @@ //printf("pixel = %d\n", pixel); //printf("pixel %x bpp = %d ",p, fmt->BytesPerPixel); //SDL_UnlockSurface(texture_image); - + temp = pixel&fmt->Rmask; temp = temp>>fmt->Rshift; temp = temp<<fmt->Rloss; red = (Uint8)temp; - + temp = pixel&fmt->Gmask; temp = temp>>fmt->Gshift; temp = temp<<fmt->Gloss; green = (Uint8)temp; - + temp = pixel&fmt->Bmask; temp = temp>>fmt->Bshift; temp = temp<<fmt->Bloss; @@ -297,8 +295,8 @@ blue = (Uint8) p[0]; green = (Uint8) p[1]; red = (Uint8) p[2]; - - //printf("tx = %d ty = %d ", tx,ty); + + //printf("tx = %d ty = %d ", tx,ty); //printf("pixel color => R: %d, G: %d, B: %d\n", red, green, blue); SDL_PixelFormat *pf = NULL;
--- a/TaskManager/Test/test_render/polygon.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/polygon.h Wed Jul 15 17:39:51 2009 +0900 @@ -36,8 +36,8 @@ float *anim; int texture_id; //texture id number struct texture_list texture_info; - - static SDL_Surface* texture_image; // pointer of this surface's texture + + SDL_Surface* texture_image; Polygon(void);
--- a/TaskManager/Test/test_render/polygon_pack.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/polygon_pack.h Wed Jul 15 17:39:51 2009 +0900 @@ -15,6 +15,12 @@ float tex_y; } VertexPack, *VertexPackPtr; // 20 +typedef struct NormalPack { + float x; + float y; + float z; +} NormalPack, *NormalPackPtr; // 12 + typedef struct TriTexInfo { uint32 *addr; int width; @@ -27,11 +33,14 @@ VertexPack ver1; VertexPack ver2; VertexPack ver3; + NormalPack normal1; + NormalPack normal2; + NormalPack normal3; } TrianglePack, *TrianglePackPtr; typedef struct PolygonPack { - struct PORIGON_info { + struct POLYGON_info { int size; int light_pos[3]; int light_rgb[3];
--- a/TaskManager/Test/test_render/spe/CreatePolygon.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/spe/CreatePolygon.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -4,6 +4,9 @@ * c莨冴鴻 */ +// #define DEBUG +#include "error.h" + #include "CreatePolygon.h" #include "polygon_pack.h" #include "scene_graph_pack.h" @@ -37,6 +40,8 @@ int CreatePolygon::run(void *rbuf, void *wbuf) { + __debug_spe("CreatePolygon\n"); + float xyz1[4],xyz2[4],xyz3[4]; SceneGraphPackPtr sgp = (SceneGraphPack*)smanager->get_input(0);
--- a/TaskManager/Test/test_render/spe/CreateSpan.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/spe/CreateSpan.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -1,3 +1,5 @@ +// #define DEBUG +#include "error.h" #include "CreateSpan.h" #include "viewer_types.h" @@ -291,9 +293,11 @@ if (spack->info.size >= MAX_SIZE_SPAN) { SpanPackPtr next; + __debug_spe("CreateSpan mainMem_alloc 0x%x\n", (unsigned int)sizeof(SpanPack)); smanager->mainMem_alloc(0, sizeof(SpanPack)); smanager->mainMem_wait(); next = (SpanPackPtr)smanager->mainMem_get(0); + __debug_spe("CreateSpan mainMem_allocated 0x%x\n", (unsigned int)next); spack->next = next; // TaskManager с @@ -408,6 +412,8 @@ int CreateSpan::run(void *rbuf, void *wbuf) { + __debug_spe("CreateSpan\n"); + PolygonPack *pp = (PolygonPack*)smanager->get_input(0); PolygonPack *next_pp = (PolygonPack*)smanager->allocate(sizeof(PolygonPack)); @@ -432,6 +438,8 @@ int charge_y_end = get_param(2); do { + __debug_spe("CreateSpan allocated 0x%x\n",(uint32)next_pp); + if (pp->next != NULL) { smanager->dma_load(next_pp, (uint32)pp->next, sizeof(PolygonPack), POLYGON_PACK_LOAD); @@ -486,6 +494,7 @@ smanager->dma_store(spack, (uint32)spackList[prev_index], sizeof(SpanPack), SPAN_PACK_STORE); smanager->dma_wait(SPAN_PACK_STORE); + __debug_spe("CreateSpan spack_stored 0x%x\n",(uint32)spackList[prev_index]); // smanager allocate free smanager с鴻 free(free_pp);
--- a/TaskManager/Test/test_render/spe/DrawBack.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawBack.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -1,3 +1,6 @@ +// #define DEBUG +#include "error.h" + #include <stdlib.h> #include <string.h> #include "DrawBack.h" @@ -16,6 +19,7 @@ int DrawBack::run(void *rbuf, void *wbuf) { + __debug_spe("DrawBack\n"); int rgb = smanager->get_param(0); int rangex_start = smanager->get_param(1); int rangex_end = smanager->get_param(2);
--- a/TaskManager/Test/test_render/spe/DrawSpan.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -1,3 +1,6 @@ +// #define DEBUG +#include "error.h" + #include <stdlib.h> #include <string.h> #include <spu_intrinsics.h> @@ -6,6 +9,7 @@ #include "texture.h" #include "viewer_types.h" #include "Func.h" +#include "global_alloc.h" SchedDefineTask(DrawSpan); @@ -117,7 +121,7 @@ int *buf = (int*)smanager->allocate(sizeof(int)*width*height); for (int i = 0; i < width*height; i++) { - buf[i] = rgb; + buf[i] = rgb; } return buf; @@ -138,16 +142,16 @@ #if 0 for (int i = 0; i < width*height; i++) { - buf[i] = def; + buf[i] = def; } -#else +#else vector float init = spu_splats(0.0f); vector float defi = spu_splats(def); for (int i = 0; i < width*height; i += 4) { - vector float *out = (vector float *)&buf[i]; + vector float *out = (vector float *)&buf[i]; - *out = spu_add(init, defi); + *out = spu_add(init, defi); } #endif @@ -167,63 +171,33 @@ return hash->get(addr); } -void +TilePtr DrawSpan::set_rgb(uint32 *addr, int tag) { TilePtr tile; - if (isAvailableTile(addr)) { - return; - } + tile = tileList->nextTile(); + uint32 old_addr = tile->texture_addr; + smanager->dma_load(tile->pixel, (uint32)addr, + sizeof(uint32)*TEXTURE_BLOCK_SIZE, tag); - tile = tileList->nextTile(); /** * FIFO с罧c医 */ - hash->remove(tile->texture_addr); - + hash->remove(old_addr); + tile->texture_addr = addr; - + hash->put(tile->texture_addr, tile); - smanager->dma_load(tile->pixel, (uint32)addr, - sizeof(uint32)*TEXTURE_BLOCK_SIZE, tag); + + return tile; } -/** - * - */ -void -DrawSpan::set_rgbs(uint32 *cur_addr, uint32 *max_addr, int wait_tag) -{ - uint32 curp = (uint32)cur_addr; - uint32 maxp = (uint32)max_addr; - uint32 startp = curp; - uint32 diff = sizeof(int)*TEXTURE_BLOCK_SIZE; - int length = (int)maxp-(int)curp; - - int cmp = (length < 0); - -#if 1 - length += cmp*(-1)*length*2; - startp = cmp*maxp + !cmp*curp; -#else - if (length < 0) { - length = -length; - startp = maxp; - } -#endif - - for (int i = 0; i <= length; i += diff) { - set_rgb((uint32*)(startp + i), wait_tag); - } -} uint32 -DrawSpan::get_rgb(int tx, int ty, uint32 *addr) +DrawSpan::get_rgb(int tx, int ty, TilePtr tile) { - TilePtr tile; - - tile = hash->get(addr); + return tile->pixel[(TEXTURE_SPLIT_PIXEL)*ty+tx]; } @@ -238,7 +212,7 @@ DrawSpan::reboot(SpanPackPtr spack, int cur_span_x) { DrawSpanArgPtr args = - (DrawSpanArgPtr)smanager->allocate(sizeof(DrawSpanArg)); + (DrawSpanArgPtr)smanager->allocate(sizeof(DrawSpanArg)); TaskPtr renew_task = smanager->create_task(TASK_DRAW_SPAN2); // 違紊ф篏ф検 @@ -255,7 +229,7 @@ * spack rbuf 緇醇с * rbuf 激鴻 free() * ≪鴻羝<NG - */ + */ SpanPackPtr curr = (SpanPackPtr)smanager->allocate(sizeof(SpanPack)); memcpy(curr, spack, sizeof(SpanPack)); renew_task->add_param((int)curr); @@ -267,7 +241,7 @@ /** * 莎桁帥鴻緇 - */ + */ smanager->wait_task(renew_task); // next_spack free() wait @@ -276,12 +250,12 @@ void DrawSpan::writebuffer(unsigned int display, int buf_width, int height, - int screen_width) + int screen_width) { for (int i = 0; i < height; i++) { - smanager->dma_store(&linebuf[i*buf_width], - display + (sizeof(int)*screen_width*i), - sizeof(int)*buf_width, FB_STORE); + smanager->dma_store(&linebuf[i*buf_width], + display + (sizeof(int)*screen_width*i), + sizeof(int)*buf_width, FB_STORE); } doneWrite = 1; @@ -300,10 +274,10 @@ */ void DrawSpan::updateBuffer(float zpos, int rangex, int x, int y, - int tex_x, int tex_y, uint32 *tex_addr) + int tex_x, int tex_y, TilePtr tile) { - int rgb = get_rgb(tex_x, tex_y, tex_addr); - + int rgb = get_rgb(tex_x, tex_y, tile); + zRow[x + (rangex*y)] = zpos; linebuf[x + (rangex*y)] = rgb; } @@ -343,36 +317,32 @@ uint32 *tex_addr; if (span->x < startx || endx < span->x) { - return -1; + return -1; } tex_xpos = (int)((span->tex_width-1) * tex); tex_ypos = (int)((span->tex_height-1) * tey); if (zpos < zRow[localx + (rangex*localy)]) { - tex_addr = getTile(tex_xpos, tex_ypos, - span->tex_width, span->tex_addr); - tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; - tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; + tex_addr = getTile(tex_xpos, tex_ypos, + span->tex_width, span->tex_addr); + tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; + tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; - if (!isAvailableTile(tex_addr)) { - set_rgb(tex_addr, wait_tag); - smanager->dma_wait(wait_tag); - //return startx; - } + TilePtr tile; + if (!(tile = isAvailableTile(tex_addr))) { + tile = set_rgb(tex_addr, wait_tag); + smanager->dma_wait(wait_tag); + //return startx; + } - updateBuffer(zpos, rangex, localx, localy, - tex_localx, tex_localy, tex_addr); + updateBuffer(zpos, rangex, localx, localy, + tex_localx, tex_localy, tile); } return -1; } -void -DrawSpan::drawDot2(SpanPtr span, int startx, int end, int js, int wait_tag) -{ - //printf("%d\n", js); -} /** * 激 1 紊с Span @@ -385,7 +355,7 @@ * 篁 drawLine1 load -> wait -> rendering c障 * (rendering crendering buffer 吾莨若 * 障 main memory (frame buffer) dma store с) - * + * * @param span Span * @param startx 脂紮膀 * @param endx 紫篋膀 @@ -423,140 +393,53 @@ //for (int j = js; j <= je; j++) { for (int j = je; j >= js; j--) { - float tex_x, tex_y, tex_z; + float tex_x, tex_y, tex_z; - localx = getLocalX(x-1+j); + localx = getLocalX(x-1+j); - tex_z = zpos1*(x_len-1-j)/(x_len-1) + zpos2*j/(x_len-1); + tex_z = zpos1*(x_len-1-j)/(x_len-1) + zpos2*j/(x_len-1); - tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1); - tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1); - if (tex_x > 1) tex_x = 1; - if (tex_x < 0) tex_x = 0; - if (tex_y > 1) tex_y = 1; - if (tex_y < 0) tex_y = 0; - tex_xpos = (int)((span->tex_width-1) * tex_x); - tex_ypos = (int)((span->tex_height-1) * tex_y); - - if (tex_z < zRow[localx + (rangex*localy)]) { - // (tex_xpos, tex_ypos) Tile (筝喝)с綺ф - // ≪(MainMemory) - uint32 *tex_addr; - int tex_localx; - int tex_localy; + tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1); + tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1); + if (tex_x > 1) tex_x = 1; + if (tex_x < 0) tex_x = 0; + if (tex_y > 1) tex_y = 1; + if (tex_y < 0) tex_y = 0; + tex_xpos = (int)((span->tex_width-1) * tex_x); + tex_ypos = (int)((span->tex_height-1) * tex_y); - tex_addr = getTile(tex_xpos, tex_ypos, - span->tex_width, span->tex_addr); - tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; - tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; + if (tex_z < zRow[localx + (rangex*localy)]) { + // (tex_xpos, tex_ypos) Tile (筝喝)с綺ф + // ≪(MainMemory) + uint32 *tex_addr; + int tex_localx; + int tex_localy; - if (!isAvailableTile(tex_addr)) { -#if 0 - // span 綽荀с tile 篋括 - // set_rgbs ц医 load - // 障筝c - tex_x = tex1*(x_len-1-js)/(x_len-1) + tex2*js/(x_len-1); - if (tex_x > 1) tex_x = 1; - if (tex_x < 0) tex_x = 0; - tex_xpos = (int)((span->tex_width-1) * tex_x); + tex_addr = getTile(tex_xpos, tex_ypos, + span->tex_width, span->tex_addr); + tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; + tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; - uint32 *max_addr = getTile(tex_xpos, tex_ypos, - span->tex_width, span->tex_addr); + TilePtr tile; + if (!(tile = isAvailableTile(tex_addr))) { + + tile = set_rgb(tex_addr, wait_tag); + smanager->dma_wait(wait_tag); - set_rgbs(tex_addr, max_addr, wait_tag); - return js; -#else - set_rgb(tex_addr, wait_tag); - smanager->dma_wait(wait_tag); -#endif - } + } - updateBuffer(tex_z, rangex, localx, localy, - tex_localx, tex_localy, tex_addr); - } + updateBuffer(tex_z, rangex, localx, localy, + tex_localx, tex_localy, tile); + } } return ret; } -/** - * 激 1 紊с Span (2罧級) - * - * 筝drawLine2 篁с - * 罩g∈js startx ~ endx 膀峨紮c - * - * @param span Span - * @param startx 脂紮膀 - * @param endx 紫篋膀 - * @param js (drawLine1) span 障хc - */ -void -DrawSpan::drawLine2(SpanPtr span, int startx, int endx, int js, int wait_tag) -{ - int x = span->x; - int rangex = endx - startx + 1; - int x_len = span->length_x; - - //int js = startx; - int je = (x + x_len > endx) ? endx - x : x_len; - - /* span->x 絲上 Texture 綺ф (tex_xpos, tex_ypos) */ - int tex_xpos, tex_ypos; - - // span 紮鴻絲上綺ф (tex1, tey1) - float tex1 = span->tex_x1; - float tey1 = span->tex_y1; - - // span 腟鴻絲上綺ф (tex2, tey2) - float tex2 = span->tex_x2; - float tey2 = span->tex_y2; - - // span 紮鴻腟鴻絲上 z 綺ф - float zpos1 = span->start_z; - float zpos2 = span->end_z; - - // Tile с綺ф - int localx, localy = getLocalY(span->y-1); - - // (tex_xpos, tex_ypos) Tile (筝喝)с綺ф - // ≪(MainMemory) - int tex_localx; - int tex_localy; - uint32 *tex_addr; - - float tex_x, tex_y, tex_z; - - smanager->dma_wait(wait_tag); - - for (int j = js; j <= je; j++) { - localx = getLocalX(x-1+j); - - tex_z = zpos1*(x_len-1-j)/(x_len-1) + zpos2*j/(x_len-1); - - tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1); - tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1); - if (tex_x > 1) tex_x = 1; - if (tex_x < 0) tex_x = 0; - if (tex_y > 1) tex_y = 1; - if (tex_y < 0) tex_y = 0; - tex_xpos = (int)((span->tex_width-1) * tex_x); - tex_ypos = (int)((span->tex_height-1) * tex_y); - - if (tex_z < zRow[localx + (rangex*localy)]) { - tex_addr = getTile(tex_xpos, tex_ypos, - span->tex_width, span->tex_addr); - tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; - tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; - - updateBuffer(tex_z, rangex, localx, localy, - tex_localx, tex_localy, tex_addr); - } - } -} - int DrawSpan::run(void *rbuf, void *wbuf) { + __debug_spe("DrawSpan\n"); SpanPackPtr spack = (SpanPackPtr)smanager->get_input(0); SpanPackPtr next_spack = (SpanPackPtr)smanager->allocate(sizeof(SpanPack)); SpanPackPtr free_spack = next_spack; // next_spack free() @@ -566,18 +449,18 @@ nop_span.length_x = 1; int (DrawSpan::*drawFunc1[2])(SpanPtr, int, int, int) = { - &DrawSpan::drawDot1, &DrawSpan::drawLine1 + &DrawSpan::drawDot1, &DrawSpan::drawLine1 }; void (DrawSpan::*drawFunc2[2])(SpanPtr, int, int, int, int) = { - &DrawSpan::drawDot2, &DrawSpan::drawLine2 + &DrawSpan::drawDot2, &DrawSpan::drawLine2 }; uint32 display = smanager->get_param(0); int screen_width = smanager->get_param(1); int rangex_start = smanager->get_param(2); - int rangex_end = smanager->get_param(3); - + int rangex_end = smanager->get_param(3); + // 帥鴻綵 x 膀 int rangex = rangex_end - rangex_start + 1; @@ -596,60 +479,60 @@ int tl_tag[2] = {TEX_LOAD1, TEX_LOAD2}; int tl_tag_flg1 = 0; int tl_tag_flg2 = 1; - + do { - /** - * SpanPack->next 絖翫 - * 憜 SpanPack - * 罨< SpanPack DMA 荵∫茵 - */ - if (spack->next != NULL) { - smanager->dma_load(next_spack, (uint32)spack->next, - sizeof(SpanPack), SPAN_PACK_LOAD); - } else { - next_spack = NULL; - } + /** + * SpanPack->next 絖翫 + * 憜 SpanPack + * 罨< SpanPack DMA 荵∫茵 + */ + if (spack->next != NULL) { + smanager->dma_load(next_spack, (uint32)spack->next, + sizeof(SpanPack), SPAN_PACK_LOAD); + } else { + next_spack = NULL; + } - SpanPtr resume_span = &nop_span; - int resume_span_x = 0; + SpanPtr resume_span = &nop_span; + int resume_span_x = 0; - for (int t = 0; t < spack->info.size; t++) { - SpanPtr next_span; - int next_span_x; + for (int t = 0; t < spack->info.size; t++) { + SpanPtr next_span; + int next_span_x; - span = &spack->span[t]; + span = &spack->span[t]; - /** - * span 激cdrawLine drawDot 御 - */ - next_span_x - = (this->*drawFunc1[(span->length_x != 1)])( - span, rangex_start, rangex_end, tl_tag[tl_tag_flg1]); - next_span = span; + /** + * span 激cdrawLine drawDot 御 + */ + next_span_x + = (this->*drawFunc1[(span->length_x != 1)])( + span, rangex_start, rangex_end, tl_tag[tl_tag_flg1]); + next_span = span; - (this->*drawFunc2[(resume_span->length_x != 1)])( - resume_span, rangex_start, rangex_end, resume_span_x, - tl_tag[tl_tag_flg2]); + (this->*drawFunc2[(resume_span->length_x != 1)])( + resume_span, rangex_start, rangex_end, resume_span_x, + tl_tag[tl_tag_flg2]); + + resume_span = next_span; + resume_span_x = next_span_x; - resume_span = next_span; - resume_span_x = next_span_x; - - //smanager->dma_wait(tl_tag[tl_tag_flg1]); + //smanager->dma_wait(tl_tag[tl_tag_flg1]); + + tl_tag_flg1 ^= 1; + tl_tag_flg2 ^= 1; + } - tl_tag_flg1 ^= 1; - tl_tag_flg2 ^= 1; - } - - // 憜 drawLine2drawDot2 罘純 - //(this->*drawFunc2[(resume_span->length_x != 1)])( - //resume_span, rangex_start, rangex_end, resume_span_x, - //tl_tag[tl_tag_flg1]); + // 憜 drawLine2drawDot2 罘純 + //(this->*drawFunc2[(resume_span->length_x != 1)])( + //resume_span, rangex_start, rangex_end, resume_span_x, + //tl_tag[tl_tag_flg1]); - smanager->dma_wait(SPAN_PACK_LOAD); + smanager->dma_wait(SPAN_PACK_LOAD); - SpanPackPtr tmp_spack = spack; - spack = next_spack; - next_spack = tmp_spack; + SpanPackPtr tmp_spack = spack; + spack = next_spack; + next_spack = tmp_spack; } while (spack); writebuffer(display, rangex, rangey, screen_width);
--- a/TaskManager/Test/test_render/spe/DrawSpanRenew.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpanRenew.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -1,3 +1,6 @@ +// #define DEBUG +#include "error.h" + #include <stdlib.h> #include <string.h> #include <spu_mfcio.h> @@ -7,6 +10,7 @@ #include "texture.h" #include "viewer_types.h" #include "Func.h" +#include "global_alloc.h" #define SPAN_PACK_LOAD 0 #define TEX_LOAD 1 @@ -26,24 +30,25 @@ renew_task->add_param((int)curr); renew_task->add_param(cur_span_x); - // linebuf と zRow も引き継がせる + // linebuf zRow 綣膓 renew_task->add_param((int)linebuf); renew_task->add_param((int)zRow); //fprintf(stderr, "[%p] start %u\n", curr, spu_readch(SPU_RdDec)); /** - * 再起動したタスクを待つ - */ + * 莎桁帥鴻緇 + */ smanager->wait_task(renew_task); - // next_spack は free() するので wait する + // next_spack free() wait smanager->dma_wait(SPAN_PACK_LOAD); } int DrawSpanRenew::run(void *rbuf, void *wbuf) { + __debug_spe("DrawSpanRenew\n"); SpanPackPtr spack = (SpanPackPtr)smanager->get_param(1); SpanPackPtr next_spack = (SpanPackPtr)smanager->allocate(sizeof(SpanPack)); SpanPackPtr free_spack1 = spack; @@ -56,21 +61,21 @@ int rangex_start = args->rangex_start; int rangex_end = args->rangex_end; - // このタスクが担当する x の範囲 + // 帥鴻綵 x 膀 int rangex = rangex_end - rangex_start + 1; - // y の範囲 (render_y + rangey - 1) + // y 膀 (render_y + rangey - 1) int rangey = args->rangey; hash = (TileHashPtr)smanager->global_get(GLOBAL_TEXTURE_HASH); tileList = (TileListPtr)smanager->global_get(GLOBAL_TILE_LIST); - + linebuf = (int*)smanager->get_param(3); zRow = (float*)smanager->get_param(4); doneWrite = 0; - // span->length_x の処理での再起動位置 + // span->length_x с莎桁篏臀 int js_cont = smanager->get_param(2); //fprintf(stderr, "[%p] end %u\n", spack, spu_readch(SPU_RdDec)); @@ -78,137 +83,137 @@ smanager->dma_wait(TEX_LOAD); do { - /** - * SpanPack->next が存在する場合、 - * 現在の SpanPack を処理してる間に - * 次の SpanPack の DMA 転送を行う - */ - if (spack->next != NULL) { - smanager->dma_load(next_spack, (uint32)spack->next, - sizeof(SpanPack), SPAN_PACK_LOAD); - } else { - next_spack = NULL; - } + /** + * SpanPack->next 絖翫 + * 憜 SpanPack + * 罨< SpanPack DMA 荵∫茵 + */ + if (spack->next != NULL) { + smanager->dma_load(next_spack, (uint32)spack->next, + sizeof(SpanPack), SPAN_PACK_LOAD); + } else { + next_spack = NULL; + } - for (int t = spack->info.start; t < spack->info.size; t++) { - span = &spack->span[t]; + for (int t = spack->info.start; t < spack->info.size; t++) { + span = &spack->span[t]; - uint32 rgb = 0x00ff0000; - float tex1 = span->tex_x1; - float tex2 = span->tex_x2; - float tey1 = span->tex_y1; - float tey2 = span->tex_y2; + uint32 rgb = 0x00ff0000; + float tex1 = span->tex_x1; + float tex2 = span->tex_x2; + float tey1 = span->tex_y1; + float tey2 = span->tex_y2; - /** - * Span が持つ 1 pixel 毎の - * テクスチャの座標 - */ - int tex_xpos; - int tex_ypos; + /** + * Span 1 pixel 罸 + * 鴻c綺ф + */ + int tex_xpos; + int tex_ypos; - /** - * (tex_xpos, tex_ypos) の、ブロック内(上の図参照)での座標と - * そのブロックのアドレス(MainMemory) - */ - int tex_localx; - int tex_localy; - uint32 *tex_addr; + /** + * (tex_xpos, tex_ypos) (筝喝)с綺ф + * ≪(MainMemory) + */ + int tex_localx; + int tex_localy; + uint32 *tex_addr; - int x = span->x; - int y = span->y; - int x_len = span->length_x; - float z = span->start_z; - float zpos = span->end_z; + int x = span->x; + int y = span->y; + int x_len = span->length_x; + float z = span->start_z; + float zpos = span->end_z; + + // 綺ф [0 .. split_screen_w-1] ャ x,y -1 + int localx = getLocalX(x-1); + int localy = getLocalY(y-1); - // 座標が [0 .. split_screen_w-1] に入るように x,y を -1 - int localx = getLocalX(x-1); - int localy = getLocalY(y-1); + if (x_len == 1) { + if (x < rangex_start || rangex_end < x) { + continue; + } - if (x_len == 1) { - if (x < rangex_start || rangex_end < x) { - continue; - } + tex_xpos = (int)((span->tex_width-1) * tex1); + tex_ypos = (int)((span->tex_height-1) * tey1); - tex_xpos = (int)((span->tex_width-1) * tex1); - tex_ypos = (int)((span->tex_height-1) * tey1); + if (zpos < zRow[localx + (rangex * localy)]) { + tex_addr = getTile(tex_xpos, tex_ypos, + span->tex_width, span->tex_addr); + tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; + tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; - if (zpos < zRow[localx + (rangex * localy)]) { - tex_addr = getTile(tex_xpos, tex_ypos, - span->tex_width, span->tex_addr); - tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; - tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; + if (!isAvailableTile(tex_addr)) { + set_rgb(tex_addr, 0); + smanager->dma_wait(0); + } - if (!isAvailableTile(tex_addr)) { - set_rgb(tex_addr, 0); - smanager->dma_wait(0); - } - - rgb = get_rgb(tex_localx, tex_localy, tex_addr); + rgb = get_rgb(tex_localx, tex_localy, tex_addr); + + zRow[localx + (rangex*localy)] = zpos; + linebuf[localx + (rangex*localy)] = rgb; + } + } else { + int js = (x < rangex_start) ? rangex_start - x : 0; + int je = (x + x_len > rangex_end) ? rangex_end - x : x_len; + float tex_x, tex_y, tex_z; - zRow[localx + (rangex*localy)] = zpos; - linebuf[localx + (rangex*localy)] = rgb; - } - } else { - int js = (x < rangex_start) ? rangex_start - x : 0; - int je = (x + x_len > rangex_end) ? rangex_end - x : x_len; - float tex_x, tex_y, tex_z; - - /** - * 一回比較すれば、以後再起動するまでは - * js_cont は使わないから 0 にしてるわけだけど、 - * 最初の一回のためだけにこれはめんどくさいのー。 - */ - js = (js < js_cont) ? js_cont : js; - js_cont = 0; + /** + * 筝罸莠違篁ュ莎桁障с + * js_cont 篏帥 0 + * 筝若 + */ + js = (js < js_cont) ? js_cont : js; + js_cont = 0; + + for (int j = js; j <= je; j++) { + localx = getLocalX(x-1+j); - for (int j = js; j <= je; j++) { - localx = getLocalX(x-1+j); + tex_z = z*(x_len-1-j)/(x_len-1) + zpos*j/(x_len-1); - tex_z = z*(x_len-1-j)/(x_len-1) + zpos*j/(x_len-1); + tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1); + tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1); + if (tex_x > 1) tex_x = 1; + if (tex_x < 0) tex_x = 0; + if (tex_y > 1) tex_y = 1; + if (tex_y < 0) tex_y = 0; + tex_xpos = (int)((span->tex_width-1) * tex_x); + tex_ypos = (int)((span->tex_height-1) * tex_y); - tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1); - tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1); - if (tex_x > 1) tex_x = 1; - if (tex_x < 0) tex_x = 0; - if (tex_y > 1) tex_y = 1; - if (tex_y < 0) tex_y = 0; - tex_xpos = (int)((span->tex_width-1) * tex_x); - tex_ypos = (int)((span->tex_height-1) * tex_y); - - if (tex_z < zRow[localx + (rangex*localy)]) { - tex_addr = getTile(tex_xpos, tex_ypos, - span->tex_width, span->tex_addr); - tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; - tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; + if (tex_z < zRow[localx + (rangex*localy)]) { + tex_addr = getTile(tex_xpos, tex_ypos, + span->tex_width, span->tex_addr); + tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; + tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; - if (!isAvailableTile(tex_addr)) { - spack->info.start = t; + if (!isAvailableTile(tex_addr)) { + spack->info.start = t; #if 0 - set_rgbs(tex_addr, - getTile(span->tex_width-1, tex_ypos, - span->tex_width, span->tex_addr)); - reboot(spack, j); - goto FINISH; + set_rgbs(tex_addr, + getTile(span->tex_width-1, tex_ypos, + span->tex_width, span->tex_addr)); + reboot(spack, j); + goto FINISH; #else - set_rgb(tex_addr, TEX_LOAD); - smanager->dma_wait(TEX_LOAD); + set_rgb(tex_addr, TEX_LOAD); + smanager->dma_wait(TEX_LOAD); #endif - } - - rgb = get_rgb(tex_localx, tex_localy, tex_addr); - - zRow[localx + (rangex*localy)] = tex_z; - linebuf[localx + (rangex*localy)] = rgb; - } - } - } - } + } + + rgb = get_rgb(tex_localx, tex_localy, tex_addr); - smanager->dma_wait(SPAN_PACK_LOAD); + zRow[localx + (rangex*localy)] = tex_z; + linebuf[localx + (rangex*localy)] = rgb; + } + } + } + } - SpanPackPtr tmp_spack = spack; - spack = next_spack; - next_spack = tmp_spack; + smanager->dma_wait(SPAN_PACK_LOAD); + + SpanPackPtr tmp_spack = spack; + spack = next_spack; + next_spack = tmp_spack; } while (spack); writebuffer(display, rangex, rangey, screen_width); @@ -217,7 +222,7 @@ free(args); /** - * linebuf, zRow, args は RenewTask が引き継ぐ + * linebuf, zRow, args RenewTask 綣膓 */ free(free_spack1); free(free_spack2);
--- a/TaskManager/Test/test_render/spe/Load_Texture.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/spe/Load_Texture.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -1,9 +1,13 @@ +// #define DEBUG +#include "error.h" + #include <stdlib.h> #include <string.h> #include "Load_Texture.h" #include "texture.h" #include "TileHash.h" #include "Func.h" +#include "global_alloc.h" SchedDefineTask(LoadTexture); @@ -11,19 +15,20 @@ * Load腟絮 DrawSpan т戎 * Hash 羣с紊 */ -int -LoadTexture::run(void *rbuf , void *wbuf) +int +LoadTexture::run(void *rbuf , void *wbuf) { + __debug_spe("LoadTexture\n"); /** * 憜 global_alloc() с new 泣若 * 潟潟鴻水若吟 placement new 障 */ void *hash_tmp - = smanager->global_alloc(GLOBAL_TEXTURE_HASH, sizeof(TileHash)); + = smanager->global_alloc(GLOBAL_TEXTURE_HASH, sizeof(TileHash)); new(hash_tmp) TileHash; void *tileList_tmp - = smanager->global_alloc(GLOBAL_TILE_LIST, sizeof(TileList)); + = smanager->global_alloc(GLOBAL_TILE_LIST, sizeof(TileList)); new(tileList_tmp) TileList; return 0;
--- a/TaskManager/Test/test_render/spe/Set_Texture.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/spe/Set_Texture.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -1,30 +1,34 @@ +// #define DEBUG +#include "error.h" #include <string.h> #include "Set_Texture.h" #include "texture.h" +#include "global_alloc.h" SchedDefineTask(SetTexture); //texture global 潟若帥鴻 -int +int SetTexture::run(void *rbuf, void *wbuf) { + __debug_spe("SetTexture\n"); void *src[4]; - + src[0] = get_input(rbuf, 0); src[1] = get_input(rbuf, 1); src[2] = get_input(rbuf, 2); src[3] = get_input(rbuf, 3); - + if (global_get(TEXTURE_ID)) { - return 0; + return 0; } else { - //帥鴻掩с腆坂 - void *data = global_alloc(TEXTURE_ID, MAX_LOAD_SIZE*4); + //帥鴻掩с腆坂 + void *data = global_alloc(TEXTURE_ID, MAX_LOAD_SIZE*4); - memcpy(data, src[0], MAX_LOAD_SIZE); - memcpy((void*)((int)data + MAX_LOAD_SIZE), src[1], MAX_LOAD_SIZE); - memcpy((void*)((int)data + MAX_LOAD_SIZE*2), src[2], MAX_LOAD_SIZE); - memcpy((void*)((int)data + MAX_LOAD_SIZE*3), src[3], MAX_LOAD_SIZE); + memcpy(data, src[0], MAX_LOAD_SIZE); + memcpy((void*)((int)data + MAX_LOAD_SIZE), src[1], MAX_LOAD_SIZE); + memcpy((void*)((int)data + MAX_LOAD_SIZE*2), src[2], MAX_LOAD_SIZE); + memcpy((void*)((int)data + MAX_LOAD_SIZE*3), src[3], MAX_LOAD_SIZE); } return 0;
--- a/TaskManager/Test/test_render/spe/TileHash.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/spe/TileHash.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -15,9 +15,9 @@ int key; for (int i = 0; i < 8; i ++) { - key = data & 0xf; - value += key * PRIME[n++]; - data >>= 4; + key = data & 0xf; + value += key * PRIME[n++]; + data >>= 4; } return value % hashSize; @@ -25,8 +25,8 @@ TileHash::TileHash(void) { - hashSize = 263; - tableSize = sizeof(TilePtr)*hashSize; + //hashSize = 263; + //tableSize = sizeof(TilePtr)*hashSize; table = (TilePtr*)malloc(tableSize); clear(); @@ -38,12 +38,12 @@ int hashval = hash((uint32)key); for (int i = 0; i < hashSize/2; i++) { - int index = (hashval + i*i)%hashSize; + int index = (hashval + i*i)%hashSize; - if (table[index] == 0) { // 腥冴 table ャ - table[index] = data; - return index; - } + if (table[index] == 0) { // 腥冴 table ャ + table[index] = data; + return index; + } } return -1; @@ -55,12 +55,12 @@ int hashval = hash((uint32)key); for (int i = 0; i < hashSize/2; i++) { - int index = (hashval + i*i)%hashSize; - - if (table[index] != NULL && - table[index]->texture_addr == key) { - return table[index]; - } + int index = (hashval + i*i)%hashSize; + + if (table[index] != NULL && + table[index]->texture_addr == key) { + return table[index]; + } } return NULL; @@ -72,12 +72,12 @@ int hashval = hash((uint32)key); for (int i = 0; i < hashSize/2; i++) { - int index = (hashval + i*i)%hashSize; - - if (table[index] != NULL && - table[index]->texture_addr == key) { - table[index] = NULL; - } + int index = (hashval + i*i)%hashSize; + + if (table[index] != NULL && + table[index]->texture_addr == key) { + table[index] = NULL; + } } }
--- a/TaskManager/Test/test_render/spe/TileHash.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/spe/TileHash.h Wed Jul 15 17:39:51 2009 +0900 @@ -11,8 +11,6 @@ private: TilePtr *table; - int hashSize; - int tableSize; public: void clear(void); @@ -26,5 +24,7 @@ #endif -const int GLOBAL_TEXTURE_HASH = 0; -const int GLOBAL_TILE_LIST = 1; +const int hashSize = 263; +const int tableSize = sizeof(TilePtr)*hashSize; + +
--- a/TaskManager/Test/test_render/spe/spe-main.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/spe/spe-main.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -10,6 +10,8 @@ SchedExternTask(CreateSpan); //SchedExternTask(CreatePolygon); +SchedExternTask(ShowTime); + void task_init(void) { @@ -21,4 +23,6 @@ SchedRegisterTask(TASK_CREATE_SPAN, CreateSpan); //SchedRegisterTask(TASK_CREATE_PP, CreatePolygon); + + SchedRegisterTask(SHOW_TIME, ShowTime); }
--- a/TaskManager/Test/test_render/spe/texture.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/spe/texture.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,3 +1,2 @@ #define MAX_LOAD_SIZE 16384 -#define TEXTURE_ID 0 #define TEXTURE2_ID 13
--- a/TaskManager/Test/test_render/task/CreatePolygonFromSceneGraph.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreatePolygonFromSceneGraph.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -35,6 +35,21 @@ } } +static void +ApplyNormalMatrix(float *v, float *m) +{ + float t[4]; + + t[0] = v[0]; + t[1] = v[1]; + t[2] = v[2]; + + for (int i = 0; i < 3; i++) { + v[i] = t[0]*m[i] + t[1]*m[i+4] + t[2]*m[i+8]; + } +} + + /** * 茵腥 * @@ -59,6 +74,13 @@ CreatePolygonFromSceneGraph::run(void *rbuf, void *wbuf) { float xyz1[4], xyz2[4], xyz3[4]; + /* + *号羈膩 + *∽ + *篏帥鐚筝綽c + *by yutaka + */ + float normal1[4],normal2[4],normal3[4]; SceneGraphPtr sg_top = (SceneGraphPtr)smanager->get_param(0); SceneGraphPtr sg = sg_top; @@ -148,6 +170,41 @@ triangle->ver3.z = xyz3[2]; triangle->ver3.tex_x = sg->coord_tex[(i+2)*3]; triangle->ver3.tex_y = sg->coord_tex[(i+2)*3+1]; + + //羈膩ApplyMatrix鐚筝綽ゃcby yutaka + + normal1[0] = sg->normal[(i+0)*3]; + normal1[1] = sg->normal[(i+0)*3+1]; + normal1[2] = sg->normal[(i+0)*3+2]*-1.0f; + normal1[3] = 1.0f; + + normal2[0] = sg->normal[(i+1)*3]; + normal2[1] = sg->normal[(i+1)*3+1]; + normal2[2] = sg->normal[(i+1)*3+2]*-1.0f; + normal2[3] = 1.0f; + + normal3[0] = sg->normal[(i+2)*3]; + normal3[1] = sg->normal[(i+2)*3+1]; + normal3[2] = sg->normal[(i+2)*3+2]*-1.0f; + normal3[3] = 1.0f; + + ApplyNormalMatrix(normal1,sg->matrix); + + //polygon羈膩宴cby yutaka + + triangle->normal1.x = normal1[0]; + triangle->normal1.y = normal1[1]; + triangle->normal1.z = normal1[2]; + + triangle->normal2.x = normal2[0]; + triangle->normal2.y = normal2[1]; + triangle->normal2.z = normal2[2]; + + triangle->normal3.x = normal3[0]; + triangle->normal3.y = normal3[1]; + triangle->normal3.z = normal3[2]; + + triangle->tex_info.addr = sg->texture_info.pixels; triangle->tex_info.width = sg->texture_info.t_w;
--- a/TaskManager/Test/test_render/task/CreateSpan.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreateSpan.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -31,7 +31,8 @@ */ static void make_vertex(TrianglePack *triPack, - VertexPackPtr *vMin, VertexPackPtr *vMid, VertexPackPtr *vMax) + VertexPackPtr *vMin, VertexPackPtr *vMid, VertexPackPtr *vMax, + NormalPackPtr *normal1, NormalPackPtr *normal2, NormalPackPtr *normal3) { if (triPack->ver1.y <= triPack->ver2.y) { if (triPack->ver2.y <= triPack->ver3.y) { @@ -62,6 +63,11 @@ *vMax = &triPack->ver1; } } + + *normal1 = &triPack->normal1; + *normal2 = &triPack->normal2; + *normal3 = &triPack->normal3; + } static void @@ -193,6 +199,7 @@ int charge_y_top, int charge_y_end, TriangleTexInfoPtr tex_info, VertexPack *vMin,VertexPack *vMid,VertexPack *vMid10, + NormalPack *normal1, NormalPack *normal2, NormalPack *normal3, int length_y, float tex_y_len) { float tmp_z,tmp_tex1, tmp_tex2 ,tmp_tey1,tmp_tey2; @@ -372,6 +379,13 @@ span->tex_x2 = end_tex_x; span->tex_y1 = start_tex_y; span->tex_y2 = end_tex_y; + /*ч劫羈膩c + * 筝ゃ冴span筝ゃ羈膩 + *by yutaka + */ + span->normal_x = normal1->x; + span->normal_y = normal1->y; + span->normal_z = normal1->z; float tex_x_len = span->tex_x2 - span->tex_x1; @@ -417,7 +431,7 @@ VertexPackPtr vMin, vMid, vMax; VertexPackPtr vMid10 = (VertexPackPtr)smanager->allocate(sizeof(VertexPack)); - + NormalPackPtr normal1,normal2, normal3; SpanPackPtr *spackList = (SpanPackPtr*)smanager->get_input(1); spack = (SpanPackPtr)smanager->get_input(2); send_spack = (SpanPackPtr)smanager->allocate(sizeof(SpanPack)); @@ -443,7 +457,7 @@ TriangleTexInfoPtr tri_tex_info = &triPack->tex_info; - make_vertex(triPack, &vMin, &vMid, &vMax); + make_vertex(triPack, &vMin, &vMid, &vMax, &normal1, &normal2, &normal3); make_vMid10(vMid10, vMin, vMid, vMax); /** @@ -468,9 +482,11 @@ */ half_triangle(spackList, charge_y_top, charge_y_end, tri_tex_info, vMin, vMid, vMid10, + normal1,normal2,normal3, (int)(vMax->y - vMin->y), vMax->tex_y - vMin->tex_y); half_triangle(spackList, charge_y_top, charge_y_end, tri_tex_info, vMax, vMid, vMid10, + normal1,normal2,normal3, (int)(vMax->y - vMin->y), vMax->tex_y - vMin->tex_y); }
--- a/TaskManager/Test/test_render/task/CreateSpan.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreateSpan.h Wed Jul 15 17:39:51 2009 +0900 @@ -22,6 +22,7 @@ int charge_y_top, int charge_y_end, TriangleTexInfoPtr tex_info, VertexPack *vMin,VertexPack *vMid,VertexPack *vMid1, + NormalPack *normal1, NormalPack *normal2, NormalPack *normal3, int length_y, float tex_y_len); };
--- a/TaskManager/Test/test_render/task/DrawSpan.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawSpan.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -5,6 +5,8 @@ #include "texture.h" #include "viewer_types.h" #include "Func.h" +#include "sys.h" +#include "global_alloc.h" SchedDefineTask(DrawSpan); @@ -91,7 +93,7 @@ int *buf = (int*)smanager->allocate(sizeof(int)*width*height); for (int i = 0; i < width*height; i++) { - buf[i] = rgb; + buf[i] = rgb; } return buf; @@ -111,7 +113,7 @@ float def = 65535.0f; for (int i = 0; i < width*height; i++) { - buf[i] = def; + buf[i] = def; } return buf; @@ -135,25 +137,28 @@ { TilePtr tile; +#if 0 if (isAvailableTile(addr)) { - return; + return; } +#endif tile = tileList->nextTile(); /** * FIFO с罧c医 */ hash->remove(tile->texture_addr); - + tile->texture_addr = addr; - + hash->put(tile->texture_addr, tile); smanager->dma_load(tile->pixel, (uint32)addr, - sizeof(uint32)*TEXTURE_BLOCK_SIZE, tag); + sizeof(uint32)*TEXTURE_BLOCK_SIZE, tag); } +#if 0 /** - * + * */ void DrawSpan::set_rgbs(uint32 *cur_addr, uint32 *max_addr, int wait_tag) @@ -171,15 +176,16 @@ startp = cmp*maxp + !cmp*curp; #else if (length < 0) { - length = -length; - startp = maxp; + length = -length; + startp = maxp; } #endif for (int i = 0; i <= length; i += diff) { - set_rgb((uint32*)(startp + i), wait_tag); + set_rgb((uint32*)(startp + i), wait_tag); } } +#endif uint32 DrawSpan::get_rgb(int tx, int ty, uint32 *addr) @@ -201,7 +207,7 @@ DrawSpan::reboot(SpanPackPtr spack, int cur_span_x) { DrawSpanArgPtr args = - (DrawSpanArgPtr)smanager->allocate(sizeof(DrawSpanArg)); + (DrawSpanArgPtr)smanager->allocate(sizeof(DrawSpanArg)); TaskPtr renew_task = smanager->create_task(TASK_DRAW_SPAN2); // 違紊ф篏ф検 @@ -218,7 +224,7 @@ * spack rbuf 緇醇с * rbuf 激鴻 free() * ≪鴻羝<NG - */ + */ SpanPackPtr curr = (SpanPackPtr)smanager->allocate(sizeof(SpanPack)); memcpy(curr, spack, sizeof(SpanPack)); renew_task->add_param((int)curr); @@ -230,7 +236,7 @@ /** * 莎桁帥鴻緇 - */ + */ smanager->wait_task(renew_task); // next_spack free() wait @@ -239,12 +245,12 @@ void DrawSpan::writebuffer(unsigned int display, int buf_width, int height, - int screen_width) + int screen_width) { for (int i = 0; i < height; i++) { - smanager->dma_store(&linebuf[i*buf_width], - display + (sizeof(int)*screen_width*i), - sizeof(int)*buf_width, FB_STORE); + smanager->dma_store(&linebuf[i*buf_width], + display + (sizeof(int)*screen_width*i), + sizeof(int)*buf_width, FB_STORE); } doneWrite = 1; @@ -262,19 +268,20 @@ * @param tex_addr 鴻c≪(MainMemory) */ void -DrawSpan::updateBuffer(float zpos, int rangex, int x, int y, - int tex_x, int tex_y, uint32 *tex_addr) +DrawSpan::updateBuffer(float zpos, int rangex, int x, int y, int tex_x, int tex_y, + float normal_x, float normal_y, float normal_z, uint32 *tex_addr) { - - int rgb = get_rgb(tex_x, tex_y, tex_addr); + int color = get_rgb(tex_x, tex_y, tex_addr); /*筝篏4bit遵*/ - int alpha = rgb & 0x000F; + int alpha = color & 0x000F; /*絎ゆ*/ int flag = (alpha != 0); + color = infinity_light_calc(color,normal_x,normal_y,normal_z); + zRow[x + (rangex*y)] = zpos*flag + zRow[x + (rangex*y)]*(1-flag); - linebuf[x + (rangex*y)] = rgb*flag + linebuf[x + (rangex*y)]*(1-flag); + linebuf[x + (rangex*y)] = color*flag + linebuf[x + (rangex*y)]*(1-flag); } @@ -290,6 +297,11 @@ { int rangex = endx - startx + 1; + float normal_x = span->normal_x; + float normal_y = span->normal_y; + float normal_z = span->normal_z; + + /* span->x 絲上 Texture 綺ф (tex_xpos, tex_ypos) */ int tex_xpos, tex_ypos; @@ -313,26 +325,27 @@ uint32 *tex_addr; if (span->x < startx || endx < span->x) { - return -1; + return -1; } tex_xpos = (int)((span->tex_width-1) * tex); tex_ypos = (int)((span->tex_height-1) * tey); if (zpos < zRow[localx + (rangex*localy)]) { - tex_addr = getTile(tex_xpos, tex_ypos, - span->tex_width, span->tex_addr); - tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; - tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; + tex_addr = getTile(tex_xpos, tex_ypos, + span->tex_width, span->tex_addr); + tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; + tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; - if (!isAvailableTile(tex_addr)) { - set_rgb(tex_addr, wait_tag); - smanager->dma_wait(wait_tag); - //return startx; - } + if (!isAvailableTile(tex_addr)) { + set_rgb(tex_addr, wait_tag); + smanager->dma_wait(wait_tag); + //return startx; + } - updateBuffer(zpos, rangex, localx, localy, - tex_localx, tex_localy, tex_addr); + updateBuffer(zpos, rangex, localx, localy, + tex_localx, tex_localy, + normal_x,normal_y,normal_z,tex_addr); } return -1; @@ -355,7 +368,7 @@ * 篁 drawLine1 load -> wait -> rendering c障 * (rendering crendering buffer 吾莨若 * 障 main memory (frame buffer) dma store с) - * + * * @param span Span * @param startx 脂紮膀 * @param endx 紫篋膀 @@ -368,6 +381,11 @@ int rangex = endx - startx + 1; int x_len = span->length_x; + float normal_x = span->normal_x; + float normal_y = span->normal_y; + float normal_z = span->normal_z; + + int js = (x < startx) ? startx - x : 0; int je = (x + x_len > endx) ? endx - x : x_len; @@ -393,57 +411,58 @@ //for (int j = js; j <= je; j++) { for (int j = je; j >= js; j--) { - float tex_x, tex_y, tex_z; + float tex_x, tex_y, tex_z; - localx = getLocalX(x-1+j); + localx = getLocalX(x-1+j); - tex_z = zpos1*(x_len-1-j)/(x_len-1) + zpos2*j/(x_len-1); + tex_z = zpos1*(x_len-1-j)/(x_len-1) + zpos2*j/(x_len-1); - tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1); - tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1); - if (tex_x > 1) tex_x = 1; - if (tex_x < 0) tex_x = 0; - if (tex_y > 1) tex_y = 1; - if (tex_y < 0) tex_y = 0; - tex_xpos = (int)((span->tex_width-1) * tex_x); - tex_ypos = (int)((span->tex_height-1) * tex_y); - - if (tex_z < zRow[localx + (rangex*localy)]) { - // (tex_xpos, tex_ypos) Tile (筝喝)с綺ф - // ≪(MainMemory) - uint32 *tex_addr; - int tex_localx; - int tex_localy; + tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1); + tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1); + if (tex_x > 1) tex_x = 1; + if (tex_x < 0) tex_x = 0; + if (tex_y > 1) tex_y = 1; + if (tex_y < 0) tex_y = 0; + tex_xpos = (int)((span->tex_width-1) * tex_x); + tex_ypos = (int)((span->tex_height-1) * tex_y); + + if (tex_z < zRow[localx + (rangex*localy)]) { + // (tex_xpos, tex_ypos) Tile (筝喝)с綺ф + // ≪(MainMemory) + uint32 *tex_addr; + int tex_localx; + int tex_localy; - tex_addr = getTile(tex_xpos, tex_ypos, - span->tex_width, span->tex_addr); - tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; - tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; + tex_addr = getTile(tex_xpos, tex_ypos, + span->tex_width, span->tex_addr); + tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; + tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; - if (!isAvailableTile(tex_addr)) { + if (!isAvailableTile(tex_addr)) { #if 0 - // span 綽荀с tile 篋括 - // set_rgbs ц医 load - // 障筝c - tex_x = tex1*(x_len-1-js)/(x_len-1) + tex2*js/(x_len-1); - if (tex_x > 1) tex_x = 1; - if (tex_x < 0) tex_x = 0; - tex_xpos = (int)((span->tex_width-1) * tex_x); + // span 綽荀с tile 篋括 + // set_rgbs ц医 load + // 障筝c + tex_x = tex1*(x_len-1-js)/(x_len-1) + tex2*js/(x_len-1); + if (tex_x > 1) tex_x = 1; + if (tex_x < 0) tex_x = 0; + tex_xpos = (int)((span->tex_width-1) * tex_x); - uint32 *max_addr = getTile(tex_xpos, tex_ypos, - span->tex_width, span->tex_addr); + uint32 *max_addr = getTile(tex_xpos, tex_ypos, + span->tex_width, span->tex_addr); - set_rgbs(tex_addr, max_addr, wait_tag); - return js; + set_rgbs(tex_addr, max_addr, wait_tag); + return js; #else - set_rgb(tex_addr, wait_tag); - smanager->dma_wait(wait_tag); + set_rgb(tex_addr, wait_tag); + smanager->dma_wait(wait_tag); #endif - } + } - updateBuffer(tex_z, rangex, localx, localy, - tex_localx, tex_localy, tex_addr); - } + updateBuffer(tex_z, rangex, localx, localy, + tex_localx, tex_localy, + normal_x, normal_y, normal_z,tex_addr); + } } return ret; @@ -467,6 +486,11 @@ int rangex = endx - startx + 1; int x_len = span->length_x; + float normal_x = span->normal_x; + float normal_y = span->normal_y; + float normal_z = span->normal_z; + + //int js = startx; int je = (x + x_len > endx) ? endx - x : x_len; @@ -499,31 +523,67 @@ smanager->dma_wait(wait_tag); for (int j = js; j <= je; j++) { - localx = getLocalX(x-1+j); + localx = getLocalX(x-1+j); + + tex_z = zpos1*(x_len-1-j)/(x_len-1) + zpos2*j/(x_len-1); + + tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1); + tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1); + if (tex_x > 1) tex_x = 1; + if (tex_x < 0) tex_x = 0; + if (tex_y > 1) tex_y = 1; + if (tex_y < 0) tex_y = 0; + tex_xpos = (int)((span->tex_width-1) * tex_x); + tex_ypos = (int)((span->tex_height-1) * tex_y); - tex_z = zpos1*(x_len-1-j)/(x_len-1) + zpos2*j/(x_len-1); + if (tex_z < zRow[localx + (rangex*localy)]) { + tex_addr = getTile(tex_xpos, tex_ypos, + span->tex_width, span->tex_addr); + tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; + tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; + + updateBuffer(tex_z, rangex, localx, localy, + tex_localx, tex_localy, + normal_x, normal_y, normal_z,tex_addr); + } + } +} + - tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1); - tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1); - if (tex_x > 1) tex_x = 1; - if (tex_x < 0) tex_x = 0; - if (tex_y > 1) tex_y = 1; - if (tex_y < 0) tex_y = 0; - tex_xpos = (int)((span->tex_width-1) * tex_x); - tex_ypos = (int)((span->tex_height-1) * tex_y); +int +DrawSpan::infinity_light_calc(int color,float normal_x, float normal_y, float normal_z) +{ + unsigned char rgb[4]; + int light_rgb; + int flag; + float normal_vector[4] = {normal_x,normal_y,normal_z,0}; + // ,<<c + float light_vector[4] = {0,0,-1,0}; + float inner_product; + + // 綣違уc color rgb 宴冴 + rgb[0] = (color & 0xff000000) >> 24; + rgb[1] = (color & 0x00ff0000) >> 16; + rgb[2] = (color & 0x0000ff00) >> 8; + rgb[3] = (color & 0x000000ff); - if (tex_z < zRow[localx + (rangex*localy)]) { - tex_addr = getTile(tex_xpos, tex_ypos, - span->tex_width, span->tex_addr); - tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; - tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; + // 羈膩羣腥 + inner_product = innerProduct(normal_vector,light_vector); + // 腥ゃ鴻翫蚊 + flag = (inner_product > 0); - updateBuffer(tex_z, rangex, localx, localy, - tex_localx, tex_localy, tex_addr); - } - } + // 腥 rgb + rgb[0] = rgb[0]*inner_product*flag; + rgb[1] = rgb[1]*inner_product*flag; + rgb[2] = rgb[2]*inner_product*flag; + + //荐膊 rgb light_rgb 障 + light_rgb = (rgb[0] << 24) + (rgb[1] << 16) + (rgb[2] << 8) + (rgb[3]); + + return light_rgb; } + int DrawSpan::run(void *rbuf, void *wbuf) { @@ -536,18 +596,18 @@ nop_span.length_x = 1; int (DrawSpan::*drawFunc1[2])(SpanPtr, int, int, int) = { - &DrawSpan::drawDot1, &DrawSpan::drawLine1 + &DrawSpan::drawDot1, &DrawSpan::drawLine1 }; void (DrawSpan::*drawFunc2[2])(SpanPtr, int, int, int, int) = { - &DrawSpan::drawDot2, &DrawSpan::drawLine2 + &DrawSpan::drawDot2, &DrawSpan::drawLine2 }; uint32 display = smanager->get_param(0); int screen_width = smanager->get_param(1); int rangex_start = smanager->get_param(2); - int rangex_end = smanager->get_param(3); - + int rangex_end = smanager->get_param(3); + // 帥鴻綵 x 膀 int rangex = rangex_end - rangex_start + 1; @@ -566,60 +626,60 @@ int tl_tag[2] = {TEX_LOAD1, TEX_LOAD2}; int tl_tag_flg1 = 0; int tl_tag_flg2 = 1; - + do { - /** - * SpanPack->next 絖翫 - * 憜 SpanPack - * 罨< SpanPack DMA 荵∫茵 - */ - if (spack->next != NULL) { - smanager->dma_load(next_spack, (uint32)spack->next, - sizeof(SpanPack), SPAN_PACK_LOAD); - } else { - next_spack = NULL; - } + /** + * SpanPack->next 絖翫 + * 憜 SpanPack + * 罨< SpanPack DMA 荵∫茵 + */ + if (spack->next != NULL) { + smanager->dma_load(next_spack, (uint32)spack->next, + sizeof(SpanPack), SPAN_PACK_LOAD); + } else { + next_spack = NULL; + } - SpanPtr resume_span = &nop_span; - int resume_span_x = 0; + SpanPtr resume_span = &nop_span; + int resume_span_x = 0; - for (int t = 0; t < spack->info.size; t++) { - SpanPtr next_span; - int next_span_x; + for (int t = 0; t < spack->info.size; t++) { + SpanPtr next_span; + int next_span_x; - span = &spack->span[t]; + span = &spack->span[t]; - /** - * span 激cdrawLine drawDot 御 - */ - next_span_x - = (this->*drawFunc1[(span->length_x != 1)])( - span, rangex_start, rangex_end, tl_tag[tl_tag_flg1]); - next_span = span; + /** + * span 激cdrawLine drawDot 御 + */ + next_span_x + = (this->*drawFunc1[(span->length_x != 1)])( + span, rangex_start, rangex_end, tl_tag[tl_tag_flg1]); + next_span = span; - (this->*drawFunc2[(resume_span->length_x != 1)])( - resume_span, rangex_start, rangex_end, resume_span_x, - tl_tag[tl_tag_flg2]); + (this->*drawFunc2[(resume_span->length_x != 1)])( + resume_span, rangex_start, rangex_end, resume_span_x, + tl_tag[tl_tag_flg2]); + + resume_span = next_span; + resume_span_x = next_span_x; - resume_span = next_span; - resume_span_x = next_span_x; - - //smanager->dma_wait(tl_tag[tl_tag_flg1]); + //smanager->dma_wait(tl_tag[tl_tag_flg1]); + + tl_tag_flg1 ^= 1; + tl_tag_flg2 ^= 1; + } - tl_tag_flg1 ^= 1; - tl_tag_flg2 ^= 1; - } - - // 憜 drawLine2drawDot2 罘純 - //(this->*drawFunc2[(resume_span->length_x != 1)])( - //resume_span, rangex_start, rangex_end, resume_span_x, - //tl_tag[tl_tag_flg1]); + // 憜 drawLine2drawDot2 罘純 + //(this->*drawFunc2[(resume_span->length_x != 1)])( + //resume_span, rangex_start, rangex_end, resume_span_x, + //tl_tag[tl_tag_flg1]); - smanager->dma_wait(SPAN_PACK_LOAD); + smanager->dma_wait(SPAN_PACK_LOAD); - SpanPackPtr tmp_spack = spack; - spack = next_spack; - next_spack = tmp_spack; + SpanPackPtr tmp_spack = spack; + spack = next_spack; + next_spack = tmp_spack; } while (spack); writebuffer(display, rangex, rangey, screen_width);
--- a/TaskManager/Test/test_render/task/DrawSpan.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawSpan.h Wed Jul 15 17:39:51 2009 +0900 @@ -42,7 +42,7 @@ void writebuffer(unsigned int display, int width, int height, int screen_width); void updateBuffer(float zpos, int rangex, int x, int y, - int tex_x, int tex_y, uint32 *tex_addr); + int tex_x, int tex_y, float normal_x, float nomral_x, float normal_z, uint32 *tex_addr); void reboot(SpanPackPtr spack, int cur_span_x); @@ -51,6 +51,7 @@ void drawDot2(SpanPtr span, int startx, int endx, int js, int wait_tag); int drawLine1(SpanPtr span, int startx, int endx, int wait_tag); void drawLine2(SpanPtr span, int startx, int endx, int js, int wait_tag); + int infinity_light_calc(int color,float normal_x, float normal_y, float normal_z); }; typedef struct {
--- a/TaskManager/Test/test_render/task/DrawSpanRenew.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawSpanRenew.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -6,6 +6,7 @@ #include "texture.h" #include "viewer_types.h" #include "Func.h" +#include "global_alloc.h" #define SPAN_PACK_LOAD 0 #define TEX_LOAD 1 @@ -25,18 +26,18 @@ renew_task->add_param((int)curr); renew_task->add_param(cur_span_x); - // linebuf と zRow も引き継がせる + // linebuf zRow 綣膓 renew_task->add_param((int)linebuf); renew_task->add_param((int)zRow); //fprintf(stderr, "[%p] start %u\n", curr, spu_readch(SPU_RdDec)); /** - * 再起動したタスクを待つ - */ + * 莎桁帥鴻緇 + */ smanager->wait_task(renew_task); - // next_spack は free() するので wait する + // next_spack free() wait smanager->dma_wait(SPAN_PACK_LOAD); } @@ -55,21 +56,21 @@ int rangex_start = args->rangex_start; int rangex_end = args->rangex_end; - // このタスクが担当する x の範囲 + // 帥鴻綵 x 膀 int rangex = rangex_end - rangex_start + 1; - // y の範囲 (render_y + rangey - 1) + // y 膀 (render_y + rangey - 1) int rangey = args->rangey; hash = (TileHashPtr)smanager->global_get(GLOBAL_TEXTURE_HASH); tileList = (TileListPtr)smanager->global_get(GLOBAL_TILE_LIST); - + linebuf = (int*)smanager->get_param(3); zRow = (float*)smanager->get_param(4); doneWrite = 0; - // span->length_x の処理での再起動位置 + // span->length_x с莎桁篏臀 int js_cont = smanager->get_param(2); //fprintf(stderr, "[%p] end %u\n", spack, spu_readch(SPU_RdDec)); @@ -77,137 +78,137 @@ smanager->dma_wait(TEX_LOAD); do { - /** - * SpanPack->next が存在する場合、 - * 現在の SpanPack を処理してる間に - * 次の SpanPack の DMA 転送を行う - */ - if (spack->next != NULL) { - smanager->dma_load(next_spack, (uint32)spack->next, - sizeof(SpanPack), SPAN_PACK_LOAD); - } else { - next_spack = NULL; - } + /** + * SpanPack->next 絖翫 + * 憜 SpanPack + * 罨< SpanPack DMA 荵∫茵 + */ + if (spack->next != NULL) { + smanager->dma_load(next_spack, (uint32)spack->next, + sizeof(SpanPack), SPAN_PACK_LOAD); + } else { + next_spack = NULL; + } - for (int t = spack->info.start; t < spack->info.size; t++) { - span = &spack->span[t]; + for (int t = spack->info.start; t < spack->info.size; t++) { + span = &spack->span[t]; - uint32 rgb = 0x00ff0000; - float tex1 = span->tex_x1; - float tex2 = span->tex_x2; - float tey1 = span->tex_y1; - float tey2 = span->tex_y2; + uint32 rgb = 0x00ff0000; + float tex1 = span->tex_x1; + float tex2 = span->tex_x2; + float tey1 = span->tex_y1; + float tey2 = span->tex_y2; - /** - * Span が持つ 1 pixel 毎の - * テクスチャの座標 - */ - int tex_xpos; - int tex_ypos; + /** + * Span 1 pixel 罸 + * 鴻c綺ф + */ + int tex_xpos; + int tex_ypos; - /** - * (tex_xpos, tex_ypos) の、ブロック内(上の図参照)での座標と - * そのブロックのアドレス(MainMemory) - */ - int tex_localx; - int tex_localy; - uint32 *tex_addr; + /** + * (tex_xpos, tex_ypos) (筝喝)с綺ф + * ≪(MainMemory) + */ + int tex_localx; + int tex_localy; + uint32 *tex_addr; - int x = span->x; - int y = span->y; - int x_len = span->length_x; - float z = span->start_z; - float zpos = span->end_z; + int x = span->x; + int y = span->y; + int x_len = span->length_x; + float z = span->start_z; + float zpos = span->end_z; + + // 綺ф [0 .. split_screen_w-1] ャ x,y -1 + int localx = getLocalX(x-1); + int localy = getLocalY(y-1); - // 座標が [0 .. split_screen_w-1] に入るように x,y を -1 - int localx = getLocalX(x-1); - int localy = getLocalY(y-1); + if (x_len == 1) { + if (x < rangex_start || rangex_end < x) { + continue; + } - if (x_len == 1) { - if (x < rangex_start || rangex_end < x) { - continue; - } + tex_xpos = (int)((span->tex_width-1) * tex1); + tex_ypos = (int)((span->tex_height-1) * tey1); - tex_xpos = (int)((span->tex_width-1) * tex1); - tex_ypos = (int)((span->tex_height-1) * tey1); + if (zpos < zRow[localx + (rangex * localy)]) { + tex_addr = getTile(tex_xpos, tex_ypos, + span->tex_width, span->tex_addr); + tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; + tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; - if (zpos < zRow[localx + (rangex * localy)]) { - tex_addr = getTile(tex_xpos, tex_ypos, - span->tex_width, span->tex_addr); - tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; - tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; + if (!isAvailableTile(tex_addr)) { + set_rgb(tex_addr, 0); + smanager->dma_wait(0); + } - if (!isAvailableTile(tex_addr)) { - set_rgb(tex_addr, 0); - smanager->dma_wait(0); - } - - rgb = get_rgb(tex_localx, tex_localy, tex_addr); + rgb = get_rgb(tex_localx, tex_localy, tex_addr); + + zRow[localx + (rangex*localy)] = zpos; + linebuf[localx + (rangex*localy)] = rgb; + } + } else { + int js = (x < rangex_start) ? rangex_start - x : 0; + int je = (x + x_len > rangex_end) ? rangex_end - x : x_len; + float tex_x, tex_y, tex_z; - zRow[localx + (rangex*localy)] = zpos; - linebuf[localx + (rangex*localy)] = rgb; - } - } else { - int js = (x < rangex_start) ? rangex_start - x : 0; - int je = (x + x_len > rangex_end) ? rangex_end - x : x_len; - float tex_x, tex_y, tex_z; - - /** - * 一回比較すれば、以後再起動するまでは - * js_cont は使わないから 0 にしてるわけだけど、 - * 最初の一回のためだけにこれはめんどくさいのー。 - */ - js = (js < js_cont) ? js_cont : js; - js_cont = 0; + /** + * 筝罸莠違篁ュ莎桁障с + * js_cont 篏帥 0 + * 筝若 + */ + js = (js < js_cont) ? js_cont : js; + js_cont = 0; + + for (int j = js; j <= je; j++) { + localx = getLocalX(x-1+j); - for (int j = js; j <= je; j++) { - localx = getLocalX(x-1+j); + tex_z = z*(x_len-1-j)/(x_len-1) + zpos*j/(x_len-1); - tex_z = z*(x_len-1-j)/(x_len-1) + zpos*j/(x_len-1); + tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1); + tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1); + if (tex_x > 1) tex_x = 1; + if (tex_x < 0) tex_x = 0; + if (tex_y > 1) tex_y = 1; + if (tex_y < 0) tex_y = 0; + tex_xpos = (int)((span->tex_width-1) * tex_x); + tex_ypos = (int)((span->tex_height-1) * tex_y); - tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1); - tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1); - if (tex_x > 1) tex_x = 1; - if (tex_x < 0) tex_x = 0; - if (tex_y > 1) tex_y = 1; - if (tex_y < 0) tex_y = 0; - tex_xpos = (int)((span->tex_width-1) * tex_x); - tex_ypos = (int)((span->tex_height-1) * tex_y); - - if (tex_z < zRow[localx + (rangex*localy)]) { - tex_addr = getTile(tex_xpos, tex_ypos, - span->tex_width, span->tex_addr); - tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; - tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; + if (tex_z < zRow[localx + (rangex*localy)]) { + tex_addr = getTile(tex_xpos, tex_ypos, + span->tex_width, span->tex_addr); + tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; + tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; - if (!isAvailableTile(tex_addr)) { - spack->info.start = t; + if (!isAvailableTile(tex_addr)) { + spack->info.start = t; #if 0 - set_rgbs(tex_addr, - getTile(span->tex_width-1, tex_ypos, - span->tex_width, span->tex_addr)); - reboot(spack, j); - goto FINISH; + set_rgbs(tex_addr, + getTile(span->tex_width-1, tex_ypos, + span->tex_width, span->tex_addr)); + reboot(spack, j); + goto FINISH; #else - set_rgb(tex_addr, TEX_LOAD); - smanager->dma_wait(TEX_LOAD); + set_rgb(tex_addr, TEX_LOAD); + smanager->dma_wait(TEX_LOAD); #endif - } - - rgb = get_rgb(tex_localx, tex_localy, tex_addr); - - zRow[localx + (rangex*localy)] = tex_z; - linebuf[localx + (rangex*localy)] = rgb; - } - } - } - } + } + + rgb = get_rgb(tex_localx, tex_localy, tex_addr); - smanager->dma_wait(SPAN_PACK_LOAD); + zRow[localx + (rangex*localy)] = tex_z; + linebuf[localx + (rangex*localy)] = rgb; + } + } + } + } - SpanPackPtr tmp_spack = spack; - spack = next_spack; - next_spack = tmp_spack; + smanager->dma_wait(SPAN_PACK_LOAD); + + SpanPackPtr tmp_spack = spack; + spack = next_spack; + next_spack = tmp_spack; } while (spack); writebuffer(display, rangex, rangey, screen_width); @@ -217,7 +218,7 @@ //FINISH: /** - * linebuf, zRow, args は RenewTask が引き継ぐ + * linebuf, zRow, args RenewTask 綣膓 */ free(free_spack1); free(free_spack2);
--- a/TaskManager/Test/test_render/task/Load_Texture.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/task/Load_Texture.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -4,6 +4,7 @@ #include "texture.h" #include "TileHash.h" #include "Func.h" +#include "global_alloc.h" SchedDefineTask(LoadTexture); @@ -11,19 +12,19 @@ * Load腟絮 DrawSpan т戎 * Hash 羣с紊 */ -int -LoadTexture::run(void *rbuf , void *wbuf) +int +LoadTexture::run(void *rbuf , void *wbuf) { /** * 憜 global_alloc() с new 泣若 * 潟潟鴻水若吟 placement new 障 */ void *hash_tmp - = smanager->global_alloc(GLOBAL_TEXTURE_HASH, sizeof(TileHash)); + = smanager->global_alloc(GLOBAL_TEXTURE_HASH, sizeof(TileHash)); new(hash_tmp) TileHash; void *tileList_tmp - = smanager->global_alloc(GLOBAL_TILE_LIST, sizeof(TileList)); + = smanager->global_alloc(GLOBAL_TILE_LIST, sizeof(TileList)); new(tileList_tmp) TileList; return 0;
--- a/TaskManager/Test/test_render/task/Set_Texture.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/task/Set_Texture.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -1,30 +1,31 @@ #include <string.h> #include "Set_Texture.h" #include "texture.h" +#include "global_alloc.h" SchedDefineTask(SetTexture); //texture global 潟若帥鴻 -int +int SetTexture::run(void *rbuf, void *wbuf) { void *src[4]; - + src[0] = get_input(rbuf, 0); src[1] = get_input(rbuf, 1); src[2] = get_input(rbuf, 2); src[3] = get_input(rbuf, 3); - + if (global_get(TEXTURE_ID)) { - return 0; + return 0; } else { - //帥鴻掩с腆坂 - void *data = global_alloc(TEXTURE_ID, MAX_LOAD_SIZE*4); + //帥鴻掩с腆坂 + void *data = global_alloc(TEXTURE_ID, MAX_LOAD_SIZE*4); - memcpy(data, src[0], MAX_LOAD_SIZE); - memcpy((void*)((int)data + MAX_LOAD_SIZE), src[1], MAX_LOAD_SIZE); - memcpy((void*)((int)data + MAX_LOAD_SIZE*2), src[2], MAX_LOAD_SIZE); - memcpy((void*)((int)data + MAX_LOAD_SIZE*3), src[3], MAX_LOAD_SIZE); + memcpy(data, src[0], MAX_LOAD_SIZE); + memcpy((void*)((int)data + MAX_LOAD_SIZE), src[1], MAX_LOAD_SIZE); + memcpy((void*)((int)data + MAX_LOAD_SIZE*2), src[2], MAX_LOAD_SIZE); + memcpy((void*)((int)data + MAX_LOAD_SIZE*3), src[3], MAX_LOAD_SIZE); } return 0;
--- a/TaskManager/Test/test_render/task/TileHash.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/task/TileHash.h Wed Jul 15 17:39:51 2009 +0900 @@ -26,5 +26,3 @@ #endif -const int GLOBAL_TEXTURE_HASH = 0; -const int GLOBAL_TILE_LIST = 1;
--- a/TaskManager/Test/test_render/task/task_init.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/task/task_init.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -16,8 +16,10 @@ SchedExternTask(Dummy); +SchedExternTask(ShowTime); + /** - * set_cpu(CPU_PPE) で動作する task + * set_cpu(CPU_PPE) у篏 task */ void task_initialize() @@ -36,4 +38,5 @@ SchedRegisterTask(TASK_SET_TEXTURE, SetTexture); SchedRegisterTask(TASK_DUMMY, Dummy); + SchedRegisterTask(SHOW_TIME, ShowTime); }
--- a/TaskManager/Test/test_render/task/texture.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/task/texture.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,3 +1,2 @@ #define MAX_LOAD_SIZE 16384 -#define TEXTURE_ID 0 #define TEXTURE2_ID 13
--- a/TaskManager/Test/test_render/task/update_sgp.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/task/update_sgp.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -17,7 +17,7 @@ //int screen_width = get_param(0); //int screen_height = get_param(1); - // 本当はここでやるもんじゃないんだが。。。 + // 綵с for (int i = 0; i < sgp->info.size && i < 3; i++) { node = &sgp->node[i];
--- a/TaskManager/Test/test_render/tools/create_sglist.pl Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/tools/create_sglist.pl Wed Jul 15 17:39:51 2009 +0900 @@ -54,6 +54,10 @@ #################################### use strict; +# +# to install this, +# cpan -i XML::LibXML::SAX::Generator +# use XML::LibXML; my $outfile_h = "SGList.h";
--- a/TaskManager/Test/test_render/viewer.cpp Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/viewer.cpp Wed Jul 15 17:39:51 2009 +0900 @@ -95,6 +95,8 @@ extern void vacuum_init(int w, int h); extern void untitled_init(void); extern void boss1_init(int w, int h); +extern void init_gaplant(int w, int h); + void Viewer::run_init(const char *xml, int sg_number) { @@ -145,6 +147,9 @@ case 13: boss1_init(this->width, this->height); break; + case 14: + init_gaplant(this->width, this->height); + break; default: node_init(); break;
--- a/TaskManager/Test/test_render/viewer_types.h Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/Test/test_render/viewer_types.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,12 +1,12 @@ #ifndef INCLUDED_VIEWER_TYPES #define INCLUDED_VIEWER_TYPES -// texture は 8x8 に分割 -// この値は、SpanPack にも使う +// texture 8x8 +// ゃSpanPack 篏帥 const int TEXTURE_SPLIT_PIXEL = 8; const int TEXTURE_BLOCK_SIZE = TEXTURE_SPLIT_PIXEL*TEXTURE_SPLIT_PIXEL; -// 一個の SPE が描画担当する width, height (pixel) +// 筝 SPE 紙綵 width, height (pixel) const int split_screen_w = 256; const int split_screen_h = 8;
--- a/TaskManager/kernel/main.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/kernel/main.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,6 +3,10 @@ #include <SDL.h> #include "TaskManager.h" +/*! + User 吾 TMmain() (*阪) 絎茵 + */ + /* User main function */ extern int TMmain(int argc, char *argv[]); @@ -11,6 +15,11 @@ defaultTMend(void) {} TaskManager *manager; + +/*! + const char *usr_help_str User 眼ф絎綽荀 + -help у阪絖 + */ const char *help_str = "\n\ * Cerium program option *\n\ -help Print this message \n\
--- a/TaskManager/kernel/ppe/HTask.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/kernel/ppe/HTask.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,24 +3,34 @@ #include "TaskManagerImpl.h" -/** - * manager->set_task_depend(task1, task2); // task2 は task1 の終了を待つ - * - * ってやるより - * - * task2->set_depend(task1); - * - * ってやったほうがわかりやすいよねー的な話し合いで - * 下のようなAPIを作りました - */ +/*! + manager->set_task_depend(task1, task2); // task2 task1 腟篋緇 + + c + + task2->set_depend(task1); + + cc祉主荅宴 + 筝API篏障 +*/ + void HTask::spawn(void) { mimpl->spawn_task(this); } +/*! + @brief Task 緇≦ Task 絎 + @param[in] master Task 腟篋緇≦御 Task + + 膵違菴篏睡篋ц違 Task 緇≦篋с + + wait_for Task ュ< Task 吾莨若帥с罘純 + */ + void -HTask::set_depend(HTaskPtr master) +HTask::wait_for(HTaskPtr master) { mimpl->set_task_depend(master, this); }
--- a/TaskManager/kernel/ppe/HTaskInfo.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/kernel/ppe/HTaskInfo.cc Wed Jul 15 17:39:51 2009 +0900 @@ -19,7 +19,7 @@ /** * Fix me - * extend できる限界を設定するべき? + * extend с荐絎鴻鐚 */ int HTaskInfo::extend_pool(int num) @@ -50,9 +50,9 @@ } /** - * Task をプールから取って来て返す + * Task 若cャ菴 * - * @param [cmd] タスクコマンド + * @param [cmd] 帥鴻潟潟 */ HTaskPtr HTaskInfo::create(int cmd)
--- a/TaskManager/kernel/ppe/Task.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/kernel/ppe/Task.cc Wed Jul 15 17:39:51 2009 +0900 @@ -1,7 +1,7 @@ #include "Task.h" /** - * タスクの入力データを追加する + * 帥鴻ュ若帥菴遵 * * @param [addr] add input data * @param [size] size of data at [addr] @@ -15,7 +15,7 @@ } /** - * タスクの出力先を追加する + * 帥鴻阪菴遵 * * @param[in] addr Address at out data * @param[in] size Size of data transfer @@ -29,8 +29,8 @@ } /** - * エラーの時に -1 を返す、ってことするよりは - * perror みたいにしたほうがわかりやすいかな。 + * 若 -1 菴c + * perror 帥祉 */ int Task::add_param(int _param) @@ -42,8 +42,8 @@ } /* - * エラーの時に -1 を返す、ってことするよりは - * perror みたいにしたほうがわかりやすいかな。 + * 若 -1 菴c + * perror 帥祉 */ int Task::add_data(ListDataPtr list, uint32 addr, int size) @@ -52,7 +52,7 @@ list->bound[list->length] = list->size; - // size でも制限かけるべき? + // size с狗鴻鐚 list->size += size; ListElementPtr elm = &list->element[list->length++];
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Wed Jul 15 17:39:51 2009 +0900 @@ -16,9 +16,9 @@ : machineNum(num), activeTaskQueue(NULL), waitTaskQueue(NULL) {} /** - * 一番最初に PPE で実行される systask_start - * 一番最後に、全てのタスクの終了を待つ systask_finish - * 番兵的な意味で実装 + * 筝 PPE у茵 systask_start + * 筝緇帥鴻腟篋緇 systask_finish + * 窮潟у茖 */ void TaskManagerImpl::systask_init(void) @@ -30,10 +30,10 @@ systask_start->spawn(); - // systask_finish で spawn すると + // systask_finish spawn // systask_finish->wait_for(systask_finish); - // とかなって無限ループになるので、 - // これだけは明示的に append_waitTask() で + // c♂若с + // 腓榊 append_waitTask() append_waitTask(systask_finish); } @@ -50,8 +50,8 @@ } /** - * task の依存関係を設定 - * master task が終わってから、slave task を実行するように + * task 箴絖≫荐絎 + * master task 腟cslave task 絎茵 * master->wait_for(slave); */ void @@ -67,8 +67,8 @@ } /** - * タスクを実行可能キューまたは待機キューへ追加する。 - * 依存関係が満たされていれば active, まだだったら wait へ。 + * 帥鴻絎茵純ャ若障緇罘ャ若梧申 + * 箴絖≫羣 active, 障c wait 吾 * task->spawn(); */ void @@ -86,7 +86,7 @@ } /** - * Task を実行可能キューに追加する + * Task 絎茵純ャ若菴遵 */ void TaskManagerImpl::append_activeTask(HTaskPtr task) @@ -98,10 +98,10 @@ } /** - * タスクが実行する CPU を選択する + * 帥鴻絎茵 CPU 御 * - * 現在は CPU_PPE, CPU_SPE, SPE_ANY, SPE_0, SPE_1, ..., SPE_5 - * types.h に書いてます。 + * 憜 CPU_PPE, CPU_SPE, SPE_ANY, SPE_0, SPE_1, ..., SPE_5 + * types.h 吾障 */ void TaskManagerImpl::set_task_cpu(HTaskPtr task, CPU_TYPE type) @@ -110,11 +110,11 @@ } /** - * 終了したタスクから依存の処理とか - * post_func() はこのタスクが終了したら実行する関数。 - * 今のところ使ってないっす + * 腟篋帥鴻箴絖 + * post_func() 帥鴻腟篋絎茵∽違 + * 篁篏帥cc * - * @param [task] 終了したタスク + * @param [task] 腟篋帥鴻 */ void TaskManagerImpl::check_task_finish(HTaskPtr task) @@ -125,8 +125,8 @@ } /** - * 終了したタスク [depend] を待っている TaskList に - * 終わった事を知らせる(削除する + * 腟篋帥鴻 [depend] 緇c TaskList + * 腟c篋ャ(ゃ */ void TaskManagerImpl::notify_wait_taskQueue(HTaskPtr depend, TaskQueuePtr list) @@ -155,8 +155,8 @@ } /** - * waitQueue の中で依存関係を満たしたタスクは - * activeQueue へ移す + * waitQueue 筝т絖≫羣帥鴻 + * activeQueue 悟Щ */ void TaskManagerImpl::wakeup_waitTask(void) @@ -189,9 +189,9 @@ } /** - * [list] が持つ queue->task の中に [task] と同じ奴があれば - * 削除する。まあ remove_taskQueue() の HTask で比較するverです。 - * こういうのはオーバーロードでやるもんなのかな? + * [list] queue->task 筝 [task] 絅眼 + * ゃ障 remove_taskQueue() HTask ф莠verс + * 若若若с鐚 */ TaskQueuePtr TaskManagerImpl::remove_taskQueue_eq_task(TaskQueuePtr list, HTaskPtr task)
--- a/TaskManager/kernel/schedule/SchedMail.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedMail.cc Wed Jul 15 17:39:51 2009 +0900 @@ -16,7 +16,7 @@ params_addr = scheduler->mail_read(); __debug("[SchedMail:%s]\n", __FUNCTION__); - // if 文なくすには・・・関数ポインタ? + // if 祉祉脂∽違ゃ潟随 if ((int)params_addr == MY_SPE_COMMAND_EXIT) { return new SchedExit(); } else {
--- a/TaskManager/kernel/schedule/SchedNop2Ready.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedNop2Ready.cc Wed Jul 15 17:39:51 2009 +0900 @@ -28,7 +28,7 @@ nextSched = scheduler->get_nextRenewTaskList(); - // RenewTask がある + // RenewTask if (nextSched) { return nextSched; } else {
--- a/TaskManager/kernel/schedule/SchedTask.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Wed Jul 15 17:39:51 2009 +0900 @@ -1,6 +1,7 @@ #include <stdlib.h> #include <string.h> #include "SchedTask.h" +#include "SchedTask.h" #include "SchedTaskList.h" #include "SchedNop2Ready.h" #include "DmaManager.h" @@ -11,13 +12,14 @@ //#define NO_PIPELINE -SchedTask* +SchedTask * createSchedTask(TaskPtr task) { return task_list[task->command](); } -SchedTask::SchedTask(void) + +SchedTask::SchedTask() { __list = NULL; __task = NULL; @@ -38,14 +40,15 @@ ex_next = &SchedTask::ex_next_normal; run_func = &SchedTask::run; + run_func1 = &SchedTask::run; } /** - * dma_store の wait を行う - * このタスクが RenewTask だった場合、 - * __inListData や __outListData は - * Scheduler の持つ、使い回しの buffer ではなく - * 新たに allocate されたものなので、ここで free する + * dma_store wait 茵 + * 帥鴻 RenewTask c翫 + * __inListData __outListData + * Scheduler ゃ篏帥 buffer с + * 違 allocate с free */ SchedTask::~SchedTask(void) { @@ -54,21 +57,21 @@ free(__outListData); /** - * __list != NULL の場合、 - * この Task が __list の最後の Task になるので (SchedTask::next 参照) - * このタイミングで __list を解放する - * (free に渡されるアドレスが正しいものとなる)。 - * それ以外の Task では当然解放しない。 - * __list == NULL なので、free に渡しても無問題 + * __list != NULL 翫 + * Task __list 緇 Task (SchedTask::next ) + * 帥ゃ潟違 __list 茹f障 + * (free 羝<≪鴻罩c) + * 篁ュ Task с綵区В障 + * __list == NULL сfree 羝<≦馹 */ free(__list); } - delete smanager; + } /** - * このタスクを Renew Task とし、それに応じた関数をセットする + * 帥鴻 Renew Task 綽∽違祉 */ void SchedTask::__setRenew(void) @@ -93,7 +96,7 @@ __scheduler = sc; __cur_index = index; - smanager = new STaskManager(this); + smanager = this; __scheduler->mainMem_wait(); @@ -101,7 +104,7 @@ } /** - * PPE 内で生成されたタスクの ex_init() + * PPE х帥鴻 ex_init() */ void SchedTask::ex_init_normal(void) @@ -120,9 +123,9 @@ } /** - * SPE 内で生成されたタスクの ex_init() - * 各データは SPE 内の create_task 時に生成もしくは引き継がれているので - * ex_init_normal() と違い、ここでは値を渡すだけ + * SPE х帥鴻 ex_init() + * 若帥 SPE create_task 綣膓 + * ex_init_normal() сゃ羝< */ void SchedTask::ex_init_renew(void) @@ -134,12 +137,12 @@ /** * [Todo] - * データの読み込み場所を readbuf ではなく、 - * ユーザ自身で決めれるようになるといいかもしれない。 + * 若帥茯粋昭水贋 readbuf с + * 若区荳ф浦 * - * # TaskManager が勝手に消すことなく、 - * # ユーザが SPE 上に持ち続けることができるため。 - * # もちろん管理はユーザに任せるわけだ。 + * # TaskManager 羔 + * # 若吟 SPE 筝∞с + * # <膊∞若吟篁祉 */ void SchedTask::read(void) @@ -153,7 +156,7 @@ __writebuf = __scheduler->allocate(__outListData->size); - // 読むデータが一つもなければ無視 + // 茯若帥筝ゃ亥∴ if (__inListData->length == 0) return; // load Input Data @@ -178,6 +181,7 @@ //run(__readbuf, __writebuf); (this->*run_func)(__readbuf, __writebuf); + (this->*run_func1)(this, __readbuf, __writebuf); free(__readbuf); @@ -188,7 +192,7 @@ } - // 書き込む領域がなければ無視 + // 吾莨若亥∴ if (__outListData->length > 0) { __scheduler->dma_storeList(__outListData, __writebuf, DMA_WRITE); @@ -217,7 +221,7 @@ } /** - * PPE 内で生成されたタスクの ex_read() + * PPE х帥鴻 ex_read() */ void SchedTask::ex_read_normal(void) @@ -225,7 +229,7 @@ } /** - * SPE 内で生成されたタスクの ex_read() + * SPE х帥鴻 ex_read() */ void SchedTask::ex_read_renew(void) @@ -233,7 +237,7 @@ } /** - * PPE 内で生成されたタスクの ex_exec() + * PPE х帥鴻 ex_exec() */ void SchedTask::ex_exec_normal(void) @@ -241,7 +245,7 @@ } /** - * SPE 内で生成されたタスクの ex_exec() + * SPE х帥鴻 ex_exec() */ void SchedTask::ex_exec_renew(void) @@ -251,18 +255,18 @@ /** - * PPE 内で生成されたタスクの ex_write() + * PPE х帥鴻 ex_write() * - * このタスク内で新たにタスクが生成され、 - * 且つそのタスクの終了を待つ必要がある場合、 - * PPE に終了したことは知らせない(command は送信しない) + * 帥鴻ф違帥鴻 + * 筝ゃ帥鴻腟篋緇ゅ荀翫 + * PPE 腟篋ャ(command 篆<) */ void SchedTask::ex_write_normal(void) { /** - * このタスク内で新たにタスクが生成されなかった - * or 生成されたが、そのタスクの終了を待つ必要は無い + * 帥鴻ф違帥鴻c + * or 帥鴻腟篋緇ゅ荀< */ if (__renew_flag == 0) { __scheduler->mail_write(__task->self); @@ -270,16 +274,16 @@ } /** - * SPE 内で生成されたタスクの ex_write() + * SPE х帥鴻 ex_write() * - * A <- 親タスク + * A <- 荀帥鴻 * | \ - * B C <- SPE 内で生成されたタスク + * B C <- SPE х帥鴻 * - * A は SPE 内で B, C を生成したとする。 - * B と C が終了したら、A が PPE に送るはずだったコマンドが - * 子タスクに引き継がれているので、最後に実行された子タスクが - * PPE に mail 送信する。 + * A SPE B, C + * B C 腟篋A PPE c潟潟 + * 絖帥鴻綣膓с緇絎茵絖帥鴻 + * PPE mail 篆< */ void SchedTask::ex_write_renew(void) @@ -289,7 +293,7 @@ __taskGroup->remove(__task); cmd = __taskGroup->status(); - // タスク内で作られた全てのタスクが終了した + // 帥鴻т帥鴻腟篋 if (cmd != 0) { delete __taskGroup; __scheduler->mail_write(cmd); @@ -314,7 +318,7 @@ nextSched = __scheduler->get_nextRenewTaskList(); - // RenewTask がある + // RenewTask if (nextSched) { __scheduler->set_backupTaskList(__list); __scheduler->set_backupTaskListIndex(__cur_index); @@ -353,7 +357,7 @@ nextTask = &__list->tasks[__cur_index++]; nextSched = createSchedTask(nextTask); - // RenewTaskList を実行中なので + // RenewTaskList 絎茵筝 nextSched->__setRenew(); nextSched->__init__(__list, nextTask, __cur_index, __scheduler->get_curReadBuf(), @@ -361,7 +365,7 @@ __scheduler); /** - * この理由は SchedTask:~SchedTask() で + * 宴 SchedTask:~SchedTask() */ __list = NULL; return nextSched; @@ -375,7 +379,7 @@ } else { TaskListPtr nextList = __scheduler->get_backupTaskList(); - // 中断した TaskList がある + // 筝 TaskList if (nextList) { __cur_index = __scheduler->get_backupTaskListIndex(); @@ -401,8 +405,8 @@ } /** - * task->add_inData で与えられた順番に対応する index (0〜n-1) で、 - * buffer から対応するデータを返す。 + * task->add_inData т絲上 index (0n-1) с + * buffer 絲上若帥菴 */ void* SchedTask::get_input(void *buff, int index) @@ -415,7 +419,7 @@ } /** - * get_input(index) のアドレスを返す + * get_input(index) ≪鴻菴 */ uint32 SchedTask::get_inputAddr(int index) @@ -424,7 +428,7 @@ } /** - * get_input(index) のサイズを返す + * get_input(index) 泣ゃ冴菴 */ int SchedTask::get_inputSize(int index) @@ -433,7 +437,7 @@ } /** - * write buffer の領域を返す。 + * write buffer 菴 */ void* SchedTask::get_output(void *buff, int index) @@ -446,7 +450,7 @@ } /** - * get_output(index) のアドレスを返す + * get_output(index) ≪鴻菴 */ uint32 SchedTask::get_outputAddr(int index) @@ -455,7 +459,7 @@ } /** - * get_output(index) のサイズを返す + * get_output(index) 泣ゃ冴菴 */ int SchedTask::get_outputSize(int index) @@ -489,10 +493,10 @@ } /** - * 生成したタスクが終了してから、メインスケジューラ(PPE) に - * タスクが終了した旨を知らせる。 + * 帥鴻腟篋<ゃ潟鴻宴吾ャ若(PPE) + * 帥鴻腟篋ャ * - * @param[in] waitTask タスク内で生成したタスク + * @param[in] waitTask 帥鴻х帥鴻 */ void SchedTask::wait_task(TaskPtr waitTask) @@ -553,3 +557,10 @@ SchedTask::dma_wait(uint32 mask) { __scheduler->dma_wait(mask); } + +void +SchedTask::show_dma_wait() { + __scheduler->show_dma_wait(); +} + +/* end */
--- a/TaskManager/kernel/schedule/Scheduler.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Wed Jul 15 17:39:51 2009 +0900 @@ -4,6 +4,11 @@ #include "SchedNop.h" #include "error.h" +/* + * Edit kernel/schedule/xx.cc, Cell/spe/xx.cc will be over writen by this. + * Do not edit Cell/spe/xx.cc unless there is no kernel/schedule/xx.cc files. + */ + Scheduler::TaskObject task_list[MAX_TASK_OBJECT]; Scheduler::~Scheduler(void) @@ -11,6 +16,9 @@ delete connector; } +/*! @brief speTaskュ阪ゃゃ潟<腆坂 + */ + void Scheduler::init(void) { @@ -27,7 +35,7 @@ buffFlag_outListData = 0; flag_renewTaskList = 0; - // bzero でもいいけど + // bzero с for (int i = 0; i < MAX_GLOBAL_AREA; i++) { globalList[i] = NULL; } @@ -81,8 +89,8 @@ } /** - * あらかじめ memory allocte してある TaskList の領域を - * パイプラインの各処理が交代して使う。 + * memory allocte TaskList + * ゃゃ潟篋や撮篏帥 */ TaskListPtr Scheduler::get_curListBuf(void) @@ -94,8 +102,8 @@ /** - * あらかじめ memory allocte してある ListData の領域を - * パイプラインの各処理が交代して使う。 + * memory allocte ListData + * ゃゃ潟篋や撮篏帥 */ ListDataPtr Scheduler::get_curWriteBuf(void) @@ -113,13 +121,13 @@ } /** - * タスク内で生成されたタスクを格納する TaskList を取得する - * 現在格納に使っている TaskList (renewCur_taskList) が使えるならそれを返す - * もしそうでないなら、新しく TaskList を allocate してそれを返す - * コード中で renewCur_taskList が NULL になるのは - * - プログラム開始時 - * - タスク内生成タスクがある TaskList の実行を新しく始める (Nop2Ready 参照) - * 以上の場合です + * 帥鴻х帥鴻主 TaskList 緇 + * 憜主篏帥c TaskList (renewCur_taskList) 篏帥菴 + * с違 TaskList allocate 菴 + * 潟若筝 renewCur_taskList NULL + * - 違紮 + * - 帥鴻帥鴻 TaskList 絎茵違鎈 (Nop2Ready ) + * 篁ヤ翫с */ TaskListPtr Scheduler::get_renewListBuf(void) @@ -137,11 +145,11 @@ } /** - * 次に実行する Renew Task List を返す + * 罨<絎茵 Renew Task List 菴 * - * @param[in] curList 現在実行中の TaskList - * 中断して RenewTaskList を行うため - * バックアップを取っておく + * @param[in] curList 憜絎茵筝 TaskList + * 筝 RenewTaskList 茵 + * ≪c * @return next RenewTaskList */ SchedTaskList* @@ -174,8 +182,8 @@ } /** - * RenewTaskList 実行前に中断した TaskList を返す - * NULL の場合、中断した TaskList は無い。 + * RenewTaskList 絎茵筝 TaskList 菴 + * NULL 翫筝 TaskList < * * @return TaskList */ @@ -296,8 +304,8 @@ } /** - * mainMem_alloc で確保したメインメモリの領域アドレスを返す。 - * これは Fifo, Cell で共通 + * mainMem_alloc х∈篆<ゃ潟<≪≪鴻菴 + * Fifo, Cell у演 */ void* Scheduler::mainMem_get(int id) @@ -307,8 +315,8 @@ /** - * 本当は Scheduler クラスに入れるべきなんだろうか。。。 - * なんか手抜きの感がある + * 綵 Scheduler 鴻ャ鴻 + * */ void register_task(int cmd, Scheduler::TaskObject task)
--- a/example/HelloWorld/Func.h Fri Jun 05 17:07:35 2009 +0900 +++ b/example/HelloWorld/Func.h Wed Jul 15 17:39:51 2009 +0900 @@ -3,4 +3,3 @@ RUN_FINISH, }; -#define DATA_NUM 12
--- a/example/HelloWorld/ppe/Hello.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/HelloWorld/ppe/Hello.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,7 +3,7 @@ #include "Hello.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Hello); int
--- a/example/HelloWorld/ppe/task_init.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/HelloWorld/ppe/task_init.cc Wed Jul 15 17:39:51 2009 +0900 @@ -1,13 +1,13 @@ #include "Func.h" #include "Scheduler.h" -/* 必ずこの位置に書いて */ +/* 綽篏臀吾 */ SchedExternTask(Hello); /** - * この関数は ../spe/spe-main と違って - * 自分で呼び出せばいい関数なので - * 好きな関数名でおk (SchedRegisterTask は必須) + * ∽違 ../spe/spe-main c + * у若喝冴違∽違 + * 絅純∽医сk (SchedRegisterTask 綽) */ void
--- a/example/HelloWorld/spe/Hello.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/HelloWorld/spe/Hello.cc Wed Jul 15 17:39:51 2009 +0900 @@ -2,7 +2,7 @@ #include "Hello.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Hello); int
--- a/example/HelloWorld/spe/spe-main.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/HelloWorld/spe/spe-main.cc Wed Jul 15 17:39:51 2009 +0900 @@ -4,8 +4,8 @@ SchedExternTask(Hello); /** - * この関数は SpeScheduler から呼ばれるので - * 必ずこの関数名でお願いします。 + * ∽違 SpeScheduler 若違 + * 綽∽医с蕁障 */ void task_init(void)
--- a/example/basic/main.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/basic/main.cc Wed Jul 15 17:39:51 2009 +0900 @@ -25,7 +25,7 @@ } /** - * タスク終了後の data1, data2 の確認 + * 帥鴻腟篋緇 data1, data2 腆肴 */ void twice_result(void *a) @@ -87,6 +87,9 @@ */ twice->add_param(length); + /* + * set_post() ppe task 羝< + */ twice->set_post(twice_result, (void*)data); // add Active Queue
--- a/example/basic/ppe/Twice.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/basic/ppe/Twice.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,7 +3,7 @@ #include "Twice.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Twice); int
--- a/example/basic/ppe/task_init.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/basic/ppe/task_init.cc Wed Jul 15 17:39:51 2009 +0900 @@ -1,13 +1,13 @@ #include "Func.h" #include "Scheduler.h" -/* 必ずこの位置に書いて */ +/* 綽篏臀吾 */ SchedExternTask(Twice); /** - * この関数は ../spe/spe-main と違って - * 自分で呼び出せばいい関数なので - * 好きな関数名でおk (SchedRegisterTask は必須) + * ∽違 ../spe/spe-main c + * у若喝冴違∽違 + * 絅純∽医сk (SchedRegisterTask 綽) */ void
--- a/example/basic/spe/Twice.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/basic/spe/Twice.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,7 +3,7 @@ #include "Twice.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Twice); int
--- a/example/basic/spe/spe-main.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/basic/spe/spe-main.cc Wed Jul 15 17:39:51 2009 +0900 @@ -4,8 +4,8 @@ SchedExternTask(Twice); /** - * この関数は SpeScheduler から呼ばれるので - * 必ずこの関数名でお願いします。 + * ∽違 SpeScheduler 若違 + * 綽∽医с蕁障 */ void task_init(void)
--- a/example/dependency_task/main.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/dependency_task/main.cc Wed Jul 15 17:39:51 2009 +0900 @@ -24,12 +24,12 @@ idata[i] = 0; } - // exec1,2 が計算した配列を見る + // exec1,2 荐膊荀 t_print = manager->create_task(TASK_PRINT); t_print->add_inData(idata, sizeof(int)*length*2); t_print->add_param(length*2); - // idata を二つに分けて計算する + // idata 篋ゃ荐膊 for (int i = 0; i < 2; i++) { t_exec = manager->create_task(TASK_EXEC); t_exec->add_inData(&idata[length*i], sizeof(int)*length);
--- a/example/dependency_task/ppe/Exec.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/dependency_task/ppe/Exec.cc Wed Jul 15 17:39:51 2009 +0900 @@ -2,7 +2,7 @@ #include "Exec.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Exec); int
--- a/example/dependency_task/ppe/Print.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/dependency_task/ppe/Print.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,7 +3,7 @@ #include "Print.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Print); int
--- a/example/dependency_task/ppe/RunFinish.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/dependency_task/ppe/RunFinish.cc Wed Jul 15 17:39:51 2009 +0900 @@ -1,6 +1,6 @@ #include "RunFinish.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(RunFinish); int
--- a/example/dependency_task/ppe/task_init.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/dependency_task/ppe/task_init.cc Wed Jul 15 17:39:51 2009 +0900 @@ -1,15 +1,15 @@ #include "Func.h" #include "Scheduler.h" -/* 必ずこの位置に書いて */ +/* 綽篏臀吾 */ SchedExternTask(Print); SchedExternTask(Exec); SchedExternTask(RunFinish); /** - * この関数は ../spe/spe-main と違って - * 自分で呼び出せばいい関数なので - * 好きな関数名でおk (SchedRegisterTask は必須) + * ∽違 ../spe/spe-main c + * у若喝冴違∽違 + * 絅純∽医сk (SchedRegisterTask 綽) */ void task_init(void)
--- a/example/dependency_task/spe/Exec.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/dependency_task/spe/Exec.cc Wed Jul 15 17:39:51 2009 +0900 @@ -2,7 +2,7 @@ #include "Exec.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Exec); int
--- a/example/dependency_task/spe/Print.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/dependency_task/spe/Print.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,7 +3,7 @@ #include "Print.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Print); int
--- a/example/dependency_task/spe/spe-main.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/dependency_task/spe/spe-main.cc Wed Jul 15 17:39:51 2009 +0900 @@ -5,8 +5,8 @@ SchedExternTask(Exec); /** - * この関数は SpeScheduler から呼ばれるので - * 必ずこの関数名でお願いします。 + * ∽違 SpeScheduler 若違 + * 綽∽医с蕁障 */ void task_init(void)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/Func.h Wed Jul 15 17:39:51 2009 +0900 @@ -0,0 +1,5 @@ +enum { + HELLO_TASK, + RUN_FINISH, +}; +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/Makefile Wed Jul 15 17:39:51 2009 +0900 @@ -0,0 +1,20 @@ +default: macosx + +macosx: FORCE + @echo "Make for Mac OS X" + @$(MAKE) -f Makefile.macosx + +linux: FORCE + @echo "Make for Linux" + @$(MAKE) -f Makefile.linux + +cell: FORCE + @echo "Make for PS3 (Cell)" + @$(MAKE) -f Makefile.cell + +FORCE: + +clean: + @$(MAKE) -f Makefile.macosx clean + @$(MAKE) -f Makefile.linux clean + @$(MAKE) -f Makefile.cell clean \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/Makefile.cell Wed Jul 15 17:39:51 2009 +0900 @@ -0,0 +1,42 @@ +include ./Makefile.def + +SRCS_TMP = $(wildcard *.cc) +SRCS_EXCLUDE = # 除外するファイルを書く +SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) +OBJS = $(SRCS:.cc=.o) + +TASK_DIR = ppe +TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc) +TASK_SRCS_EXCLUDE = +TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) +TASK_OBJS = $(TASK_SRCS:.cc=.o) + +LIBS += -lCellManager -lspe2 -lpthread -Wl,--gc-sections + +.SUFFIXES: .cc .o + +.cc.o: + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ + +all: $(TARGET) speobject + +$(TARGET): $(OBJS) $(TASK_OBJS) + $(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS) + +speobject: + cd spe; $(MAKE) + +run: + ./$(TARGET) -cpu 6 + +link: + $(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS) + +debug: $(TARGET) + sudo ppu-gdb ./$(TARGET) + +clean: + rm -f $(TARGET) $(OBJS) $(TASK_OBJS) + rm -f *~ \#* + rm -f ppe/*~ ppe/\#* + cd spe; $(MAKE) clean
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/Makefile.def Wed Jul 15 17:39:51 2009 +0900 @@ -0,0 +1,14 @@ +TARGET = mainMem + +# include/library path +# ex: macosx +#CERIUM = /Users/gongo/Source/Cerium + +# ex: linux/ps3 +CERIUM = ../../../Cerium + +CC = g++ +CFLAGS = -g -Wall -O9 + +INCLUDE = -I${CERIUM}/include/TaskManager -I. -I.. +LIBS = -L${CERIUM}/TaskManager
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/Makefile.linux Wed Jul 15 17:39:51 2009 +0900 @@ -0,0 +1,36 @@ +include ./Makefile.def + +SRCS_TMP = $(wildcard *.cc) +SRCS_EXCLUDE = # 除外するファイルを書く +SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) +OBJS = $(SRCS:.cc=.o) + +TASK_DIR = ppe +TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc) +TASK_SRCS_EXCLUDE = +TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) +TASK_OBJS = $(TASK_SRCS:.cc=.o) + +LIBS += -lFifoManager + +.SUFFIXES: .cc .o + +.cc.o: + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ + +all: $(TARGET) + +$(TARGET): $(OBJS) $(TASK_OBJS) + $(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS) + +link: + $(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS) + +debug: $(TARGET) + sudo gdb ./$(TARGET) + +clean: + rm -f $(TARGET) $(OBJS) $(TASK_OBJS) + rm -f *~ \#* + rm -f ppe/*~ ppe/\#* + rm -f spe/*~ spe/\#*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/Makefile.macosx Wed Jul 15 17:39:51 2009 +0900 @@ -0,0 +1,36 @@ +include ./Makefile.def + +SRCS_TMP = $(wildcard *.cc) +SRCS_EXCLUDE = # 除外するファイルを書く +SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) +OBJS = $(SRCS:.cc=.o) + +TASK_DIR = ppe +TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc) +TASK_SRCS_EXCLUDE = +TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) +TASK_OBJS = $(TASK_SRCS:.cc=.o) + +LIBS += -lFifoManager `sdl-config --libs` + +.SUFFIXES: .cc .o + +.cc.o: + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ + +all: $(TARGET) + +$(TARGET): $(OBJS) $(TASK_OBJS) + $(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS) + +link: + $(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS) + +debug: $(TARGET) + sudo gdb ./$(TARGET) + +clean: + rm -f $(TARGET) $(OBJS) $(TASK_OBJS) + rm -f *~ \#* + rm -f ppe/*~ ppe/\#* + rm -f spe/*~ spe/\#*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/README Wed Jul 15 17:39:51 2009 +0900 @@ -0,0 +1,47 @@ +/* + * $Id: README,v 1.5 2008/11/01 02:37:12 gongo Exp $ + */ + +- 概要 + +"Hello, World!!" を出力するプログラムです。 +タスク Hello が文字列を表示します。 + +- 実行方法 + +% ./hello [-count COUNT] + + -count 表示する "Hello, World!!" の数(つまり、タスク Hello の数)です。 + +- 実行例 (-cpu は Cerium 標準のオプションです) + +% ./hello +[0] Hello, World!! + +% ./hello -count 10 +[0] Hello, World!! +[1] Hello, World!! +[2] Hello, World!! +[3] Hello, World!! +[4] Hello, World!! +[5] Hello, World!! +[6] Hello, World!! +[7] Hello, World!! +[8] Hello, World!! +[9] Hello, World!! + +% ./hello -count 10 -cpu 3 +[0] Hello, World!! +[2] Hello, World!! +[3] Hello, World!! +[5] Hello, World!! +[6] Hello, World!! +[8] Hello, World!! +[9] Hello, World!! +[1] Hello, World!! +[4] Hello, World!! +[7] Hello, World!! + +上の例では、Hello タスク 10 個を、 +3 つの CPU に振り分けて実行しているので +表示が順になっていない -> 並列に実行されていることがわかります。 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/main.cc Wed Jul 15 17:39:51 2009 +0900 @@ -0,0 +1,73 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "TaskManager.h" +#include "Func.h" + +extern void task_init(void); + +static int count = 1; + +extern TaskManager *manager; + +const char *usr_help_str = "Usage: ./hello [-cpu spe_num] [-count N]\n\ + -cpu Number of SPE (default 1) \n\ + -count Number of task is print \"Hello, World!!\""; + +int +init(int argc, char **argv) +{ + for (int i = 1; argv[i]; ++i) { + if (strcmp(argv[i], "-count") == 0) { + count = atoi(argv[++i]); + } + + } + + return 0; +} + +void +hello_init(void) +{ + HTask *hello; + + for (int i = 0; i < count; i++) { + /** + * Create Task + * create_task(Task ID); + */ + hello = manager->create_task(HELLO_TASK); + + /** + * Select CPU + * SPE_0, SPE_1, SPE_2, SPE_3, SPE_4, SPE_5, SPE_ANY + * if you do not call this, execute PPE. + */ + hello->set_cpu(SPE_ANY); + + /** + * Set 32bits parameter + * add_param(32bit parameter); + */ + hello->add_param(i); + + hello->spawn(); + } +} + +int +TMmain(int argc, char *argv[]) +{ + if (init(argc, argv) < 0) { + return -1; + } + + // Task Register + // ppe/task_init.cc + task_init(); + + hello_init(); + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/ppe/Hello.cc Wed Jul 15 17:39:51 2009 +0900 @@ -0,0 +1,42 @@ +#include <stdio.h> +#include "Hello.h" +#include "Func.h" + +/* 綽 */ +SchedDefineTask(Hello); + +#define PP_STORE 3 +#define SIZE (4096*sizeof(int)) + +int +Hello::run(void *rbuf, void *wbuf) +{ + int task_id = get_param(0); + int *ptr = 0; +#if 1 + ptr = (int*)smanager->allocate(SIZE); + + smanager->mainMem_alloc(0, SIZE); + + int i; + for(i=0;i<4096;i++) { + ptr[i] = i; + } +#endif + + void *next = 0; +#if 1 + smanager->mainMem_wait(); + next = (void *)smanager->mainMem_get(0); + + smanager->dma_wait(PP_STORE); + smanager->dma_store(ptr, (uint32)next, + SIZE, PP_STORE); +#endif + + + fprintf(stderr,"sizeof(int) = [%d] sizeof(void*)=[%d]\n", (int)sizeof(int),(int)sizeof(void*)); + fprintf(stderr,"[%d] Main Mem %0x len %d\n", task_id, (unsigned int)next,(int)SIZE); + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/ppe/Hello.h Wed Jul 15 17:39:51 2009 +0900 @@ -0,0 +1,15 @@ +#ifndef INCLUDED_TASK_HELLO +#define INCLUDED_TASK_HELLO + +#ifndef INCLUDED_SCHED_TASK +# include "SchedTask.h" +#endif + +class Hello : public SchedTask { +public: + SchedConstructor(Hello); + + int run(void *r, void *w); +}; + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/ppe/task_init.cc Wed Jul 15 17:39:51 2009 +0900 @@ -0,0 +1,17 @@ +#include "Func.h" +#include "Scheduler.h" + +/* 綽篏臀吾 */ +SchedExternTask(Hello); + +/** + * ∽違 ../spe/spe-main c + * у若喝冴違∽違 + * 絅純∽医сk (SchedRegisterTask 綽) + */ + +void +task_init(void) +{ + SchedRegisterTask(HELLO_TASK, Hello); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/spe/Hello.cc Wed Jul 15 17:39:51 2009 +0900 @@ -0,0 +1,48 @@ +#include <stdio.h> +#include "Hello.h" +#include "Func.h" + +/* 綽 */ +SchedDefineTask(Hello); + +#define PP_STORE 3 +#define SIZE (4096*sizeof(int)) + +int +Hello::run(void *rbuf, void *wbuf) +{ + int task_id = get_param(0); + int *ptr = 0; +#if 1 + ptr = (int*)smanager->allocate(SIZE); + + smanager->mainMem_alloc(0, SIZE); + + int i; + for(i=0;i<4096;i++) { + ptr[i] = i; + } +#endif + + void *next = 0; +#if 1 + smanager->mainMem_wait(); + next = (void *)smanager->mainMem_get(0); + + smanager->dma_wait(PP_STORE); + smanager->dma_store(ptr, (uint32)next, + SIZE, PP_STORE); + smanager->dma_wait(PP_STORE); + uint32 wait_id = smanager->get_segment(next, SIZE); + void* cur = smanager->wait_segment(wait_id); + //smanager->put_segment(wait_id); + //comparePtr *next; +#endif + + + fprintf(stderr,"sizeof(int) = [%d] sizeof(void*)=[%d]\n", (int)sizeof(int),(int)sizeof(void*)); + fprintf(stderr,"[%d] Main Mem %0x len %d\n", task_id, (unsigned int)next,(int)SIZE); + + free(ptr); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/spe/Hello.h Wed Jul 15 17:39:51 2009 +0900 @@ -0,0 +1,15 @@ +#ifndef INCLUDED_TASK_HELLO +#define INCLUDED_TASK_HELLO + +#ifndef INCLUDED_SCHED_TASK +# include "SchedTask.h" +#endif + +class Hello : public SchedTask { +public: + SchedConstructor(Hello); + + int run(void *r, void *w); +}; + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/spe/Makefile Wed Jul 15 17:39:51 2009 +0900 @@ -0,0 +1,26 @@ +include ../Makefile.def + +TARGET = ../spe-main + +SRCS_TMP = $(wildcard *.cc) +SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) +OBJS = $(SRCS:.cc=.o) + +CC = spu-g++ +CFLAGS = -O9 -g -Wall -fno-exceptions -fno-rtti#-DDEBUG +INCLUDE = -I../${CERIUM}/include/TaskManager -I. -I.. +LIBS = -L../${CERIUM}/TaskManager -lspemanager -Wl,--gc-sections + +.SUFFIXES: .cc .o + +.cc.o: + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ + +all: $(TARGET) + +$(TARGET): $(OBJS) + $(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS) + +clean: + rm -f $(TARGET) $(OBJS) + rm -f *~ \#* \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/spe/spe-main.cc Wed Jul 15 17:39:51 2009 +0900 @@ -0,0 +1,14 @@ +#include "Func.h" +#include "Scheduler.h" + +SchedExternTask(Hello); + +/** + * ∽違 SpeScheduler 若違 + * 綽∽医с蕁障 + */ +void +task_init(void) +{ + SchedRegisterTask(HELLO_TASK, Hello); +}
--- a/example/many_task/Makefile.def Fri Jun 05 17:07:35 2009 +0900 +++ b/example/many_task/Makefile.def Wed Jul 15 17:39:51 2009 +0900 @@ -1,10 +1,9 @@ TARGET = sort # include/library path -# ex: macosx +# ex macosx #CERIUM = /Users/gongo/Source/Concurrency/Game_project/Cerium -# ex: linux/ps3 CERIUM = ../../../Cerium CC = g++
--- a/example/many_task/Makefile.macosx Fri Jun 05 17:07:35 2009 +0900 +++ b/example/many_task/Makefile.macosx Wed Jul 15 17:39:51 2009 +0900 @@ -15,7 +15,7 @@ CFLAGS = -g -Wall# -O9 #-DDEBUG INCLUDE = -I${CERIUM}/include/TaskManager -I. -I.. -LIBS = -L${CERIUM}/TaskManager -lFifoManager +LIBS = -L${CERIUM}/TaskManager -lFifoManager `sdl-config --libs` .SUFFIXES: .cc .o
--- a/example/many_task/spe/Makefile Fri Jun 05 17:07:35 2009 +0900 +++ b/example/many_task/spe/Makefile Wed Jul 15 17:39:51 2009 +0900 @@ -23,4 +23,4 @@ clean: rm -f $(TARGET) $(OBJS) - rm -f *~ \#* \ No newline at end of file + rm -f *~ \#*
--- a/example/many_task/spe/QuickSort.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/many_task/spe/QuickSort.cc Wed Jul 15 17:39:51 2009 +0900 @@ -6,7 +6,7 @@ SchedDefineTask(QuickSort); int -QuickSort::run(void* rbuff, void* wbuff) { +QuickSort::run(SchedTask *smanager, void* rbuff, void* wbuff) { int begin = 0; int end = smanager->get_param(0); DataPtr r_data = (DataPtr)smanager->get_input(0);
--- a/example/many_task/spe/QuickSort.h Fri Jun 05 17:07:35 2009 +0900 +++ b/example/many_task/spe/QuickSort.h Wed Jul 15 17:39:51 2009 +0900 @@ -9,9 +9,9 @@ class QuickSort : public SchedTask { public: - SchedConstructor(QuickSort); + SchedConstructor(QuickSort); - int run(void *r, void *w); + int run(SchedTask *smanager, void *r, void *w); void quick_sort(Data *data, int left, int right); void bubble_sort(Data *data, int left, int right); void swap(Data *data, int left, int right );
--- a/example/many_task/spe/SpeProfile.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/many_task/spe/SpeProfile.cc Wed Jul 15 17:39:51 2009 +0900 @@ -1,35 +1,35 @@ /** - * SPU Decrementerを用いた処理時間計測 + * SPU Decrementer荐羝 */ #include "SpeProfile.h" -/* DMA転送に関する関数を使用するために必要なインクルードファイル */ +/* DMA荵∫≪∽違篏睡綽荀ゃ潟若<ゃ */ #include <spu_intrinsics.h> #include <stdio.h> -/* SPU Decrementerの初期値 */ +/* SPU Decrementer */ #define SPU_DECREMENTER_INITIAL_VALUE 0x7FFFFFFFU SpeProfile::SpeProfile(void): profile(0) {} void SpeProfile::ProfStart(void) { - /* SPU Decrementerに初期値を設定 */ + /* SPU Decrementerゃ荐絎 */ spu_writech(SPU_WrDec, SPU_DECREMENTER_INITIAL_VALUE); - /* 計測開始時間をSPU Decrementerから読み取る */ + /* 荐羝紮SPU Decrementer茯水 */ profile = spu_readch(SPU_RdDec); } void SpeProfile::ProfStop(void) { - /* 計測終了時間をSPU Decrementerから読み取り, 計測開始時間との差を計算 */ + /* 荐羝腟篋SPU Decrementer茯水, 荐羝紮綏荐膊 */ profile -= spu_readch(SPU_RdDec); } void SpeProfile::ProfPrint(void) { - /* 処理時間を出力 */ + /* 阪 */ printf("SPE time by SPU Decrementer: %f\n", profile / 79800000.0f * 1000.0f); }
--- a/example/many_task/spe/spe-main.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/many_task/spe/spe-main.cc Wed Jul 15 17:39:51 2009 +0900 @@ -7,8 +7,15 @@ * ∽違 SpeScheduler 若違 * 綽∽医с蕁障 */ + +static void +spe_debug() +{ +} + void task_init(void) { + spe_debug(); SchedRegisterTask(QUICK_SORT, QuickSort); }
--- a/example/post_function/ppe/Hello.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/post_function/ppe/Hello.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,7 +3,7 @@ #include "Hello.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Hello); int
--- a/example/post_function/ppe/task_init.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/post_function/ppe/task_init.cc Wed Jul 15 17:39:51 2009 +0900 @@ -1,13 +1,13 @@ #include "Func.h" #include "Scheduler.h" -/* 必ずこの位置に書いて */ +/* 綽篏臀吾 */ SchedExternTask(Hello); /** - * この関数は ../spe/spe-main と違って - * 自分で呼び出せばいい関数なので - * 好きな関数名でおk (SchedRegisterTask は必須) + * ∽違 ../spe/spe-main c + * у若喝冴違∽違 + * 絅純∽医сk (SchedRegisterTask 綽) */ void
--- a/example/post_function/spe/Hello.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/post_function/spe/Hello.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,7 +3,7 @@ #include "Hello.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Hello); int
--- a/example/post_function/spe/spe-main.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/post_function/spe/spe-main.cc Wed Jul 15 17:39:51 2009 +0900 @@ -4,8 +4,8 @@ SchedExternTask(Hello); /** - * この関数は SpeScheduler から呼ばれるので - * 必ずこの関数名でお願いします。 + * ∽違 SpeScheduler 若違 + * 綽∽医с蕁障 */ void task_init(void)
--- a/example/renew_task/ppe/Renew1.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/renew_task/ppe/Renew1.cc Wed Jul 15 17:39:51 2009 +0900 @@ -2,7 +2,7 @@ #include "Renew1.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Renew1); int @@ -11,8 +11,8 @@ printf("[PPE] ** running Renew1\n"); printf("[PPE] Create Task : Renew2\n"); - TaskPtr nextTask = smanager->create_task(RENEW2); - smanager->wait_task(nextTask); + TaskPtr nextTask = create_task(RENEW2); + wait_task(nextTask); printf("[PPE] ** finish Renew1\n"); printf("\n");
--- a/example/renew_task/ppe/Renew2.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/renew_task/ppe/Renew2.cc Wed Jul 15 17:39:51 2009 +0900 @@ -2,7 +2,7 @@ #include "Renew2.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Renew2); int @@ -11,8 +11,8 @@ printf("[PPE] ** running Renew2\n"); printf("[PPE] Create Task : Renew3\n"); - TaskPtr nextTask = smanager->create_task(RENEW3); - smanager->wait_task(nextTask); + TaskPtr nextTask = create_task(RENEW3); + wait_task(nextTask); printf("[PPE] ** finish Renew2\n"); printf("\n");
--- a/example/renew_task/ppe/Renew3.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/renew_task/ppe/Renew3.cc Wed Jul 15 17:39:51 2009 +0900 @@ -2,7 +2,7 @@ #include "Renew3.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Renew3); int @@ -11,8 +11,8 @@ printf("[PPE] ** running Renew3\n"); printf("[PPE] Create Task : Renew4\n"); - TaskPtr nextTask = smanager->create_task(RENEW4); - smanager->wait_task(nextTask); + TaskPtr nextTask = create_task(RENEW4); + wait_task(nextTask); printf("[PPE] ** finish Renew3\n"); printf("\n");
--- a/example/renew_task/ppe/Renew4.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/renew_task/ppe/Renew4.cc Wed Jul 15 17:39:51 2009 +0900 @@ -2,7 +2,7 @@ #include "Renew4.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Renew4); int
--- a/example/renew_task/ppe/RenewStart.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/renew_task/ppe/RenewStart.cc Wed Jul 15 17:39:51 2009 +0900 @@ -2,7 +2,7 @@ #include "RenewStart.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(RenewStart); int @@ -11,8 +11,8 @@ printf("[PPE] ** running RenewStart\n"); printf("[PPE] Create Task : Renew1\n"); - TaskPtr nextTask = smanager->create_task(RENEW1); - smanager->wait_task(nextTask); + TaskPtr nextTask = create_task(RENEW1); + wait_task(nextTask); printf("[PPE] ** finish RenewStart\n"); printf("\n");
--- a/example/renew_task/ppe/task_init.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/renew_task/ppe/task_init.cc Wed Jul 15 17:39:51 2009 +0900 @@ -1,7 +1,7 @@ #include "Func.h" #include "Scheduler.h" -/* 必ずこの位置に書いて */ +/* 綽篏臀吾 */ SchedExternTask(RenewStart); SchedExternTask(Renew1); SchedExternTask(Renew2); @@ -9,9 +9,9 @@ SchedExternTask(Renew4); /** - * この関数は ../spe/spe-main と違って - * 自分で呼び出せばいい関数なので - * 好きな関数名でおk (SchedRegisterTask は必須) + * ∽違 ../spe/spe-main c + * у若喝冴違∽違 + * 絅純∽医сk (SchedRegisterTask 綽) */ void
--- a/example/renew_task/spe/Renew1.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/renew_task/spe/Renew1.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,21 +3,21 @@ #include "SpeProfile.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Renew1); int Renew1::run(void *rbuf, void *wbuf) { - SpeProfile *profile = (SpeProfile*)smanager->global_get(0); + SpeProfile *profile = (SpeProfile*)global_get(0); profile->ProfStop(); profile->ProfPrint(); printf("[SPE] ** running Renew1\n"); printf("[SPE] Create Task : Renew2\n"); - TaskPtr nextTask = smanager->create_task(RENEW2); - smanager->wait_task(nextTask); + TaskPtr nextTask = create_task(RENEW2); + wait_task(nextTask); printf("[SPE] ** finish Renew1\n\n");
--- a/example/renew_task/spe/Renew2.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/renew_task/spe/Renew2.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,21 +3,21 @@ #include "SpeProfile.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Renew2); int Renew2::run(void *rbuf, void *wbuf) { - SpeProfile *profile = (SpeProfile*)smanager->global_get(0); + SpeProfile *profile = (SpeProfile*) global_get(0); profile->ProfStop(); profile->ProfPrint(); printf("[SPE] ** running Renew2\n"); printf("[SPE] Create Task : Renew3\n"); - TaskPtr nextTask = smanager->create_task(RENEW3); - smanager->wait_task(nextTask); + TaskPtr nextTask = create_task(RENEW3); + wait_task(nextTask); printf("[SPE] ** finish Renew2\n\n");
--- a/example/renew_task/spe/Renew3.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/renew_task/spe/Renew3.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,21 +3,21 @@ #include "SpeProfile.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Renew3); int Renew3::run(void *rbuf, void *wbuf) { - SpeProfile *profile = (SpeProfile*)smanager->global_get(0); + SpeProfile *profile = (SpeProfile*) global_get(0); profile->ProfStop(); profile->ProfPrint(); printf("[SPE] ** running Renew3\n"); printf("[SPE] Create Task : Renew4\n"); - TaskPtr nextTask = smanager->create_task(RENEW4); - smanager->wait_task(nextTask); + TaskPtr nextTask = create_task(RENEW4); + wait_task(nextTask); printf("[SPE] ** finish Renew3\n"); printf("\n");
--- a/example/renew_task/spe/Renew4.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/renew_task/spe/Renew4.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,13 +3,13 @@ #include "SpeProfile.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Renew4); int Renew4::run(void *rbuf, void *wbuf) { - SpeProfile *profile = (SpeProfile*)smanager->global_get(0); + SpeProfile *profile = (SpeProfile*) global_get(0); profile->ProfStop(); profile->ProfPrint(); @@ -17,7 +17,7 @@ printf("[SPE] ** finish Renew4\n"); - smanager->global_free(0); + global_free(0); return 0; }
--- a/example/renew_task/spe/RenewStart.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/renew_task/spe/RenewStart.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,7 +3,7 @@ #include "SpeProfile.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(RenewStart); int @@ -11,12 +11,12 @@ { printf("[SPE] ** running RenewStart\n"); - void *tmp = smanager->global_alloc(sizeof(SpeProfile), 0); + void *tmp = global_alloc(sizeof(SpeProfile), 0); SpeProfile *profile = new (tmp) SpeProfile; printf("[SPE] Create Task : Renew1\n"); - TaskPtr nextTask = smanager->create_task(RENEW1); - smanager->wait_task(nextTask); + TaskPtr nextTask = create_task(RENEW1); + wait_task(nextTask); printf("[SPE] ** finish RenewStart\n\n");
--- a/example/renew_task/spe/SpeProfile.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/renew_task/spe/SpeProfile.cc Wed Jul 15 17:39:51 2009 +0900 @@ -1,35 +1,35 @@ /** - * SPU Decrementerを用いた処理時間計測 + * SPU Decrementer荐羝 */ #include "SpeProfile.h" -/* DMA転送に関する関数を使用するために必要なインクルードファイル */ +/* DMA荵∫≪∽違篏睡綽荀ゃ潟若<ゃ */ #include <spu_intrinsics.h> #include <stdio.h> -/* SPU Decrementerの初期値 */ +/* SPU Decrementer */ #define SPU_DECREMENTER_INITIAL_VALUE 0x7FFFFFFFU SpeProfile::SpeProfile(void): profile(0) {} void SpeProfile::ProfStart(void) { - /* SPU Decrementerに初期値を設定 */ + /* SPU Decrementerゃ荐絎 */ spu_writech(SPU_WrDec, SPU_DECREMENTER_INITIAL_VALUE); - /* 計測開始時間をSPU Decrementerから読み取る */ + /* 荐羝紮SPU Decrementer茯水 */ profile = spu_readch(SPU_RdDec); } void SpeProfile::ProfStop(void) { - /* 計測終了時間をSPU Decrementerから読み取り, 計測開始時間との差を計算 */ + /* 荐羝腟篋SPU Decrementer茯水, 荐羝紮綏荐膊 */ profile -= spu_readch(SPU_RdDec); } void SpeProfile::ProfPrint(void) { - /* 処理時間を出力 */ + /* 阪 */ printf("SPE time by SPU Decrementer: %f\n", profile / 79800000.0f * 1000.0f); }
--- a/example/renew_task/spe/spe-main.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/renew_task/spe/spe-main.cc Wed Jul 15 17:39:51 2009 +0900 @@ -8,8 +8,8 @@ SchedExternTask(Renew4); /** - * この関数は SpeScheduler から呼ばれるので - * 必ずこの関数名でお願いします。 + * ∽違 SpeScheduler 若違 + * 綽∽医с蕁障 */ void task_init(void)
--- a/example/share_task/main.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/share_task/main.cc Wed Jul 15 17:39:51 2009 +0900 @@ -25,13 +25,13 @@ idata[i] = i; } - // idata を SPU の共有領域へコピーするタスク (所謂準備的な) + // idata SPU 掩吾潟若帥鴻 (茗羣) task_load = manager->create_task(TASK_LOAD); task_load->add_inData(idata, sizeof(int)*length); task_load->add_param(length); task_load->set_cpu(SPE_ANY); - // task_load が作った領域を見ていくタスク (複数で共有して) + // task_load 篏c荀帥鴻 (茲違у掩) for (int i = 0; i < numtask; i++) { task_exec = manager->create_task(TASK_EXEC); task_exec->add_param(length); @@ -63,7 +63,7 @@ return 0; } -//---------main関数----------- +//---------main∽----------- int TMmain(int argc, char *argv[]) {
--- a/example/share_task/ppe/Exec.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/share_task/ppe/Exec.cc Wed Jul 15 17:39:51 2009 +0900 @@ -2,7 +2,7 @@ #include "Exec.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Exec); int
--- a/example/share_task/ppe/Load.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/share_task/ppe/Load.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,7 +3,7 @@ #include "Load.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Load); int @@ -13,7 +13,7 @@ int *odata = (int*)global_get(DATA_ID); int length = get_param(0); - // SPU LS 内に領域確保し、データをコピー + // SPU LS 腆坂若帥潟 odata = (int*)global_alloc(DATA_ID, sizeof(int)*length); memcpy(odata, idata, sizeof(int)*length);
--- a/example/share_task/ppe/RunFinish.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/share_task/ppe/RunFinish.cc Wed Jul 15 17:39:51 2009 +0900 @@ -1,6 +1,6 @@ #include "RunFinish.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(RunFinish); int
--- a/example/share_task/ppe/task_init.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/share_task/ppe/task_init.cc Wed Jul 15 17:39:51 2009 +0900 @@ -1,15 +1,15 @@ #include "Func.h" #include "Scheduler.h" -/* 必ずこの位置に書いて */ +/* 綽篏臀吾 */ SchedExternTask(Load); SchedExternTask(Exec); SchedExternTask(RunFinish); /** - * この関数は ../spe/spe-main と違って - * 自分で呼び出せばいい関数なので - * 好きな関数名でおk (SchedRegisterTask は必須) + * ∽違 ../spe/spe-main c + * у若喝冴違∽違 + * 絅純∽医сk (SchedRegisterTask 綽) */ void task_init(void)
--- a/example/share_task/spe/Exec.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/share_task/spe/Exec.cc Wed Jul 15 17:39:51 2009 +0900 @@ -2,7 +2,7 @@ #include "Exec.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Exec); int
--- a/example/share_task/spe/Load.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/share_task/spe/Load.cc Wed Jul 15 17:39:51 2009 +0900 @@ -3,7 +3,7 @@ #include "Load.h" #include "Func.h" -/* これは必須 */ +/* 綽 */ SchedDefineTask(Load); int @@ -13,7 +13,7 @@ int *odata; int length = get_param(0); - // SPU LS 内に領域確保し、データをコピー + // SPU LS 腆坂若帥潟 odata = (int*)global_alloc(DATA_ID, sizeof(int)*length); memcpy(odata, idata, sizeof(int)*length);
--- a/example/share_task/spe/spe-main.cc Fri Jun 05 17:07:35 2009 +0900 +++ b/example/share_task/spe/spe-main.cc Wed Jul 15 17:39:51 2009 +0900 @@ -5,8 +5,8 @@ SchedExternTask(Exec); /** - * この関数は SpeScheduler から呼ばれるので - * 必ずこの関数名でお願いします。 + * ∽違 SpeScheduler 若違 + * 綽∽医с蕁障 */ void task_init(void)
--- a/include/TaskManager/BufferManager.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/BufferManager.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,21 +1,15 @@ #ifndef INCLUDED_BUFFER_MANAGER #define INCLUDED_BUFFER_MANAGER -#ifndef INCLUDED_TYPES -# include "types.h" -#endif - -#ifndef INCLUDED_TASK_LIST_INFO -# include "TaskListInfo.h" -#endif +#include "types.h" +#include "TaskListInfo.h" +#include "TaskQueueInfo.h" +#include "HTaskInfo.h" -#ifndef INCLUDED_TASK_QUEUE_INFO -# include "TaskQueueInfo.h" -#endif - -#ifndef INCLUDED_HTASK_INFO -# include "HTaskInfo.h" -#endif +/*! + * Task Input/Output buffer manager + * + */ class BufferManager { public:
--- a/include/TaskManager/CellBufferManager.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/CellBufferManager.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,13 +1,8 @@ #ifndef INCLUDED_CELL_BUFFER_MANAGER #define INCLUDED_CELL_BUFFER_MANAGER -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_BUFFER_MANAGER -# include "BufferManager.h" -#endif +#include "base.h" +#include "BufferManager.h" class CellBufferManager : public BufferManager { public:
--- a/include/TaskManager/CellDmaManager.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/CellDmaManager.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,13 +1,8 @@ #ifndef INCLUDED_CELL_DMA_MANAGER #define INCLUDED_CELL_DMA_MANAGER -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_DMA_MANAGER -# include "DmaManager.h" -#endif +#include "base.h" +#include "DmaManager.h" #include <spu_mfcio.h>
--- a/include/TaskManager/CellHTaskInfo.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/CellHTaskInfo.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,9 +1,7 @@ #ifndef INCLUDED_CELL_HTASK_INFO #define INCLUDED_CELL_HTASK_INFO -#ifndef INCLUDED_HTASK_INFO -# include "HTaskInfo.h" -#endif +#include "HTaskInfo.h" class CellHTaskInfo : public HTaskInfo { public:
--- a/include/TaskManager/CellScheduler.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/CellScheduler.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,13 +1,8 @@ #ifndef INCLUDED_CELL_SCHEDULER #define INCLUDED_CELL_SCHEDULER -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_SCHEDULER -# include "Scheduler.h" -#endif +#include "base.h" +#include "Scheduler.h" class CellScheduler : public Scheduler { public:
--- a/include/TaskManager/CellTaskInfo.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/CellTaskInfo.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,13 +1,8 @@ #ifndef INCLUDED_CELL_TASK_INFO #define INCLUDED_CELL_TASK_INFO -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_TASK_INFO -# include "TaskInfo.h" -#endif +#include "base.h" +#include "TaskInfo.h" class CellTaskInfo : public TaskInfo { public:
--- a/include/TaskManager/CellTaskListInfo.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/CellTaskListInfo.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,9 +1,7 @@ #ifndef INCLUDED_CELL_TASK_LIST_INFO #define INCLUDED_CELL_TASK_LIST_INFO -#ifndef INCLUDED_TASK_LIST_INFO -# include "TaskListInfo.h" -#endif +#include "TaskListInfo.h" class CellTaskListInfo : public TaskListInfo { public:
--- a/include/TaskManager/CellTaskManagerImpl.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/CellTaskManagerImpl.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,17 +1,9 @@ #ifndef INCLUDED_CELL_TASK_MANAGER_IMPL #define INCLUDED_CELL_TASK_MANAGER_IMPL -#ifndef INCLUDED_TASK_MANAGER_IMPL -# include "TaskManagerImpl.h" -#endif - -#ifndef INCLUDED_FIFO_TASK_MANAGER_IMPL -# include "FifoTaskManagerImpl.h" -#endif - -#ifndef INCLUDED_SPE_THREADS -# include "SpeThreads.h" -#endif +#include "TaskManagerImpl.h" +#include "FifoTaskManagerImpl.h" +#include "SpeThreads.h" class CellTaskManagerImpl : public TaskManagerImpl { public:
--- a/include/TaskManager/DmaBuffer.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/DmaBuffer.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,9 +1,7 @@ #ifndef INCLUDED_DMA_BUFFER #define INCLUDED_DMA_BUFFER -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif +#include "base.h" class DmaBuffer { public:
--- a/include/TaskManager/DmaManager.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/DmaManager.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,17 +1,9 @@ #ifndef INCLUDED_DMA_MANAGER #define INCLUDED_DMA_MANAGER -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_LIST_DATA -# include "ListData.h" -#endif - -#ifndef INCLUDED_TYPES -# include "types.h" - #endif +#include "base.h" +#include "ListData.h" +#include "types.h" enum dma_tag { DMA_READ = 25,
--- a/include/TaskManager/FifoDmaManager.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/FifoDmaManager.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,17 +1,9 @@ #ifndef INCLUDED_FIFO_DMA_MANAGER #define INCLUDED_FIFO_DMA_MANAGER -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_DMA_MANAGER -# include "DmaManager.h" -#endif - -#ifndef INCLUDED_MAIL_MANAGER -# include "MailManager.h" -#endif +#include "base.h" +#include "DmaManager.h" +#include "MailManager.h" class FifoDmaManager : public DmaManager { public:
--- a/include/TaskManager/FifoTaskManagerImpl.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/FifoTaskManagerImpl.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,13 +1,8 @@ #ifndef INCLUDED_FIFO_TASK_MANAGER_IMPL #define INCLUDED_FIFO_TASK_MANAGER_IMPL -#ifndef INCLUDED_TASK_MANAGER_IMPL -# include "TaskManagerImpl.h" -#endif - -#ifndef INCLUDED_MAIN_SCHEDULER -# include "MainScheduler.h" -#endif +#include "TaskManagerImpl.h" +#include "MainScheduler.h" class FifoTaskManagerImpl : public TaskManagerImpl { public:
--- a/include/TaskManager/HTask.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/HTask.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,24 +1,24 @@ #ifndef INCLUDED_HTASK #define INCLUDED_HTASK -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_TYPES -# include "types.h" -#endif - -#ifndef INCLUDED_TASK -# include "Task.h" -#endif - -#ifndef INCLUDED_TASK_QUEUE_INFO -# include "TaskQueueInfo.h" -#endif +#include "base.h" +#include "types.h" +#include "Task.h" +#include "TaskQueueInfo.h" class TaskManagerImpl; +/*! + @class + + @brief + + Cerium Task сspawn() сャ若主罨≦茵 + cpu 絎遺研絎茵 + 劫 Task 緇≦篋純 + Task ュ阪 dma copy + */ + class HTask : public Task { public: BASE_NEW_DELETE(HTask); @@ -32,11 +32,9 @@ TaskManagerImpl *mimpl; void spawn(void); - void set_depend(HTask *); + void wait_for(HTask *); void set_cpu(CPU_TYPE type); void set_post(void (*func)(void *), void *arg); - -#define wait_for set_depend }; typedef HTask* HTaskPtr;
--- a/include/TaskManager/HTaskInfo.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/HTaskInfo.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,9 +1,7 @@ #ifndef INCLUDED_HTASK_INFO #define INCLUDED_HTASK_INFO -#ifndef INCLUDED_HTASK -# include "HTask.h" -#endif +#include "HTask.h" class HTaskInfo { public:
--- a/include/TaskManager/ListData.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/ListData.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,9 +1,7 @@ #ifndef INCLUDED_LIST_DATA #define INCLUDED_LIST_DATA -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif +#include "base.h" #define MAX_LIST_DMA_SIZE 8
--- a/include/TaskManager/MainScheduler.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/MainScheduler.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,13 +1,8 @@ #ifndef INCLUDED_MAIN_SCHEDULER #define INCLUDED_MAIN_SCHEDULER -#ifndef INCLUDED_SCHEDULER -# include "Scheduler.h" -#endif - -#ifndef INCLUDED_MAIL_MANAGER -# include "MailManager.h" -#endif +#include "Scheduler.h" +#include "MailManager.h" class MainScheduler : public Scheduler { public:
--- a/include/TaskManager/PpeScheduler.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/PpeScheduler.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,9 +1,7 @@ #ifndef INCLUDED_PPE_SCHEDULER #define INCLUDED_PPE_SCHEDULER -#ifndef INCLUDED_MAIN_SCHEDULER -# include "MainScheduler.h" -#endif +#include "MainScheduler.h" class PpeScheduler : public MainScheduler { public:
--- a/include/TaskManager/SchedExit.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/SchedExit.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,17 +1,10 @@ #ifndef INCLUDED_SCHED_EXIT #define INCLUDED_SCHED_EXIT -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif +#include "base.h" +#include "Scheduler.h" +#include "SchedTaskBase.h" -#ifndef INCLUDED_SCHEDULER -# include "Scheduler.h" -#endif - -#ifndef INCLUDED_SCHED_TASK_BASE -# include "SchedTaskBase.h" -#endif class SchedExit : public SchedTaskBase { public:
--- a/include/TaskManager/SchedMail.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/SchedMail.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,17 +1,9 @@ #ifndef INCLUDED_SCHED_MAIL #define INCLUDED_SCHED_MAIL -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_SCHEDULER -# include "Scheduler.h" -#endif - -#ifndef INCLUDED_SCHED_TASK_BASE -# include "SchedTaskBase.h" -#endif +#include "base.h" +#include "Scheduler.h" +#include "SchedTaskBase.h" #include "error.h"
--- a/include/TaskManager/SchedNop.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/SchedNop.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,17 +1,9 @@ #ifndef INCLUDED_SCHED_NOP #define INCLUDED_SCHED_NOP -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_SCHEDULER -# include "Scheduler.h" -#endif - -#ifndef INCLUDED_SCHED_TASK_BASE -# include "SchedTaskBase.h" -#endif +#include "base.h" +#include "Scheduler.h" +#include "SchedTaskBase.h" #include "error.h"
--- a/include/TaskManager/SchedNop2Ready.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/SchedNop2Ready.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,21 +1,10 @@ #ifndef INCLUDED_SCHED_NOP2READY #define INCLUDED_SCHED_NOP2READY -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_SCHEDULER -# include "Scheduler.h" -#endif - -#ifndef INCLUDED_SCHED_TASK_BASE -# include "SchedTaskBase.h" -#endif - -#ifndef INCLUDED_SCHED_NOP -# include "SchedNop.h" -#endif +#include "base.h" +#include "Scheduler.h" +#include "SchedTaskBase.h" +#include "SchedNop.h" #include "error.h"
--- a/include/TaskManager/SchedTask.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/SchedTask.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,122 +1,115 @@ #ifndef INCLUDED_SCHED_TASK #define INCLUDED_SCHED_TASK -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_SCHEDULER -# include "Scheduler.h" -#endif - -#ifndef INCLUDED_SCHED_TASK_BASE -# include "SchedTaskBase.h" -#endif - -#ifndef INCLUDED_LIST_DATA -# include "ListData.h" -#endif - -#ifndef INCLUDED_TASK_GROUP -# include "TaskGroup.h" -#endif - +#include "base.h" +#include "Scheduler.h" +#include "SchedTaskBase.h" +#include "ListData.h" +#include "TaskGroup.h" class SchedTask : public SchedTaskBase { public: /* constructor */ - SchedTask(void); - ~SchedTask(void); + SchedTask(); + virtual ~SchedTask(); BASE_NEW_DELETE(SchedTask); + SchedTask *smanager; + +private: /* variables */ - // Task を実行するスケジューラ自身 + // Task 絎茵鴻宴吾ャ若荳 Scheduler *__scheduler; - // 現在スケジューラが実行している TaskList と、このタスクに対応する Task + // 憜鴻宴吾ャ若絎茵 TaskList 帥鴻絲上 Task TaskListPtr __list; TaskPtr __task; - // read/write 用の ListData + // read/write ListData ListDataPtr __inListData; ListDataPtr __outListData; /** - * read データ、write 用のバッファ - * readbuf には タスク登録時に設定した入力データが入っている。 - * writebuf にデータを描き込んでおくと、 - * タスク登録時に設定した出力先に書き込む + * read 若帥write + * readbuf 帥鴻脂我荐絎ュ若帥ャc + * writebuf 若帥莨若с + * 帥鴻脂我荐絎阪吾莨若 */ void *__readbuf; void *__writebuf; - // Task の、Tasklist での位置。(task = &list[cur_index-1]) + // Task Tasklist с篏臀(task = &list[cur_index-1]) int __cur_index; - // タスク内で生成されたタスクのグループ + // 帥鴻х帥鴻違若 TaskGroup *__taskGroup; - // このタスク内で生成されたタスクの数 + // 帥鴻х帥鴻 int __renew_flag; - // このタスクが SPE 内で生成されたタスクか否か 1: Yes, 0: No + // 帥鴻 SPE х帥鴻 1: Yes, 0: No int __flag_renewTask; - // タスクがメインメモリ側で生成されたものか、 - // SPE で生成されたものかによって、データの扱いが変わってくる。 - // そのために if (__flag_renewTask) を連発するのはよくないので - // 関数ポインタで持っておく - void (SchedTask::*ex_init)(void); - void (SchedTask::*ex_read)(void); - void (SchedTask::*ex_exec)(void); - void (SchedTask::*ex_write)(void); - SchedTaskBase* (SchedTask::*ex_next)(void); - + // 帥鴻<ゃ潟<≪眼х + // SPE хc若帥宴紊c + // if (__flag_renewTask) g冴 + // ∽違ゃ潟帥фc + void (SchedTask::*ex_init)(); + void (SchedTask::*ex_read)(); + void (SchedTask::*ex_exec)(); + void (SchedTask::*ex_write)(); + SchedTaskBase* (SchedTask::*ex_next)(); + /* functions */ - void __setRenew(void); - void __init__(TaskListPtr _list, TaskPtr _task, int index, - ListDataPtr rbuf, ListDataPtr wbuf, Scheduler* sc); // override - void read(void); - void exec(void); - void write(void); + void read(); + void exec(); + void write(); SchedTaskBase* next(Scheduler *, SchedTaskBase *); - // ここをユーザが継承して - // それぞれのタスクに対応した処理を記述する + // 若吟膓帥 + // 帥鴻絲上荐菴違 + virtual int run(SchedTask* smanager, void* r, void *w) { return 0; } virtual int run(void* r, void *w) { return 0; } int (SchedTask::*run_func)(void* r, void *w); + int (SchedTask::*run_func1)(SchedTask* smanager, void* r, void *w); //--- System API --- SchedTask* get_nextTask(TaskListPtr list); /** - * PPE で生成されたタスクに対する - * __init__, read,exec,write,next の付属(?)処理 + * PPE х帥鴻絲障 + * __init__, read,exec,write,next 篁絮(?) */ - void ex_init_normal(void); - void ex_read_normal(void); - void ex_exec_normal(void); - void ex_write_normal(void); - SchedTaskBase* ex_next_normal(void); + void ex_init_normal(); + void ex_read_normal(); + void ex_exec_normal(); + void ex_write_normal(); + SchedTaskBase* ex_next_normal(); /** - * SPE で生成されたタスクに対する - * __inti__, ead,exec,write,next の付属(?)処理 + * SPE х帥鴻絲障 + * __inti__, ead,exec,write,next 篁絮(?) */ - void ex_init_renew(void); - void ex_read_renew(void); - void ex_exec_renew(void); - void ex_write_renew(void); - SchedTaskBase* ex_next_renew(void); + void ex_init_renew(); + void ex_read_renew(); + void ex_exec_renew(); + void ex_write_renew(); + SchedTaskBase* ex_next_renew(); +public: + /* functions */ + + void __setRenew(); + void __init__(TaskListPtr _list, TaskPtr _task, int index, + ListDataPtr rbuf, ListDataPtr wbuf, Scheduler* sc); //--- User API --- - int get_cpuid(void); + int get_cpuid(); void* get_input(void *buff, int index); void* get_output(void *buff, int index); @@ -134,7 +127,7 @@ void global_free(int id); void mainMem_alloc(int id, int size); - void mainMem_wait(void); + void mainMem_wait(); void* mainMem_get(int id); void *allocate(int size); @@ -142,104 +135,25 @@ void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask); void dma_store(void *buf,uint32 addr, uint32 size, uint32 mask); void dma_wait(uint32 mask); - - class STaskManager { - public: - STaskManager(SchedTask *_t) { - outer = _t; - } - - BASE_NEW_DELETE(STaskManager); - - SchedTask *outer; - - int get_cpuid(void) { - return outer->get_cpuid(); - } - - void* get_input(int index) { - return outer->get_input(outer->__readbuf, index); - } - - void* get_output(int index) { - return outer->get_output(outer->__writebuf, index); - } - - uint32 get_inputAddr(int index) { - return outer->get_inputAddr(index); - } - - uint32 get_outputAddr(int index) { - return outer->get_outputAddr(index); - } - - uint32 get_inputSize(int index) { - return outer->get_inputSize(index); - } - - uint32 get_outputSize(int index) { - return outer->get_outputSize(index); - } - - int get_param(int index) { - return outer->get_param(index); - } - - TaskPtr create_task(int cmd) { - return outer->create_task(cmd); - } + void show_dma_wait(); + + /*! + SPU get_input, get_output + */ - void wait_task(TaskPtr waitTask) { - outer->wait_task(waitTask); - } - - void* global_alloc(int id, int size) { - return outer->global_alloc(id, size); - } - - void* global_get(int id) { - return outer->global_get(id); - } - - void global_free(int id) { - outer->global_free(id); - } - - void mainMem_alloc(int id, int size) { - outer->mainMem_alloc(id, size); - } - - void mainMem_wait(void) { - outer->mainMem_wait(); - } - - void* mainMem_get(int id) { - return outer->mainMem_get(id); - } - - void *allocate(int size) { - return outer->allocate(size); - } - - void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask) { - outer->dma_load(buf, addr, size, mask); - } - - void dma_store(void *buf,uint32 addr, uint32 size, uint32 mask) { - outer->dma_store(buf, addr, size, mask); - } - - void dma_wait(uint32 mask) { - outer->dma_wait(mask); - } - }; - - STaskManager *smanager; + void* get_input(int index) { + return get_input(__readbuf, index); + } + + void* get_output(int index) { + return get_output(__writebuf, index); + } }; const int SCHED_TASK_NORMAL = 0; const int SCHED_TASK_RENEW = 1; +extern SchedTask* createSchedTask(TaskPtr); + #endif -extern SchedTask* createSchedTask(TaskPtr);
--- a/include/TaskManager/SchedTaskBase.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/SchedTaskBase.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,13 +1,8 @@ #ifndef INCLUDED_SCHED_TASK_BASE #define INCLUDED_SCHED_TASK_BASE -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_SCHEDULER -# include "Scheduler.h" -#endif +#include "base.h" +#include "Scheduler.h" class Scheduler;
--- a/include/TaskManager/SchedTaskList.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/SchedTaskList.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,17 +1,9 @@ #ifndef INCLUDED_SCHED_TASKLIST #define INCLUDED_SCHED_TASKLIST -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_SCHEDULER -# include "Scheduler.h" -#endif - -#ifndef INCLUDED_SCHED_TASK_BASE -# include "SchedTaskBase.h" -#endif +#include "base.h" +#include "Scheduler.h" +#include "SchedTaskBase.h" #include "error.h" @@ -45,6 +37,7 @@ const int SCHED_TASKLIST_NORMAL = 0; const int SCHED_TASKLIST_RENEW = 1; +extern SchedTaskList* createSchedTaskList(uint32, Scheduler*, int); + #endif -extern SchedTaskList* createSchedTaskList(uint32, Scheduler*, int);
--- a/include/TaskManager/Scheduler.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/Scheduler.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,37 +1,14 @@ #ifndef INCLUDED_SCHEDULER #define INCLUDED_SCHEDULER -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_TASKLIST -# include "TaskList.h" -#endif - -#ifndef INCLUDED_LIST_DATA -# include "ListData.h" -#endif - -#ifndef INCLUDED_DMA_MANAGER -# include "DmaManager.h" -#endif +#include "base.h" +#include "TaskList.h" +#include "ListData.h" +#include "DmaManager.h" +#include "SchedTaskBase.h" +#include "SchedTaskList.h" +#include "TaskGroup.h" -#ifndef INCLUDED_SCHED_TASK_BASE -# include "SchedTaskBase.h" -#endif - -#ifndef INCLUDED_SCHED_TASK -# include "SchedTask.h" -#endif - -#ifndef INCLUDED_SCHED_TASKLIST -# include "SchedTaskList.h" -#endif - -#ifndef INCLUDED_TASK_GROUP -# include "TaskGroup.h" -#endif #define MAX_USER_TASK 32 #define MAX_SYSTEM_TASK 2 @@ -61,45 +38,45 @@ int buffFlag_inListData; int buffFlag_outListData; - /* TaskList 関連 */ + /* TaskList ∫ */ /** - * 実行中 TaskList の現在の位置 (list->tasks[index]) + * 絎茵筝 TaskList 憜篏臀 (list->tasks[index]) * - * bakIndex_taskList がある理由 - * taskList の途中で renew task が作られたとき、 - * 即座に実行するため、TaskList -> RenewTaskList と移って処理する。 - * RenewTaskList が終了したとき、再び TaskList に戻ってくるが - * Renew Task を生成した所から再スタートするため、 - * taskList の index を覚えておく (backup) - * 同様に TaskList も覚えておく + * bakIndex_taskList + * taskList 筝 renew task 篏 + * 喝婚絎茵TaskList -> RenewTaskList 腱祉c + * RenewTaskList 腟篋 TaskList 祉c + * Renew Task 鴻帥若 + * taskList index 荀 (backup) + * 罕 TaskList 荀 */ int bakIndex_taskList; TaskListPtr bak_curTaskList; /** - * タスク内で生成されたタスクを入れる - * Linked List で管理 + * 帥鴻х帥鴻ャ + * Linked List х∞ */ TaskListPtr renewCur_taskList; TaskListPtr renewTop_taskList; /** - * 実行中 TaskList が Renew されたものかどうかのフラグ - * Renew の場合、ListData は DMA する必要ないとか - * いろいろな判定に使えるかもしれん + * 絎茵筝 TaskList Renew + * Renew 翫ListData DMA 綽荀 + * ゅ篏帥 * if (flag == 1) taskList is Renew */ int flag_renewTaskList; /** - * タスク内 (T1) でタスク (Tc = T2, T3, ..) が複数生成された場合、 - * Tc が全て終わってから、T1 の終了コマンドを PPE に送る。 - * なので、Tc を process group として記憶しておく。 + * 帥鴻 (T1) с帥鴻 (Tc = T2, T3, ..) 茲亥翫 + * Tc 腟cT1 腟篋潟潟 PPE + * сTc process group 荐吟 * - * Tc が taskGroup のアドレスを持つので - * Scheduler が持つ taskGroup 変数は一つだけで(多分)おk + * Tc taskGroup ≪鴻ゃ + * Scheduler taskGroup 紊違筝ゃ(紊)k */ TaskGroupPtr taskGroup; @@ -110,6 +87,8 @@ void* mainMemList[MAX_MAINMEM_AREA]; // Task Object Table + // this is named TaskObject but it is not an object. + // It is a pointer to an object creation function typedef SchedTask* (*TaskObject)(void); DmaManager* connector; @@ -136,7 +115,7 @@ TaskListPtr get_backupTaskList(void); int get_backupTaskListIndex(void); - // なんか名前が変だが。。。 + // 紊 /* TaskGroup */ TaskGroupPtr set_groupTask(uint32 command); void add_groupTask(TaskGroupPtr group, TaskPtr task); @@ -160,15 +139,16 @@ void dma_store(void *buf,uint32 addr, uint32 size, uint32 mask); void dma_wait(uint32 mask); void show_dma_wait() { connector->show_dma_wait(id); }; + void show_dma_wait(int id) { connector->show_dma_wait(id); }; void mail_write(uint32 data); uint32 mail_read(void); void dma_loadList(ListDataPtr list, void *, uint32 mask); void dma_storeList(ListDataPtr list, void *, uint32 mask); }; +extern void register_task(int cmd, Scheduler::TaskObject task); #endif -extern void register_task(int cmd, Scheduler::TaskObject task); #define SchedConstructor(str) \ str(void) {} \
--- a/include/TaskManager/Task.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/Task.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,17 +1,9 @@ #ifndef INCLUDED_TASK #define INCLUDED_TASK -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_TYPES -# include "types.h" -#endif - -#ifndef INCLUDED_LIST_DATA -# include "ListData.h" -#endif +#include "base.h" +#include "types.h" +#include "ListData.h" #define MAX_PARAMS 8
--- a/include/TaskManager/TaskGroup.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/TaskGroup.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,13 +1,8 @@ #ifndef INCLUDED_TASK_GROUP #define INCLUDED_TASK_GROUP -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_TASK_QUEUE -# include "TaskQueue.h" -#endif +#include "base.h" +#include "TaskQueue.h" class TaskGroup { public:
--- a/include/TaskManager/TaskList.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/TaskList.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,13 +1,9 @@ #ifndef INCLUDED_TASKLIST #define INCLUDED_TASKLIST -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif +#include "base.h" +#include "Task.h" -#ifndef INCLUDED_TASK -# include "Task.h" -#endif // sizeof(Task)*TASK_MAX_SIZE = 512 byte #define TASK_MAX_SIZE 16
--- a/include/TaskManager/TaskListInfo.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/TaskListInfo.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,13 +1,8 @@ #ifndef INCLUDED_TASK_LIST_INFO #define INCLUDED_TASK_LIST_INFO -#ifndef INCLUDED_TYPES -# include "types.h" -#endif - -#ifndef INCLUDED_TASKLIST -# include "TaskList.h" -#endif +#include "types.h" +#include "TaskList.h" class TaskListInfo { public:
--- a/include/TaskManager/TaskManager.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/TaskManager.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,13 +1,8 @@ #ifndef INCLUDED_TASK_MANAGER #define INCLUDED_TASK_MANAGER -#ifndef INCLUDED_TASK_MANAGER_IMPL -# include "TaskManagerImpl.h" -#endif - -#ifndef INCLUDED_RANDOM -# include "Random.h" -#endif +#include "TaskManagerImpl.h" +#include "Random.h" class TaskManager { public: @@ -39,3 +34,4 @@ #endif extern TaskManager *manager; +
--- a/include/TaskManager/TaskManagerImpl.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/TaskManagerImpl.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,17 +1,9 @@ #ifndef INCLUDED_TASK_MANAGER_IMPL #define INCLUDED_TASK_MANAGER_IMPL -#ifndef INCLUDED_MAIL_MANAGER -# include "MailManager.h" -#endif - -#ifndef INCLUDED_BUFFER_MANAGER -# include "BufferManager.h" -#endif - -#ifndef INCLUDED_LIST_DATA -# include "ListData.h" -#endif +#include "MailManager.h" +#include "BufferManager.h" +#include "ListData.h" class TaskManagerImpl { public:
--- a/include/TaskManager/TaskQueue.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/TaskQueue.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,13 +1,8 @@ #ifndef INCLUDED_TASK_QUEUE #define INCLUDED_TASK_QUEUE -#ifndef INCLUDED_BASE_H_ -# include "base.h" -#endif - -#ifndef INCLUDED_TASK -# include "Task.h" -#endif +#include "base.h" +#include "Task.h" #include <stdio.h>
--- a/include/TaskManager/TaskQueueInfo.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/TaskQueueInfo.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,9 +1,7 @@ #ifndef INCLUDED_TASK_QUEUE_INFO #define INCLUDED_TASK_QUEUE_INFO -#ifndef INCLUDED_TASK_QUEUE -# include "TaskQueue.h" -#endif +#include "TaskQueue.h" class TaskQueueInfo { public:
--- a/include/TaskManager/base.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/base.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,3 +1,5 @@ +#ifndef INCLUDED_BASE_H_ + #include <new> #include <stdlib.h> #include <stdio.h> @@ -23,3 +25,4 @@ # define BASE_NEW_DELETE(T) #endif +#endif
--- a/include/TaskManager/error.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/error.h Wed Jul 15 17:39:51 2009 +0900 @@ -1,3 +1,6 @@ +#ifndef CERIUM_ERR +#define CERIUM_ERR + #ifdef DEBUG # include <stdio.h> # define __debug(...) do { \ @@ -7,7 +10,7 @@ # define __debug(...) #endif -#ifdef _PPE_DEBUG +#ifdef DEBUG # include <stdio.h> # define __debug_ppe(...) do { \ printf("[PPE] "); printf(__VA_ARGS__); \ @@ -16,12 +19,12 @@ # define __debug_ppe(...) #endif -#ifdef _PPE_DEBUG +#ifdef DEBUG # include <stdio.h> # define __debug_spe(...) do { \ printf("[SPE] "); printf(__VA_ARGS__); \ } while (0) #else /* DEBUG */ -# define __debug_ppe(...) +# define __debug_spe(...) #endif - +#endif
--- a/include/TaskManager/types.h Fri Jun 05 17:07:35 2009 +0900 +++ b/include/TaskManager/types.h Wed Jul 15 17:39:51 2009 +0900 @@ -20,9 +20,9 @@ #define round_up16(value) ROUND_UP_ALIGN(value, 16) #define round_up128(value) ROUND_UP_ALIGN(value, 128) -// ここも typedef しとくか? +// typedef 鐚 enum { -// どの方向かで enum 分けるだろjk... +// 劫 enum jk... // PPE -> SPE MY_SPE_NOP = 0, MY_SPE_COMMAND_EXIT,