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

Truncate attribute buffer data rather than attribute buffers #10270

Merged
merged 1 commit into from
Oct 28, 2023

Conversation

robojeb
Copy link
Contributor

@robojeb robojeb commented Oct 26, 2023

Existing truncation code limits the number of attribute buffers to be less than or equal to the number of vertices.
Instead the number of elements from each attribute buffer should be limited to the length of the shortest buffer as mentioned in the earlier warning.

Objective

Solution

  • Moves the .take() from the outer loop of attribute buffers, to the inner loop of attribute values.

Existing truncation code limits the number of attribute buffers to be
less than or equal to the number of vertices.
Instead the number of elements from each attribute buffer should be
limited to the length of the shortest buffer as mentioned in the earlier
warning.
@rparrett rparrett added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen labels Oct 26, 2023
@rparrett rparrett requested review from IceSentry and robtfm October 27, 2023 17:35
Copy link
Contributor

@rparrett rparrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am surprised this hasn't caused any problems elsewhere... I guess we probably don't have any examples where there are more vertex attributes than vertices in a mesh?

This seems like an obvious good fix and holds up to some basic testing in generate_custom_mesh.rs.

@rparrett rparrett added this to the 0.12 milestone Oct 28, 2023
@rparrett rparrett added the P-High This is particularly urgent, and deserves immediate attention label Oct 28, 2023
Copy link
Contributor

@robtfm robtfm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the original pr happened to fix the problem for me because i had an input with zero data for one of the attributes...

it was clearly wrong and this looks correct though.

@IceSentry IceSentry added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Oct 28, 2023
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Oct 28, 2023
Merged via the queue into bevyengine:main with commit 4b50edc Oct 28, 2023
26 checks passed
ameknite pushed a commit to ameknite/bevy that referenced this pull request Nov 6, 2023
…ine#10270)

Existing truncation code limits the number of attribute buffers to be
less than or equal to the number of vertices.
Instead the number of elements from each attribute buffer should be
limited to the length of the shortest buffer as mentioned in the earlier
warning.

# Objective

- Fixes bevyengine#10267 

## Solution

- Moves the `.take()` from the outer loop of attribute buffers, to the
inner loop of attribute values.
---
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this pull request Jan 9, 2024
…ine#10270)

Existing truncation code limits the number of attribute buffers to be
less than or equal to the number of vertices.
Instead the number of elements from each attribute buffer should be
limited to the length of the shortest buffer as mentioned in the earlier
warning.

# Objective

- Fixes bevyengine#10267 

## Solution

- Moves the `.take()` from the outer loop of attribute buffers, to the
inner loop of attribute values.
---
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 P-High This is particularly urgent, and deserves immediate attention S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bevy still crashes when mesh attributes are different lengths
6 participants