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

Panicked at 'TextureID' whenever camera was not present or no entity was rendered with given texture #3409

Closed
DMClVG opened this issue Dec 21, 2021 · 3 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior

Comments

@DMClVG
Copy link

DMClVG commented Dec 21, 2021

Bevy version

0.5.0

Operating system & version

Manjaro LTS

What you did

  1. Loaded a texture
  2. Made multiple strong references to loaded texture handle
  3. Stored a reference as a resource + inserted materials with said references to dozen of entities
  4. Did not create camera OR hid all the entities (ie removed the Visible component)
  5. Enabled camera OR made one entity with texture handle visible again

What you expected to happen

To not panic and for the texture to be drawn on my screen

What actually happened

Game panics and crashes upon enabling the camera or making an entity visible after it had been disabled/made invisible.

Additional information

I thought this #693 from a year ago was meant to fix this issue but it seems to have not. Textures still keep sort of "unloading" themselves from the GPU and panics whenever it gets asked to be rendered again by the same texture handle

@DMClVG DMClVG added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Dec 21, 2021
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Dec 21, 2021
@alice-i-cecile
Copy link
Member

Rendering has gotten a lot of overhaul since 0.5's release: can you reproduce this on main?

@DMClVG
Copy link
Author

DMClVG commented Dec 24, 2021

Actually, after playing around with my code a bit, turns out the reason for the problem wasn't what I initially thought it was.

Basically, I had this system that would run for every new texture and change some filter settings (that funnily enough doesn't even work), and that would in turn recreate the so called texture sampler, and the sampler that is used for every other entity would suddenly become invalid, even though the handle to the texture wouldn't change. But what still bugs me is that it WOULD only happen when there's no camera, and for some other reason whenever all the entities using that texture would lose its visibility (if they're out of range for example) and then I'd come in range again, the event listener to AssetEvent would, if I'm not mistaken, spit out another AssetEvent::Created event and the filter settings would be reset again, therefore reinitialising the texture sampler, before crashing the program because the old sampler lost its validity or something or another. Needless to say, after I disabled that system, everything went on as normal.

Summary:
New renderer works fine + what I said wasn't entirely factual. Apologies for your time!

@DMClVG DMClVG closed this as completed Dec 24, 2021
@alice-i-cecile
Copy link
Member

Glad to hear it, and thanks for the investigation <3 Don't worry about it, I've made my fair share of confused bug reports in the past!

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-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

2 participants