mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-17 04:39:34 +00:00
softgpu: Refactor duplicate rectangle compat check.
This just moves the logic to a single place for changes.
This commit is contained in:
parent
a2ca85bc87
commit
6004d4a459
@ -321,26 +321,32 @@ bool RectangleFastPath(const VertexData &v0, const VertexData &v1, BinManager &b
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool AreCoordsRectangleCompatible(const RasterizerState &state, const VertexData &data0, const VertexData &data1) {
|
||||
if (!(data1.color0 == data0.color0))
|
||||
return false;
|
||||
if (!(data1.screenpos.z == data0.screenpos.z)) {
|
||||
// Sometimes, we don't actually care about z.
|
||||
if (state.pixelID.depthWrite || state.pixelID.DepthTestFunc() != GE_COMP_ALWAYS)
|
||||
return false;
|
||||
}
|
||||
if (!state.throughMode) {
|
||||
if (!state.throughMode && !(data1.color1 == data0.color1))
|
||||
return false;
|
||||
// Do we have to think about perspective correction or slope mip level?
|
||||
if (state.enableTextures && data1.clippos.w != data0.clippos.w)
|
||||
return false;
|
||||
if (state.pixelID.applyFog && data1.fogdepth != data0.fogdepth)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DetectRectangleFromStrip(const RasterizerState &state, const VertexData data[4], int *tlIndex, int *brIndex) {
|
||||
// Color and Z must be flat. Also find the TL and BR meanwhile.
|
||||
int tl = 0, br = 0;
|
||||
for (int i = 1; i < 4; ++i) {
|
||||
if (!(data[i].color0 == data[0].color0))
|
||||
if (!AreCoordsRectangleCompatible(state, data[i], data[0]))
|
||||
return false;
|
||||
if (!(data[i].screenpos.z == data[0].screenpos.z)) {
|
||||
// Sometimes, we don't actually care about z.
|
||||
if (state.pixelID.depthWrite || state.pixelID.DepthTestFunc() != GE_COMP_ALWAYS)
|
||||
return false;
|
||||
}
|
||||
if (!state.throughMode) {
|
||||
if (!state.throughMode && !(data[i].color1 == data[0].color1))
|
||||
return false;
|
||||
// Do we have to think about perspective correction or slope mip level?
|
||||
if (state.enableTextures && data[i].clippos.w != data[0].clippos.w)
|
||||
return false;
|
||||
if (state.pixelID.applyFog && data[i].fogdepth != data[0].fogdepth)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data[i].screenpos.x <= data[tl].screenpos.x && data[i].screenpos.y <= data[tl].screenpos.y)
|
||||
tl = i;
|
||||
@ -394,22 +400,8 @@ bool DetectRectangleFromStrip(const RasterizerState &state, const VertexData dat
|
||||
bool DetectRectangleFromFan(const RasterizerState &state, const VertexData *data, int c, int *tlIndex, int *brIndex) {
|
||||
// Color and Z must be flat.
|
||||
for (int i = 1; i < c; ++i) {
|
||||
if (!(data[i].color0 == data[0].color0))
|
||||
if (!AreCoordsRectangleCompatible(state, data[i], data[0]))
|
||||
return false;
|
||||
if (!(data[i].screenpos.z == data[0].screenpos.z)) {
|
||||
// Sometimes, we don't actually care about z.
|
||||
if (state.pixelID.depthWrite || state.pixelID.DepthTestFunc() != GE_COMP_ALWAYS)
|
||||
return false;
|
||||
}
|
||||
if (!state.throughMode) {
|
||||
if (!state.throughMode && !(data[i].color1 == data[0].color1))
|
||||
return false;
|
||||
// Do we have to think about perspective correction or slope mip level?
|
||||
if (state.enableTextures && data[i].clippos.w != data[0].clippos.w)
|
||||
return false;
|
||||
if (state.pixelID.applyFog && data[i].fogdepth != data[0].fogdepth)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for the common case: a single TL-TR-BR-BL.
|
||||
|
@ -838,7 +838,7 @@ void SoftGPU::Execute_Prim(u32 op, u32 diff) {
|
||||
return;
|
||||
}
|
||||
|
||||
const void *verts = Memory::GetPointer(gstate_c.vertexAddr);
|
||||
const void *verts = Memory::GetPointerUnchecked(gstate_c.vertexAddr);
|
||||
const void *indices = NULL;
|
||||
if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) {
|
||||
if (!Memory::IsValidAddress(gstate_c.indexAddr)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user