1 // Copyright 2015 The Shaderc Authors. All rights reserved. 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 LIBSHADERC_UTIL_INC_VERSION_PROFILE_H_ 16 #define LIBSHADERC_UTIL_INC_VERSION_PROFILE_H_ 17 18 #include <string> 19 20 #include "glslang/MachineIndependent/Versions.h" 21 22 namespace shaderc_util { 23 24 // Returns true if the given version is an accepted GLSL (ES) version. 25 inline bool IsKnownVersion(int version) { 26 return version == 100 || version == 110 || version == 120 || version == 130 || 27 version == 140 || version == 150 || version == 300 || version == 330 || 28 version == 310 || version == 400 || version == 410 || version == 420 || 29 version == 430 || version == 440 || version == 450; 30 } 31 32 // Given a string version_profile containing both version and profile, decodes 33 // it and puts the decoded version in version, decoded profile in profile. 34 // Returns true if decoding is successful and version and profile are accepted. 35 bool ParseVersionProfile(const std::string& version_profile, int* version, 36 EProfile* profile); 37 38 } // namespace shaderc_util 39 40 #endif // LIBSHADERC_UTIL_INC_VERSION_PROFILE_H_ 41