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

Support gl_InstanceIndex in shaders #1262

Merged
merged 1 commit into from
Jan 19, 2021

Conversation

alec-deason
Copy link
Member

@alec-deason alec-deason commented Jan 18, 2021

In order to write useful shaders for instanced rendering it's necessary to have access to the gl_InstanceIndex builtin. Bevy's current shader reflection incorrectly identifies gl_InstanceIndex as a vertex attribute, preventing it from being used. This skips gl_InstanceIndex in the reflection code in the same way that gl_VertexIndex is already being skipped.

A more complete solution might be to enumerate all glsl builtins rather than just special casing them as needed but I decided to keep this change minimal because this seemed like code that was likely to be rewritten soon anyway. If someone thinks it's worth expanding to the more general version, I'm happy to do that in this PR.

@cart
Copy link
Member

cart commented Jan 19, 2021

I think this is a reasonable workaround for now. Thanks!

@cart cart merged commit 71c6a19 into bevyengine:master Jan 19, 2021
rparrett pushed a commit to rparrett/bevy that referenced this pull request Jan 27, 2021
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