# HG changeset patch # User aaa # Date 1248852866 -32400 # Node ID f88744ee935015206395c462f6dfeab373760cf3 # Parent 4435c999098879f47033a0e15aae7c3098945ab5 change DrawSpan, #define USE_MEMLIST use MemList(LRU) diff -r 4435c9990988 -r f88744ee9350 TaskManager/Test/test_render/Tapestry.h --- a/TaskManager/Test/test_render/Tapestry.h Wed Jul 29 15:09:36 2009 +0900 +++ b/TaskManager/Test/test_render/Tapestry.h Wed Jul 29 16:34:26 2009 +0900 @@ -74,11 +74,15 @@ }; +#ifdef USE_MEMLIST +typedef MemorySegment Tile, *TilePtr; +#else typedef struct { - uint32 pixel[TEXTURE_BLOCK_SIZE]; // 8*8 - uint32 *texture_addr; + uint32 data[TEXTURE_BLOCK_SIZE]; // 8*8 + uint32 *address; int pad[3]; } Tile, *TilePtr; +#endif #define MAX_TILE 128 @@ -87,6 +91,13 @@ * これは汎用のサイズ別 freelist に置き換える * freelist は double linked list で、LRU をサポートする */ +#ifdef USE_MEMLIST +class TileList : MemList { +/*! + 中身は同じ + */ +}; +#else class TileList { public: int curIndex; @@ -120,6 +131,7 @@ curIndex = 0; } }; +#endif typedef TileList* TileListPtr; diff -r 4435c9990988 -r f88744ee9350 TaskManager/Test/test_render/spe/DrawSpan.cpp --- a/TaskManager/Test/test_render/spe/DrawSpan.cpp Wed Jul 29 15:09:36 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp Wed Jul 29 16:34:26 2009 +0900 @@ -176,9 +176,15 @@ { TilePtr tile; +#ifdef USE_MEMLIST + tile = tileList->getLast(); + tileList->remove(tile); +#else tile = tileList->nextTile(); - uint32 *old_addr = tile->texture_addr; - smanager->dma_load(tile->pixel, (uint32)addr, +#endif + + uint32 *old_addr = tile->address; + smanager->dma_load(tile->data, (uint32)addr, sizeof(uint32)*TEXTURE_BLOCK_SIZE, tag); /** * FIFO なので、もし前のが残っていれば削除 @@ -186,9 +192,9 @@ hash->remove(old_addr); - tile->texture_addr = addr; + tile->address = addr; - hash->put(tile->texture_addr, tile); + hash->put(tile->address, tile); return tile; } @@ -197,7 +203,7 @@ DrawSpan::get_rgb(int tx, int ty, TilePtr tile) { - return tile->pixel[(TEXTURE_SPLIT_PIXEL)*ty+tx]; + return tile->data[(TEXTURE_SPLIT_PIXEL)*ty+tx]; } /** @@ -334,6 +340,11 @@ smanager->dma_wait(wait_tag); //return startx; } +#ifdef USE_MEMLIST + else { + tileList->moveToFirst(tile); + } +#endif updateBuffer(zpos, rangex, localx, localy, tex_localx, tex_localy, tile); @@ -424,7 +435,11 @@ tile = set_rgb(tex_addr, wait_tag); smanager->dma_wait(wait_tag); } - +#ifdef USE_MEMLIST + else { + tileList->moveToFirst(tile); + } +#endif updateBuffer(tex_z, rangex, localx, localy, tex_localx, tex_localy, tile); diff -r 4435c9990988 -r f88744ee9350 TaskManager/Test/test_render/spe/Load_Texture.cpp --- a/TaskManager/Test/test_render/spe/Load_Texture.cpp Wed Jul 29 15:09:36 2009 +0900 +++ b/TaskManager/Test/test_render/spe/Load_Texture.cpp Wed Jul 29 16:34:26 2009 +0900 @@ -27,9 +27,14 @@ = smanager->global_alloc(GLOBAL_TEXTURE_HASH, sizeof(TileHash)); new(hash_tmp) TileHash; +#ifdef USE_MEMLIST + void *tileList_tmp + = smanager->global_alloc(GLOBAL_TILE_LIST, sizeof(MemList)); + new(tileList_tmp) MemList; +#else void *tileList_tmp = smanager->global_alloc(GLOBAL_TILE_LIST, sizeof(TileList)); new(tileList_tmp) TileList; - +#endif return 0; } diff -r 4435c9990988 -r f88744ee9350 TaskManager/Test/test_render/task/DrawSpan.cpp --- a/TaskManager/Test/test_render/task/DrawSpan.cpp Wed Jul 29 15:09:36 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawSpan.cpp Wed Jul 29 16:34:26 2009 +0900 @@ -128,7 +128,7 @@ */ TilePtr DrawSpan::isAvailableTile(uint32 *addr) -{ +{ return hash->get(addr); } @@ -137,10 +137,15 @@ { TilePtr tile; - +#ifdef USE_MEMLIST + tile = tileList->getLast(); + tileList->remove(tile); +#else tile = tileList->nextTile(); - uint32 *old_addr = tile->texture_addr; - smanager->dma_load(tile->pixel, (uint32)addr, +#endif + + uint32 *old_addr = tile->address; + smanager->dma_load(tile->data, (uint32)addr, sizeof(uint32)*TEXTURE_BLOCK_SIZE, tag); /** * FIFO なので、もし前のが残っていれば削除 @@ -148,9 +153,9 @@ hash->remove(old_addr); - tile->texture_addr = addr; + tile->address = addr; - hash->put(tile->texture_addr, tile); + hash->put(tile->address, tile); return tile; } @@ -158,7 +163,7 @@ uint32 DrawSpan::get_rgb(int tx, int ty, TilePtr tile) { - return tile->pixel[(TEXTURE_SPLIT_PIXEL)*ty+tx]; + return tile->data[(TEXTURE_SPLIT_PIXEL)*ty+tx]; } /** @@ -303,11 +308,16 @@ tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; TilePtr tile; - if (!(tile = isAvailableTile(tex_addr))) { + if (!(tile = isAvailableTile(tex_addr))) { tile = set_rgb(tex_addr, wait_tag); smanager->dma_wait(wait_tag); //return startx; } +#ifdef USE_MEMLIST + else { + tileList->moveToFirst(tile); + } +#endif updateBuffer(zpos, rangex, localx, localy, tex_localx, tex_localy, @@ -409,6 +419,11 @@ tile = set_rgb(tex_addr, wait_tag); smanager->dma_wait(wait_tag); } +#ifdef USE_MEMLIST + else { + tileList->moveToFirst(tile); + } +#endif updateBuffer(tex_z, rangex, localx, localy, tex_localx, tex_localy, diff -r 4435c9990988 -r f88744ee9350 TaskManager/Test/test_render/task/TileHash.cpp --- a/TaskManager/Test/test_render/task/TileHash.cpp Wed Jul 29 15:09:36 2009 +0900 +++ b/TaskManager/Test/test_render/task/TileHash.cpp Wed Jul 29 16:34:26 2009 +0900 @@ -58,7 +58,7 @@ int index = (hashval + i*i)%hashSize; if (table[index] != NULL && - table[index]->texture_addr == key) { + table[index]->address == key) { return table[index]; } } @@ -75,7 +75,7 @@ int index = (hashval + i*i)%hashSize; if (table[index] != NULL && - table[index]->texture_addr == key) { + table[index]->address == key) { table[index] = NULL; } }