1 // Copyright (c) 2016 Google Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef SOURCE_SPIRV_TARGET_ENV_H_ 16 #define SOURCE_SPIRV_TARGET_ENV_H_ 17 18 #include "spirv-tools/libspirv.h" 19 20 // Parses s into *env and returns true if successful. If unparsable, returns 21 // false and sets *env to SPV_ENV_UNIVERSAL_1_0. 22 bool spvParseTargetEnv(const char* s, spv_target_env* env); 23 24 // Returns true if |env| is a VULKAN environment, false otherwise. 25 bool spvIsVulkanEnv(spv_target_env env); 26 27 // Returns true if |env| is an OPENCL environment, false otherwise. 28 bool spvIsOpenCLEnv(spv_target_env env); 29 30 // Returns true if |env| is an WEBGPU environment, false otherwise. 31 bool spvIsWebGPUEnv(spv_target_env env); 32 33 // Returns the version number for the given SPIR-V target environment. 34 uint32_t spvVersionForTargetEnv(spv_target_env env); 35 36 #endif // SOURCE_SPIRV_TARGET_ENV_H_ 37