Open tangmi opened 5 years ago
I wonder if we could employ reflection capabilties of d3d11 here and pick the semantic index as we already do with the semantic name. Currently not sure if there will be conflicts. See https://github.com/gfx-rs/gfx/blob/pre-ll/src/backend/dx11/src/mirror.rs#L108
I've found a (hacky) solution that seems to work: https://github.com/gfx-rs/gfx/pull/2747/files. The idea is to try both TEXCOORD
and TEXCOORD0
to see if one sticks.
Thinking a bit of this, I would see supporting either location indices or strings as two variants for the pipeline vertex macros would be a way to go here. Trying to infer the locations from the order sounds really scary to me. As location is the only information from SPIR-V for the shader interface it's difficult with information we provide on the host side to do the necessary reflection/generating binding information.
A possible variant:
vertex TerrainVertex {
pos: [f32; 3] = 0,
normal: [f32; 3] = 1,
color: [f32; 3] = 2,
}
I don't know how difficult this would be to integrate with the currently pipeline macros as I don't really looked into these.
Short info header:
I'm wondering how to correctly support HLSL semantics with indexes like these:
I've made an attempt here: https://github.com/gfx-rs/gfx/pull/2747, but I can tell this solution is pretty sketchy.
My best guess is that
Structure<Format>::query
needs to take ashade::AttributeVar
instead of a&str
and thegfx_defines!
macros should generate aquery
implementation that is aware of indexed semantics?Thanks for your time!