Mercurial > hg > Game > Cerium
changeset 1120:377c2dbd6e80 draft
CreateSpan trial and error 2 on PS3.
author | tkaito@henri |
---|---|
date | Fri, 28 Jan 2011 03:37:16 +0900 |
parents | 543c735a98b3 |
children | d6725e0a7b3e |
files | Renderer/Engine/spe/CreateSpan.cc |
diffstat | 1 files changed, 40 insertions(+), 70 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/spe/CreateSpan.cc Fri Jan 28 02:03:58 2011 +0900 +++ b/Renderer/Engine/spe/CreateSpan.cc Fri Jan 28 03:37:16 2011 +0900 @@ -289,8 +289,6 @@ smanager->dma_load(g->spack, (memaddr)spackList[index], sizeof(SpanPack), SPAN_PACK_LOAD); - g->prev_index = index; - //smanager->dma_wait(SPAN_PACK_LOAD); } tmp_xpos = calc(vMid10->x - vMin->x ,div_y, i, vMin->x); @@ -298,6 +296,42 @@ tmp_z = calc(vMid10->z - vMin->z ,div_y, i, vMin->z); tmp_zpos = calc(vMid->z - vMin->z ,div_y, i, vMin->z); + if (index != g->prev_index) { + g->prev_index = index; + smanager->dma_wait(SPAN_PACK_LOAD); + } + + + /** + * 書き込む SpanPack が満杯だったら + * メインメモリで allocate した領域 (next) を持ってきて + * 現在の spack->next につなぎ、next を次の spack とする。 + */ + if (g->spack->info.size >= MAX_SIZE_SPAN) { + SpanPackPtr next; + + __debug_spe("CreateSpan mainMem_alloc 0x%x\n", (unsigned int)sizeof(SpanPack)); + smanager->mainMem_alloc(0, sizeof(SpanPack)); + smanager->mainMem_wait(); + next = (SpanPackPtr)smanager->mainMem_get(0); + __debug_spe("CreateSpan mainMem_allocated 0x%x\n", (unsigned int)next); + + g->spack->next = next; // この部分は TaskManager でやる + + tmp_spack = g->spack; + g->spack = g->send_spack; + g->send_spack = tmp_spack; + + smanager->dma_wait(SPAN_PACK_STORE); + smanager->dma_store(g->send_spack, (memaddr)spackList[index], + sizeof(SpanPack), SPAN_PACK_STORE); + + spackList[index] = next; + + smanager->dma_load(g->spack, (memaddr)spackList[index], + sizeof(SpanPack), SPAN_PACK_LOAD); + } + tmp_tex1 =((i/(div_y)) * vMid10->tex_x) + ( ((div_y - i)/(div_y)) * vMin->tex_x); tmp_tex2 =( (i/(div_y)) * vMid->tex_x) + @@ -327,90 +361,26 @@ start_tex_y = tmp_tey1; end_tex_y = tmp_tey2; } - - smanager->dma_wait(SPAN_PACK_LOAD); - /** - * 書き込む SpanPack が満杯だったら - * メインメモリで allocate した領域 (next) を持ってきて - * 現在の spack->next につなぎ、next を次の spack とする。 - */ - if (g->spack->info.size >= MAX_SIZE_SPAN) { - SpanPackPtr next; - - __debug_spe("CreateSpan mainMem_alloc 0x%x\n", (unsigned int)sizeof(SpanPack)); - smanager->mainMem_alloc(0, sizeof(SpanPack)); - smanager->mainMem_wait(); - next = (SpanPackPtr)smanager->mainMem_get(0); - __debug_spe("CreateSpan mainMem_allocated 0x%x\n", (unsigned int)next); - - g->spack->next = next; // この部分は TaskManager でやる - - tmp_spack = g->spack; - g->spack = g->send_spack; - g->send_spack = tmp_spack; - - smanager->dma_wait(SPAN_PACK_STORE); - smanager->dma_store(g->send_spack, (memaddr)spackList[index], - sizeof(SpanPack), SPAN_PACK_STORE); - - spackList[index] = next; - - smanager->dma_load(g->spack, (memaddr)spackList[index], - sizeof(SpanPack), SPAN_PACK_LOAD); - + if (g->send_spack->info.size >= MAX_SIZE_SPAN) { + smanager->dma_wait(SPAN_PACK_LOAD); g->spack->init((index+1)*split_screen_h); } + } else { /** * 担当範囲外だったら無視 */ continue; } - /* - tmp_xpos = calc(vMid10->x - vMin->x ,div_y, i, vMin->x); - tmp_end = calc(vMid->x - vMin->x ,div_y, i, vMin->x); - tmp_z = calc(vMid10->z - vMin->z ,div_y, i, vMin->z); - tmp_zpos = calc(vMid->z - vMin->z ,div_y, i, vMin->z); - */ length = (tmp_xpos > tmp_end) ? (int)tmp_xpos - (int)tmp_end : (int)tmp_end - (int)tmp_xpos; if (length == 0) { continue; } - /* - tmp_tex1 =((i/(div_y)) * vMid10->tex_x) + - ( ((div_y - i)/(div_y)) * vMin->tex_x); - tmp_tex2 =( (i/(div_y)) * vMid->tex_x) + - ( ((div_y - i)/(div_y)) * vMin->tex_x); - tmp_tey1 =( (i/(div_y)) * vMid10->tex_y) + - ( ((div_y - i)/(div_y)) * vMin->tex_y); - tmp_tey2 =( (i/(div_y)) * vMid->tex_y) + - ( ((div_y - i)/(div_y)) * vMin->tex_y); - - if (tmp_xpos > tmp_end) { - x = (int)tmp_end; - length = (int)(tmp_xpos)-(int)(tmp_end)+1; - start_z = tmp_zpos; - end_z = tmp_z; - start_tex_x = tmp_tex2; - end_tex_x = tmp_tex1; - start_tex_y = tmp_tey2; - end_tex_y = tmp_tey1; - } else { - x = (int)tmp_xpos; - length = (int)(tmp_end)-(int)(tmp_xpos)+1; - start_z = tmp_z; - end_z = tmp_zpos; - start_tex_x = tmp_tex1; - end_tex_x = tmp_tex2; - start_tex_y = tmp_tey1; - end_tex_y = tmp_tey2; - } - */ //smanager->dma_wait(SPAN_PACK_LOAD); Span *span = &g->spack->span[g->spack->info.size++]; @@ -545,7 +515,7 @@ smanager->dma_wait(SPAN_PACK_STORE); smanager->dma_store(g->spack, (memaddr)spackList[g->prev_index], sizeof(SpanPack), SPAN_PACK_STORE); - smanager->dma_wait(SPAN_PACK_STORE); + //smanager->dma_wait(SPAN_PACK_STORE); __debug_spe("CreateSpan spack_stored 0x%x\n",(uint32)spackList[g->prev_index]); // smanager で allocate したのだから free も smanager でやるべき