bevy
bevy copied to clipboard
Don't ignore draw errors
Objective
- It's possible to have errors in a draw command, but these errors are ignored
Solution
- Return a result with the error
Changelog
Renamed RenderCommandResult::Failure to RenderCommandResult::Skip
Added a reason string parameter to RenderCommandResult::Failure
Migration Guide
If you were using RenderCommandResult::Failure to just ignore an error and retry later, use RenderCommandResult::Skip instead.
This wasn't intentional, but this PR should also help with https://github.com/bevyengine/bevy/issues/12660 since we can turn a few unwraps into error messages now.
Looks like I should use expect here and just log the errors. I'll update my PR soon.
Okay, so this generates a bunch of errors now, but it just generates a bunch RenderCommandFailure. So I'll need to also bubble up what those failures are. The main issue is that we use RenderCommandResult::Failure just to skip execution even if it isn't an error.
I added a skip variant to RenderCommandResult because that's how it's used every where. I also added a new Failure variant with a message so we can log real failures and not just expected situations to skip.
I'm not sure if I should now prefer to panic when I encounter a failure because this should be a real error now.
Looks like I should use expect here and just log the errors. I'll update my PR soon.
you kept 3 expect, is it... expected?
you kept 3 expect, is it... expected?
~~Yes and no, it's possible I missed one, but also, I want this PR to mostly keep the previous behaviour and we can start slowly finding places that should use Failure instead of panicking.~~
nvm those were indeed unexpected
@IceSentry let me know once merge conflicts are resolved so I can merge?