Closed
Description
Bevy version
All commits after d44e865
What you did
Followed migration instructions in the PR.
What went wrong
Shader error with:
2022-12-21T07:05:18.759671Z ERROR bevy_render::render_resource::pipeline_cache: failed to process shader:
error: expected constant, found '#'
┌─ wgsl:44:49
│
44 │ directional_lights: array<DirectionalLight, #{MAX_DIRECTIONAL_LIGHTS}u>,
│ ^ expected constant
Additional information
It appears that PR #5900 breaks imports, because those imports now depend on shaderdefs which users may not have available. In my case, I was attempting to import:
#import bevy_pbr::mesh_view_types
so I could use the View
struct, which was giving me the error posted above. The problem was that the import was bringing struct
s into scope that referred to the MAX_DIRECTIONAL_LIGHTS
shaderdef, which my shader did not use. Specifically, it was erroring when it reached struct Lights
:
struct Lights {
// NOTE: this array size must be kept in sync with the constants defined in bevy_pbr/src/render/light.rs
directional_lights: array<DirectionalLight, #{MAX_DIRECTIONAL_LIGHTS}u>,