mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge branch 'VideoSoftware-savestates'
This commit is contained in:
commit
0c16489c39
@ -71,7 +71,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
|
||||
static std::thread g_save_thread;
|
||||
|
||||
// Don't forget to increase this after doing changes on the savestate system
|
||||
static const u32 STATE_VERSION = 14;
|
||||
static const u32 STATE_VERSION = 15;
|
||||
|
||||
struct StateHeader
|
||||
{
|
||||
|
@ -186,6 +186,11 @@ void VideoBackendHardware::InitializeShared()
|
||||
// Run from the CPU thread
|
||||
void VideoBackendHardware::DoState(PointerWrap& p)
|
||||
{
|
||||
bool software = false;
|
||||
p.Do(software);
|
||||
if (p.GetMode() == PointerWrap::MODE_READ && software == true)
|
||||
// change mode to abort load of incompatible save state.
|
||||
p.SetMode(PointerWrap::MODE_VERIFY);
|
||||
VideoCommon_DoState(p);
|
||||
p.DoMarker("VideoCommon");
|
||||
|
||||
|
@ -65,6 +65,13 @@ namespace Clipper
|
||||
OutputVertexData ClippedVertices[NUM_CLIPPED_VERTICES];
|
||||
OutputVertexData *Vertices[NUM_INDICES];
|
||||
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
p.DoArray(m_ViewOffset,2);
|
||||
for (int i = 0; i< NUM_CLIPPED_VERTICES; ++i)
|
||||
ClippedVertices[i].DoState(p);
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
for (int i = 0; i < NUM_CLIPPED_VERTICES; ++i)
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "NativeVertexFormat.h"
|
||||
#include "ChunkFile.h"
|
||||
|
||||
|
||||
namespace Clipper
|
||||
@ -36,6 +37,8 @@ namespace Clipper
|
||||
bool CullTest(OutputVertexData *v0, OutputVertexData *v1, OutputVertexData *v2, bool &backface);
|
||||
|
||||
void PerspectiveDivide(OutputVertexData *vertex);
|
||||
|
||||
void DoState(PointerWrap &p);
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,6 +28,7 @@ u8 efb[EFB_WIDTH*EFB_HEIGHT*6];
|
||||
|
||||
namespace EfbInterface
|
||||
{
|
||||
|
||||
u8 efbColorTexture[EFB_WIDTH*EFB_HEIGHT*4];
|
||||
|
||||
inline u32 GetColorOffset(u16 x, u16 y)
|
||||
@ -40,6 +41,12 @@ namespace EfbInterface
|
||||
return (x + y * EFB_WIDTH) * 3 + DEPTH_BUFFER_START;
|
||||
}
|
||||
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
p.DoArray(efb, EFB_WIDTH*EFB_HEIGHT*6);
|
||||
p.DoArray(efbColorTexture, EFB_WIDTH*EFB_HEIGHT*4);
|
||||
}
|
||||
|
||||
void SetPixelAlphaOnly(u32 offset, u8 a)
|
||||
{
|
||||
switch (bpmem.zcontrol.pixel_format)
|
||||
|
@ -47,6 +47,7 @@ namespace EfbInterface
|
||||
|
||||
void UpdateColorTexture();
|
||||
extern u8 efbColorTexture[EFB_WIDTH*EFB_HEIGHT*4]; // RGBA format
|
||||
void DoState(PointerWrap &p);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define _NATIVEVERTEXFORMAT_H
|
||||
|
||||
#include "Vec3.h"
|
||||
#include "ChunkFile.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define LOADERDECL __cdecl
|
||||
@ -92,6 +93,18 @@ struct OutputVertexData
|
||||
#undef LINTERP
|
||||
#undef LINTERP_INT
|
||||
}
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
mvPosition.DoState(p);
|
||||
p.Do(projectedPosition);
|
||||
screenPosition.DoState(p);
|
||||
for (int i = 0; i < 3;++i)
|
||||
normal[i].DoState(p);
|
||||
p.DoArray(color, sizeof color);
|
||||
for (int i = 0; i < 8;++i)
|
||||
texCoords[i].DoState(p);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -35,7 +35,6 @@ typedef void (*DecodingFunction)(u32);
|
||||
|
||||
namespace OpcodeDecoder
|
||||
{
|
||||
|
||||
static DecodingFunction currentFunction = NULL;
|
||||
static u32 minCommandSize;
|
||||
static u16 streamSize;
|
||||
@ -46,6 +45,20 @@ static bool inObjectStream;
|
||||
static u8 lastPrimCmd;
|
||||
|
||||
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(minCommandSize);
|
||||
// Not sure what is wrong with this. Something(s) in here is causing dolphin to crash/hang when loading states saved from another run of dolphin. Doesn't seem too important anyway...
|
||||
//vertexLoader.DoState(p);
|
||||
p.Do(readOpcode);
|
||||
p.Do(inObjectStream);
|
||||
p.Do(lastPrimCmd);
|
||||
p.Do(streamSize);
|
||||
p.Do(streamAddress);
|
||||
if (p.GetMode() == PointerWrap::MODE_READ)
|
||||
ResetDecoding();
|
||||
}
|
||||
|
||||
void DecodePrimitiveStream(u32 iBufferSize)
|
||||
{
|
||||
u32 vertexSize = vertexLoader.GetVertexSize();
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define _OPCODEDECODER_H_
|
||||
|
||||
#include "CommonTypes.h"
|
||||
#include "ChunkFile.h"
|
||||
|
||||
namespace OpcodeDecoder
|
||||
{
|
||||
@ -57,6 +58,8 @@ namespace OpcodeDecoder
|
||||
bool CommandRunnable(u32 iBufferSize);
|
||||
|
||||
void Run(u32 iBufferSize);
|
||||
|
||||
void DoState(PointerWrap &p);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -62,6 +62,28 @@ s32 scissorBottom = 0;
|
||||
Tev tev;
|
||||
RasterBlock rasterBlock;
|
||||
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
ZSlope.DoState(p);
|
||||
WSlope.DoState(p);
|
||||
for (int i=0;i<2;++i)
|
||||
for (int n=0; n<4; ++n)
|
||||
ColorSlopes[i][n].DoState(p);
|
||||
for (int i=0;i<8;++i)
|
||||
for (int n=0; n<3; ++n)
|
||||
TexSlopes[i][n].DoState(p);
|
||||
p.Do(vertex0X);
|
||||
p.Do(vertex0Y);
|
||||
p.Do(vertexOffsetX);
|
||||
p.Do(vertexOffsetY);
|
||||
p.Do(scissorLeft);
|
||||
p.Do(scissorTop);
|
||||
p.Do(scissorRight);
|
||||
p.Do(scissorBottom);
|
||||
tev.DoState(p);
|
||||
p.Do(rasterBlock);
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
tev.Init();
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define _RASTERIZER_H_
|
||||
|
||||
#include "NativeVertexFormat.h"
|
||||
#include "ChunkFile.h"
|
||||
|
||||
namespace Rasterizer
|
||||
{
|
||||
@ -37,6 +38,12 @@ namespace Rasterizer
|
||||
float f0;
|
||||
|
||||
float GetValue(float dx, float dy) { return f0 + (dfdx * dx) + (dfdy * dy); }
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(dfdx);
|
||||
p.Do(dfdy);
|
||||
p.Do(f0);
|
||||
}
|
||||
};
|
||||
|
||||
struct RasterBlockPixel
|
||||
@ -53,6 +60,8 @@ namespace Rasterizer
|
||||
s32 TextureLod[16];
|
||||
bool TextureLinear[16];
|
||||
};
|
||||
|
||||
void DoState(PointerWrap &p);
|
||||
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,15 @@ CPReg cpreg; // shared between gfx and emulator thread
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(cpreg);
|
||||
p.DoArray(commandBuffer, commandBufferSize);
|
||||
p.Do(readPos);
|
||||
p.Do(writePos);
|
||||
p.Do(et_UpdateInterrupts);
|
||||
p.Do(interruptSet);
|
||||
p.Do(interruptWaiting);
|
||||
|
||||
// Is this right?
|
||||
p.DoArray(g_pVideoData,writePos);
|
||||
}
|
||||
|
||||
// does it matter that there is no synchronization between threads during writes?
|
||||
|
@ -53,6 +53,8 @@ void DoState(PointerWrap &p)
|
||||
p.Do(pereg);
|
||||
p.Do(g_bSignalTokenInterrupt);
|
||||
p.Do(g_bSignalFinishInterrupt);
|
||||
p.Do(et_SetTokenOnMainThread);
|
||||
p.Do(et_SetFinishOnMainThread);
|
||||
}
|
||||
|
||||
void UpdateInterrupts();
|
||||
|
@ -328,4 +328,15 @@ void SWVertexLoader::LoadTexCoord(SWVertexLoader *vertexLoader, InputVertexData
|
||||
vertexLoader->m_texCoordLoader[index]();
|
||||
}
|
||||
|
||||
|
||||
void SWVertexLoader::DoState(PointerWrap &p)
|
||||
{
|
||||
p.DoArray(m_AttributeLoaders, sizeof m_AttributeLoaders);
|
||||
p.Do(m_VertexSize);
|
||||
p.Do(*m_CurrentVat);
|
||||
p.Do(m_positionLoader);
|
||||
p.Do(m_normalLoader);
|
||||
p.DoArray(m_colorLoader, sizeof m_colorLoader);
|
||||
p.Do(m_NumAttributeLoaders);
|
||||
m_SetupUnit->DoState(p);
|
||||
p.Do(m_TexGenSpecialCase);
|
||||
}
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "NativeVertexFormat.h"
|
||||
#include "CPMemLoader.h"
|
||||
#include "ChunkFile.h"
|
||||
|
||||
class SetupUnit;
|
||||
|
||||
@ -69,7 +70,7 @@ public:
|
||||
u32 GetVertexSize() { return m_VertexSize; }
|
||||
|
||||
void LoadVertex();
|
||||
|
||||
void DoState(PointerWrap &p);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -39,6 +39,9 @@
|
||||
#include "FileUtil.h"
|
||||
#include "VideoBackend.h"
|
||||
#include "Core.h"
|
||||
#include "OpcodeDecoder.h"
|
||||
#include "SWVertexLoader.h"
|
||||
#include "SWStatistics.h"
|
||||
|
||||
#define VSYNC_ENABLED 0
|
||||
|
||||
@ -93,9 +96,33 @@ bool VideoSoftware::Initialize(void *&window_handle)
|
||||
return true;
|
||||
}
|
||||
|
||||
void VideoSoftware::DoState(PointerWrap&)
|
||||
void VideoSoftware::DoState(PointerWrap& p)
|
||||
{
|
||||
// NYI
|
||||
bool software = true;
|
||||
p.Do(software);
|
||||
if (p.GetMode() == PointerWrap::MODE_READ && software == false)
|
||||
// change mode to abort load of incompatible save state.
|
||||
p.SetMode(PointerWrap::MODE_VERIFY);
|
||||
|
||||
// TODO: incomplete?
|
||||
SWCommandProcessor::DoState(p);
|
||||
SWPixelEngine::DoState(p);
|
||||
EfbInterface::DoState(p);
|
||||
OpcodeDecoder::DoState(p);
|
||||
Clipper::DoState(p);
|
||||
p.Do(swxfregs);
|
||||
p.Do(bpmem);
|
||||
p.Do(swstats);
|
||||
|
||||
// CP Memory
|
||||
p.DoArray(arraybases, 16);
|
||||
p.DoArray(arraystrides, 16);
|
||||
p.Do(MatrixIndexA);
|
||||
p.Do(MatrixIndexB);
|
||||
p.Do(g_VtxDesc.Hex);
|
||||
p.DoArray(g_VtxAttr, 8);
|
||||
p.DoMarker("CP Memory");
|
||||
|
||||
}
|
||||
|
||||
void VideoSoftware::CheckInvalidState()
|
||||
|
@ -25,13 +25,13 @@
|
||||
|
||||
void SetupUnit::Init(u8 primitiveType)
|
||||
{
|
||||
m_PrimType = primitiveType;
|
||||
m_PrimType = primitiveType;
|
||||
|
||||
m_VertexCounter = 0;
|
||||
m_VertPointer[0] = &m_Vertices[0];
|
||||
m_VertPointer[1] = &m_Vertices[1];
|
||||
m_VertPointer[2] = &m_Vertices[2];
|
||||
m_VertWritePointer = m_VertPointer[0];
|
||||
m_VertexCounter = 0;
|
||||
m_VertPointer[0] = &m_Vertices[0];
|
||||
m_VertPointer[1] = &m_Vertices[1];
|
||||
m_VertPointer[2] = &m_Vertices[2];
|
||||
m_VertWritePointer = m_VertPointer[0];
|
||||
}
|
||||
|
||||
void SetupUnit::SetupVertex()
|
||||
@ -169,3 +169,21 @@ void SetupUnit::SetupLineStrip()
|
||||
|
||||
void SetupUnit::SetupPoint()
|
||||
{}
|
||||
|
||||
void SetupUnit::DoState(PointerWrap &p)
|
||||
{
|
||||
// TODO: some or all of this is making the save states stop working once dolphin is closed...sometimes (usually)
|
||||
// I have no idea what specifically is wrong, or if this is even important. Disabling it doesn't seem to make any noticible difference...
|
||||
/* p.Do(m_PrimType);
|
||||
p.Do(m_VertexCounter);
|
||||
for (int i = 0; i < 3; ++i)
|
||||
m_Vertices[i].DoState(p);
|
||||
|
||||
if (p.GetMode() == PointerWrap::MODE_READ)
|
||||
{
|
||||
m_VertPointer[0] = &m_Vertices[0];
|
||||
m_VertPointer[1] = &m_Vertices[1];
|
||||
m_VertPointer[2] = &m_Vertices[2];
|
||||
m_VertWritePointer = m_VertPointer[0];
|
||||
}*/
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "NativeVertexFormat.h"
|
||||
#include "ChunkFile.h"
|
||||
|
||||
class SetupUnit
|
||||
{
|
||||
@ -45,6 +46,7 @@ public:
|
||||
OutputVertexData* GetVertex() { return m_VertWritePointer; }
|
||||
|
||||
void SetupVertex();
|
||||
void DoState(PointerWrap &p);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -827,3 +827,31 @@ void Tev::SetRegColor(int reg, int comp, bool konst, s16 color)
|
||||
Reg[reg][comp] = color;
|
||||
}
|
||||
}
|
||||
|
||||
void Tev::DoState(PointerWrap &p)
|
||||
{
|
||||
p.DoArray(Reg, sizeof(Reg));
|
||||
|
||||
p.DoArray(KonstantColors, sizeof(KonstantColors));
|
||||
p.DoArray(TexColor,4);
|
||||
p.DoArray(RasColor,4);
|
||||
p.DoArray(StageKonst,4);
|
||||
p.DoArray(Zero16,4);
|
||||
|
||||
p.DoArray(FixedConstants,9);
|
||||
p.Do(AlphaBump);
|
||||
p.DoArray(IndirectTex, sizeof(IndirectTex));
|
||||
p.Do(TexCoord);
|
||||
|
||||
p.DoArray(m_BiasLUT,4);
|
||||
p.DoArray(m_ScaleLShiftLUT,4);
|
||||
p.DoArray(m_ScaleRShiftLUT,4);
|
||||
|
||||
p.DoArray(Position,3);
|
||||
p.DoArray(Color, sizeof(Color));
|
||||
p.DoArray(Uv, 8);
|
||||
p.DoArray(IndirectLod,4);
|
||||
p.DoArray(IndirectLinear,4);
|
||||
p.DoArray(TextureLod,16);
|
||||
p.DoArray(TextureLinear,16);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define _TEV_H_
|
||||
|
||||
#include "BPMemLoader.h"
|
||||
#include "ChunkFile.h"
|
||||
|
||||
class Tev
|
||||
{
|
||||
@ -96,6 +97,8 @@ public:
|
||||
void SetRegColor(int reg, int comp, bool konst, s16 color);
|
||||
|
||||
enum { ALP_C, BLU_C, GRN_C, RED_C };
|
||||
|
||||
void DoState(PointerWrap &p);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "ChunkFile.h"
|
||||
|
||||
class Vec3
|
||||
{
|
||||
@ -111,6 +112,12 @@ public:
|
||||
{
|
||||
memset((void *)this,0,sizeof(float)*3);
|
||||
}
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(x);
|
||||
p.Do(y);
|
||||
p.Do(z);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user