Unbreak save states, fix other minor issues from review

This commit is contained in:
Henrik Rydgård 2017-11-25 12:13:02 +01:00
parent 5c9436f276
commit b52b8b1329
2 changed files with 19 additions and 9 deletions

View File

@ -1810,8 +1810,15 @@ void GPUCommon::Execute_MorphWeight(u32 op, u32 diff) {
void GPUCommon::Execute_ImmVertexAlphaPrim(u32 op, u32 diff) {
// Safety check.
if (immCount_ >= MAX_IMMBUFFER_SIZE)
if (immCount_ >= MAX_IMMBUFFER_SIZE) {
// Only print once for each overrun.
if (immCount_ == MAX_IMMBUFFER_SIZE) {
ERROR_LOG_REPORT_ONCE(exceed_imm_buffer, G3D, "Exceeded immediate draw buffer size");
}
if (immCount_ < 0x7fffffff) // Paranoia :)
immCount_++;
return;
}
uint32_t data = op & 0xFFFFFF;
TransformedVertex &v = immBuffer_[immCount_++];
@ -1822,19 +1829,21 @@ void GPUCommon::Execute_ImmVertexAlphaPrim(u32 op, u32 diff) {
v.x = ((gstate.imm_vscx & 0xFFFFFF) - offsetX) / 16.0f;
v.y = ((gstate.imm_vscy & 0xFFFFFF) - offsetY) / 16.0f;
v.z = gstate.imm_vscz & 0xFFFF;
v.u = 0.0f; // we have no information about the scale here
v.v = 0.0f; // we have no information about the scale here
v.w = 0.0f; // we have no information about the scale here
v.u = getFloat24(gstate.imm_vtcs);
v.v = getFloat24(gstate.imm_vtct);
v.w = getFloat24(gstate.imm_vtcq);
v.color0_32 = (gstate.imm_cv & 0xFFFFFF) | (gstate.imm_ap << 24);
v.fog = 0.0f; // we have no information about the scale here
v.color1_32 = gstate.imm_scv & 0xFFFFFF;
int prim = (op >> 8) & 0xF;
if (prim != 7) {
int prim = (op >> 8) & 0x7;
if (prim != GE_PRIM_KEEP_PREVIOUS) {
immPrim_ = (GEPrimitiveType)prim;
} else if (prim == 7 && immCount_ == 2) {
} else if (prim == GE_PRIM_KEEP_PREVIOUS && immCount_ == 2) {
// Instead of finding a proper point to flush, we just emit a full rectangle every time one
// is finished.
FlushImm();
} else {
ERROR_LOG_REPORT_ONCE(imm_draw_prim, G3D, "Immediate draw: Unexpected primitive %d at count %d", prim, immCount_);
}
}

View File

@ -196,8 +196,9 @@ struct GPUgstate {
imm_cv,
imm_ap,
imm_fc,
imm_scv;
u32 pad05[0xFF- 0xEE];
imm_scv; // 0xF9
// In the unlikely case we ever add anything else here, don't forget to update the padding on the next line!
u32 pad05[0xFF- 0xF9];
};
};