Add FOG_ENABLE param, prune fog cone on the board profile (fix -6.165ns setup)
The fog blend's tex_color*F multiply landed on the texture->color critical path (u_texcache RAM -> u_tex|tex_color -> mult_126 -> raster_pixel_color_q, 46ns, -6.165ns setup). Fog is a proven no-op for the current board scene (96.5% F=255), so pay zero for it here. FOG_ENABLE (default 1, byte-identical fog) added to gs_stub; each fog mux gated (FOG_ENABLE && ras_fge) so FOG_ENABLE=0 constant-folds the entire fog cone away (multiply, FOGCOL adders, s2_fog_f/persp_fog_f5 interp). Threaded through top_psmct32_raster_demo_bram; set FOG_ENABLE(1'b0) on the active GS_SH3_LPDDR_FB board arm (elsif at :1086, the one the QSF profile compiles). Fog stays default-on everywhere else. Verified: FOG_ENABLE=1 fog TBs unchanged PASS; FOG_ENABLE=0 (new tb_gs_fog_disabled + board scene TB) emits raw color = pre-fog datapath; board elaborates clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+13
-5
@@ -450,6 +450,14 @@ module gs_stub
|
||||
// out, so every existing TB / the flat production build is byte-identical
|
||||
// (zero DSP/ALM/M20K cost). Only a perspective demo build sets it 1.
|
||||
parameter bit PERSPECTIVE_CORRECT = 1'b0,
|
||||
// GS per-vertex FOG compile gate. Default 1 = fog blend active (byte-
|
||||
// identical to the fog build). 0 = every fog application collapses to the
|
||||
// pre-fog color at elaboration (FOG_ENABLE is a constant), so the
|
||||
// synthesizer constant-folds the entire fog cone — the texel*F/color*F
|
||||
// multiplies, the FOGCOL adders/mux, AND the s2_fog_f / persp_fog_f5
|
||||
// interpolation pipes that feed ONLY fog — off the texture->color critical
|
||||
// path. Set 0 on board profiles whose scene fog is a functional no-op.
|
||||
parameter bit FOG_ENABLE = 1'b1,
|
||||
// Preserve the low four XYZ2/XYZF2 screen-coordinate bits and evaluate
|
||||
// triangle coverage at the GS 12.4 pixel center. Default off retains the
|
||||
// integer/corner raster contract used by every pre-Ch416 fixture.
|
||||
@@ -5307,7 +5315,7 @@ module gs_stub
|
||||
// consumer (s2_natural_abgr pack, the PSMCT32 emit, the Z-tested emit color)
|
||||
// sees the fogged color. Gated on ras_fge → FGE=0 is byte-identical.
|
||||
logic [63:0] s2_sprite_color64;
|
||||
assign s2_sprite_color64 = ras_fge
|
||||
assign s2_sprite_color64 = (FOG_ENABLE && ras_fge)
|
||||
? {s2_sprite_color64_raw[63:32],
|
||||
fog_blend_abgr(s2_sprite_color64_raw[31:0], s2_fog_f, fogcol_q)}
|
||||
: s2_sprite_color64_raw;
|
||||
@@ -5326,7 +5334,7 @@ module gs_stub
|
||||
// GS per-vertex FOG — blend the post-texture/post-Gouraud RGB toward FOGCOL
|
||||
// when FGE=1 (see the SPRITE note above). Gated → FGE=0 byte-identical.
|
||||
logic [63:0] s2_tri_color64;
|
||||
assign s2_tri_color64 = ras_fge
|
||||
assign s2_tri_color64 = (FOG_ENABLE && ras_fge)
|
||||
? {s2_tri_color64_raw[63:32],
|
||||
fog_blend_abgr(s2_tri_color64_raw[31:0], s2_fog_f, fogcol_q)}
|
||||
: s2_tri_color64_raw;
|
||||
@@ -6982,7 +6990,7 @@ module gs_stub
|
||||
// GS per-vertex FOG — fog the held bilinear-perspective texel
|
||||
// with its captured +5-aligned F. Gated → FGE=0 byte-identical.
|
||||
raster_pixel_color_q <= {32'd0,
|
||||
ras_fge
|
||||
(FOG_ENABLE && ras_fge)
|
||||
? fog_blend_abgr(comb_modulate ? persp_bili_mod_color
|
||||
: s1_tex_color,
|
||||
persp_bili_fog_q, fogcol_q)
|
||||
@@ -7076,7 +7084,7 @@ module gs_stub
|
||||
// GS per-vertex FOG — fog the source RGB BEFORE the blend
|
||||
// when FGE=1 (sprite fog is flat: s2_fog_f == ras_f0).
|
||||
// Source alpha is NOT fogged. FGE=0 → byte-identical.
|
||||
s3_cs_q <= ras_fge
|
||||
s3_cs_q <= (FOG_ENABLE && ras_fge)
|
||||
? {ras_color[63:32],
|
||||
fog_blend_abgr(ras_color[31:0], s2_fog_f, fogcol_q)}
|
||||
: ras_color;
|
||||
@@ -7161,7 +7169,7 @@ module gs_stub
|
||||
// F (persp_fog_f5). Gated on ras_fge → FGE=0 byte-identical
|
||||
// to the pre-fog perspective emit.
|
||||
raster_pixel_color_q <= {32'd0,
|
||||
ras_fge
|
||||
(FOG_ENABLE && ras_fge)
|
||||
? fog_blend_abgr(comb_modulate ? modulated_s1_tex_color
|
||||
: s1_tex_color,
|
||||
persp_fog_f5, fogcol_q)
|
||||
|
||||
Reference in New Issue
Block a user