Skip to content

remove has_capability() checks#531

Open
Firestar99 wants to merge 2 commits into
mainfrom
remove_has_capability
Open

remove has_capability() checks#531
Firestar99 wants to merge 2 commits into
mainfrom
remove_has_capability

Conversation

@Firestar99

@Firestar99 Firestar99 commented Feb 18, 2026

Copy link
Copy Markdown
Member
  • remove BuilderSpirv::has_capability(&self, capability: Capability) -> bool, you can no longer check whether some capability is enabled. Progress towards RFC: link-time capabilities #388
  • add compiletests for non_uniform removal by post-link pass (previously partially gated behind has_capability check)

@Firestar99 Firestar99 force-pushed the remove_has_capability branch 3 times, most recently from c38ccd4 to 784c8c8 Compare February 19, 2026 10:05
@Firestar99 Firestar99 marked this pull request as ready for review February 19, 2026 10:10
@Firestar99 Firestar99 force-pushed the remove_has_capability branch from 784c8c8 to ddbc0c2 Compare April 8, 2026 11:11
@Firestar99 Firestar99 force-pushed the remove_has_capability branch from ddbc0c2 to 3874f69 Compare April 8, 2026 11:20
Comment on lines -53 to +56
if self.builder.has_capability(Capability::ShaderNonUniform) {
// apply NonUniform to the operation and the index
self.emit()
.decorate(ptr.def(self), Decoration::NonUniform, []);
self.emit()
.decorate(actual_index, Decoration::NonUniform, []);
}
// apply NonUniform to the operation and the index
self.emit()
.decorate(ptr.def(self), Decoration::NonUniform, []);
self.emit()
.decorate(actual_index, Decoration::NonUniform, []);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test using this feature, but not enabling ShaderNonUniform?

It should trigger a validation error from the new SPIR-T-based validation pass, if I'm not mistaken.

Comment on lines 571 to +575
fn zombie_ptr_equal(&self, def: Word, inst: &str) {
if !self.builder.has_capability(Capability::VariablePointers) {
self.zombie(
def,
&format!("{inst} without OpCapability VariablePointers"),
);
}
self.zombie(
def,
&format!("{inst} without OpCapability VariablePointers"),
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is weird. I would almost want to say that the instruction is not yet supported, rather than claiming any connection to VariablePointers (which doesn't give you pointer equality in general, just in very narrow cases).

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