Skip to content

Handle sprites smaller than one texture stripe - #106

Open
PS2HomeDeveloper wants to merge 1 commit into
ps2dev:masterfrom
PS2HomeDeveloper:patch-2
Open

PS2HomeDeveloper wants to merge 1 commit into
ps2dev:masterfrom
PS2HomeDeveloper:patch-2

Conversation

@PS2HomeDeveloper

Copy link
Copy Markdown

Summary

gsKit_prim_sprite_striped_texture_3d can calculate a zero or negative stripcount when the sprite covers no complete 64-pixel stripe. The function then divides by zero or enters its strip loop with a negative count, which can corrupt the render queue.

Fall back to the regular textured-sprite primitive when there are no complete interior stripes, while keeping nearest-neighbor filtering for this path.

Testing

  • Build gsKit with the PS2 toolchain.
  • Draw sprites spanning x=2..30 and x=60..65; verify they render once and the render queue remains usable.
  • Draw a sprite spanning multiple 64-pixel boundaries, such as x=2..200; verify the existing striped path still renders correctly.

## Summary

`gsKit_prim_sprite_striped_texture_3d` can calculate a zero or negative `stripcount` when the sprite covers no complete 64-pixel stripe. The function then divides by zero or enters its strip loop with a negative count, which can corrupt the render queue.

Fall back to the regular textured-sprite primitive when there are no complete interior stripes, while keeping nearest-neighbor filtering for this path.

## Testing

- Build gsKit with the PS2 toolchain.
- Draw sprites spanning x=2..30 and x=60..65; verify they render once and the render queue remains usable.
- Draw a sprite spanning multiple 64-pixel boundaries, such as x=2..200; verify the existing striped path still renders correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant