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

Function ValidateVariableVulkanInterface

source/val/validate_memory.cpp:740–768  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

738}
739
740spv_result_t ValidateVariableVulkanInterface(ValidationState_t& _,
741 const Instruction* inst,
742 spv::StorageClass storage_class,
743 const Instruction* value_type,
744 uint32_t value_id) {
745 // Check for invalid use of Invariant
746 if (storage_class != spv::StorageClass::Input &&
747 storage_class != spv::StorageClass::Output) {
748 if (_.HasDecoration(inst->id(), spv::Decoration::Invariant)) {
749 return _.diag(SPV_ERROR_INVALID_ID, inst)
750 << _.VkErrorID(4677)
751 << "Variable decorated with Invariant must only be identified "
752 "with the Input or Output storage class in Vulkan "
753 "environment.";
754 }
755 // Need to check if only the members in a struct are decorated
756 if (value_type && value_type->opcode() == spv::Op::OpTypeStruct) {
757 if (_.HasDecoration(value_id, spv::Decoration::Invariant)) {
758 return _.diag(SPV_ERROR_INVALID_ID, inst)
759 << _.VkErrorID(4677)
760 << "Variable struct member decorated with Invariant must only "
761 "be identified with the Input or Output storage class in "
762 "Vulkan environment.";
763 }
764 }
765 }
766
767 return SPV_SUCCESS;
768}
769
770spv_result_t ValidateVariableCoopMat(ValidationState_t& _,
771 const Instruction* inst,

Callers 1

ValidateVariableFunction · 0.85

Calls 5

diagMethod · 0.80
VkErrorIDMethod · 0.80
HasDecorationMethod · 0.45
idMethod · 0.45
opcodeMethod · 0.45

Tested by

no test coverage detected