mirror of
https://github.com/jkdansereau/goldeneye-pc-port.git
synced 2026-10-23 15:52:42 +02:00
D288 M-152: static investigation, add GE_D288 near-plane probe
Read gfx_sp_tri1 against D233/D106/D271's existing guards. D233's trivial-reject fix is ruled out as a direct cause -- GL clips well-formed clip-space geometry correctly downstream of it. Found a new, previously uncatalogued unguarded site: the G_CULL_BOTH backface-cull cross-product divides raw vertex w with no epsilon guard, which can NaN/Inf near w=0 and silently skip both cull branches. Not yet confirmed against a live repro. Added GE_D288 (cached-getenv, D250-safe) to catch the culprit triangle's w/bbox at draw time on the next -level_20 run. No game-logic change; port/fast3d/ diagnostic only, inert unless GE_D288 is set.
This commit is contained in:
1 parent
56d2dfd672
commit
fbc2a533ae
4 files changed
+35
-1
No files matched your search
@@ -1613,6 +1613,28 @@ static void gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t vtx3_idx, bo
|
||||
// The whole triangle lies outside the visible area
|
||||
return;
|
||||
}
|
||||
|
||||
/* D288 diag (M-152): the silo intro's screen-filling stray triangle
|
||||
* (bounded to level_20 frames ~562-741) isn't explained by this
|
||||
* function's existing D233/D106 guards on static review -- log any
|
||||
* triangle whose clip-space NDC bbox covers an unreasonable chunk
|
||||
* of the screen, or whose bbox math goes non-finite, together with
|
||||
* each vertex's w and any_behind_camera, to catch it at draw time.
|
||||
* Remove once D288 is root-caused. */
|
||||
static int ge_d288 = -1;
|
||||
if (ge_d288 < 0) ge_d288 = getenv("GE_D288") != NULL;
|
||||
if (ge_d288) {
|
||||
float minx = std::fmin(std::fmin(v1->x / v1->w, v2->x / v2->w), v3->x / v3->w);
|
||||
float maxx = std::fmax(std::fmax(v1->x / v1->w, v2->x / v2->w), v3->x / v3->w);
|
||||
float miny = std::fmin(std::fmin(v1->y / v1->w, v2->y / v2->w), v3->y / v3->w);
|
||||
float maxy = std::fmax(std::fmax(v1->y / v1->w, v2->y / v2->w), v3->y / v3->w);
|
||||
float bbox_frac = (maxx - minx) * (maxy - miny) / 4.0f; // NDC quad is [-1,1]^2
|
||||
if (!std::isfinite(bbox_frac) || bbox_frac > 0.15f) {
|
||||
fprintf(stderr, "D288: tri w=(%.6f,%.6f,%.6f) bbox_frac=%.3f any_behind=%d color=(%d,%d,%d)\n",
|
||||
v1->w, v2->w, v3->w, bbox_frac, (int)any_behind_camera,
|
||||
v1->color.r, v1->color.g, v1->color.b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((rsp.geometry_mode & G_CULL_BOTH) != 0) {
|
||||
|
||||
Reference in new issue
Block a user