Stored TA command stream persists on TA_LIST_INIT, until first actual write.

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»
This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis 2014-04-25 19:57:34 +03:00 committed by ptitSeb
parent ee81dd881e
commit fc48044323
3 changed files with 23 additions and 6 deletions

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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 )