Mercurial > hg > Members > kono > Cerium
diff TaskManager/Test/test_render/spe/DrawSpan.cpp @ 148:9642aeef298d
Span への Texture List の渡し。じゃっかん texture がバグってるので
要チェック
author | gongo@charles.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Tue, 02 Dec 2008 18:49:04 +0900 |
parents | 3ecf43bd1a35 |
children | 77dac07efd79 a59868d37093 |
line wrap: on
line diff
--- a/TaskManager/Test/test_render/spe/DrawSpan.cpp Tue Dec 02 15:47:25 2008 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp Tue Dec 02 18:49:04 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,