Commit Graph

68 Commits

Author SHA1 Message Date
Lucas Scharenbroich
4c1dba0f68 Complete Dynamic Tile renderer 2022-06-21 23:13:28 -05:00
Lucas Scharenbroich
1f9c9b3f5b Checkpoint of final tile proc reorg for generalize new infrastructure for different engine modes 2022-06-20 15:55:09 -05:00
Lucas Scharenbroich
78d7dafe14 Another checkpoint; converging on the working implementation 2022-05-31 08:43:26 -05:00
Lucas Scharenbroich
755ac3fbfd Move most data storage to separate bank; fix many banking bugs 2022-05-18 21:00:06 -05:00
Lucas Scharenbroich
01e92a7b62 Update; tool is compiling while referencing new rederer pipeline 2022-05-18 00:34:25 -05:00
Lucas Scharenbroich
7f6e5d1b1f Work checkpoint 2022-04-29 12:38:04 -05:00
Lucas Scharenbroich
e5da3991cd Start to split the tiles into high-level and low-level code 2022-04-25 16:34:54 -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
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
e0912c8956 More tweaks and fixes
* Adjusted tile calculation when drawing sprites
* Fixed incorred draw order in 16x16 sprite
* Added more early-out checks to save work
2022-02-21 15:45:11 -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
260b2097c2 Continue fixing code issues; strange relocation error happening 2022-02-18 13:42:37 -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
1b9425b620 Streamline sprite functions; untested conceptual changes 2022-02-03 08:50:11 -06:00
Lucas Scharenbroich
027f9746ec Checkpoint of work 2022-01-19 20:58:57 -06:00
Lucas Scharenbroich
cd5de05d74 Most of the horizontal flip routines are not needed since the _GetTileAddr function returns the correct tile address. Need to finish auditing other Tile blitters 2021-11-20 13:54:19 -06:00
Lucas Scharenbroich
0cc28f9e6e Generalize _DrawSprite to handle all sizes and flip bits. 2021-11-20 12:00:21 -06:00
Lucas Scharenbroich
a7ba1e4b6b Add final tile blitter 2021-11-19 16:48:39 -06:00
Lucas Scharenbroich
39303041f9 Add priority dynamic tiles + sprite blitter 2021-11-19 16:30:22 -06:00
Lucas Scharenbroich
44cbba3f23 Add in new variants for sprite and priority tiles 2021-11-19 15:07:43 -06:00
Lucas Scharenbroich
b4871efe8f Streamlining tile blitter macros 2021-11-19 13:00:59 -06:00
Lucas Scharenbroich
0a9eb76ab5 Checkpoint; have old Dynamic Tile Renderers working 2021-11-18 16:23:44 -06:00
Lucas Scharenbroich
9a6eb45b20 Add Masked Sprite Tile blitter and fix some minor issues with the macro 2021-11-15 21:23:15 -06:00
Lucas Scharenbroich
cc8e03e6d3 Add SCB binding infrastructure 2021-11-13 19:45:27 -06:00
Lucas Scharenbroich
596777da8d Enable non-sprite, solid dynamic tiles 2021-11-12 15:11:29 -06:00
Lucas Scharenbroich
de5bdc6041 Rename tile blitters to match internal bit fields and add in the solid prioity blitter 2021-11-12 09:07:51 -06:00
Lucas Scharenbroich
dec9a3d106 Fix fast-path return value in PushDirtyTile and correct handling of TS_SPRITE_FLAG 2021-11-11 22:10:54 -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
Lucas Scharenbroich
bb5f4493d9 Fully integration simple (8x8) sprites into the render pipeline 2021-11-01 23:36:53 -05:00
Lucas Scharenbroich
631f40da23 Nearly complete integration of sprites into rendering function 2021-10-31 15:42:59 -05:00
Lucas Scharenbroich
b4155dc751 Expose the ApplyTiles subroutine 2021-10-29 00:52:29 -05:00
Lucas Scharenbroich
4e46a6af85 WIP: manual sprite rendering showing on screen 2021-10-28 21:41:01 -05:00
Lucas Scharenbroich
2feb6f590b Add address in sprite plane for tile rendering; use in tile dispatcher 2021-10-27 00:14:19 -05:00
Lucas Scharenbroich
82c1a8e2e4 Remember to cacluate the tile address when adding to the dirty tile list 2021-10-26 21:34:38 -05:00
Lucas Scharenbroich
0366c1a0e0 Fix missing index in the dirty tile initializations 2021-10-26 21:21:08 -05:00
Lucas Scharenbroich
3b8bf652e1 Continued bug fixing
* Missed an XBA to swap tile command bits into a proper index range
* Explicitly track the BASE_ADDR
* Fix some register overwriting
* Add an UpdateSprite method
2021-10-23 22:31:38 -05:00
Lucas Scharenbroich
494673416b Fix several incorrect uses of internal API; work toward functional demo 2021-10-22 00:56:12 -05:00
Lucas Scharenbroich
4e779e71d2 Tile rendering reorganization
This significantly simplifies the dispatch process by creating a
proper backing store for the tiles.  Most values that were
calcualted on the fly are now stored as constants in the tile
store.

Also, all tile updated are run through the dirty tile list which
solved a checken-and-egg problem of which order to do sprites vs
new tiles and affords a lot of optimizations since tile rendering
is deferred and each tile is only drawn at most once per frame.
2021-10-21 08:50:07 -05:00
Lucas Scharenbroich
4d224a92d9 Fix pre-shift bug in the tile address calculation 2021-10-11 16:47:38 -05:00
Lucas Scharenbroich
4338b64338 First cut at a non-trivial overlay. Pallettes and tile indexes still to be fixed 2021-10-11 14:09:38 -05:00
Lucas Scharenbroich
2966b1052b Add rendering path for masked dynamic tiles 2021-10-07 23:54:45 -05:00
Lucas Scharenbroich
87ded17e20 Initial Tiled tile animation export support
* Tiled tile animations read from TSX files
* Hooks for initialization generated by the tiled export tool
* Animated tiles implements with dynamic tiles backed by 2KB of direct
  page space in Bank 00
* Animation resolution limited to 1/60th incremenents

TODO
* Fix crasher in the _DoScriptSequ timer callback
* Fix single-line of garbage on the top line of the dynamic tiles
2021-10-06 07:10:09 -05:00
Lucas Scharenbroich
a82c1248db Add untested framework for handling fringe tile rendering 2021-08-30 22:14:04 -05:00
Lucas Scharenbroich
fe18759759 Refactor original demo driver to use GTE Core; move functions around 2021-08-26 08:52:43 -05:00
Lucas Scharenbroich
238d2f0a6f Fix banking bug and enable BG1 tile maps 2021-08-20 20:20:47 -05:00