From fc480443234c828c0c8eff3c37355327cb81761d Mon Sep 17 00:00:00 2001 From: Stefanos Kornilios Mitsis Poiitidis Date: Fri, 25 Apr 2014 19:57:34 +0300 Subject: [PATCH] Stored TA command stream persists on TA_LIST_INIT, until first actual write. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #141, "Main menus on POD and Speed Devil show up black" Seems like the TA doesn't touch any of the memory structures before first write (and probably later on, but we're not gonna support corrupted ta streams for now) According to p1pkin «At least in SpeedDevils, at title screen game do a bit weird thing - Init TA context - Send lists to TA - Init the same context again - Start Render so, if you are clear stored poly/vertex data at "TA_LIST_INIT" pvr2 reg write - you'll get black screen instead game title» --- core/hw/pvr/ta.cpp | 2 +- core/hw/pvr/ta_ctx.cpp | 3 +-- core/hw/pvr/ta_ctx.h | 24 +++++++++++++++++++++--- 3 files changed, 23 insertions(+), 6 deletions(-) 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 )