Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow for custom batchers #10885

Merged
merged 13 commits into from
Sep 11, 2024
Merged

feat: allow for custom batchers #10885

merged 13 commits into from
Sep 11, 2024

Conversation

GoodBoyDigital
Copy link
Member

@GoodBoyDigital GoodBoyDigital commented Aug 23, 2024

Description of change

Did a pass at making the batcher generic. This is to set it up so that creating custom batchers becomes much easier. This will ultimatly take a few steps. This is the first one!

Essentially it removes the packAttributes / packIndex from the batchable objects and moves it to a batcher instead. This means we can create new batchers and modify the packAttribute function without having to modify any of the other batchable classes!

I also added a packQuadAttributes function to the batchers as this lets us batch the sprites even faster. Without this perf would be slower for spritesas we would need to copy sprite to a format packAttribute undertands and then copy that to the batch. packQuadAttributes does this in one step.

This is a draft for people to see where im at. Next steps will be:

  • tie move geometry to custom batchers
  • allow for new batchers to be registered
  • work to remove the batchable objects and have them live on the sprite / mesh directly. This will make it much easier to customise batches as devs will only need to create a new batcher and then set the batch id on the sprite / mesh etc.
  • auto generate the batching funcitions so users will just need to create a shader and make sure the required props live on the renderable and it will work magically :D This will be really cool!

Oh and as a bonus - bunny mark is running a bit faster now too.. so we will get some more perf wins! woop!

Pre-Merge Checklist
  • Tests and/or benchmarks are included
  • Documentation is changed or added
  • Lint process passed (npm run lint)
  • Tests passed (npm run test)

Copy link

codesandbox-ci bot commented Aug 23, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 9210fd9:

Sandbox Source
pixi.js-sandbox Configuration

@GoodBoyDigital GoodBoyDigital marked this pull request as ready for review September 4, 2024 08:23
src/rendering/batcher/shared/Batcher.ts Show resolved Hide resolved
src/rendering/batcher/shared/Batcher.ts Outdated Show resolved Hide resolved
src/rendering/batcher/shared/Batcher.ts Outdated Show resolved Hide resolved
src/rendering/batcher/shared/Batcher.ts Outdated Show resolved Hide resolved
src/rendering/batcher/shared/DefaultBatcher.ts Outdated Show resolved Hide resolved
tests/renderering/graphics/Graphics.test.ts Show resolved Hide resolved
GoodBoyDigital and others added 4 commits September 9, 2024 11:14
* batch renaming and prop clean up
extracted default shader

* DefaultBatchableElement -> DefaultBatchableMeshElement

* doc

* fix lint

* Update src/rendering/batcher/shared/DefaultBatcher.ts

Co-authored-by: Zyie <24736175+Zyie@users.noreply.github.com>

* add docs

---------

Co-authored-by: Zyie <24736175+Zyie@users.noreply.github.com>
@Zyie Zyie changed the title feat: make batcher generic feat: allow for custom batchers Sep 11, 2024
@Zyie Zyie added the ✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t label Sep 11, 2024
@Zyie Zyie added this pull request to the merge queue Sep 11, 2024
Merged via the queue into dev with commit 2eacd8b Sep 11, 2024
6 checks passed
@Zyie Zyie deleted the chore/remove-pack-attributes branch September 11, 2024 12:31
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants