Commit Graph

34 Commits

Author SHA1 Message Date
Lucas Scharenbroich 68b8ca5856 Remove a CLC from the inner dispatch. Saves 2 cycles per block per sprite at the cost of 2 cycles per sprite 2022-07-26 00:11:47 -05:00
Lucas Scharenbroich 77b69cdc82 Fix _PopDirtyTile2 routine to sync with new TS_DIRTY conventions; fixes basic dirty sprite rendering 2022-07-07 09:12:23 -05:00
Lucas Scharenbroich 182ebfd566 Set dirty render to the correct direct page and several small cleanups 2022-07-06 14:55:27 -05:00
Lucas Scharenbroich 388470c133 Fix left-edge sprite rendering glitch; was an issue with not erasing sprites when they transition to IS_OFFSCREEN status 2022-06-08 14:25:52 -05:00
Lucas Scharenbroich 2c409b02a7 Fix lookup tables to fix boundary rendering 2022-06-06 20:10:15 -05:00
Lucas Scharenbroich b6202ca44c Implement framework for adjusting VBuff tables to handle boundary transitions 2022-06-06 11:23:00 -05:00
Lucas Scharenbroich 36d57f7c2d Fix signed calculations for negative sprite X and Y coordinates 2022-06-02 23:02:06 -05:00
Lucas Scharenbroich e6251f05a3 Clean up constants and fix bad addressing mode 2022-06-02 13:06:26 -05:00
Lucas Scharenbroich 4f557230c6 Remove some dead code and streamline some addressing. Fix bug in dispatch macro 2022-06-02 12:28:49 -05:00
Lucas Scharenbroich b022162036 Fix vertical offset bug; was using the TileStore lookup index, not the TileStore offset 2022-06-01 09:19:28 -05:00
Lucas Scharenbroich cde517bcc9 Fix single-step vertical displacement issue 2022-06-01 07:50:19 -05:00
Lucas Scharenbroich dec50bc6fc Fix several bugs; biggest one in the SpriteStamp routine 2022-05-31 22:53:33 -05:00
Lucas Scharenbroich 98adfe5daa Continuing to tweak and debug 2022-05-31 16:31:44 -05:00
Lucas Scharenbroich 78d7dafe14 Another checkpoint; converging on the working implementation 2022-05-31 08:43:26 -05:00
Lucas Scharenbroich 7909113a97 Checkpoint 2022-05-26 19:36:40 -05:00
Lucas Scharenbroich 5577105be8 Complete unrolled loop for clearing sprites from the tile store 2022-05-23 15:18:34 -05:00
Lucas Scharenbroich e2710ace85 Refactor to support building a tool and new demo to try and use it [not working] 2022-04-23 00:47:13 -05:00
Lucas Scharenbroich 8bb17895a9 Rough outline of streamlined sprite subsystem
* Split the creation of the sprite stamps from adding the
  sprites themselves.  This allows for 48 stamps that can
  be pre-rendered and quickly reassigned to sprites for
  animations.

* Inlined all calls to PushDirtyTile.  This both removed
  significant overhead from calling the small function and,
  since almost all callers we checking multiple tiles, we
  were able to avoid incrementing the count each time and
  just add a single incrments at the end.

* Switched from recording each tile that a sprite intersects
  with each from to only recording the top-left tile and the
  overlap size.  This reduced overhead for larger sprites
  and removed the needs for an end-of-list marker.

* Much more aggressive caching of Sprite and Tile Store
  values in order to streamline the inner tile dispatch
  routines.

* Moving TileStore and Sprites (and other supporting
  data structures) into a separate data bank.  Needed just
  for size purposes and provide micro-optimizations by
  opening up the use of abs,y addressing modes.

* Revamped multi-sprite rendering code to avoid the need to
  copy any masks and all stacked sprites can be drawn
  via a sequence of and [addrX],y; ora (addrX),y where
  addrX is set once per tile.

* General streamlining to reduct overhead. This work was
  focused on removing as much per-tile overhead as possible.
2022-04-20 07:43:16 -05:00
Lucas Scharenbroich df0d0ccada Commit to a huge unrolled loop to do bitfield -> render function 2022-02-25 17:05:32 -06:00
Lucas Scharenbroich 19ae2b0866 Remove stray pla that prevented more than one sprite from rendering 2022-02-22 21:27:47 -06:00
Lucas Scharenbroich 2507724a49 More sprite streamlining
* Added a TS_LAST_VBUFF cached value in the tile store
* Added a fast path for single sprite w/fast test
* Improved raster timing granularity for visual profiling

All of the code paths are generally good.  Both the _RenderSprites
and _ApplyDirtyTiles functions take a fair bit of raster time. Will
continue to try and streamline the data structures and code to
reduce overhead.`
2022-02-22 02:35:21 -06:00
Lucas Scharenbroich 56bfdc4236 Fix sprite VBUFF offset calculation 2022-02-21 15:58:16 -06:00
Lucas Scharenbroich 9d401a5861 Fix masking bug in sprite pre-calc 2022-02-21 14:25:55 -06:00
Lucas Scharenbroich 54474bbe5f Add more pre-computed values to the sprite structure 2022-02-21 13:33:39 -06:00
Lucas Scharenbroich 8b9415a7a5 Working through integration bugs
* Gave active list dedicated direct page space
* Change active list bit test from ror to asl to avoid barrel shift
* Various address fixes
2022-02-21 10:31:35 -06:00
Lucas Scharenbroich bb83e7f7c5 Background rendering again 2022-02-18 20:43:55 -06:00
Lucas Scharenbroich 95058fb969 Checkpoint for sprite rewrite
All of the sprite rendering has been deferred down to the level of
the tile drawing. Sprites are no longer drawn/erased, but instead
a sprite sheet is generated in AddSprite and referenced by the
renderer.

Because there is no longer a single off-screen buffer that holds
a copy of all the rendered sprites, the TileStore size must be
expanded to hold a reference to the sprite data address fo each
tile.  This increase in data structure size require the TileStore
to be put into its own bank and appropriate code restructuring.

The benefits to the rewrite are significant:

  1. Sprites are never drawn/erased off-screen.  They are only
     ever drawn directly to the screen or play field.
  2. The concept of "damaged" sprites is gone.  Every dirty tile
     automatically renders just to portion of a sprite that it
     intersects.

These two properties result in a substantial increase in throughput.
2022-02-18 12:12:32 -06:00
Lucas Scharenbroich 397df074ac Sprite state rework; have run out of bank space 2022-02-07 01:19:31 -06:00
Lucas Scharenbroich 89ea425043 Start work on sprite attribute caching 2022-02-04 12:37:05 -06:00
Lucas Scharenbroich 8b852485ac Fix dirty sprite renderer when StartX and StartY are not zero 2022-02-03 23:44:46 -06:00
Lucas Scharenbroich 1b9425b620 Streamline sprite functions; untested conceptual changes 2022-02-03 08:50:11 -06:00
Lucas Scharenbroich 2683a91e93 Fix sprite rendering with overlapping sprites. Must erase all sprites first, then re-render 2021-11-20 21:58:09 -06:00
Lucas Scharenbroich b607275089 Separate updating a sprite's position with updating it's flags 2021-11-20 12:16:03 -06:00
Lucas Scharenbroich 678c9a0563 Initial shell of generalize sprite size support; just for marking the dirty tiles 2021-11-11 17:06:38 -06:00