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

Several examples appear broken following recent changes #15570

Closed
5 tasks done
alice-i-cecile opened this issue Oct 1, 2024 · 14 comments
Closed
5 tasks done

Several examples appear broken following recent changes #15570

alice-i-cecile opened this issue Oct 1, 2024 · 14 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Milestone

Comments

@alice-i-cecile
Copy link
Member

alice-i-cecile commented Oct 1, 2024

The example runs shows several example regressions, per @rparrett on Discord.

  • ui_texture_*,
  • custom_shader_instancing
  • asset_decompression
  • volumetric_fog
  • transparency_2d (changed, not sure if broken)

Retained rendering world #15320 or various required components changes are both plausible.

This is in addition to #15563.

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen S-Needs-Investigation This issue requires detective work to figure out what's going wrong labels Oct 1, 2024
@alice-i-cecile alice-i-cecile added this to the 0.15 milestone Oct 1, 2024
@ChristopherBiscardi
Copy link
Contributor

I think deferred_rendering is broken too

2024-10-01T19:43:15.414646Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 11 Pro", kernel: "22631", cpu: "AMD Ryzen 9 7950X 16-Core Processor", core_count: "16", memory: "63.2 GiB" }
HookApp::findGameWindow, injectWindow: 0000000000000000
HookApp::findGameWindow, graphicsWindow: 0000000000000000
OverlayConnector::onMessage,overlay.init
2024-10-01T19:43:16.256784Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 2080 Ti", vendor: 4318, device: 7687, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "560.94", backend: Vulkan }
2024-10-01T19:43:16.750808Z  INFO bevy_winit::system: Creating new window "App" (0v1#4294967296)
HookApp::deferHook,
HookApp::findGameWindow, injectWindow: 0000000000000000
HookApp::findGameWindow, graphicsWindow: 0000000000480DA8
2024-10-01T19:43:16.862308Z  INFO bevy_input::gamepad: Gamepad 44v1#4294967340 connected.
2024-10-01T19:43:17.191075Z  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.
HookApp::deferHook,
2024-10-01T19:43:18.219489Z ERROR wgpu_core::device::global: Device::create_render_pipeline error: Error matching ShaderStages(FRAGMENT) shader requirements against the pipeline
2024-10-01T19:43:18.219683Z ERROR wgpu::backend::wgpu_core: Handling wgpu errors as fatal by default
thread 'Async Compute Task Pool (3)' panicked at C:\Users\chris\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-22.1.0\src\backend\wgpu_core.rs:3411:5:
wgpu error: Validation Error

Caused by:
  In Device::create_render_pipeline, label = 'deferred_lighting_pipeline'
    Error matching ShaderStages(FRAGMENT) shader requirements against the pipeline
      Shader global ResourceBinding { group: 0, binding: 22 } is not available in the pipeline layout
        View dimension D3 (is array: false) doesn't match the binding Sampler(Filtering)


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::render_resource::pipeline_cache::PipelineCache::process_pipeline_queue_system`!
thread '<unnamed>' panicked at C:\Users\chris\tmp\bevy\crates\bevy_render\src\render_resource\pipeline_cache.rs:580:28:
index out of bounds: the len is 0 but the index is 14
Encountered a panic in system `bevy_render::renderer::render_system`!

@DGriffin91
Copy link
Contributor

@ChristopherBiscardi Agreed: #15525

@JMS55
Copy link
Contributor

JMS55 commented Oct 1, 2024

Meshlet example/rendering is also broken :(

@mockersf
Copy link
Member

mockersf commented Oct 2, 2024

3d in wasm/webgpu is also broken since #13497

1 error(s) generated while compiling the shader:
:704:25 error: no matching call to textureSampleLevel(texture_depth_2d_array, sampler, vec2<f32>, i32, f32)

14 candidate functions:
  textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: A, level: L) -> f32  where: A is i32 or u32, L is i32 or u32
  textureSampleLevel(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: A, level: f32) -> vec4<f32>  where: A is i32 or u32
  textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: A, level: L, offset: vec2<i32>) -> f32  where: A is i32 or u32, L is i32 or u32
  textureSampleLevel(texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: A, level: f32) -> vec4<f32>  where: A is i32 or u32
  textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>, level: L, offset: vec2<i32>) -> f32  where: L is i32 or u32
  textureSampleLevel(texture: texture_depth_cube_array, sampler: sampler, coords: vec3<f32>, array_index: A, level: L) -> f32  where: A is i32 or u32, L is i32 or u32
  textureSampleLevel(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: A, level: f32, offset: vec2<i32>) -> vec4<f32>  where: A is i32 or u32
  textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>, level: L) -> f32  where: L is i32 or u32
  textureSampleLevel(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, level: f32, offset: vec2<i32>) -> vec4<f32>
  textureSampleLevel(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, level: f32) -> vec4<f32>
  textureSampleLevel(texture: texture_depth_cube, sampler: sampler, coords: vec3<f32>, level: L) -> f32  where: L is i32 or u32
  textureSampleLevel(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, level: f32, offset: vec3<i32>) -> vec4<f32>
  textureSampleLevel(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, level: f32) -> vec4<f32>
  textureSampleLevel(texture: texture_cube<f32>, sampler: sampler, coords: vec3<f32>, level: f32) -> vec4<f32>

    let sampled_depth = textureSampleLevel(directional_shadow_texturesX_naga_oil_mod_XMJSXM6K7OBRHEOR2NVSXG2C7OZUWK527MJUW4ZDJNZTXGX, directional_shadow_textures_linear_samplerX_naga_oil_mod_XMJSXM6K7OBRHEOR2NVSXG2C7OZUWK527MJUW4ZDJNZTXGX, light_local_3, array_index_3, 0f);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

it's also broken in wasm/webgl2 for another reason:

wgpu error: Validation Error

Caused by:
  In Device::create_bind_group, label = 'mesh_view_bind_group'
    Buffer binding 8 range 20480 exceeds `max_*_buffer_binding_size` limit 16384

@kristoff3r
Copy link
Contributor

3d in wasm/webgpu is also broken since #13497

1 error(s) generated while compiling the shader:
:704:25 error: no matching call to textureSampleLevel(texture_depth_2d_array, sampler, vec2<f32>, i32, f32)

14 candidate functions:
  textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: A, level: L) -> f32  where: A is i32 or u32, L is i32 or u32
  textureSampleLevel(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: A, level: f32) -> vec4<f32>  where: A is i32 or u32
  textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: A, level: L, offset: vec2<i32>) -> f32  where: A is i32 or u32, L is i32 or u32
  textureSampleLevel(texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: A, level: f32) -> vec4<f32>  where: A is i32 or u32
  textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>, level: L, offset: vec2<i32>) -> f32  where: L is i32 or u32
  textureSampleLevel(texture: texture_depth_cube_array, sampler: sampler, coords: vec3<f32>, array_index: A, level: L) -> f32  where: A is i32 or u32, L is i32 or u32
  textureSampleLevel(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: A, level: f32, offset: vec2<i32>) -> vec4<f32>  where: A is i32 or u32
  textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>, level: L) -> f32  where: L is i32 or u32
  textureSampleLevel(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, level: f32, offset: vec2<i32>) -> vec4<f32>
  textureSampleLevel(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, level: f32) -> vec4<f32>
  textureSampleLevel(texture: texture_depth_cube, sampler: sampler, coords: vec3<f32>, level: L) -> f32  where: L is i32 or u32
  textureSampleLevel(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, level: f32, offset: vec3<i32>) -> vec4<f32>
  textureSampleLevel(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, level: f32) -> vec4<f32>
  textureSampleLevel(texture: texture_cube<f32>, sampler: sampler, coords: vec3<f32>, level: f32) -> vec4<f32>

    let sampled_depth = textureSampleLevel(directional_shadow_texturesX_naga_oil_mod_XMJSXM6K7OBRHEOR2NVSXG2C7OZUWK527MJUW4ZDJNZTXGX, directional_shadow_textures_linear_samplerX_naga_oil_mod_XMJSXM6K7OBRHEOR2NVSXG2C7OZUWK527MJUW4ZDJNZTXGX, light_local_3, array_index_3, 0f);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

it's also broken in wasm/webgl2 for another reason:

wgpu error: Validation Error

Caused by:
  In Device::create_bind_group, label = 'mesh_view_bind_group'
    Buffer binding 8 range 20480 exceeds `max_*_buffer_binding_size` limit 16384

Which example is this? I tried a couple of the 3d examples but they all worked on wasm/webgl2 for me.

@mockersf
Copy link
Member

mockersf commented Oct 4, 2024

Which example is this? I tried a couple of the 3d examples but they all worked on wasm/webgl2 for me.

examples pbr and 3d_scene. after testing on more browsers, it crashes in Safari and Chromium, but works in Firefox after freezing for a few seconds

@kristoff3r
Copy link
Contributor

Which example is this? I tried a couple of the 3d examples but they all worked on wasm/webgl2 for me.

examples pbr and 3d_scene. after testing on more browsers, it crashes in Safari and Chromium, but works in Firefox after freezing for a few seconds

Ah, I was testing in firefox. I didn't expect it to be browser-specific, fun.

@kristoff3r
Copy link
Contributor

Which example is this? I tried a couple of the 3d examples but they all worked on wasm/webgl2 for me.

examples pbr and 3d_scene. after testing on more browsers, it crashes in Safari and Chromium, but works in Firefox after freezing for a few seconds

Both of those work for me with webgl2 on firefox and chromium on Linux. I hope it's not OSX specific =/

@mockersf
Copy link
Member

mockersf commented Oct 4, 2024

from https://docs.rs/wgpu/latest/wgpu/struct.Limits.html#method.downlevel_webgl2_defaults, I guess max_*_buffer_binding_size is max_uniform_buffer_binding_size which should be limited to 16KiB on WebGL2. It's not mandatory for browser to respect it, but it's the standard... and we're requesting more

github-merge-queue bot pushed a commit that referenced this issue Oct 8, 2024
# Objective

Fixes #15560
Fixes (most of) #15570

Currently a lot of examples (and presumably some user code) depend on
toggling certain render features by adding/removing a single component
to an entity, e.g. `SpotLight` to toggle a light. Because of the
retained render world this no longer works: Extract will add any new
components, but when it is removed the entity persists unchanged in the
render world.

## Solution

Add `SyncComponentPlugin<C: Component>` that registers
`SyncToRenderWorld` as a required component for `C`, and adds a
component hook that will clear all components from the render world
entity when `C` is removed. We add this plugin to
`ExtractComponentPlugin` which fixes most instances of the problem. For
custom extraction logic we can manually add `SyncComponentPlugin` for
that component.

We also rename `WorldSyncPlugin` to `SyncWorldPlugin` so we start a
naming convention like all the `Extract` plugins.

In this PR I also fixed a bunch of breakage related to the retained
render world, stemming from old code that assumed that `Entity` would be
the same in both worlds.

I found that using the `RenderEntity` wrapper instead of `Entity` in
data structures when referring to render world entities makes intent
much clearer, so I propose we make this an official pattern.

## Testing

Run examples like

```
cargo run --features pbr_multi_layer_material_textures --example clearcoat
cargo run --example volumetric_fog
```

and see that they work, and that toggles work correctly. But really we
should test every single example, as we might not even have caught all
the breakage yet.

---

## Migration Guide

The retained render world notes should be updated to explain this edge
case and `SyncComponentPlugin`

---------

Co-authored-by: Alice Cecile <[email protected]>
Co-authored-by: Trashtalk217 <[email protected]>
@akimakinai
Copy link
Contributor

transmission example is also broken.
Looks like bloom depended on the old behavior where it would stop being extracted depending on Camera value. In transmission example, pressing H key (which toggles Camera.hdr) crashes it.

wgpu error: Validation Error

Caused by:
  In RenderPass::end
    In a set_pipeline command
      Render pipeline targets are incompatible with render pass
        Incompatible color attachments at indices [0]: the RenderPass uses textures with formats [Some(Rgba8UnormSrgb)] but the RenderPipeline with 'bloom_upsampling_pipeline' label uses attachments with formats [Some(Rgba16Float)]

@akimakinai
Copy link
Contributor

akimakinai commented Oct 9, 2024

Currently ExtractComponents plugin does nothing if extract_component returns None. Shouldn't components be removed in that case?
For example in addition to bloom, ChromaticAberration starts to return None from its extract_component if intensity becomes zero, which is I think not synchronoized currently.

Edit: Uh, this does not work if some components in ExtractComponent::Out bundle are shared across ExtractComponent impls?

@rparrett
Copy link
Contributor

rparrett commented Oct 10, 2024

auto_exposure also seems completely broken. (tested macos, win/4080). separate issue created: #15824

ssao as well, bisected to #15320. run and press 151515 and observe nothing changing.

@cart
Copy link
Member

cart commented Oct 19, 2024

All of the examples in the original message work for me (I just checked them off in the message). I've tested all of the other examples mentioned and they either (1) work for me or (2) have a separate tracking issue.

I'm closing this out. If you identify a case that is still broken, please open a new issue scoped to it.

@cart cart closed this as completed Oct 19, 2024
@rparrett
Copy link
Contributor

Opened #15997 and #15998. They may be platform specific if you weren't able to reproduce.

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-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
Development

No branches or pull requests

9 participants