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

Function CheckBuiltInVariable

source/val/validate_decorations.cpp:820–833  ·  view source on GitHub ↗

Checks whether a builtin variable is valid.

Source from the content-addressed store, hash-verified

818
819// Checks whether a builtin variable is valid.
820spv_result_t CheckBuiltInVariable(uint32_t var_id, ValidationState_t& vstate) {
821 const auto& decorations = vstate.id_decorations(var_id);
822 for (const auto& d : decorations) {
823 if (spvIsVulkanEnv(vstate.context()->target_env)) {
824 if (d.dec_type() == spv::Decoration::Location ||
825 d.dec_type() == spv::Decoration::Component) {
826 return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id))
827 << vstate.VkErrorID(4915) << "A BuiltIn variable (id " << var_id
828 << ") cannot have any Location or Component decorations";
829 }
830 }
831 }
832 return SPV_SUCCESS;
833}
834
835// Checks whether proper decorations have been applied to the entry points.
836spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) {

Callers 1

Calls 6

spvIsVulkanEnvFunction · 0.85
dec_typeMethod · 0.80
diagMethod · 0.80
FindDefMethod · 0.80
VkErrorIDMethod · 0.80
contextMethod · 0.45

Tested by

no test coverage detected