close
Skip to content

Support gl_InstanceIndex in shaders#1262

Merged
cart merged 1 commit into
bevyengine:masterfrom
alec-deason:support_gl_instanceindex
Jan 19, 2021
Merged

Support gl_InstanceIndex in shaders#1262
cart merged 1 commit into
bevyengine:masterfrom
alec-deason:support_gl_instanceindex

Conversation

@alec-deason
Copy link
Copy Markdown
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
Copy Markdown
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