Deprecate #[spirv(block)] and auto-wrap in "interface blocks" instead.#576
Deprecate #[spirv(block)] and auto-wrap in "interface blocks" instead.#576eddyb merged 8 commits intoEmbarkStudios:mainfrom LykenSol:autoblock
#[spirv(block)] and auto-wrap in "interface blocks" instead.#576Conversation
|
Very nice :D |
|
@khyperia @XAMPPRocky For the record I think this could be avoided in the future if GitHub has an option to require reviews from everyone who was added as a reviewer. EDIT: can't find such an option in the branch protection settings of my own repos, welp. |
| Decoration::Offset, | ||
| [Operand::LiteralInt32(0)].iter().cloned(), |
There was a problem hiding this comment.
What happens if there's multiple interface blocks in the function? Won't this point them to the same offset?
There was a problem hiding this comment.
This is just what you would get from this kind of struct:
#[spirv(block)]
struct InterfaceBlock<T> {
inner: T,
}So this isn't a regression, and I believe offsets are per interface variable.
There's an unrelated issue that we allow multiple push constants and multiple other bindings with the same (descriptor_set, binding), that's the only situations I can think of in which anything would overlap.
| .finish(), | ||
|
|
||
| SpirvType::InterfaceBlock { inner_type } => f | ||
| .debug_struct("SampledImage") |
There was a problem hiding this comment.
.debug_struct("InterfaceBlock")| let len = bx | ||
| .emit() | ||
| .array_length( | ||
| len_spirv_type, |
There was a problem hiding this comment.
12 levels of indentation makes me sad :( would be nice to split this out
There was a problem hiding this comment.
I guess the newly introduced use of Builder means that we can interleave things a bit more and not have to separate them out so much - e.g. declare_interface_global_for_param could also return an OperandValue for the call args.
As per Vulkan and OpenGL requirements:
PushConstant,UniformandStorageBuferinterface variables must have aBlock-decoratedOpTypeStructtypestruct(with some fields) inside an "interface block" shouldn't differ from having those same fields in the "interface block" itselfstructand annotate it with#[spirv(block)]Input/Outputcan also use "interface blocks", but it's not mandatoryMost of the commits in this PR are small refactors, leading up to the last commit, which is the actual change.
Because of
#[spirv(block)]being deprecated instead of outright removed, this isn't a breaking change, except for slices, where you have to remove thestructwrapping the[T]that you previously had to add - it's now just:The auto-generated "interface block" also allows simpler uniforms like this to "just work":
Closes #391.
EDIT: temporarily rebased on top of #577 to unbreak CI.