Open louis-le-cam opened 1 year ago
I think this is a problem with the default prepass shaders not matching the vertex buffer layout that you set. @IceSentry perhaps you can debug this quicker than me :)
Yeah, changing the vertex layout in specialize is most likely the issue.
There's a few solution
The reason this happens even if you don't actually use the prepass is because the shadows reuse the depth prepass shaders.
I tried to set the prepass vertex shader with the vertex shader and it shows another error:
wgpu error: Validation Error
Caused by:
In Device::create_render_pipeline
note: label = `prepass_pipeline`
Error matching ShaderStages(VERTEX) shader requirements against the pipeline
Shader global ResourceBinding { group: 0, binding: 9 } is not available in the layout pipeline layout
Binding is missing from the pipeline layout
(I don't know how to implement the first solution proposition)
Theses errors are not clear, I think they should be handled.
Why custom_vertex_attribute
example work with light ?
By the way what is a prepass shader ?
Theses errors are not clear, I think they should be handled.
They come from wgpu so we don't have control over them
Why custom_vertex_attribute example work with light?
The issue seems to be with bind group not matching. That example doesn't do anything with bind groups so it doesn't cause any issues.
By the way what is a prepass shader?
A prepass is a render phase that runs before the main pass. It generates a depth texture that can be used in the main pass. We also use the prepass for the shadow system which is why you are getting this error despite not actually having a prepass enabled.
As to how to fix it. Do you have a full reproduction in a repo I could clone and run? I have a very vague idea of what might be the issue but I'm not sure so I'd need to run the code.
I uploaded my project at louis-le-cam/topdown_game
The material definition: src/water/mod.rs
The shader: assets/shaders/water.wgsl
Thank you for your help
I have the same problem as @louis-le-cam after he fixed the first one. But I am using bevy 0.14.2. A simple project to reproduce the problem is here: https://github.com/Kuerbiskakteen/bevy-test-time/tree/main
@Kuerbiskakteen that's an unrelated error, the reason your shader doesn't work is that you are importing Globals from bevy_pbr
but you are using a 2d material. bevy_pbr is for 3d, for 2d you should use bevy_sprite
Bevy version
0.11.3
Relevant system information
What you did
Create a project with a custom material (vertex and fragment shaders) and a light
What went wrong
The application crashed with a wgpu validation error
Additional information
The
shader_material_screenspace_texture
works fine and have point Light and custom material (only fragment shader)Other dependencies:
Shader:
Material:
MeshMaterial:
PointLight:
Logs: