Mercurial > hg > Game > Cerium
changeset 389:e2f1706b4eeb draft
MemHash for Cell
author | kono@localhost.localdomain |
---|---|
date | Thu, 06 Aug 2009 23:43:28 +0900 |
parents | 3d1e86396d16 |
children | 6087affae003 |
files | TaskManager/Test/test_render/spe/DrawSpan.cpp TaskManager/Test/test_render/spe/DrawSpan.h TaskManager/Test/test_render/spe/Load_Texture.cpp TaskManager/Test/test_render/spe/Makefile TaskManager/Test/test_render/spe/spe-main.cpp TaskManager/kernel/schedule/Scheduler.h |
diffstat | 6 files changed, 32 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Test/test_render/spe/DrawSpan.cpp Thu Aug 06 23:30:26 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp Thu Aug 06 23:43:28 2009 +0900 @@ -158,6 +158,7 @@ return buf; } +#if !USE_MEMHASH /** * Span が使う Texture Tile があるか @@ -199,6 +200,8 @@ return tile; } +#endif + uint32 DrawSpan::get_rgb(int tx, int ty, TilePtr tile) { @@ -253,6 +256,7 @@ // next_spack は free() するので wait する smanager->dma_wait(SPAN_PACK_LOAD); } +#endif void DrawSpan::writebuffer(unsigned int display, int buf_width, int height, @@ -266,7 +270,6 @@ doneWrite = 1; } -#endif /** * zRow と Linebuf を更新する @@ -336,6 +339,10 @@ tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; +#if USE_MEMHASH + TilePtr tile = smanager->get_segment(tex_addr,tileList); + smanager->wait_segment(tile); +#else TilePtr tile; if (!(tile = isAvailableTile(tex_addr))) { tile = set_rgb(tex_addr, wait_tag); @@ -347,6 +354,7 @@ tileList->moveToFirst(tile); } #endif +#endif updateBuffer(zpos, rangex, localx, localy, tex_localx, tex_localy, tile); @@ -432,6 +440,10 @@ tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; +#if USE_MEMHASH + TilePtr tile = smanager->get_segment(tex_addr,tileList); + smanager->wait_segment(tile); +#else TilePtr tile; if (!(tile = isAvailableTile(tex_addr))) { tile = set_rgb(tex_addr, wait_tag); @@ -442,6 +454,7 @@ tileList->moveToFirst(tile); } #endif +#endif updateBuffer(tex_z, rangex, localx, localy, tex_localx, tex_localy, tile); @@ -478,7 +491,9 @@ // y の範囲 int rangey = smanager->get_param(4); +#if !USE_MEMHASH hash = (TileHashPtr)smanager->global_get(GLOBAL_TEXTURE_HASH); +#endif tileList = (TileListPtr)smanager->global_get(GLOBAL_TILE_LIST); zRow = zRow_init(rangex, rangey);
--- a/TaskManager/Test/test_render/spe/DrawSpan.h Thu Aug 06 23:30:26 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.h Thu Aug 06 23:43:28 2009 +0900 @@ -4,7 +4,9 @@ #include "SchedTask.h" #include "Tapestry.h" #include "SpanPack.h" +#if !USE_MEMHASH #include "TileHash.h" +#endif class DrawSpan : public SchedTask { public: @@ -12,7 +14,9 @@ int *linebuf; float *zRow; +#if !USE_MEMHASH TileHashPtr hash; +#endif TileListPtr tileList; int doneWrite;
--- a/TaskManager/Test/test_render/spe/Load_Texture.cpp Thu Aug 06 23:30:26 2009 +0900 +++ b/TaskManager/Test/test_render/spe/Load_Texture.cpp Thu Aug 06 23:43:28 2009 +0900 @@ -5,7 +5,9 @@ #include <string.h> #include "Load_Texture.h" #include "texture.h" +#if !USE_MEMHASH #include "TileHash.h" +#endif #include "Func.h" #include "global_alloc.h" @@ -19,6 +21,8 @@ LoadTexture::run(void *rbuf , void *wbuf) { __debug_spe("LoadTexture\n"); + +#if !USE_MEMHASH /** * 現在 global_alloc() では new をサポートしてないので * コンストラクタ呼ぶために placement new してます。 @@ -26,6 +30,7 @@ void *hash_tmp = smanager->global_alloc(GLOBAL_TEXTURE_HASH, sizeof(TileHash)); new(hash_tmp) TileHash; +#endif #ifdef USE_MEMLIST MemList *ml = smanager->createMemList(sizeof(uint32) * TEXTURE_BLOCK_SIZE, MAX_TILE);
--- a/TaskManager/Test/test_render/spe/Makefile Thu Aug 06 23:30:26 2009 +0900 +++ b/TaskManager/Test/test_render/spe/Makefile Thu Aug 06 23:43:28 2009 +0900 @@ -10,7 +10,7 @@ OBJS = $(SRCS:.cpp=.o) CC = spu-g++ -CFLAGS = -O9 -Wall -g -fno-exceptions -fno-rtti -D USE_MEMLIST=1 #-DDEBUG +CFLAGS = -O9 -Wall -g -fno-exceptions -fno-rtti -DUSE_MEMLIST=1 -DUSE_MEMHASH=1 #-DDEBUG INCLUDE = -I$(TOP)/include/TaskManager -I. -I.. LIBS = -L$(TOP)/TaskManager -lspemanager
--- a/TaskManager/Test/test_render/spe/spe-main.cpp Thu Aug 06 23:30:26 2009 +0900 +++ b/TaskManager/Test/test_render/spe/spe-main.cpp Thu Aug 06 23:43:28 2009 +0900 @@ -18,7 +18,9 @@ SchedRegisterTask(TASK_INIT_TEXTURE, LoadTexture); SchedRegisterTask(TASK_SET_TEXTURE, SetTexture); SchedRegisterTask(TASK_DRAW_SPAN, DrawSpan); +#if 0 SchedRegisterTask(TASK_DRAW_SPAN2, DrawSpanRenew); +#endif SchedRegisterTask(TASK_DRAW_BACK, DrawBack); SchedRegisterTask(TASK_CREATE_SPAN, CreateSpan);
--- a/TaskManager/kernel/schedule/Scheduler.h Thu Aug 06 23:30:26 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.h Thu Aug 06 23:43:28 2009 +0900 @@ -137,10 +137,10 @@ virtual void mainMem_wait(void) {}; void *mainMem_get(int id); - MemorySegment * Scheduler::get_segment(memaddr addr, MemList *m); - virtual uint32 Scheduler::get_tag(); - void Scheduler::put_segment(MemorySegment *s); - void Scheduler::wait_segment(MemorySegment *s); + MemorySegment * get_segment(memaddr addr, MemList *m); + virtual uint32 get_tag(); + void put_segment(MemorySegment *s); + void wait_segment(MemorySegment *s); /* DMA Transfer */ void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask);