-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - fix memory size for PointLightBundle #1940
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mockersf
added
C-Bug
An unexpected or incorrect behavior
A-Rendering
Drawing game state to the screen
labels
Apr 16, 2021
cart
reviewed
Apr 16, 2021
It sounds like it would be a good idea to add some kind of lighting demo that allows us to easily test 1-n light setups with different colors/sizes/etc. to prevent issues like this in the future. |
mockersf
added a commit
to mockersf/bevy
that referenced
this pull request
Apr 18, 2021
bors r+ |
bors bot
pushed a commit
that referenced
this pull request
Apr 19, 2021
Introduced in #1778, not fixed by #1931 The size of `Lights` buffer currently is : ```rust 16 // (color, `[f32; 4]`) + 16 // (number of lights, `f32` encoded as a `[f32; 4]`) + 10 // (maximum number of lights) * ( 16 // (light position, `[f32; 4]` + 16 // (color, `[16; 4]`) + 4 // (inverse_range_squared, `f32`) ) -> 392 ``` This makes the pbr shader crash when running with Xcode debugger or with the WebGL2 backend. They both expect a buffer sized 512. This can also be seen on desktop by adding a second light to a scene with a color, it's position and color will be wrong. adding a second light to example `load_gltf`: ```rust commands .spawn_bundle(PointLightBundle { transform: Transform::from_xyz(-3.0, 5.0, -3.0), point_light: PointLight { color: Color::BLUE, ..Default::default() }, ..Default::default() }) .insert(Rotates); ``` before fix: <img width="1392" alt="Screenshot 2021-04-16 at 19 14 59" src="https://user-images.githubusercontent.com/8672791/115060744-866fb080-9ee8-11eb-8915-f87cc872ad48.png"> after fix: <img width="1392" alt="Screenshot 2021-04-16 at 19 16 44" src="https://user-images.githubusercontent.com/8672791/115060759-8cfe2800-9ee8-11eb-92c2-d79f39c7b36b.png"> This PR changes `inverse_range_squared` to be a `[f32; 4]` instead of a `f32` to have the expected alignement
Pull request successfully merged into main. Build succeeded: |
bors
bot
changed the title
fix memory size for PointLightBundle
[Merged by Bors] - fix memory size for PointLightBundle
Apr 19, 2021
ostwilkens
pushed a commit
to ostwilkens/bevy
that referenced
this pull request
Jul 27, 2021
Introduced in bevyengine#1778, not fixed by bevyengine#1931 The size of `Lights` buffer currently is : ```rust 16 // (color, `[f32; 4]`) + 16 // (number of lights, `f32` encoded as a `[f32; 4]`) + 10 // (maximum number of lights) * ( 16 // (light position, `[f32; 4]` + 16 // (color, `[16; 4]`) + 4 // (inverse_range_squared, `f32`) ) -> 392 ``` This makes the pbr shader crash when running with Xcode debugger or with the WebGL2 backend. They both expect a buffer sized 512. This can also be seen on desktop by adding a second light to a scene with a color, it's position and color will be wrong. adding a second light to example `load_gltf`: ```rust commands .spawn_bundle(PointLightBundle { transform: Transform::from_xyz(-3.0, 5.0, -3.0), point_light: PointLight { color: Color::BLUE, ..Default::default() }, ..Default::default() }) .insert(Rotates); ``` before fix: <img width="1392" alt="Screenshot 2021-04-16 at 19 14 59" src="https://user-images.githubusercontent.com/8672791/115060744-866fb080-9ee8-11eb-8915-f87cc872ad48.png"> after fix: <img width="1392" alt="Screenshot 2021-04-16 at 19 16 44" src="https://user-images.githubusercontent.com/8672791/115060759-8cfe2800-9ee8-11eb-92c2-d79f39c7b36b.png"> This PR changes `inverse_range_squared` to be a `[f32; 4]` instead of a `f32` to have the expected alignement
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduced in #1778, not fixed by #1931
The size of
Lights
buffer currently is :This makes the pbr shader crash when running with Xcode debugger or with the WebGL2 backend. They both expect a buffer sized 512. This can also be seen on desktop by adding a second light to a scene with a color, it's position and color will be wrong.
adding a second light to example
load_gltf
:before fix:
after fix:
This PR changes
inverse_range_squared
to be a[f32; 4]
instead of af32
to have the expected alignement