Move vertex serialization into its own method
This commit is contained in:
parent
51d32f1106
commit
2c921ba024
|
@ -279,6 +279,19 @@ std::unique_ptr<GPU3D::Renderer3D> CurrentRenderer = {};
|
|||
|
||||
bool AbortFrame;
|
||||
|
||||
void Vertex::DoSavestate(Savestate* file) noexcept
|
||||
{
|
||||
file->VarArray(Position, sizeof(Position));
|
||||
file->VarArray(Color, sizeof(Color));
|
||||
file->VarArray(TexCoords, sizeof(TexCoords));
|
||||
|
||||
file->Bool32(&Clipped);
|
||||
|
||||
file->VarArray(FinalPosition, sizeof(FinalPosition));
|
||||
file->VarArray(FinalColor, sizeof(FinalColor));
|
||||
file->VarArray(HiresPosition, sizeof(HiresPosition));
|
||||
}
|
||||
|
||||
bool Init()
|
||||
{
|
||||
return true;
|
||||
|
@ -474,18 +487,9 @@ void DoSavestate(Savestate* file)
|
|||
file->Var32(&VertexNumInPoly);
|
||||
file->Var32(&NumConsecutivePolygons);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (Vertex& vtx : TempVertexBuffer)
|
||||
{
|
||||
Vertex* vtx = &TempVertexBuffer[i];
|
||||
|
||||
file->VarArray(vtx->Position, sizeof(s32)*4);
|
||||
file->VarArray(vtx->Color, sizeof(s32)*3);
|
||||
file->VarArray(vtx->TexCoords, sizeof(s16)*2);
|
||||
|
||||
file->Bool32(&vtx->Clipped);
|
||||
|
||||
file->VarArray(vtx->FinalPosition, sizeof(s32)*2);
|
||||
file->VarArray(vtx->FinalColor, sizeof(s32)*3);
|
||||
vtx.DoSavestate(file);
|
||||
}
|
||||
|
||||
if (file->Saving)
|
||||
|
@ -511,18 +515,9 @@ void DoSavestate(Savestate* file)
|
|||
file->Var32(&FlushRequest);
|
||||
file->Var32(&FlushAttributes);
|
||||
|
||||
for (int i = 0; i < 6144*2; i++)
|
||||
for (Vertex& vtx : VertexRAM)
|
||||
{
|
||||
Vertex* vtx = &VertexRAM[i];
|
||||
|
||||
file->VarArray(vtx->Position, sizeof(s32)*4);
|
||||
file->VarArray(vtx->Color, sizeof(s32)*3);
|
||||
file->VarArray(vtx->TexCoords, sizeof(s16)*2);
|
||||
|
||||
file->Bool32(&vtx->Clipped);
|
||||
|
||||
file->VarArray(vtx->FinalPosition, sizeof(s32)*2);
|
||||
file->VarArray(vtx->FinalColor, sizeof(s32)*3);
|
||||
vtx.DoSavestate(file);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 2048*2; i++)
|
||||
|
|
|
@ -46,6 +46,7 @@ struct Vertex
|
|||
// TODO maybe: hi-res color? (that survives clipping)
|
||||
s32 HiresPosition[2];
|
||||
|
||||
void DoSavestate(Savestate* file) noexcept;
|
||||
};
|
||||
|
||||
struct Polygon
|
||||
|
@ -77,6 +78,7 @@ struct Polygon
|
|||
|
||||
u32 SortKey;
|
||||
|
||||
void DoSavestate(Savestate* file) noexcept;
|
||||
};
|
||||
|
||||
extern u32 RenderDispCnt;
|
||||
|
|
Loading…
Reference in New Issue