Skip to content

Conversation

@greeble-dev
Copy link
Contributor

@greeble-dev greeble-dev commented Apr 5, 2025

Objective

The MotionBlur component exposes renderer internals. Users shouldn't have to deal with this.

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.

…sing the `MotionBlur` component. This means `_webgl2_padding` is no longer exposed to users.
…rld no longer needs a copy of the `MotionBlur` component.
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen O-WebGL2 Specific to the WebGL2 render API labels Apr 5, 2025
@alice-i-cecile alice-i-cecile added S-Needs-Review Needs reviewer attention (from anyone!) to move forward C-Code-Quality A section of code that is hard to understand or change X-Uncontroversial This work is generally agreed upon D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels Apr 5, 2025
Copy link
Contributor

@JMS55 JMS55 left a 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!

@JMS55 JMS55 added this to the 0.16 milestone Apr 5, 2025
Copy link
Contributor

@BenjaminBrienen BenjaminBrienen left a 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!
Schermafdruk van 2025-04-06 21-49-22

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 superdump added this pull request to the merge queue Apr 6, 2025
Merged via the queue into bevyengine:main with commit a1fd3a4 Apr 6, 2025
45 checks passed
@github-project-automation github-project-automation bot moved this to Done in Rendering 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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants