// // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2012-2013 LunarG, Inc. // Copyright (C) 2017 ARM Limited. // Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // // Neither the name of 3Dlabs Inc. Ltd. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // #ifndef _BASICTYPES_INCLUDED_ #define _BASICTYPES_INCLUDED_ namespace glslang { // // Basic type. Arrays, vectors, sampler details, etc., are orthogonal to this. // enum TBasicType { … }; // // Storage qualifiers. Should align with different kinds of storage or // resource or GLSL storage qualifier. Expansion is deprecated. // // N.B.: You probably DON'T want to add anything here, but rather just add it // to the built-in variables. See the comment above TBuiltInVariable. // // A new built-in variable will normally be an existing qualifier, like 'in', 'out', etc. // DO NOT follow the design pattern of, say EvqInstanceId, etc. // enum TStorageQualifier { … }; // // Subcategories of the TStorageQualifier, simply to give a direct mapping // between built-in variable names and an numerical value (the enum). // // For backward compatibility, there is some redundancy between the // TStorageQualifier and these. Existing members should both be maintained accurately. // However, any new built-in variable (and any existing non-redundant one) // must follow the pattern that the specific built-in is here, and only its // general qualifier is in TStorageQualifier. // // Something like gl_Position, which is sometimes 'in' and sometimes 'out' // shows up as two different built-in variables in a single stage, but // only has a single enum in TBuiltInVariable, so both the // TStorageQualifier and the TBuitinVariable are needed to distinguish // between them. // enum TBuiltInVariable { … }; // In this enum, order matters; users can assume higher precision is a bigger value // and EpqNone is 0. enum TPrecisionQualifier { … }; // These will show up in error messages __inline const char* GetStorageQualifierString(TStorageQualifier q) { … } __inline const char* GetBuiltInVariableString(TBuiltInVariable v) { … } __inline const char* GetPrecisionQualifierString(TPrecisionQualifier p) { … } __inline bool isTypeSignedInt(TBasicType type) { … } __inline bool isTypeUnsignedInt(TBasicType type) { … } __inline bool isTypeInt(TBasicType type) { … } __inline bool isTypeFloat(TBasicType type) { … } __inline int getTypeRank(TBasicType type) { … } } // end namespace glslang #endif // _BASICTYPES_INCLUDED_