MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / IsCompatibleModule

Method IsCompatibleModule

source/opt/graphics_robust_access_pass.cpp:188–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188spv_result_t GraphicsRobustAccessPass::IsCompatibleModule() {
189 auto* feature_mgr = context()->get_feature_mgr();
190 if (!feature_mgr->HasCapability(spv::Capability::Shader))
191 return Fail() << "Can only process Shader modules";
192 if (feature_mgr->HasCapability(spv::Capability::VariablePointers))
193 return Fail() << "Can't process modules with VariablePointers capability";
194 if (feature_mgr->HasCapability(
195 spv::Capability::VariablePointersStorageBuffer))
196 return Fail() << "Can't process modules with VariablePointersStorageBuffer "
197 "capability";
198 if (feature_mgr->HasCapability(spv::Capability::RuntimeDescriptorArrayEXT)) {
199 // These have a RuntimeArray outside of Block-decorated struct. There
200 // is no way to compute the array length from within SPIR-V.
201 return Fail() << "Can't process modules with RuntimeDescriptorArrayEXT "
202 "capability";
203 }
204
205 {
206 auto* inst = context()->module()->GetMemoryModel();
207 const auto addressing_model =
208 spv::AddressingModel(inst->GetSingleWordOperand(0));
209 if (addressing_model != spv::AddressingModel::Logical)
210 return Fail() << "Addressing model must be Logical. Found "
211 << inst->PrettyPrint();
212 }
213 return SPV_SUCCESS;
214}
215
216spv_result_t GraphicsRobustAccessPass::ProcessCurrentModule() {
217 auto err = IsCompatibleModule();

Callers

nothing calls this directly

Calls 6

GetSingleWordOperandMethod · 0.80
get_feature_mgrMethod · 0.45
HasCapabilityMethod · 0.45
GetMemoryModelMethod · 0.45
moduleMethod · 0.45
PrettyPrintMethod · 0.45

Tested by

no test coverage detected