Mercurial > hg > Game > Cerium
changeset 623:50803cb3d9df draft
endian
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 15 Nov 2009 04:16:35 +0900 |
parents | 911050e9f99d |
children | 55c95360f95b |
files | Renderer/Engine/spe/DrawSpan.cc Renderer/Engine/task/DrawSpan.cc |
diffstat | 2 files changed, 20 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/spe/DrawSpan.cc Sun Nov 15 03:55:12 2009 +0900 +++ b/Renderer/Engine/spe/DrawSpan.cc Sun Nov 15 04:16:35 2009 +0900 @@ -11,7 +11,11 @@ #include "Tapestry.h" #include "SpanPack.h" -#define BIGENDIAN 0 +#if (__LITTLE_ENDIAN__) +#define LITTLEENDIAN 1 +#else +#define LITTLEENDIAN 0 +#endif SchedDefineTask(DrawSpan); @@ -181,7 +185,7 @@ int color = get_rgb(tex_x, tex_y, tile); /*下位4bitを抽出*/ -#if BIGENDIAN +#if LITTLEENDIAN int alpha = color & 0x000000ff; #else int alpha = color & 0xff000000; @@ -372,7 +376,7 @@ float inner_product; // 引数で受け取った color の rgb 情報の抜き出し -#if BIGENDIAN +#if LITTLEENDIAN rgb[0] = (color & 0xff000000) >> 24; rgb[1] = (color & 0x00ff0000) >> 16; rgb[2] = (color & 0x0000ff00) >> 8; @@ -395,7 +399,7 @@ rgb[2] = (unsigned char)(rgb[2]*inner_product*flag); //計算した rgb を light_rgb にまとめる。 -#if BIGENDIAN +#if LITTLEENDIAN light_rgb = (rgb[0] << 24) + (rgb[1] << 16) + (rgb[2] << 8) + (rgb[3]); #else light_rgb = (rgb[3] << 24) + (rgb[2] << 16) + (rgb[1] << 8) + (rgb[0]); @@ -408,7 +412,8 @@ static int run(SchedTask *smanager, void *rbuf, void *wbuf) { - Gptr g = (Gptr)smanager->allocate(sizeof(G)); + G g0; + Gptr g = &g0; SpanPackPtr spack = (SpanPackPtr)smanager->get_input(0); SpanPackPtr next_spack = (SpanPackPtr)smanager->allocate(sizeof(SpanPack)); @@ -418,10 +423,6 @@ Span nop_span; nop_span.length_x = 1; - int (*drawFunc1[2])(SchedTask *, Gptr, SpanPtr, int, int, int) = { - &drawDot1, &drawLine1 - }; - // uint32 display = smanager->get_param(0); // int screen_width = smanager->get_param(1); int rangex_start = smanager->get_param(2); @@ -477,17 +478,10 @@ resume_span = next_span; resume_span_x = next_span_x; - //smanager->dma_wait(tl_tag[tl_tag_flg1]); - tl_tag_flg1 ^= 1; tl_tag_flg2 ^= 1; } - // 現在 drawLine2、drawDot2 は機能してないので - //(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); SpanPackPtr tmp_spack = spack; @@ -498,7 +492,6 @@ free(g->zRow); free(g->linebuf); - free(g); //FINISH: /**
--- a/Renderer/Engine/task/DrawSpan.cc Sun Nov 15 03:55:12 2009 +0900 +++ b/Renderer/Engine/task/DrawSpan.cc Sun Nov 15 04:16:35 2009 +0900 @@ -11,7 +11,11 @@ #include "Tapestry.h" #include "SpanPack.h" -#define BIGENDIAN 1 +#if (__LITTLE_ENDIAN__) +#define LITTLEENDIAN 1 +#else +#define LITTLEENDIAN 0 +#endif SchedDefineTask(DrawSpan); @@ -181,7 +185,7 @@ int color = get_rgb(tex_x, tex_y, tile); /*下位4bitを抽出*/ -#if BIGENDIAN +#if LITTLEENDIAN int alpha = color & 0x000000ff; #else int alpha = color & 0xff000000; @@ -372,7 +376,7 @@ float inner_product; // 引数で受け取った color の rgb 情報の抜き出し -#if BIGENDIAN +#if LITTLEENDIAN rgb[0] = (color & 0xff000000) >> 24; rgb[1] = (color & 0x00ff0000) >> 16; rgb[2] = (color & 0x0000ff00) >> 8; @@ -395,7 +399,7 @@ rgb[2] = (unsigned char)(rgb[2]*inner_product*flag); //計算した rgb を light_rgb にまとめる。 -#if BIGENDIAN +#if LITTLEENDIAN light_rgb = (rgb[0] << 24) + (rgb[1] << 16) + (rgb[2] << 8) + (rgb[3]); #else light_rgb = (rgb[3] << 24) + (rgb[2] << 16) + (rgb[1] << 8) + (rgb[0]); @@ -408,7 +412,8 @@ static int run(SchedTask *smanager, void *rbuf, void *wbuf) { - Gptr g = (Gptr)smanager->allocate(sizeof(G)); + G g0; + Gptr g = &g0; SpanPackPtr spack = (SpanPackPtr)smanager->get_input(0); SpanPackPtr next_spack = (SpanPackPtr)smanager->allocate(sizeof(SpanPack)); @@ -418,10 +423,6 @@ Span nop_span; nop_span.length_x = 1; - int (*drawFunc1[2])(SchedTask *, Gptr, SpanPtr, int, int, int) = { - &drawDot1, &drawLine1 - }; - // uint32 display = smanager->get_param(0); // int screen_width = smanager->get_param(1); int rangex_start = smanager->get_param(2); @@ -477,17 +478,10 @@ resume_span = next_span; resume_span_x = next_span_x; - //smanager->dma_wait(tl_tag[tl_tag_flg1]); - tl_tag_flg1 ^= 1; tl_tag_flg2 ^= 1; } - // 現在 drawLine2、drawDot2 は機能してないので - //(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); SpanPackPtr tmp_spack = spack; @@ -498,7 +492,6 @@ free(g->zRow); free(g->linebuf); - free(g); //FINISH: /**