Repository navigation
[Merged by Bors] - use error scope to handle errors on shader module creation - #3675
Closed
jakobhellermann wants to merge 4 commits into
Closed
jakobhellermann wants to merge 4 commits into
jakobhellermann wants to merge 4 commits into
Conversation
jakobhellermann
commented
Jan 14, 2022
| use futures_util::future::FutureExt; | ||
| let error = render_device.wgpu_device().pop_error_scope(); | ||
| if let Some(Some(wgpu::Error::Validation { description, .. })) = | ||
| error.now_or_never() |
Contributor
Author
There was a problem hiding this comment.
now_or_never will return Some if the future is ready and None otherwise.
On native wgpu will yield the error immediatly while on wasm it may take some time.
I used it here to not make the pipeline cache more complicated by storing and polling futures, which is IMO not worth it for this change.
IceSentry
approved these changes
Jan 14, 2022
jakobhellermann
force-pushed
the
error-scope-shader
branch
from
February 4, 2022 12:33
7ba3a96 to
a156d1e
Compare
jakobhellermann
force-pushed
the
error-scope-shader
branch
from
March 20, 2022 10:40
a156d1e to
8860540
Compare
Contributor
Author
|
Rebased it on main and inlined the futures-util dependency since it's just ~20 lines 8860540#diff-cc220cd7b30bdab53f07cc69085af49c438247ef41ebd0d0921d87013d74271cR544-R576 |
jakobhellermann
force-pushed
the
error-scope-shader
branch
from
March 29, 2022 16:06
8860540 to
1389f05
Compare
Contributor
Author
|
Rebased on main again and added a comment explaining the usage of |
cart
reviewed
Mar 29, 2022
cart
left a comment
Member
There was a problem hiding this comment.
This looks good to me. I appreciate that you removed the extra dependency!
Member
|
bors r+ |
bors Bot
pushed a commit
that referenced
this pull request
Mar 29, 2022
related: #3289 In addition to validating shaders early when debug assertions are enabled, use the new [error scopes](https://gpuweb.github.io/gpuweb/#error-scopes) API when creating a shader module. I chose to keep the early validation (and thereby parsing twice) when debug assertions are enabled in, because it lets as handle errors ourselves and display them with pretty colors, while the error scopes API just gives us a string we can display. This change pulls in `futures-util` as a new dependency for `future.now_or_never()`. I can inline that part of futures-lite into `bevy_render` to keep the compilation time lower if that's preferred.
aevyrie
pushed a commit
to aevyrie/bevy
that referenced
this pull request
Jun 7, 2022
…e#3675) related: bevyengine#3289 In addition to validating shaders early when debug assertions are enabled, use the new [error scopes](https://gpuweb.github.io/gpuweb/#error-scopes) API when creating a shader module. I chose to keep the early validation (and thereby parsing twice) when debug assertions are enabled in, because it lets as handle errors ourselves and display them with pretty colors, while the error scopes API just gives us a string we can display. This change pulls in `futures-util` as a new dependency for `future.now_or_never()`. I can inline that part of futures-lite into `bevy_render` to keep the compilation time lower if that's preferred.
ItsDoot
pushed a commit
to ItsDoot/bevy
that referenced
this pull request
Feb 1, 2023
…e#3675) related: bevyengine#3289 In addition to validating shaders early when debug assertions are enabled, use the new [error scopes](https://gpuweb.github.io/gpuweb/#error-scopes) API when creating a shader module. I chose to keep the early validation (and thereby parsing twice) when debug assertions are enabled in, because it lets as handle errors ourselves and display them with pretty colors, while the error scopes API just gives us a string we can display. This change pulls in `futures-util` as a new dependency for `future.now_or_never()`. I can inline that part of futures-lite into `bevy_render` to keep the compilation time lower if that's preferred.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
related: #3289
In addition to validating shaders early when debug assertions are enabled, use the new error scopes API when creating a shader module.
I chose to keep the early validation (and thereby parsing twice) when debug assertions are enabled in, because it lets as handle errors ourselves and display them with pretty colors, while the error scopes API just gives us a string we can display.
This change pulls in
futures-utilas a new dependency forfuture.now_or_never(). I can inline that part of futures-lite intobevy_renderto keep the compilation time lower if that's preferred.