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

Fix for SpriteSheetComponents + TextComponents Crash #555

Closed
wants to merge 15 commits into from

Conversation

insrcd
Copy link

@insrcd insrcd commented Sep 22, 2020

This PR was a result of me working around #134. I have been using it successfully since 0.1.0 and confirmed the issue still exists in 0.2.x.

The issue stems from the UI text using the same pipeline as the SpriteSheet and DrawableText setting the rendering pipeline specifics when the text is drawn instead of relying on a dynamic pipeline bindings.

A few caveats, I'm new to rust, and to rendering pipelines in general, so this may not be the best approach. I just wanted to get my game (/~https://github.com/insrcd/labyrinth-game) to be able to show text and sprites at the same time.

I'd love to hear feedback on how to improve this, or if my approach is just plain ol' wrong, I'd love to learn more about how to address it.

@Moxinilian Moxinilian added P-Crash A sudden unexpected crash A-Rendering Drawing game state to the screen labels Sep 22, 2020
@ConnorBP
Copy link

ConnorBP commented Sep 22, 2020

This compiles for me, however the result displays the text properly and the sprite no longer renders at all. May just be me though. Anyone else tried this?
edit: I am on MaxOs. This may be related.

@ConnorBP
Copy link

ConnorBP commented Sep 23, 2020

Adding in the z depth on my spritesheet transform fixed (workaround) the sprite render issue on macOS machines. Once zdepth starts working by default, I personally think this patch is ready to merge and should be. Up to the repo owner though. For now I will keep developing on this branch until they do. Thanks very much for your work in resolving this issue! 😃

@ConnorBP
Copy link

You should fix the CI / clean check (clippy error)

error: unused import: `TextureAtlasSprite`
244
  --> crates/bevy_text/src/draw.rs:16:57
245
   |
246
16 | use bevy_sprite::{TextTextureAtlasSprite, TextureAtlas, TextureAtlasSprite};
247
   |                                                         ^^^^^^^^^^^^^^^^^^
248
   |
249

@cart
Copy link
Member

cart commented Sep 23, 2020

I'm investigating the issue now. This is quite weird because we are already creating two "different" pipelines, one with dynamic bindings and one without. (by using bevy's "pipeline specialization" system).

This almost feels like a bug in wgpu where its getting confused about dynamic bindings.

In general creating full copies of all relevant assets shouldn't be necessary. The "pipeline specialization" code we have already should be solving this problem for us. I'll take some time to see if theres anything obvious. If not, I'll try getting a repro using a wgpu example.

We might need to hack around this in the short term, but I think we can do it in a way that doesnt explicitly create new assets.

@cart
Copy link
Member

cart commented Sep 23, 2020

Found the root cause. Its a one line fix.

Closing in favor of #560

(this was definitely my fault 😄)

@cart cart closed this Sep 23, 2020
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 P-Crash A sudden unexpected crash
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants