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(webgl): constant attributes #1802

Merged
merged 1 commit into from
Aug 28, 2023
Merged

fix(webgl): constant attributes #1802

merged 1 commit into from
Aug 28, 2023

Conversation

ibgreen
Copy link
Collaborator

@ibgreen ibgreen commented Aug 28, 2023

For #

Background

  • Addressing report that constant attributes don't work when setting one interleaved attribute to constant.

Change List

  • Naive fix for constant attributes, not tested.

@@ -393,6 +393,7 @@ export class WEBGLRenderPipeline extends RenderPipeline {
continue; // eslint-disable-line no-continue
}
this.vertexArrayObject.setConstant(attributeInfo.location, value);
this.vertexArrayObject.enable(attributeInfo.location, false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this go into VertexArrayObject.setConstant? enable is called in VertexArrayObject.setBuffer

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes I was considering it. One small hesitation was that in principle, the vertexArray does not have to be updated every draw, as each model could have its own vertexArray and just bind it, even when they share programs.

If we did that, it would mean that the location disable state could also be saved, however the constant values must still be updated on every draw as they are stored on the shared context and might have been clobbered by the constant values of other draw calls.

So there is perhaps a small case for keeping these separate. Will give it some more thought.

@ibgreen ibgreen merged commit 211eb30 into master Aug 28, 2023
1 of 2 checks passed
@ibgreen ibgreen deleted the ib/fix-constant-attributes branch August 28, 2023 23:35
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.

2 participants