Mercurial > hg > Members > kono > Cerium
changeset 151:5179a90fb610
fix
author | gongo@gendarme.local |
---|---|
date | Tue, 02 Dec 2008 19:14:52 +0900 |
parents | bbf774c57544 |
children | a59868d37093 |
files | TaskManager/Test/test_render/Makefile.def TaskManager/Test/test_render/task/CreateSpan.cpp TaskManager/Test/test_render/task/DrawSpan.cpp |
diffstat | 3 files changed, 73 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Test/test_render/Makefile.def Tue Dec 02 19:10:34 2008 +0900 +++ b/TaskManager/Test/test_render/Makefile.def Tue Dec 02 19:14:52 2008 +0900 @@ -3,10 +3,10 @@ # include/library path # ex: macosx #CERIUM = /Users/gongo/Source/Concurrency/Game_project/Cerium -#CERIUM = /Users/gongo/Source/hg/Cerium +CERIUM = /Users/gongo/Source/hg/Cerium # ex: linux/ps3 -CERIUM = /home/gongo/Cerium +#CERIUM = /home/gongo/Cerium #CERIUM = ../../..
--- a/TaskManager/Test/test_render/task/CreateSpan.cpp Tue Dec 02 19:10:34 2008 +0900 +++ b/TaskManager/Test/test_render/task/CreateSpan.cpp Tue Dec 02 19:14:52 2008 +0900 @@ -122,10 +122,12 @@ tile->tix = tex_xpos; tile->tiy = tex_ypos; + tile->tile = span->tex_addr; + tile->padding = 1; } else { - while (cur_x < span->length_x) { - if (cur_x + MAX_TILE_LIST < span->length_x) { - len = MAX_TILE_LIST; + while (cur_x <= span->length_x) { + if (cur_x + MAX_TILE_LIST - 1 < span->length_x) { + len = MAX_TILE_LIST - 1; smanager->mainMem_alloc(TILE_ALLOCATE, sizeof(TileInfoList)); } else { len = span->length_x - cur_x; @@ -135,21 +137,28 @@ tilelist->init(); - for (int i = cur_x; i < cur_x + len; i++) { - tile = &tilelist->tileinfo[tilelist->size++]; - + for (int i = cur_x; i <= cur_x + len; i++) { tex_x = tex1*(end-1-i)/(end-1) + tex2*i/(end-1); tex_y = tey1*(end-1-i)/(end-1) + tey2*i/(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); + tex_xpos = (int)((span->tex_width-1) * tex_x); + tex_ypos = (int)((span->tex_height-1) * tex_y); + tile = &tilelist->tileinfo[tilelist->size++]; tile->tix = tex_xpos; tile->tiy = tex_ypos; + tile->padding = i; + + int blockX = tex_xpos / TEXTURE_SPLIT_PIXEL; + int blockY = tex_ypos / TEXTURE_SPLIT_PIXEL; + int block = blockX + (span->tex_width/TEXTURE_SPLIT_PIXEL)*blockY; + uint32 *addr = (uint32*)span->tex_addr; + tile->tile = (void*)(addr + block*64); + //tile->tile = span->tex_addr; } - if (cur_x + MAX_TILE_LIST < span->length_x) { + if (cur_x + MAX_TILE_LIST - 1 < span->length_x) { TileInfoListPtr tmp = tilelist; tilelist = send_tilelist; send_tilelist = tmp; @@ -165,8 +174,6 @@ smanager->dma_wait(TILE_STORE); smanager->dma_store(send_tilelist, (uint32)send_tilelist_addr, sizeof(TileInfoList), TILE_STORE); - - tilelist->init(); } cur_x += MAX_TILE_LIST;
--- a/TaskManager/Test/test_render/task/DrawSpan.cpp Tue Dec 02 19:10:34 2008 +0900 +++ b/TaskManager/Test/test_render/task/DrawSpan.cpp Tue Dec 02 19:14:52 2008 +0900 @@ -114,13 +114,17 @@ if (th-1< ty) ty = th-1 ; void *texture_addr; + TilePtr tile; +#if 0 int blockX = tx / TEXTURE_SPLIT_PIXEL; int blockY = ty / TEXTURE_SPLIT_PIXEL; void** addrList = (void**)global_get(TEXTURE2_ID); - TilePtr tile; texture_addr = addrList[blockX + (tw/TEXTURE_SPLIT_PIXEL)*blockY]; +#else + texture_addr = texture; +#endif /** * get,put はオブジェクト(Hashとか?)を作ってアクセスするかな @@ -181,7 +185,6 @@ (TileInfoListPtr)smanager->allocate(sizeof(TileInfoList)); TileInfoListPtr next_tilist = (TileInfoListPtr)smanager->allocate(sizeof(TileInfoList)); - TileInfoListPtr tmp_tilist = NULL; TileInfoPtr tinfo; @@ -250,10 +253,24 @@ 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_zpos = (int)z; +#if 0 + if (tex_xpos != tilist->tileinfo[0].tix + && tex_xpos != tilist->tileinfo[0].tix) { + fprintf(stderr, "1: (%3d, %3d), (%3d, %3d)\n", + tex_xpos, tex_ypos, tilist->tileinfo[0].tix, + tilist->tileinfo[0].tiy); + } +#endif + + tex_xpos = tilist->tileinfo[0].tix; + tex_ypos = tilist->tileinfo[0].tiy; + texture_image = tilist->tileinfo[0].tile; + if (zpos < zRow[localx + (rangex * localy)]) { rgb = get_rgb(tex_xpos, tex_ypos, span->tex_width, span->tex_height, texture_image); @@ -270,31 +287,38 @@ int max_x = je; int len; + /** + * Span は表示しない範囲([js..je]) の TileInfoList を + * 持っているので、それは飛ばす + */ while (cur_x + MAX_TILE_LIST < js) { + smanager->dma_load(next_tilist, (uint32)tilist->next, + sizeof(TileInfoList), TILE_INFO_LOAD); smanager->dma_wait(TILE_INFO_LOAD); - smanager->dma_load(tilist, (uint32)tilist->next, - sizeof(TileInfoList), TILE_INFO_LOAD); + + TileInfoListPtr tmp = tilist; + tilist = next_tilist; + next_tilist = tmp; + cur_x += MAX_TILE_LIST; } cur_x = js; - while (cur_x < max_x) { - smanager->dma_wait(TILE_INFO_LOAD); - - if (cur_x + MAX_TILE_LIST < max_x) { + while (cur_x <= max_x) { + if (cur_x + MAX_TILE_LIST - 1 < max_x) { smanager->dma_load(next_tilist, (uint32)tilist->next, - sizeof(TileInfoList), TILE_INFO_LOAD); - len = MAX_TILE_LIST; + sizeof(TileInfoList), + TILE_INFO_LOAD); + len = MAX_TILE_LIST - 1; } else { len = max_x - cur_x; } - + float tex_x, tex_y, tex_z; for (int j = cur_x; j <= cur_x + len; j++) { localx = getLocalX(x-1+j); - 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); @@ -303,6 +327,23 @@ if (tex_y > 1) tex_y = 1; tex_xpos = (int)((span->tex_width-1) * tex_x); tex_ypos = (int)((span->tex_height-1) * tex_y); + +#if 0 + if (tex_xpos != tilist->tileinfo[j%MAX_TILE_LIST].tix + && tex_xpos != tilist->tileinfo[j%MAX_TILE_LIST].tix) { + fprintf(stderr, "size = %d\n", tilist->size); + fprintf(stderr, "(%3d ..%3d) %d, %d %d\n", + x, x + x_len, js, max_x, j%MAX_TILE_LIST); + fprintf(stderr, "(%3d, %3d), (%3d, %3d)\n", + tex_xpos, tex_ypos, + tilist->tileinfo[j%MAX_TILE_LIST].tix, + tilist->tileinfo[j%MAX_TILE_LIST].tiy); + } +#endif + + tex_xpos = tilist->tileinfo[j%MAX_TILE_LIST].tix; + tex_ypos = tilist->tileinfo[j%MAX_TILE_LIST].tiy; + texture_image = tilist->tileinfo[j%MAX_TILE_LIST].tile; if (tex_z < zRow[localx + (rangex*localy)]) { rgb = get_rgb(tex_xpos, tex_ypos, span->tex_width,