denise: score sprite/playfield collision over all enabled planes#118
Merged
Conversation
The sprite/playfield collision comparator only walked bitplanes up to the current BPU count. Denise compares every CLXCON-enabled plane regardless of how many planes the display is actually fetching: a plane enabled beyond the BPU count reads back as 0 and still gates the match, matching vAmiga's checkS2PCollisions, which evaluates (dBuffer & enbp) == (mvbp & enbp) across all six (CLXCON) or eight (CLXCON2, AGA) planes. With the default CLXCON reset value (all six planes enabled, all match bits set), a low-plane-count playfield can never satisfy the compare on hardware, so no collision is flagged. Copperline previously stopped at the fetched plane count and so reported a spurious collision. Drop the nplanes argument from collision_pixel / clxcon_planes_match (render path) and live_playfield_collision_pixel / live_clxcon_planes_match (live CLXDAT path) and always iterate the full plane bank. vAmigaTS Denise/Sprites/collision/sprcoll1 and sprcoll1d drop from 5.10% to 0.12% differing pixels against the vAmiga 4.4 reference; the other collision cases are unchanged and the phooey/tomato/roots-ecs/roots-aga/zool regression screenshots stay byte-identical (collision affects only CLXDAT reads, not the rendered framebuffer).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Denise's sprite/playfield collision comparator (
clxcon_planes_match) onlywalked bitplanes up to the current BPU count. Real Denise compares every
CLXCON-enabled plane regardless of how many planes the display is fetching:
a plane enabled beyond the BPU count reads back as 0 and still gates the
match. This mirrors vAmiga's
checkS2PCollisions, which evaluates(dBuffer & enbp) == (mvbp & enbp)across all six (CLXCON) or eight(CLXCON2, AGA) planes.
With the default CLXCON reset value (all six planes enabled, all match bits
set), a low-plane-count playfield can never satisfy the compare on hardware,
so no collision is flagged. Copperline stopped at the fetched plane count and
so reported a spurious collision, corrupting the CLXDAT value software reads.
Fix
Drop the
nplanesargument fromcollision_pixel/clxcon_planes_match(render path) and
live_playfield_collision_pixel/live_clxcon_planes_match(live CLXDAT path) and always iterate the fullplane bank (6 for OCS/ECS, 8 for AGA via CLXCON2).
Validation
Denise/Sprites/collision/sprcoll1andsprcoll1ddrop from5.10% -> 0.12% differing pixels vs the vAmiga 4.4 reference. The other
14 collision cases are unchanged (their residual is a different, unrelated
class).
screenshots stay byte-identical at 4s and 8s (collision affects only CLXDAT
reads, never the rendered framebuffer).
(
collision_match_gates_on_enabled_planes_beyond_the_bpu_count); clippy andfmt clean.
The seven existing live-CLXDAT unit tests set CLXCON to
0x0FC1(match onlybitplane 1) so their one-plane playfields still collide under the corrected
all-planes compare, keeping their assertions intact.