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

Sprite render pipeline prepare stage #6621

Closed

Conversation

ManevilleF
Copy link
Contributor

@ManevilleF ManevilleF commented Nov 14, 2022

Objective

Add a prepare stage in the sprite render pipeline.

This would allow for heavier operations like #5213 as suggested by @superdump
and compute the sprite slicing there

Concept

The objective is to keep 1-1 mapping between main world Sprite and the ExtractedSprite, but allow multiple PreparedSprite to be then computed before batching. This way the slicing, tiling, etc can be computed in the prepare stage as long as other checks which are not required in the queue stage.



  Main world   │     Render World
               │
               │
               │        Extract             Prepare                   Queue               Draw
               │
               │
 ┌────────┐    │    ┌───────────┐        ┌───────────┐
 │        │    │    │ Extracted │        │Prepared   ├─┐
 │ Sprite │ ───┼──► │ Sprite    ├───────►│Sprite     │ │    ──────►  Batching    ──────►  Draw
 │        │    │    │           │        │           │ ├──┐
 └────────┘    │    └───────────┘        └─┬─────────┘ │  │
               │                           │           │  │
               │                           └─┬─────────┘  │
               │                             │            │
               │                             └────────────┘

Work done

  • Add prepare stage (fc9af23)
  • Split the render pipeline in different files

Notes

  • This new stage adds an extra computation which I'm not happy about, querying the GpuImage asset to retrieve the image size which is currently done in the queue stage which queries it also for the sampler and view.

  • I would like to include the VisibleEntities check in the prepare stage and reduce the queue stage workload but I'm not familiar with the render phases system

  • Maybe the batching could happen in the prepare stage but I'm still not sure of the implications with the render phases

@ManevilleF ManevilleF marked this pull request as ready for review November 14, 2022 19:28
@ManevilleF ManevilleF mentioned this pull request Nov 14, 2022
11 tasks
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants