Skip to content

Commit

Permalink
Simplify gstate_c savestate code a bit.
Browse files Browse the repository at this point in the history
So it's not as awkward to modify.
  • Loading branch information
unknownbrackets committed Apr 13, 2014
1 parent 36c7519 commit 58038c0
Showing 1 changed file with 15 additions and 35 deletions.
50 changes: 15 additions & 35 deletions GPU/GPUState.cpp
Expand Up @@ -267,24 +267,6 @@ struct GPUStateCache_v0

UVScale uv;
bool flipTexture;

float lightpos[4][3];
float lightdir[4][3];
float lightatt[4][3];
float lightColor[3][4][3]; // Ambient Diffuse Specular
float lightangle[4]; // spotlight cone angle (cosine)
float lightspotCoef[4]; // spotlight dropoff
float morphWeights[8];

u32 curTextureWidth;
u32 curTextureHeight;
u32 actualTextureHeight;

float vpWidth;
float vpHeight;

u32 curRTWidth;
u32 curRTHeight;
};

void GPUStateCache::DoState(PointerWrap &p) {
Expand All @@ -301,26 +283,24 @@ void GPUStateCache::DoState(PointerWrap &p) {
textureFullAlpha = old.textureFullAlpha;
vertexFullAlpha = old.vertexFullAlpha;
framebufChanged = old.framebufChanged;
skipDrawReason = old.skipDrawReason;
uv = old.uv;
flipTexture = old.flipTexture;
} else {
p.Do(vertexAddr);
p.Do(indexAddr);
p.Do(offsetAddr);

const size_t oldOffset = offsetof(GPUStateCache_v0, skipDrawReason);
const size_t newOffset = offsetof(GPUStateCache, skipDrawReason);
memcpy((char *)this + newOffset, (char *)&old + oldOffset, sizeof(old) - oldOffset);
return;
}

p.Do(vertexAddr);
p.Do(indexAddr);
p.Do(offsetAddr);

p.Do(textureChanged);
p.Do(textureFullAlpha);
p.Do(vertexFullAlpha);
p.Do(framebufChanged);
p.Do(textureChanged);
p.Do(textureFullAlpha);
p.Do(vertexFullAlpha);
p.Do(framebufChanged);

p.Do(skipDrawReason);
p.Do(skipDrawReason);

p.Do(uv);
p.Do(flipTexture);
p.Do(uv);
p.Do(flipTexture);
}

p.Do(lightpos);
p.Do(lightdir);
Expand Down

0 comments on commit 58038c0

Please sign in to comment.