mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Fix wrong logic causing excessive software transform fallback if cull planes are missing. Minor cleanup.
This commit is contained in:
@@ -416,9 +416,10 @@ static bool TestBoundingBoxFast(const float *worldViewProj, const void *vdata, i
|
||||
}
|
||||
}
|
||||
|
||||
if (AnyCompareBitsSet(anyOutsideMaskZ) || !gstate_c.Use(GPU_USE_CULL_DISTANCE)) {
|
||||
if (AnyCompareBitsSet(anyOutsideMaskZ)) {
|
||||
// Some vertices were outside the Z clipping planes. Clip againt Z=-W in software (and do culling, too).
|
||||
// TODO: With a compat flag for Flatout/Sengoku, we'll be able to avoid this in many cases.
|
||||
// TODO: With a compat flag for Flatout/Sengoku, we'll be able to avoid this in many cases, unless
|
||||
// GPU_USE_CULL_DISTANCE is missing, in which case we need it for culling.
|
||||
flags |= ClipInfoFlags::SoftClipCull;
|
||||
}
|
||||
|
||||
|
||||
@@ -438,6 +438,22 @@ inline bool IsInsideFarPlane(const TransformedVertex& v) {
|
||||
return v.z <= v.pos_w;
|
||||
}
|
||||
|
||||
// TODO: Use CrossSIMD, should help.
|
||||
inline void LerpTransformedVertex(TransformedVertex *dest, TransformedVertex &a, TransformedVertex &b, float t) {
|
||||
dest->x = a.x + (b.x - a.x) * t;
|
||||
dest->y = a.y + (b.y - a.y) * t;
|
||||
dest->z = a.z + (b.z - a.z) * t;
|
||||
dest->pos_w = a.pos_w + (b.pos_w - a.pos_w) * t;
|
||||
dest->u = a.u + (b.u - a.u) * t;
|
||||
dest->v = a.v + (b.v - a.v) * t;
|
||||
dest->uv_w = a.uv_w + (b.uv_w - a.uv_w) * t;
|
||||
dest->fog = a.fog + (b.fog - a.fog) * t;
|
||||
|
||||
// note: colorBlend is backwards.
|
||||
dest->color0_32 = colorBlend(b.color0_32, a.color0_32, t);
|
||||
dest->color1_32 = colorBlend(b.color1_32, a.color1_32, t);
|
||||
}
|
||||
|
||||
// Generated by Gemini, and adapted to fit.
|
||||
void ClipTrianglesAgainstNearPlane(
|
||||
TransformedVertex *transformed, int &transformedCount, int maxTransformed,
|
||||
@@ -528,7 +544,7 @@ void ClipTrianglesAgainstNearPlane(
|
||||
|
||||
// Generate new vertex at the intersection point
|
||||
TransformedVertex newVertex;
|
||||
TransformedVertex::Lerp(&newVertex, const_cast<TransformedVertex&>(a), const_cast<TransformedVertex&>(b), t);
|
||||
LerpTransformedVertex(&newVertex, const_cast<TransformedVertex&>(a), const_cast<TransformedVertex&>(b), t);
|
||||
|
||||
// Force exact intersection to eliminate precision creeping down the pipeline
|
||||
newVertex.z = -newVertex.pos_w;
|
||||
|
||||
@@ -596,7 +596,6 @@ u32 GPUCommonHW::CheckGPUFeatures() const {
|
||||
}
|
||||
|
||||
if (draw_->GetDeviceCaps().depthClampSupported) {
|
||||
// Some backends always do GPU_USE_ACCURATE_DEPTH, but it's required for depth clamp.
|
||||
features |= GPU_USE_DEPTH_CLAMP;
|
||||
}
|
||||
|
||||
|
||||
@@ -218,19 +218,4 @@ struct TransformedVertex {
|
||||
this->y = other.y + yoff;
|
||||
memcpy(&this->z, &other.z, sizeof(*this) - sizeof(float) * 2);
|
||||
}
|
||||
|
||||
static void Lerp(TransformedVertex *dest, TransformedVertex &a, TransformedVertex &b, float t) {
|
||||
dest->x = a.x + (b.x - a.x) * t;
|
||||
dest->y = a.y + (b.y - a.y) * t;
|
||||
dest->z = a.z + (b.z - a.z) * t;
|
||||
dest->pos_w = a.pos_w + (b.pos_w - a.pos_w) * t;
|
||||
dest->u = a.u + (b.u - a.u) * t;
|
||||
dest->v = a.v + (b.v - a.v) * t;
|
||||
dest->uv_w = a.uv_w + (b.uv_w - a.uv_w) * t;
|
||||
dest->fog = a.fog + (b.fog - a.fog) * t;
|
||||
|
||||
// note: colorBlend is backwards.
|
||||
dest->color0_32 = colorBlend(b.color0_32, a.color0_32, t);
|
||||
dest->color1_32 = colorBlend(b.color1_32, a.color1_32, t);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -442,6 +442,11 @@ bool ViewSearch::Key(UI::ViewGroup *viewGroup, const KeyInput &input) {
|
||||
if (input.flags & KeyInputFlags::CHAR) {
|
||||
const int unichar = input.keyCode;
|
||||
if (unichar >= 0x20 && unichar != 127) { // 127 gets produced from Ctrl+Backspace on Windows for some reason.
|
||||
// Don't allow spaces as the first character, it looks confusing (empty search field)
|
||||
if (searchFilter.empty() && unichar == ' ') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: Save focus state here.
|
||||
// Insert it! (todo: do it with a string insert)
|
||||
char buf[8];
|
||||
|
||||
Reference in New Issue
Block a user