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

[Merged by Bors] - report shader processing errors in RenderPipelineCache #3289

Conversation

jakobhellermann
Copy link
Contributor

Problem

  • shader processing errors are not displayed
  • during hot reloading when encountering a shader with errors, the whole app crashes

Solution

  • log error!s for shader processing errors
  • when cfg(debug_assertions) is enabled (i.e. you're running in debug mode), parse shaders before passing them to wgpu. This lets us handle errors early.

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Dec 10, 2021
@jakobhellermann jakobhellermann added A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Needs-Review and removed S-Needs-Triage This issue needs to be labelled labels Dec 10, 2021
@cart cart added this to the Bevy 0.6 milestone Dec 10, 2021
@jakobhellermann jakobhellermann force-pushed the resilient-shader-hot-reloading branch from 8adc6bb to c5254f6 Compare December 21, 2021 20:24
@jakobhellermann jakobhellermann force-pushed the resilient-shader-hot-reloading branch from c5254f6 to 305ca70 Compare December 22, 2021 21:13
@cart
Copy link
Member

cart commented Dec 22, 2021

Great work! Huge win for shader development workflows. I can confirm that this works as expected for both top level shaders and imports.

@cart
Copy link
Member

cart commented Dec 22, 2021

bors r+

bors bot pushed a commit that referenced this pull request Dec 22, 2021
### Problem
- shader processing errors are not displayed
- during hot reloading when encountering a shader with errors, the whole app crashes

### Solution
- log `error!`s for shader processing errors 
- when `cfg(debug_assertions)` is enabled (i.e. you're running in `debug` mode), parse shaders before passing them to wgpu. This lets us handle errors early.
@bors bors bot changed the title report shader processing errors in RenderPipelineCache [Merged by Bors] - report shader processing errors in RenderPipelineCache Dec 22, 2021
@bors bors bot closed this Dec 22, 2021
@jakobhellermann jakobhellermann deleted the resilient-shader-hot-reloading branch December 22, 2021 22:37
bors bot pushed a commit that referenced this pull request Dec 29, 2021
in #3289 I accidentally only logged errors for wgsl shaders, this PR expands the error reporting the the other supported shader types.
mockersf pushed a commit to mockersf/bevy that referenced this pull request Jan 1, 2022
…ne#3441)

in bevyengine#3289 I accidentally only logged errors for wgsl shaders, this PR expands the error reporting the the other supported shader types.
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.
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-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants