-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Remove WebGL padding from MotionBlur
#18727
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
Merged
Conversation
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
…sing the `MotionBlur` component. This means `_webgl2_padding` is no longer exposed to users.
…rld no longer needs a copy of the `MotionBlur` component.
JMS55
approved these changes
Apr 5, 2025
Contributor
JMS55
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't test, but code looks good!
BenjaminBrienen
approved these changes
Apr 6, 2025
Contributor
BenjaminBrienen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't look at code, but tests good!

2025-04-06T19:49:14.301547Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux (Pop!_OS 22.04)", kernel: "6.12.10-76061203-generic", cpu: "AMD Ryzen 9 7950X 16-Core Processor", core_count: "16", memory: "61.9 GiB" }
2025-04-06T19:49:14.437383Z INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 3070", vendor: 4318, device: 9348, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "565.77", backend: Vulkan }
2025-04-06T19:49:14.991799Z INFO bevy_winit::system: Creating new window motion_blur (0v1)
2025-04-06T19:49:14.991934Z INFO winit::platform_impl::linux::x11::window: Guessed window scale factor: 2
2025-04-06T19:49:15.179284Z WARN bevy_pbr::render::mesh_view_bindings: Too many textures in mesh pipeline view layout, this might cause us to hit `wgpu::Limits::max_sampled_textures_per_shader_stage` in some environments.
2025-04-06T19:49:15.271482Z WARN bevy_render::view::window: Couldn't get swap chain texture after configuring. Cause: 'The underlying surface has changed, and therefore the swap chain must be updated'
2025-04-06T19:49:15.312014Z WARN bevy_render::view::window: Couldn't get swap chain texture after configuring. Cause: 'The underlying surface has changed, and therefore the swap chain must be updated'
2025-04-06T19:49:20.946035Z INFO bevy_window::system: No windows are open, exiting
2025-04-06T19:49:20.949231Z INFO bevy_winit::system: Closing window 0v1
superdump
approved these changes
Apr 6, 2025
mockersf
pushed a commit
that referenced
this pull request
Apr 8, 2025
## Objective
The `MotionBlur` component exposes renderer internals. Users shouldn't
have to deal with this.
```rust
MotionBlur {
shutter_angle: 1.0,
samples: 2,
#[cfg(all(feature = "webgl2", target_arch = "wasm32", not(feature = "webgpu")))]
_webgl2_padding: Default::default(),
},
```
## Solution
The renderer now uses a separate `MotionBlurUniform` struct for its
internals. `MotionBlur` no longer needs padding.
I was a bit unsure about the name `MotionBlurUniform`. Other modules use
a mix of `Uniform` and `Uniforms`.
## Testing
```
cargo run --example motion_blur
```
Tested on Win10/Nvidia across Vulkan, WebGL/Chrome, WebGPU/Chrome.
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-Code-Quality
A section of code that is hard to understand or change
D-Straightforward
Simple bug fixes and API improvements, docs, test and examples
O-WebGL2
Specific to the WebGL2 render API
S-Needs-Review
Needs reviewer attention (from anyone!) to move forward
X-Uncontroversial
This work is generally agreed upon
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.
Objective
The
MotionBlurcomponent exposes renderer internals. Users shouldn't have to deal with this.Solution
The renderer now uses a separate
MotionBlurUniformstruct for its internals.MotionBlurno longer needs padding.I was a bit unsure about the name
MotionBlurUniform. Other modules use a mix ofUniformandUniforms.Testing
Tested on Win10/Nvidia across Vulkan, WebGL/Chrome, WebGPU/Chrome.