-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Merged by Bors] - Port bevy_ui to pipelined-rendering #2653
Conversation
Brilliant! I'll take a look at this ASAP. In regard to your second and third lists: Fortunately we already have a draft MSAA implementation. I'm cool with entirely ignoring the third list in the description. I'd prefer to not focus any time on adding new features to the current Bevy UI system, as thats next on our list of things to rework. |
For batching, perhaps coordinate with #2642? |
I've taken a lot of inspiration from that PR already, so implementing batching should be straightforward. I'm happy to do it (and any other point in the 3rd list) if you agree to review it, but I understand that you have a limited bandwidth.
I'm doing it to learn so it's fine even if we throw it away soon. Or is there is another part of the renderer that I could help with? |
I would review it, but given that I haven't reviewed the current batching pr yet, maybe hold off until after. There are a few corner cases that I'm worried about that I haven't tested on the current impl. |
Text and Text2d are now implemented. The ui_pipelined and text2d_pipelined examples seem to work correctly. |
Updated on top of pipelined-rendering. The first commit is a simple copy of the old bevy_ui and bevy_text to make reviewing changes easier. Remaining issues/questions:
Possible future improvements:
|
Changed the base branch to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve, but someone with more bevy experience and/or more experience with the new renderer will need to do the final sign off. I don’t see any obvious problems but I don’t think I would be able to see a great deal of the problems if they do exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did another full self review. I caught a few things and detailed a few others, hopefully it will help other reviewers.
I recommend selecting all but the first commit in the filters, to view what actually changed.
pipelined/bevy_text2/src/text2d.rs
Outdated
for (entity, mut draw, visible, text, global_transform, calculated_size) in query.iter_mut() { | ||
if !visible.is_visible { | ||
continue; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be updated now that we have Visibility
and ComputedVisibility
// FIXME there is no frustrum culling for UI | ||
pub visible_entities: VisibleEntities, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered there is no need for frustum culling since every UI item is usually on-screen, so I didn't use Visibility
, ComputedVisibility
and VisibleEntities
. VisibleEntities
is only included here because the camera systems require it.
However I now realize we need a way to manually hide on-screen nodes, like it was possible with the Visible
component. Instead of adding the full frustum culling like in bevy_sprite2, I think I'll just skip queuing when Style::display == Display::None
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of a scrollable element part of the UI items are likely outside of the bounds of the scrollable element and thus must be invisible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm tackling that case in another (soon to be) PR for clipping, where I implement the Style::overflow
property (it is currently commented out). I calculate how items are clipped in the queue_uinode fn, and skip those completely clipped. It instead might be possible to calculate it beforehand and setting a ComputedVisibility
accordingly.
There is an issue with updating images (including text glyphs), like for sprites (see #3207). Whichever solution is chosen for sprite should also be applied for UI. |
Fixed in a6f1581 (after rebasing on top of the fix for sprites). I chose to reuse |
The last commit could likely be reverted, as in retrospect, I don't think the ControlNode s are a great idea, and were merged too hastily. |
I'm diving in to this now. Tip for reviewing: deleting the old |
or in GitHub UI, there's is a dropdown when viewing file changes saying "changes from all commits" where you can select every commit but the first one (the url won't be valid if more commits are pushed) |
Just merged #3209. Lets resolve conflicts, make sure this plays nicely with the new clearing behavior, and address the remaining open comments. Then i think this is ready to go! |
`ControlNode`s where added in bevyengine#2908 in main, while bevy_ui2 was being developped in the pipelined-rendering branch.
This reverts commit 3819bc5.
Unless there is more feedback on |
Changes look good to me. I'm gonna think on the visibility situation for a bit, but I think this is probably good to merge! |
I'm fine with the choices you made regarding visibility. An empty |
bors r+ |
# Objective Port bevy_ui to pipelined-rendering (see #2535 ) ## Solution I did some changes during the port: - [X] separate color from the texture asset (as suggested [here](https://discord.com/channels/691052431525675048/743663924229963868/874353914525413406)) - [X] ~give the vertex shader a per-instance buffer instead of per-vertex buffer~ (incompatible with batching) Remaining features to implement to reach parity with the old renderer: - [x] textures - [X] TextBundle I'd also like to add these features, but they need some design discussion: - [x] batching - [ ] separate opaque and transparent phases - [ ] multiple windows - [ ] texture atlases - [ ] (maybe) clipping
Objective
Port bevy_ui to pipelined-rendering (see #2535 )
Solution
I did some changes during the port:
give the vertex shader a per-instance buffer instead of per-vertex buffer(incompatible with batching)Remaining features to implement to reach parity with the old renderer:
I'd also like to add these features, but they need some design discussion: