Checks whether a builtin variable is valid.
| 818 | |
| 819 | // Checks whether a builtin variable is valid. |
| 820 | spv_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. |
| 836 | spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { |
no test coverage detected