diff --git a/core/hw/pvr/ta.cpp b/core/hw/pvr/ta.cpp index bb0ac5425..23c4d3db0 100644 --- a/core/hw/pvr/ta.cpp +++ b/core/hw/pvr/ta.cpp @@ -264,7 +264,7 @@ void ta_vtx_ListCont() void ta_vtx_ListInit() { SetCurrentTARC(TA_ISP_BASE); - ta_tad.Clear(); + ta_tad.ClearPartial(); ta_cur_state=TAS_NS; } diff --git a/core/hw/pvr/ta_ctx.cpp b/core/hw/pvr/ta_ctx.cpp index d5d22b4e9..2017f151f 100644 --- a/core/hw/pvr/ta_ctx.cpp +++ b/core/hw/pvr/ta_ctx.cpp @@ -32,8 +32,7 @@ void SetCurrentTARC(u32 addr) //clear context ta_ctx=0; - ta_tad.thd_data=0; - ta_tad.thd_root=0; + ta_tad.Reset(0); } } diff --git a/core/hw/pvr/ta_ctx.h b/core/hw/pvr/ta_ctx.h index 8aa34ed31..5fcfb595a 100644 --- a/core/hw/pvr/ta_ctx.h +++ b/core/hw/pvr/ta_ctx.h @@ -46,11 +46,29 @@ struct tad_context { u8* thd_data; u8* thd_root; + u8* thd_old_data; void Clear() { - thd_data=thd_root; + thd_old_data = thd_data = thd_root; } + + void ClearPartial() + { + thd_old_data = thd_data; + thd_data = thd_root; + } + + u8* End() + { + return thd_data == thd_root ? thd_old_data : thd_data; + } + + void Reset(u8* ptr) + { + thd_data = thd_root = thd_old_data = ptr; + } + }; struct rend_context @@ -127,11 +145,11 @@ struct TA_context void MarkRend() { rend.proc_start = rend.proc_end; - rend.proc_end = tad.thd_data; + rend.proc_end = tad.End(); } void Alloc() { - tad.thd_root=tad.thd_data=(u8*)malloc(2*1024*1024); + tad.Reset((u8*)malloc(2*1024*1024)); rend.verts.InitBytes(1024*1024,&rend.Overrun); //up to 1 mb of vtx data/frame = ~ 38k vtx/frame rend.idx.Init(60*1024,&rend.Overrun); //up to 60K indexes ( idx have stripification overhead )