-
Notifications
You must be signed in to change notification settings - Fork 244
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
Deprecate #[spirv(block)]
and auto-wrap in "interface blocks" instead.
#576
Conversation
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -499,6 +516,12 @@ impl fmt::Debug for SpirvTypePrinter<'_, '_> { | |||
.field("id", &self.id) | |||
.field("image_type", &self.cx.debug_type(image_type)) | |||
.finish(), | |||
|
|||
SpirvType::InterfaceBlock { inner_type } => f | |||
.debug_struct("SampledImage") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.debug_struct("InterfaceBlock")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
let len = bx | ||
.emit() | ||
.array_length( | ||
len_spirv_type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12 levels of indentation makes me sad :( would be nice to split this out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
,Uniform
andStorageBufer
interface variables must have aBlock
-decoratedOpTypeStruct
typestruct
(with some fields) inside an "interface block" shouldn't differ from having those same fields in the "interface block" itselfstruct
and annotate it with#[spirv(block)]
Input
/Output
can 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 thestruct
wrapping 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.