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

Fix attribute handling for matrices #1033

Merged
merged 2 commits into from Apr 3, 2019
Merged

Conversation

tsherif
Copy link
Contributor

@tsherif tsherif commented Apr 3, 2019

Subtle bug in attribute handling introduced by the matrix attributes. ProgramConfiguration was assuming that locations were consecutive starting from 0, which is not the case if there are matrix attributes. Seems to only have become an issue when trying to rebind buffers to attributes manually (when VAOs aren't available).

@@ -96,6 +97,7 @@ export default class ProgramConfiguration {

const attributeInfo = {location, name, accessor: new Accessor(accessor)}; // Base values
this.attributeInfos.push(attributeInfo);
this.attributeInfosByLocation[location] = attributeInfo; // For quick location based lookup
Copy link
Collaborator

Choose a reason for hiding this comment

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

Comment on the difference between attributeInfos and attributeInfosByLocation and how they differ in this edge case?

@coveralls
Copy link

coveralls commented Apr 3, 2019

Coverage Status

Coverage increased (+0.008%) to 45.644% when pulling 67f0023 on fix-multi-loc-attributes into 1ab304b on master.

@tsherif tsherif merged commit 5a49ecb into master Apr 3, 2019

// Locations may not be contiguous the case of matrix attributes
// so keep a separate location->attribute map.
this.attributeInfosByLocation = [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

I can't see that we need both attributeInfos and attributeInfosByLocation.

Fine with deleting either and just keeping one array that is sorted by real locations.

Nit: We may want to initialize the array to the MAX_ATTRIBUTES so we don't assign beyond array length.

@Pessimistress Pessimistress deleted the fix-multi-loc-attributes branch July 26, 2019 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants