hadronized / luminance-rs

Type-safe, type-level and stateless Rust graphics framework
https://phaazon.github.io/learn-luminance/
Other
1.09k stars 59 forks source link

Incorrect(?) warning when a shader uses a subset of attributes declared in semantics #577

Open kpreid opened 2 years ago

kpreid commented 2 years ago

The documentation for Semantics says:

Sometimes, a shader just need a few information from the vertex attributes. You then want to be able to authorize “gaps” in the semantics so that shaders can be used for several varieties of vertex formats.

But, for each attribute name in the semantics enum, a compilation warning appears (shader program warning: vertex attribute warning: inactive <name of attribute> vertex attribute) if the shader does not read that attribute. I tried adding unbound, by analogy to #[uniform(unbound)], but that did not silence the warning.

Are these warnings meant to be ignored, or should there be a way to suppress them? Or is the documentation incorrect, and Semantics should not be reused for shader programs needing different sets of information?

(In the case where this came up, both the vertex type and the shader agree on having a smaller set of attributes; I could easily define a second, narrower Semantics enum. But it seemed like using the same Semantics was meant to be possible.)

hadronized commented 2 years ago

There should be only one Semantics for your whole application ideally. So yes, it should be possible to remove those warnings. I noticed them too lately. I’ll have a look asap.