| 937 | } |
| 938 | |
| 939 | spv_result_t ValidateMemoryModel(ValidationState_t& _, |
| 940 | const Instruction* inst) { |
| 941 | // Already produced an error if multiple memory model instructions are |
| 942 | // present. |
| 943 | if (_.memory_model() != spv::MemoryModel::VulkanKHR && |
| 944 | _.HasCapability(spv::Capability::VulkanMemoryModelKHR)) { |
| 945 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 946 | << "VulkanMemoryModelKHR capability must only be specified if " |
| 947 | "the VulkanKHR memory model is used."; |
| 948 | } |
| 949 | |
| 950 | if (spvIsOpenCLEnv(_.context()->target_env)) { |
| 951 | if ((_.addressing_model() != spv::AddressingModel::Physical32) && |
| 952 | (_.addressing_model() != spv::AddressingModel::Physical64)) { |
| 953 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 954 | << "Addressing model must be Physical32 or Physical64 " |
| 955 | << "in the OpenCL environment."; |
| 956 | } |
| 957 | if (_.memory_model() != spv::MemoryModel::OpenCL) { |
| 958 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 959 | << "Memory model must be OpenCL in the OpenCL environment."; |
| 960 | } |
| 961 | } |
| 962 | |
| 963 | if (spvIsVulkanEnv(_.context()->target_env)) { |
| 964 | if ((_.addressing_model() != spv::AddressingModel::Logical) && |
| 965 | (_.addressing_model() != |
| 966 | spv::AddressingModel::PhysicalStorageBuffer64)) { |
| 967 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 968 | << _.VkErrorID(4635) |
| 969 | << "Addressing model must be Logical or PhysicalStorageBuffer64 " |
| 970 | << "in the Vulkan environment."; |
| 971 | } |
| 972 | } |
| 973 | return SPV_SUCCESS; |
| 974 | } |
| 975 | |
| 976 | bool PerEntryExecutionMode(spv::ExecutionMode mode) { |
| 977 | switch (mode) { |
no test coverage detected