-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
MAX_DIRECTIONAL_LIGHTS must be defined to have the Lights struct #6997
MAX_DIRECTIONAL_LIGHTS must be defined to have the Lights struct #6997
Conversation
When running the post_processing example with this PR I get.
So this needs to be added anywhere that Lights is used for this to work correctly. |
oh right that example was already crashing... changed to not have the |
This also fixes #6799, turns out my issue was a duplicate. |
Maybe just hardcode it to 0? Just tested the latest commit and it works correctly for the post_processing example |
This could probably be updated now that cascaded shadow maps has landed, since it's the same error/fix for that. (assuming we won't get #5703 in before next release) Getting failures on both shader_prepass and post_processing now.
|
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.
Does this work? It’s not obvious to me that it would but if it does, ok I guess. :) As was mentioned, the cascade also need fixing, could you do that too, please?
@@ -41,8 +41,10 @@ struct DirectionalLight { | |||
let DIRECTIONAL_LIGHT_FLAGS_SHADOWS_ENABLED_BIT: u32 = 1u; | |||
|
|||
struct Lights { | |||
#ifdef MAX_DIRECTIONAL_LIGHTS |
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.
#ifdef MAX_DIRECTIONAL_LIGHTS | |
#ifdef MAX_DIRECTIONAL_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>, | ||
#endif |
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.
#endif | |
#endif |
Made a PR to fix the issue with MAX_CASCADES_PER_LIGHT being undefined sometimes so it doesn't need to be added to this one. #7380 |
I feel like this approach will only work if the binding isn't used. Because we comment out a member of the struct, we change its data layout. So if anything is bound, it will be misinterpreted. Same for #7380. I'm not sure how to solve it at this moment. I feel like the shader failing to compile is an indication that the use of the import should be fixed. |
I implemented what I think is a better fix in #7419 |
# Objective - Fix `post_processing` and `shader_prepass` examples as they fail when compiling shaders due to missing shader defs - Fixes #6799 - Fixes #6996 - Fixes #7375 - Supercedes #6997 - Supercedes #7380 ## Solution - The prepass was broken due to a missing `MAX_CASCADES_PER_LIGHT` shader def. Add it. - The shader used in the `post_processing` example is applied to a 2D mesh, so use the correct mesh2d_view_bindings shader import.
# Objective - Fix `post_processing` and `shader_prepass` examples as they fail when compiling shaders due to missing shader defs - Fixes #6799 - Fixes #6996 - Fixes #7375 - Supercedes #6997 - Supercedes #7380 ## Solution - The prepass was broken due to a missing `MAX_CASCADES_PER_LIGHT` shader def. Add it. - The shader used in the `post_processing` example is applied to a 2D mesh, so use the correct mesh2d_view_bindings shader import.
# Objective - Fix `post_processing` and `shader_prepass` examples as they fail when compiling shaders due to missing shader defs - Fixes #6799 - Fixes #6996 - Fixes #7375 - Supercedes #6997 - Supercedes #7380 ## Solution - The prepass was broken due to a missing `MAX_CASCADES_PER_LIGHT` shader def. Add it. - The shader used in the `post_processing` example is applied to a 2D mesh, so use the correct mesh2d_view_bindings shader import.
# Objective - Fix `post_processing` and `shader_prepass` examples as they fail when compiling shaders due to missing shader defs - Fixes #6799 - Fixes #6996 - Fixes #7375 - Supercedes #6997 - Supercedes #7380 ## Solution - The prepass was broken due to a missing `MAX_CASCADES_PER_LIGHT` shader def. Add it. - The shader used in the `post_processing` example is applied to a 2D mesh, so use the correct mesh2d_view_bindings shader import.
# Objective - Fix `post_processing` and `shader_prepass` examples as they fail when compiling shaders due to missing shader defs - Fixes #6799 - Fixes #6996 - Fixes #7375 - Supercedes #6997 - Supercedes #7380 ## Solution - The prepass was broken due to a missing `MAX_CASCADES_PER_LIGHT` shader def. Add it. - The shader used in the `post_processing` example is applied to a 2D mesh, so use the correct mesh2d_view_bindings shader import.
# Objective - Fix `post_processing` and `shader_prepass` examples as they fail when compiling shaders due to missing shader defs - Fixes #6799 - Fixes #6996 - Fixes #7375 - Supercedes #6997 - Supercedes #7380 ## Solution - The prepass was broken due to a missing `MAX_CASCADES_PER_LIGHT` shader def. Add it. - The shader used in the `post_processing` example is applied to a 2D mesh, so use the correct mesh2d_view_bindings shader import.
# Objective - Fix `post_processing` and `shader_prepass` examples as they fail when compiling shaders due to missing shader defs - Fixes bevyengine#6799 - Fixes bevyengine#6996 - Fixes bevyengine#7375 - Supercedes bevyengine#6997 - Supercedes bevyengine#7380 ## Solution - The prepass was broken due to a missing `MAX_CASCADES_PER_LIGHT` shader def. Add it. - The shader used in the `post_processing` example is applied to a 2D mesh, so use the correct mesh2d_view_bindings shader import.
Objective
MAX_DIRECTIONAL_LIGHTS
is not definedSolution
Lights
struct only have thedirectional_lights
field whenMAX_DIRECTIONAL_LIGHTS
is defined