Path: blob/master/thirdparty/glslang/glslang/MachineIndependent/Initialize.cpp
10933 views
//1// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.2// Copyright (C) 2012-2016 LunarG, Inc.3// Copyright (C) 2015-2020 Google, Inc.4// Copyright (C) 2017, 2022-2024 Arm Limited.5// Modifications Copyright (C) 2020-2021 Advanced Micro Devices, Inc. All rights reserved.6//7// All rights reserved.8//9// Redistribution and use in source and binary forms, with or without10// modification, are permitted provided that the following conditions11// are met:12//13// Redistributions of source code must retain the above copyright14// notice, this list of conditions and the following disclaimer.15//16// Redistributions in binary form must reproduce the above17// copyright notice, this list of conditions and the following18// disclaimer in the documentation and/or other materials provided19// with the distribution.20//21// Neither the name of 3Dlabs Inc. Ltd. nor the names of its22// contributors may be used to endorse or promote products derived23// from this software without specific prior written permission.24//25// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS26// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT27// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS28// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE29// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,30// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,31// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;32// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER33// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT34// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN35// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE36// POSSIBILITY OF SUCH DAMAGE.37//3839//40// Create strings that declare built-in definitions, add built-ins programmatically41// that cannot be expressed in the strings, and establish mappings between42// built-in functions and operators.43//44// Where to put a built-in:45// TBuiltIns::initialize(version,profile) context-independent textual built-ins; add them to the right string46// TBuiltIns::initialize(resources,...) context-dependent textual built-ins; add them to the right string47// TBuiltIns::identifyBuiltIns(...,symbolTable) context-independent programmatic additions/mappings to the symbol table,48// including identifying what extensions are needed if a version does not allow a symbol49// TBuiltIns::identifyBuiltIns(...,symbolTable, resources) context-dependent programmatic additions/mappings to the symbol table,50// including identifying what extensions are needed if a version does not allow a symbol51//5253#include <array>54#include "Initialize.h"55#include "span.h"5657namespace glslang {5859// TODO: ARB_Compatability: do full extension support60const bool ARBCompatibility = true;6162const bool ForwardCompatibility = false;6364namespace {6566//67// A set of definitions for tabling of the built-in functions.68//6970// Order matters here, as does correlation with the subsequent71// "const int ..." declarations and the ArgType enumerants.72const char* TypeString[] = {73"bool", "bvec2", "bvec3", "bvec4",74"float", "vec2", "vec3", "vec4",75"int", "ivec2", "ivec3", "ivec4",76"uint", "uvec2", "uvec3", "uvec4",77};78const int TypeStringCount = sizeof(TypeString) / sizeof(char*); // number of entries in 'TypeString'79const int TypeStringRowShift = 2; // shift amount to go downe one row in 'TypeString'80const int TypeStringColumnMask = (1 << TypeStringRowShift) - 1; // reduce type to its column number in 'TypeString'81const int TypeStringScalarMask = ~TypeStringColumnMask; // take type to its scalar column in 'TypeString'8283enum ArgType {84// numbers hardcoded to correspond to 'TypeString'; order and value matter85TypeB = 1 << 0, // Boolean86TypeF = 1 << 1, // float 3287TypeI = 1 << 2, // int 3288TypeU = 1 << 3, // uint 3289TypeF16 = 1 << 4, // float 1690TypeF64 = 1 << 5, // float 6491TypeI8 = 1 << 6, // int 892TypeI16 = 1 << 7, // int 1693TypeI64 = 1 << 8, // int 6494TypeU8 = 1 << 9, // uint 895TypeU16 = 1 << 10, // uint 1696TypeU64 = 1 << 11, // uint 6497};98// Mixtures of the above, to help the function tables99const ArgType TypeFI = static_cast<ArgType>(TypeF | TypeI);100const ArgType TypeFIB = static_cast<ArgType>(TypeF | TypeI | TypeB);101const ArgType TypeIU = static_cast<ArgType>(TypeI | TypeU);102103// The relationships between arguments and return type, whether anything is104// output, or other unusual situations.105enum ArgClass {106ClassRegular = 0, // nothing special, just all vector widths with matching return type; traditional arithmetic107ClassLS = 1 << 0, // the last argument is also held fixed as a (type-matched) scalar while the others cycle108ClassXLS = 1 << 1, // the last argument is exclusively a (type-matched) scalar while the others cycle109ClassLS2 = 1 << 2, // the last two arguments are held fixed as a (type-matched) scalar while the others cycle110ClassFS = 1 << 3, // the first argument is held fixed as a (type-matched) scalar while the others cycle111ClassFS2 = 1 << 4, // the first two arguments are held fixed as a (type-matched) scalar while the others cycle112ClassLO = 1 << 5, // the last argument is an output113ClassB = 1 << 6, // return type cycles through only bool/bvec, matching vector width of args114ClassLB = 1 << 7, // last argument cycles through only bool/bvec, matching vector width of args115ClassV1 = 1 << 8, // scalar only116ClassFIO = 1 << 9, // first argument is inout117ClassRS = 1 << 10, // the return is held scalar as the arguments cycle118ClassNS = 1 << 11, // no scalar prototype119ClassCV = 1 << 12, // first argument is 'coherent volatile'120ClassFO = 1 << 13, // first argument is output121ClassV3 = 1 << 14, // vec3 only122};123// Mixtures of the above, to help the function tables124const ArgClass ClassV1FIOCV = (ArgClass)(ClassV1 | ClassFIO | ClassCV);125const ArgClass ClassBNS = (ArgClass)(ClassB | ClassNS);126const ArgClass ClassRSNS = (ArgClass)(ClassRS | ClassNS);127128// A descriptor, for a single profile, of when something is available.129// If the current profile does not match 'profile' mask below, the other fields130// do not apply (nor validate).131// profiles == EBadProfile is the end of an array of these132struct Versioning {133EProfile profiles; // the profile(s) (mask) that the following fields are valid for134int minExtendedVersion; // earliest version when extensions are enabled; ignored if numExtensions is 0135int minCoreVersion; // earliest version function is in core; 0 means never136int numExtensions; // how many extensions are in the 'extensions' list137const char** extensions; // list of extension names enabling the function138};139140EProfile EDesktopProfile = static_cast<EProfile>(ENoProfile | ECoreProfile | ECompatibilityProfile);141142// Declare pointers to put into the table for versioning.143const std::array Es300Desktop130Version = { Versioning{ EEsProfile, 0, 300, 0, nullptr },144Versioning{ EDesktopProfile, 0, 130, 0, nullptr },145};146147const std::array Es310Desktop400Version = { Versioning{ EEsProfile, 0, 310, 0, nullptr },148Versioning{ EDesktopProfile, 0, 400, 0, nullptr },149};150151const std::array Es310Desktop450Version = { Versioning{ EEsProfile, 0, 310, 0, nullptr },152Versioning{ EDesktopProfile, 0, 450, 0, nullptr },153};154155// The main descriptor of what a set of function prototypes can look like, and156// a pointer to extra versioning information, when needed.157struct BuiltInFunction {158TOperator op; // operator to map the name to159const char* name; // function name160int numArguments; // number of arguments (overloads with varying arguments need different entries)161ArgType types; // ArgType mask162ArgClass classes; // the ways this particular function entry manifests163const span<const Versioning> versioning; // An empty span means always a valid version164};165166// The tables can have the same built-in function name more than one time,167// but the exact same prototype must be indicated at most once.168// The prototypes that get declared are the union of all those indicated.169// This is important when different releases add new prototypes for the same name.170// It also also congnitively simpler tiling of the prototype space.171// In practice, most names can be fully represented with one entry.172//173// Table is terminated by an OpNull TOperator.174175const std::array BaseFunctions = {176// TOperator, name, arg-count, ArgType, ArgClass, versioning177// --------- ---- --------- ------- -------- ----------178BuiltInFunction{ EOpRadians, "radians", 1, TypeF, ClassRegular, {} },179BuiltInFunction{ EOpDegrees, "degrees", 1, TypeF, ClassRegular, {} },180BuiltInFunction{ EOpSin, "sin", 1, TypeF, ClassRegular, {} },181BuiltInFunction{ EOpCos, "cos", 1, TypeF, ClassRegular, {} },182BuiltInFunction{ EOpTan, "tan", 1, TypeF, ClassRegular, {} },183BuiltInFunction{ EOpAsin, "asin", 1, TypeF, ClassRegular, {} },184BuiltInFunction{ EOpAcos, "acos", 1, TypeF, ClassRegular, {} },185BuiltInFunction{ EOpAtan, "atan", 2, TypeF, ClassRegular, {} },186BuiltInFunction{ EOpAtan, "atan", 1, TypeF, ClassRegular, {} },187BuiltInFunction{ EOpPow, "pow", 2, TypeF, ClassRegular, {} },188BuiltInFunction{ EOpExp, "exp", 1, TypeF, ClassRegular, {} },189BuiltInFunction{ EOpLog, "log", 1, TypeF, ClassRegular, {} },190BuiltInFunction{ EOpExp2, "exp2", 1, TypeF, ClassRegular, {} },191BuiltInFunction{ EOpLog2, "log2", 1, TypeF, ClassRegular, {} },192BuiltInFunction{ EOpSqrt, "sqrt", 1, TypeF, ClassRegular, {} },193BuiltInFunction{ EOpInverseSqrt, "inversesqrt", 1, TypeF, ClassRegular, {} },194BuiltInFunction{ EOpAbs, "abs", 1, TypeF, ClassRegular, {} },195BuiltInFunction{ EOpSign, "sign", 1, TypeF, ClassRegular, {} },196BuiltInFunction{ EOpFloor, "floor", 1, TypeF, ClassRegular, {} },197BuiltInFunction{ EOpCeil, "ceil", 1, TypeF, ClassRegular, {} },198BuiltInFunction{ EOpFract, "fract", 1, TypeF, ClassRegular, {} },199BuiltInFunction{ EOpMod, "mod", 2, TypeF, ClassLS, {} },200BuiltInFunction{ EOpMin, "min", 2, TypeF, ClassLS, {} },201BuiltInFunction{ EOpMax, "max", 2, TypeF, ClassLS, {} },202BuiltInFunction{ EOpClamp, "clamp", 3, TypeF, ClassLS2, {} },203BuiltInFunction{ EOpMix, "mix", 3, TypeF, ClassLS, {} },204BuiltInFunction{ EOpStep, "step", 2, TypeF, ClassFS, {} },205BuiltInFunction{ EOpSmoothStep, "smoothstep", 3, TypeF, ClassFS2, {} },206BuiltInFunction{ EOpNormalize, "normalize", 1, TypeF, ClassRegular, {} },207BuiltInFunction{ EOpFaceForward, "faceforward", 3, TypeF, ClassRegular, {} },208BuiltInFunction{ EOpReflect, "reflect", 2, TypeF, ClassRegular, {} },209BuiltInFunction{ EOpRefract, "refract", 3, TypeF, ClassXLS, {} },210BuiltInFunction{ EOpLength, "length", 1, TypeF, ClassRS, {} },211BuiltInFunction{ EOpDistance, "distance", 2, TypeF, ClassRS, {} },212BuiltInFunction{ EOpDot, "dot", 2, TypeF, ClassRS, {} },213BuiltInFunction{ EOpCross, "cross", 2, TypeF, ClassV3, {} },214BuiltInFunction{ EOpLessThan, "lessThan", 2, TypeFI, ClassBNS, {} },215BuiltInFunction{ EOpLessThanEqual, "lessThanEqual", 2, TypeFI, ClassBNS, {} },216BuiltInFunction{ EOpGreaterThan, "greaterThan", 2, TypeFI, ClassBNS, {} },217BuiltInFunction{ EOpGreaterThanEqual, "greaterThanEqual", 2, TypeFI, ClassBNS, {} },218BuiltInFunction{ EOpVectorEqual, "equal", 2, TypeFIB, ClassBNS, {} },219BuiltInFunction{ EOpVectorNotEqual, "notEqual", 2, TypeFIB, ClassBNS, {} },220BuiltInFunction{ EOpAny, "any", 1, TypeB, ClassRSNS, {} },221BuiltInFunction{ EOpAll, "all", 1, TypeB, ClassRSNS, {} },222BuiltInFunction{ EOpVectorLogicalNot, "not", 1, TypeB, ClassNS, {} },223BuiltInFunction{ EOpSinh, "sinh", 1, TypeF, ClassRegular, {Es300Desktop130Version} },224BuiltInFunction{ EOpCosh, "cosh", 1, TypeF, ClassRegular, {Es300Desktop130Version} },225BuiltInFunction{ EOpTanh, "tanh", 1, TypeF, ClassRegular, {Es300Desktop130Version} },226BuiltInFunction{ EOpAsinh, "asinh", 1, TypeF, ClassRegular, {Es300Desktop130Version} },227BuiltInFunction{ EOpAcosh, "acosh", 1, TypeF, ClassRegular, {Es300Desktop130Version} },228BuiltInFunction{ EOpAtanh, "atanh", 1, TypeF, ClassRegular, {Es300Desktop130Version} },229BuiltInFunction{ EOpAbs, "abs", 1, TypeI, ClassRegular, {Es300Desktop130Version} },230BuiltInFunction{ EOpSign, "sign", 1, TypeI, ClassRegular, {Es300Desktop130Version} },231BuiltInFunction{ EOpTrunc, "trunc", 1, TypeF, ClassRegular, {Es300Desktop130Version} },232BuiltInFunction{ EOpRound, "round", 1, TypeF, ClassRegular, {Es300Desktop130Version} },233BuiltInFunction{ EOpRoundEven, "roundEven", 1, TypeF, ClassRegular, {Es300Desktop130Version} },234BuiltInFunction{ EOpModf, "modf", 2, TypeF, ClassLO, {Es300Desktop130Version} },235BuiltInFunction{ EOpMin, "min", 2, TypeIU, ClassLS, {Es300Desktop130Version} },236BuiltInFunction{ EOpMax, "max", 2, TypeIU, ClassLS, {Es300Desktop130Version} },237BuiltInFunction{ EOpClamp, "clamp", 3, TypeIU, ClassLS2, {Es300Desktop130Version} },238BuiltInFunction{ EOpMix, "mix", 3, TypeF, ClassLB, {Es300Desktop130Version} },239BuiltInFunction{ EOpIsInf, "isinf", 1, TypeF, ClassB, {Es300Desktop130Version} },240BuiltInFunction{ EOpIsNan, "isnan", 1, TypeF, ClassB, {Es300Desktop130Version} },241BuiltInFunction{ EOpLessThan, "lessThan", 2, TypeU, ClassBNS, {Es300Desktop130Version} },242BuiltInFunction{ EOpLessThanEqual, "lessThanEqual", 2, TypeU, ClassBNS, {Es300Desktop130Version} },243BuiltInFunction{ EOpGreaterThan, "greaterThan", 2, TypeU, ClassBNS, {Es300Desktop130Version} },244BuiltInFunction{ EOpGreaterThanEqual, "greaterThanEqual", 2, TypeU, ClassBNS, {Es300Desktop130Version} },245BuiltInFunction{ EOpVectorEqual, "equal", 2, TypeU, ClassBNS, {Es300Desktop130Version} },246BuiltInFunction{ EOpVectorNotEqual, "notEqual", 2, TypeU, ClassBNS, {Es300Desktop130Version} },247BuiltInFunction{ EOpAtomicAdd, "atomicAdd", 2, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },248BuiltInFunction{ EOpAtomicMin, "atomicMin", 2, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },249BuiltInFunction{ EOpAtomicMax, "atomicMax", 2, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },250BuiltInFunction{ EOpAtomicAnd, "atomicAnd", 2, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },251BuiltInFunction{ EOpAtomicOr, "atomicOr", 2, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },252BuiltInFunction{ EOpAtomicXor, "atomicXor", 2, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },253BuiltInFunction{ EOpAtomicExchange, "atomicExchange", 2, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },254BuiltInFunction{ EOpAtomicCompSwap, "atomicCompSwap", 3, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },255BuiltInFunction{ EOpMix, "mix", 3, TypeB, ClassRegular, {Es310Desktop450Version} },256BuiltInFunction{ EOpMix, "mix", 3, TypeIU, ClassLB, {Es310Desktop450Version} },257};258259const std::array DerivativeFunctions = {260BuiltInFunction{ EOpDPdx, "dFdx", 1, TypeF, ClassRegular, {} },261BuiltInFunction{ EOpDPdy, "dFdy", 1, TypeF, ClassRegular, {} },262BuiltInFunction{ EOpFwidth, "fwidth", 1, TypeF, ClassRegular, {} },263};264265// For functions declared some other way, but still use the table to relate to operator.266struct CustomFunction {267TOperator op; // operator to map the name to268const char* name; // function name269const span<const Versioning> versioning; // An empty span means always a valid version270};271272const CustomFunction CustomFunctions[] = {273{ EOpBarrier, "barrier", {} },274{ EOpMemoryBarrierShared, "memoryBarrierShared", {} },275{ EOpGroupMemoryBarrier, "groupMemoryBarrier", {} },276{ EOpMemoryBarrier, "memoryBarrier", {} },277{ EOpMemoryBarrierBuffer, "memoryBarrierBuffer", {} },278279{ EOpPackSnorm2x16, "packSnorm2x16", {} },280{ EOpUnpackSnorm2x16, "unpackSnorm2x16", {} },281{ EOpPackUnorm2x16, "packUnorm2x16", {} },282{ EOpUnpackUnorm2x16, "unpackUnorm2x16", {} },283{ EOpPackHalf2x16, "packHalf2x16", {} },284{ EOpUnpackHalf2x16, "unpackHalf2x16", {} },285286{ EOpMul, "matrixCompMult", {} },287{ EOpOuterProduct, "outerProduct", {} },288{ EOpTranspose, "transpose", {} },289{ EOpDeterminant, "determinant", {} },290{ EOpMatrixInverse, "inverse", {} },291{ EOpFloatBitsToInt, "floatBitsToInt", {} },292{ EOpFloatBitsToUint, "floatBitsToUint", {} },293{ EOpIntBitsToFloat, "intBitsToFloat", {} },294{ EOpUintBitsToFloat, "uintBitsToFloat", {} },295296{ EOpTextureQuerySize, "textureSize", {} },297{ EOpTextureQueryLod, "textureQueryLod", {} },298{ EOpTextureQueryLod, "textureQueryLOD", {} }, // extension GL_ARB_texture_query_lod299{ EOpTextureQueryLevels, "textureQueryLevels", {} },300{ EOpTextureQuerySamples, "textureSamples", {} },301{ EOpTexture, "texture", {} },302{ EOpTextureProj, "textureProj", {} },303{ EOpTextureLod, "textureLod", {} },304{ EOpTextureOffset, "textureOffset", {} },305{ EOpTextureFetch, "texelFetch", {} },306{ EOpTextureFetchOffset, "texelFetchOffset", {} },307{ EOpTextureProjOffset, "textureProjOffset", {} },308{ EOpTextureLodOffset, "textureLodOffset", {} },309{ EOpTextureProjLod, "textureProjLod", {} },310{ EOpTextureProjLodOffset, "textureProjLodOffset", {} },311{ EOpTextureGrad, "textureGrad", {} },312{ EOpTextureGradOffset, "textureGradOffset", {} },313{ EOpTextureProjGrad, "textureProjGrad", {} },314{ EOpTextureProjGradOffset, "textureProjGradOffset", {} },315};316317// For the given table of functions, add all the indicated prototypes for each318// one, to be returned in the passed in decls.319void AddTabledBuiltin(TString& decls, const BuiltInFunction& function)320{321const auto isScalarType = [](int type) { return (type & TypeStringColumnMask) == 0; };322323// loop across these two:324// 0: the varying arg set, and325// 1: the fixed scalar args326const ArgClass ClassFixed = (ArgClass)(ClassLS | ClassXLS | ClassLS2 | ClassFS | ClassFS2);327for (int fixed = 0; fixed < ((function.classes & ClassFixed) > 0 ? 2 : 1); ++fixed) {328329if (fixed == 0 && (function.classes & ClassXLS))330continue;331332// walk the type strings in TypeString[]333for (int type = 0; type < TypeStringCount; ++type) {334// skip types not selected: go from type to row number to type bit335if ((function.types & (1 << (type >> TypeStringRowShift))) == 0)336continue;337338// if we aren't on a scalar, and should be, skip339if ((function.classes & ClassV1) && !isScalarType(type))340continue;341342// if we aren't on a 3-vector, and should be, skip343if ((function.classes & ClassV3) && (type & TypeStringColumnMask) != 2)344continue;345346// skip replication of all arg scalars between the varying arg set and the fixed args347if (fixed == 1 && type == (type & TypeStringScalarMask) && (function.classes & ClassXLS) == 0)348continue;349350// skip scalars when we are told to351if ((function.classes & ClassNS) && isScalarType(type))352continue;353354// return type355if (function.classes & ClassB)356decls.append(TypeString[type & TypeStringColumnMask]);357else if (function.classes & ClassRS)358decls.append(TypeString[type & TypeStringScalarMask]);359else360decls.append(TypeString[type]);361decls.append(" ");362decls.append(function.name);363decls.append("(");364365// arguments366for (int arg = 0; arg < function.numArguments; ++arg) {367if (arg == function.numArguments - 1 && (function.classes & ClassLO))368decls.append("out ");369if (arg == 0) {370if (function.classes & ClassCV)371decls.append("coherent volatile ");372if (function.classes & ClassFIO)373decls.append("inout ");374if (function.classes & ClassFO)375decls.append("out ");376}377if ((function.classes & ClassLB) && arg == function.numArguments - 1)378decls.append(TypeString[type & TypeStringColumnMask]);379else if (fixed && ((arg == function.numArguments - 1 && (function.classes & (ClassLS | ClassXLS |380ClassLS2))) ||381(arg == function.numArguments - 2 && (function.classes & ClassLS2)) ||382(arg == 0 && (function.classes & (ClassFS | ClassFS2))) ||383(arg == 1 && (function.classes & ClassFS2))))384decls.append(TypeString[type & TypeStringScalarMask]);385else386decls.append(TypeString[type]);387if (arg < function.numArguments - 1)388decls.append(",");389}390decls.append(");\n");391}392}393}394395// See if the tabled versioning information allows the current version.396bool ValidVersion(const BuiltInFunction& function, int version, EProfile profile, const SpvVersion& /* spVersion */)397{398// nullptr means always valid399if (function.versioning.empty())400return true;401402// check for what is said about our current profile403for (const auto& v : function.versioning) {404if ((v.profiles & profile) != 0) {405if (v.minCoreVersion <= version || (v.numExtensions > 0 && v.minExtendedVersion <= version))406return true;407}408}409410return false;411}412413// Relate a single table of built-ins to their AST operator.414// This can get called redundantly (especially for the common built-ins, when415// called once per stage). This is a performance issue only, not a correctness416// concern. It is done for quality arising from simplicity, as there are subtleties417// to get correct if instead trying to do it surgically.418template<class FunctionContainer>419void RelateTabledBuiltins(const FunctionContainer& functions, TSymbolTable& symbolTable)420{421for (const auto& fn : functions) {422symbolTable.relateToOperator(fn.name, fn.op);423}424}425426} // end anonymous namespace427428// Add declarations for all tables of built-in functions.429void TBuiltIns::addTabledBuiltins(int version, EProfile profile, const SpvVersion& spvVersion)430{431const auto forEachFunction = [&](TString& decls, const span<const BuiltInFunction>& functions) {432for (const auto& fn : functions) {433if (ValidVersion(fn, version, profile, spvVersion))434AddTabledBuiltin(decls, fn);435}436};437438forEachFunction(commonBuiltins, BaseFunctions);439forEachFunction(stageBuiltins[EShLangFragment], DerivativeFunctions);440441if ((profile == EEsProfile && version >= 320) || (profile != EEsProfile && version >= 450))442forEachFunction(stageBuiltins[EShLangCompute], DerivativeFunctions);443}444445// Relate all tables of built-ins to the AST operators.446void TBuiltIns::relateTabledBuiltins(int /* version */, EProfile /* profile */, const SpvVersion& /* spvVersion */, EShLanguage /* stage */, TSymbolTable& symbolTable)447{448RelateTabledBuiltins(BaseFunctions, symbolTable);449RelateTabledBuiltins(DerivativeFunctions, symbolTable);450RelateTabledBuiltins(CustomFunctions, symbolTable);451}452453inline bool IncludeLegacy(int version, EProfile profile, const SpvVersion& spvVersion)454{455return profile != EEsProfile && (version <= 130 || (spvVersion.spv == 0 && version == 140 && ARBCompatibility) ||456profile == ECompatibilityProfile);457}458459// Construct TBuiltInParseables base class. This can be used for language-common constructs.460TBuiltInParseables::TBuiltInParseables()461{462}463464// Destroy TBuiltInParseables.465TBuiltInParseables::~TBuiltInParseables()466{467}468469TBuiltIns::TBuiltIns()470{471// Set up textual representations for making all the permutations472// of texturing/imaging functions.473prefixes[EbtFloat] = "";474prefixes[EbtInt] = "i";475prefixes[EbtUint] = "u";476prefixes[EbtFloat16] = "f16";477prefixes[EbtInt8] = "i8";478prefixes[EbtUint8] = "u8";479prefixes[EbtInt16] = "i16";480prefixes[EbtUint16] = "u16";481prefixes[EbtInt64] = "i64";482prefixes[EbtUint64] = "u64";483484postfixes[2] = "2";485postfixes[3] = "3";486postfixes[4] = "4";487488// Map from symbolic class of texturing dimension to numeric dimensions.489dimMap[Esd2D] = 2;490dimMap[Esd3D] = 3;491dimMap[EsdCube] = 3;492dimMap[Esd1D] = 1;493dimMap[EsdRect] = 2;494dimMap[EsdBuffer] = 1;495dimMap[EsdSubpass] = 2; // potentially unused for now496dimMap[EsdAttachmentEXT] = 2; // potentially unused for now497}498499TBuiltIns::~TBuiltIns()500{501}502503504//505// Add all context-independent built-in functions and variables that are present506// for the given version and profile. Share common ones across stages, otherwise507// make stage-specific entries.508//509// Most built-ins variables can be added as simple text strings. Some need to510// be added programmatically, which is done later in IdentifyBuiltIns() below.511//512void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvVersion)513{514addTabledBuiltins(version, profile, spvVersion);515516//============================================================================517//518// Prototypes for built-in functions used repeatly by different shaders519//520//============================================================================521522//523// Derivatives Functions.524//525TString derivativeControls (526"float dFdxFine(float p);"527"vec2 dFdxFine(vec2 p);"528"vec3 dFdxFine(vec3 p);"529"vec4 dFdxFine(vec4 p);"530531"float dFdyFine(float p);"532"vec2 dFdyFine(vec2 p);"533"vec3 dFdyFine(vec3 p);"534"vec4 dFdyFine(vec4 p);"535536"float fwidthFine(float p);"537"vec2 fwidthFine(vec2 p);"538"vec3 fwidthFine(vec3 p);"539"vec4 fwidthFine(vec4 p);"540541"float dFdxCoarse(float p);"542"vec2 dFdxCoarse(vec2 p);"543"vec3 dFdxCoarse(vec3 p);"544"vec4 dFdxCoarse(vec4 p);"545546"float dFdyCoarse(float p);"547"vec2 dFdyCoarse(vec2 p);"548"vec3 dFdyCoarse(vec3 p);"549"vec4 dFdyCoarse(vec4 p);"550551"float fwidthCoarse(float p);"552"vec2 fwidthCoarse(vec2 p);"553"vec3 fwidthCoarse(vec3 p);"554"vec4 fwidthCoarse(vec4 p);"555);556557TString derivativesAndControl16bits (558"float16_t dFdx(float16_t);"559"f16vec2 dFdx(f16vec2);"560"f16vec3 dFdx(f16vec3);"561"f16vec4 dFdx(f16vec4);"562563"float16_t dFdy(float16_t);"564"f16vec2 dFdy(f16vec2);"565"f16vec3 dFdy(f16vec3);"566"f16vec4 dFdy(f16vec4);"567568"float16_t dFdxFine(float16_t);"569"f16vec2 dFdxFine(f16vec2);"570"f16vec3 dFdxFine(f16vec3);"571"f16vec4 dFdxFine(f16vec4);"572573"float16_t dFdyFine(float16_t);"574"f16vec2 dFdyFine(f16vec2);"575"f16vec3 dFdyFine(f16vec3);"576"f16vec4 dFdyFine(f16vec4);"577578"float16_t dFdxCoarse(float16_t);"579"f16vec2 dFdxCoarse(f16vec2);"580"f16vec3 dFdxCoarse(f16vec3);"581"f16vec4 dFdxCoarse(f16vec4);"582583"float16_t dFdyCoarse(float16_t);"584"f16vec2 dFdyCoarse(f16vec2);"585"f16vec3 dFdyCoarse(f16vec3);"586"f16vec4 dFdyCoarse(f16vec4);"587588"float16_t fwidth(float16_t);"589"f16vec2 fwidth(f16vec2);"590"f16vec3 fwidth(f16vec3);"591"f16vec4 fwidth(f16vec4);"592593"float16_t fwidthFine(float16_t);"594"f16vec2 fwidthFine(f16vec2);"595"f16vec3 fwidthFine(f16vec3);"596"f16vec4 fwidthFine(f16vec4);"597598"float16_t fwidthCoarse(float16_t);"599"f16vec2 fwidthCoarse(f16vec2);"600"f16vec3 fwidthCoarse(f16vec3);"601"f16vec4 fwidthCoarse(f16vec4);"602);603604TString derivativesAndControl64bits (605"float64_t dFdx(float64_t);"606"f64vec2 dFdx(f64vec2);"607"f64vec3 dFdx(f64vec3);"608"f64vec4 dFdx(f64vec4);"609610"float64_t dFdy(float64_t);"611"f64vec2 dFdy(f64vec2);"612"f64vec3 dFdy(f64vec3);"613"f64vec4 dFdy(f64vec4);"614615"float64_t dFdxFine(float64_t);"616"f64vec2 dFdxFine(f64vec2);"617"f64vec3 dFdxFine(f64vec3);"618"f64vec4 dFdxFine(f64vec4);"619620"float64_t dFdyFine(float64_t);"621"f64vec2 dFdyFine(f64vec2);"622"f64vec3 dFdyFine(f64vec3);"623"f64vec4 dFdyFine(f64vec4);"624625"float64_t dFdxCoarse(float64_t);"626"f64vec2 dFdxCoarse(f64vec2);"627"f64vec3 dFdxCoarse(f64vec3);"628"f64vec4 dFdxCoarse(f64vec4);"629630"float64_t dFdyCoarse(float64_t);"631"f64vec2 dFdyCoarse(f64vec2);"632"f64vec3 dFdyCoarse(f64vec3);"633"f64vec4 dFdyCoarse(f64vec4);"634635"float64_t fwidth(float64_t);"636"f64vec2 fwidth(f64vec2);"637"f64vec3 fwidth(f64vec3);"638"f64vec4 fwidth(f64vec4);"639640"float64_t fwidthFine(float64_t);"641"f64vec2 fwidthFine(f64vec2);"642"f64vec3 fwidthFine(f64vec3);"643"f64vec4 fwidthFine(f64vec4);"644645"float64_t fwidthCoarse(float64_t);"646"f64vec2 fwidthCoarse(f64vec2);"647"f64vec3 fwidthCoarse(f64vec3);"648"f64vec4 fwidthCoarse(f64vec4);"649);650651//============================================================================652//653// Prototypes for built-in functions seen by both vertex and fragment shaders.654//655//============================================================================656657//658// double functions added to desktop 4.00, but not fma, frexp, ldexp, or pack/unpack659//660if (profile != EEsProfile && version >= 150) { // ARB_gpu_shader_fp64661commonBuiltins.append(662663"double sqrt(double);"664"dvec2 sqrt(dvec2);"665"dvec3 sqrt(dvec3);"666"dvec4 sqrt(dvec4);"667668"double inversesqrt(double);"669"dvec2 inversesqrt(dvec2);"670"dvec3 inversesqrt(dvec3);"671"dvec4 inversesqrt(dvec4);"672673"double abs(double);"674"dvec2 abs(dvec2);"675"dvec3 abs(dvec3);"676"dvec4 abs(dvec4);"677678"double sign(double);"679"dvec2 sign(dvec2);"680"dvec3 sign(dvec3);"681"dvec4 sign(dvec4);"682683"double floor(double);"684"dvec2 floor(dvec2);"685"dvec3 floor(dvec3);"686"dvec4 floor(dvec4);"687688"double trunc(double);"689"dvec2 trunc(dvec2);"690"dvec3 trunc(dvec3);"691"dvec4 trunc(dvec4);"692693"double round(double);"694"dvec2 round(dvec2);"695"dvec3 round(dvec3);"696"dvec4 round(dvec4);"697698"double roundEven(double);"699"dvec2 roundEven(dvec2);"700"dvec3 roundEven(dvec3);"701"dvec4 roundEven(dvec4);"702703"double ceil(double);"704"dvec2 ceil(dvec2);"705"dvec3 ceil(dvec3);"706"dvec4 ceil(dvec4);"707708"double fract(double);"709"dvec2 fract(dvec2);"710"dvec3 fract(dvec3);"711"dvec4 fract(dvec4);"712713"double mod(double, double);"714"dvec2 mod(dvec2 , double);"715"dvec3 mod(dvec3 , double);"716"dvec4 mod(dvec4 , double);"717"dvec2 mod(dvec2 , dvec2);"718"dvec3 mod(dvec3 , dvec3);"719"dvec4 mod(dvec4 , dvec4);"720721"double modf(double, out double);"722"dvec2 modf(dvec2, out dvec2);"723"dvec3 modf(dvec3, out dvec3);"724"dvec4 modf(dvec4, out dvec4);"725726"double min(double, double);"727"dvec2 min(dvec2, double);"728"dvec3 min(dvec3, double);"729"dvec4 min(dvec4, double);"730"dvec2 min(dvec2, dvec2);"731"dvec3 min(dvec3, dvec3);"732"dvec4 min(dvec4, dvec4);"733734"double max(double, double);"735"dvec2 max(dvec2 , double);"736"dvec3 max(dvec3 , double);"737"dvec4 max(dvec4 , double);"738"dvec2 max(dvec2 , dvec2);"739"dvec3 max(dvec3 , dvec3);"740"dvec4 max(dvec4 , dvec4);"741742"double clamp(double, double, double);"743"dvec2 clamp(dvec2 , double, double);"744"dvec3 clamp(dvec3 , double, double);"745"dvec4 clamp(dvec4 , double, double);"746"dvec2 clamp(dvec2 , dvec2 , dvec2);"747"dvec3 clamp(dvec3 , dvec3 , dvec3);"748"dvec4 clamp(dvec4 , dvec4 , dvec4);"749750"double mix(double, double, double);"751"dvec2 mix(dvec2, dvec2, double);"752"dvec3 mix(dvec3, dvec3, double);"753"dvec4 mix(dvec4, dvec4, double);"754"dvec2 mix(dvec2, dvec2, dvec2);"755"dvec3 mix(dvec3, dvec3, dvec3);"756"dvec4 mix(dvec4, dvec4, dvec4);"757"double mix(double, double, bool);"758"dvec2 mix(dvec2, dvec2, bvec2);"759"dvec3 mix(dvec3, dvec3, bvec3);"760"dvec4 mix(dvec4, dvec4, bvec4);"761762"double step(double, double);"763"dvec2 step(dvec2 , dvec2);"764"dvec3 step(dvec3 , dvec3);"765"dvec4 step(dvec4 , dvec4);"766"dvec2 step(double, dvec2);"767"dvec3 step(double, dvec3);"768"dvec4 step(double, dvec4);"769770"double smoothstep(double, double, double);"771"dvec2 smoothstep(dvec2 , dvec2 , dvec2);"772"dvec3 smoothstep(dvec3 , dvec3 , dvec3);"773"dvec4 smoothstep(dvec4 , dvec4 , dvec4);"774"dvec2 smoothstep(double, double, dvec2);"775"dvec3 smoothstep(double, double, dvec3);"776"dvec4 smoothstep(double, double, dvec4);"777778"bool isnan(double);"779"bvec2 isnan(dvec2);"780"bvec3 isnan(dvec3);"781"bvec4 isnan(dvec4);"782783"bool isinf(double);"784"bvec2 isinf(dvec2);"785"bvec3 isinf(dvec3);"786"bvec4 isinf(dvec4);"787788"double length(double);"789"double length(dvec2);"790"double length(dvec3);"791"double length(dvec4);"792793"double distance(double, double);"794"double distance(dvec2 , dvec2);"795"double distance(dvec3 , dvec3);"796"double distance(dvec4 , dvec4);"797798"double dot(double, double);"799"double dot(dvec2 , dvec2);"800"double dot(dvec3 , dvec3);"801"double dot(dvec4 , dvec4);"802803"dvec3 cross(dvec3, dvec3);"804805"double normalize(double);"806"dvec2 normalize(dvec2);"807"dvec3 normalize(dvec3);"808"dvec4 normalize(dvec4);"809810"double faceforward(double, double, double);"811"dvec2 faceforward(dvec2, dvec2, dvec2);"812"dvec3 faceforward(dvec3, dvec3, dvec3);"813"dvec4 faceforward(dvec4, dvec4, dvec4);"814815"double reflect(double, double);"816"dvec2 reflect(dvec2 , dvec2 );"817"dvec3 reflect(dvec3 , dvec3 );"818"dvec4 reflect(dvec4 , dvec4 );"819820"double refract(double, double, double);"821"dvec2 refract(dvec2 , dvec2 , double);"822"dvec3 refract(dvec3 , dvec3 , double);"823"dvec4 refract(dvec4 , dvec4 , double);"824825"dmat2 matrixCompMult(dmat2, dmat2);"826"dmat3 matrixCompMult(dmat3, dmat3);"827"dmat4 matrixCompMult(dmat4, dmat4);"828"dmat2x3 matrixCompMult(dmat2x3, dmat2x3);"829"dmat2x4 matrixCompMult(dmat2x4, dmat2x4);"830"dmat3x2 matrixCompMult(dmat3x2, dmat3x2);"831"dmat3x4 matrixCompMult(dmat3x4, dmat3x4);"832"dmat4x2 matrixCompMult(dmat4x2, dmat4x2);"833"dmat4x3 matrixCompMult(dmat4x3, dmat4x3);"834835"dmat2 outerProduct(dvec2, dvec2);"836"dmat3 outerProduct(dvec3, dvec3);"837"dmat4 outerProduct(dvec4, dvec4);"838"dmat2x3 outerProduct(dvec3, dvec2);"839"dmat3x2 outerProduct(dvec2, dvec3);"840"dmat2x4 outerProduct(dvec4, dvec2);"841"dmat4x2 outerProduct(dvec2, dvec4);"842"dmat3x4 outerProduct(dvec4, dvec3);"843"dmat4x3 outerProduct(dvec3, dvec4);"844845"dmat2 transpose(dmat2);"846"dmat3 transpose(dmat3);"847"dmat4 transpose(dmat4);"848"dmat2x3 transpose(dmat3x2);"849"dmat3x2 transpose(dmat2x3);"850"dmat2x4 transpose(dmat4x2);"851"dmat4x2 transpose(dmat2x4);"852"dmat3x4 transpose(dmat4x3);"853"dmat4x3 transpose(dmat3x4);"854855"double determinant(dmat2);"856"double determinant(dmat3);"857"double determinant(dmat4);"858859"dmat2 inverse(dmat2);"860"dmat3 inverse(dmat3);"861"dmat4 inverse(dmat4);"862863"bvec2 lessThan(dvec2, dvec2);"864"bvec3 lessThan(dvec3, dvec3);"865"bvec4 lessThan(dvec4, dvec4);"866867"bvec2 lessThanEqual(dvec2, dvec2);"868"bvec3 lessThanEqual(dvec3, dvec3);"869"bvec4 lessThanEqual(dvec4, dvec4);"870871"bvec2 greaterThan(dvec2, dvec2);"872"bvec3 greaterThan(dvec3, dvec3);"873"bvec4 greaterThan(dvec4, dvec4);"874875"bvec2 greaterThanEqual(dvec2, dvec2);"876"bvec3 greaterThanEqual(dvec3, dvec3);"877"bvec4 greaterThanEqual(dvec4, dvec4);"878879"bvec2 equal(dvec2, dvec2);"880"bvec3 equal(dvec3, dvec3);"881"bvec4 equal(dvec4, dvec4);"882883"bvec2 notEqual(dvec2, dvec2);"884"bvec3 notEqual(dvec3, dvec3);"885"bvec4 notEqual(dvec4, dvec4);"886887"\n");888}889890if (profile == EEsProfile && version >= 310) { // Explicit Types891commonBuiltins.append(892893"float64_t sqrt(float64_t);"894"f64vec2 sqrt(f64vec2);"895"f64vec3 sqrt(f64vec3);"896"f64vec4 sqrt(f64vec4);"897898"float64_t inversesqrt(float64_t);"899"f64vec2 inversesqrt(f64vec2);"900"f64vec3 inversesqrt(f64vec3);"901"f64vec4 inversesqrt(f64vec4);"902903"float64_t abs(float64_t);"904"f64vec2 abs(f64vec2);"905"f64vec3 abs(f64vec3);"906"f64vec4 abs(f64vec4);"907908"float64_t sign(float64_t);"909"f64vec2 sign(f64vec2);"910"f64vec3 sign(f64vec3);"911"f64vec4 sign(f64vec4);"912913"float64_t floor(float64_t);"914"f64vec2 floor(f64vec2);"915"f64vec3 floor(f64vec3);"916"f64vec4 floor(f64vec4);"917918"float64_t trunc(float64_t);"919"f64vec2 trunc(f64vec2);"920"f64vec3 trunc(f64vec3);"921"f64vec4 trunc(f64vec4);"922923"float64_t round(float64_t);"924"f64vec2 round(f64vec2);"925"f64vec3 round(f64vec3);"926"f64vec4 round(f64vec4);"927928"float64_t roundEven(float64_t);"929"f64vec2 roundEven(f64vec2);"930"f64vec3 roundEven(f64vec3);"931"f64vec4 roundEven(f64vec4);"932933"float64_t ceil(float64_t);"934"f64vec2 ceil(f64vec2);"935"f64vec3 ceil(f64vec3);"936"f64vec4 ceil(f64vec4);"937938"float64_t fract(float64_t);"939"f64vec2 fract(f64vec2);"940"f64vec3 fract(f64vec3);"941"f64vec4 fract(f64vec4);"942943"float64_t mod(float64_t, float64_t);"944"f64vec2 mod(f64vec2 , float64_t);"945"f64vec3 mod(f64vec3 , float64_t);"946"f64vec4 mod(f64vec4 , float64_t);"947"f64vec2 mod(f64vec2 , f64vec2);"948"f64vec3 mod(f64vec3 , f64vec3);"949"f64vec4 mod(f64vec4 , f64vec4);"950951"float64_t modf(float64_t, out float64_t);"952"f64vec2 modf(f64vec2, out f64vec2);"953"f64vec3 modf(f64vec3, out f64vec3);"954"f64vec4 modf(f64vec4, out f64vec4);"955956"float64_t min(float64_t, float64_t);"957"f64vec2 min(f64vec2, float64_t);"958"f64vec3 min(f64vec3, float64_t);"959"f64vec4 min(f64vec4, float64_t);"960"f64vec2 min(f64vec2, f64vec2);"961"f64vec3 min(f64vec3, f64vec3);"962"f64vec4 min(f64vec4, f64vec4);"963964"float64_t max(float64_t, float64_t);"965"f64vec2 max(f64vec2 , float64_t);"966"f64vec3 max(f64vec3 , float64_t);"967"f64vec4 max(f64vec4 , float64_t);"968"f64vec2 max(f64vec2 , f64vec2);"969"f64vec3 max(f64vec3 , f64vec3);"970"f64vec4 max(f64vec4 , f64vec4);"971972"float64_t clamp(float64_t, float64_t, float64_t);"973"f64vec2 clamp(f64vec2 , float64_t, float64_t);"974"f64vec3 clamp(f64vec3 , float64_t, float64_t);"975"f64vec4 clamp(f64vec4 , float64_t, float64_t);"976"f64vec2 clamp(f64vec2 , f64vec2 , f64vec2);"977"f64vec3 clamp(f64vec3 , f64vec3 , f64vec3);"978"f64vec4 clamp(f64vec4 , f64vec4 , f64vec4);"979980"float64_t mix(float64_t, float64_t, float64_t);"981"f64vec2 mix(f64vec2, f64vec2, float64_t);"982"f64vec3 mix(f64vec3, f64vec3, float64_t);"983"f64vec4 mix(f64vec4, f64vec4, float64_t);"984"f64vec2 mix(f64vec2, f64vec2, f64vec2);"985"f64vec3 mix(f64vec3, f64vec3, f64vec3);"986"f64vec4 mix(f64vec4, f64vec4, f64vec4);"987"float64_t mix(float64_t, float64_t, bool);"988"f64vec2 mix(f64vec2, f64vec2, bvec2);"989"f64vec3 mix(f64vec3, f64vec3, bvec3);"990"f64vec4 mix(f64vec4, f64vec4, bvec4);"991992"float64_t step(float64_t, float64_t);"993"f64vec2 step(f64vec2 , f64vec2);"994"f64vec3 step(f64vec3 , f64vec3);"995"f64vec4 step(f64vec4 , f64vec4);"996"f64vec2 step(float64_t, f64vec2);"997"f64vec3 step(float64_t, f64vec3);"998"f64vec4 step(float64_t, f64vec4);"9991000"float64_t smoothstep(float64_t, float64_t, float64_t);"1001"f64vec2 smoothstep(f64vec2 , f64vec2 , f64vec2);"1002"f64vec3 smoothstep(f64vec3 , f64vec3 , f64vec3);"1003"f64vec4 smoothstep(f64vec4 , f64vec4 , f64vec4);"1004"f64vec2 smoothstep(float64_t, float64_t, f64vec2);"1005"f64vec3 smoothstep(float64_t, float64_t, f64vec3);"1006"f64vec4 smoothstep(float64_t, float64_t, f64vec4);"10071008"float64_t length(float64_t);"1009"float64_t length(f64vec2);"1010"float64_t length(f64vec3);"1011"float64_t length(f64vec4);"10121013"float64_t distance(float64_t, float64_t);"1014"float64_t distance(f64vec2 , f64vec2);"1015"float64_t distance(f64vec3 , f64vec3);"1016"float64_t distance(f64vec4 , f64vec4);"10171018"float64_t dot(float64_t, float64_t);"1019"float64_t dot(f64vec2 , f64vec2);"1020"float64_t dot(f64vec3 , f64vec3);"1021"float64_t dot(f64vec4 , f64vec4);"10221023"f64vec3 cross(f64vec3, f64vec3);"10241025"float64_t normalize(float64_t);"1026"f64vec2 normalize(f64vec2);"1027"f64vec3 normalize(f64vec3);"1028"f64vec4 normalize(f64vec4);"10291030"float64_t faceforward(float64_t, float64_t, float64_t);"1031"f64vec2 faceforward(f64vec2, f64vec2, f64vec2);"1032"f64vec3 faceforward(f64vec3, f64vec3, f64vec3);"1033"f64vec4 faceforward(f64vec4, f64vec4, f64vec4);"10341035"float64_t reflect(float64_t, float64_t);"1036"f64vec2 reflect(f64vec2 , f64vec2 );"1037"f64vec3 reflect(f64vec3 , f64vec3 );"1038"f64vec4 reflect(f64vec4 , f64vec4 );"10391040"float64_t refract(float64_t, float64_t, float64_t);"1041"f64vec2 refract(f64vec2 , f64vec2 , float64_t);"1042"f64vec3 refract(f64vec3 , f64vec3 , float64_t);"1043"f64vec4 refract(f64vec4 , f64vec4 , float64_t);"10441045"f64mat2 matrixCompMult(f64mat2, f64mat2);"1046"f64mat3 matrixCompMult(f64mat3, f64mat3);"1047"f64mat4 matrixCompMult(f64mat4, f64mat4);"1048"f64mat2x3 matrixCompMult(f64mat2x3, f64mat2x3);"1049"f64mat2x4 matrixCompMult(f64mat2x4, f64mat2x4);"1050"f64mat3x2 matrixCompMult(f64mat3x2, f64mat3x2);"1051"f64mat3x4 matrixCompMult(f64mat3x4, f64mat3x4);"1052"f64mat4x2 matrixCompMult(f64mat4x2, f64mat4x2);"1053"f64mat4x3 matrixCompMult(f64mat4x3, f64mat4x3);"10541055"f64mat2 outerProduct(f64vec2, f64vec2);"1056"f64mat3 outerProduct(f64vec3, f64vec3);"1057"f64mat4 outerProduct(f64vec4, f64vec4);"1058"f64mat2x3 outerProduct(f64vec3, f64vec2);"1059"f64mat3x2 outerProduct(f64vec2, f64vec3);"1060"f64mat2x4 outerProduct(f64vec4, f64vec2);"1061"f64mat4x2 outerProduct(f64vec2, f64vec4);"1062"f64mat3x4 outerProduct(f64vec4, f64vec3);"1063"f64mat4x3 outerProduct(f64vec3, f64vec4);"10641065"f64mat2 transpose(f64mat2);"1066"f64mat3 transpose(f64mat3);"1067"f64mat4 transpose(f64mat4);"1068"f64mat2x3 transpose(f64mat3x2);"1069"f64mat3x2 transpose(f64mat2x3);"1070"f64mat2x4 transpose(f64mat4x2);"1071"f64mat4x2 transpose(f64mat2x4);"1072"f64mat3x4 transpose(f64mat4x3);"1073"f64mat4x3 transpose(f64mat3x4);"10741075"float64_t determinant(f64mat2);"1076"float64_t determinant(f64mat3);"1077"float64_t determinant(f64mat4);"10781079"f64mat2 inverse(f64mat2);"1080"f64mat3 inverse(f64mat3);"1081"f64mat4 inverse(f64mat4);"10821083"\n");1084}10851086if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 310)) {1087commonBuiltins.append(10881089"int64_t abs(int64_t);"1090"i64vec2 abs(i64vec2);"1091"i64vec3 abs(i64vec3);"1092"i64vec4 abs(i64vec4);"10931094"int64_t sign(int64_t);"1095"i64vec2 sign(i64vec2);"1096"i64vec3 sign(i64vec3);"1097"i64vec4 sign(i64vec4);"10981099"int64_t min(int64_t, int64_t);"1100"i64vec2 min(i64vec2, int64_t);"1101"i64vec3 min(i64vec3, int64_t);"1102"i64vec4 min(i64vec4, int64_t);"1103"i64vec2 min(i64vec2, i64vec2);"1104"i64vec3 min(i64vec3, i64vec3);"1105"i64vec4 min(i64vec4, i64vec4);"1106"uint64_t min(uint64_t, uint64_t);"1107"u64vec2 min(u64vec2, uint64_t);"1108"u64vec3 min(u64vec3, uint64_t);"1109"u64vec4 min(u64vec4, uint64_t);"1110"u64vec2 min(u64vec2, u64vec2);"1111"u64vec3 min(u64vec3, u64vec3);"1112"u64vec4 min(u64vec4, u64vec4);"11131114"int64_t max(int64_t, int64_t);"1115"i64vec2 max(i64vec2, int64_t);"1116"i64vec3 max(i64vec3, int64_t);"1117"i64vec4 max(i64vec4, int64_t);"1118"i64vec2 max(i64vec2, i64vec2);"1119"i64vec3 max(i64vec3, i64vec3);"1120"i64vec4 max(i64vec4, i64vec4);"1121"uint64_t max(uint64_t, uint64_t);"1122"u64vec2 max(u64vec2, uint64_t);"1123"u64vec3 max(u64vec3, uint64_t);"1124"u64vec4 max(u64vec4, uint64_t);"1125"u64vec2 max(u64vec2, u64vec2);"1126"u64vec3 max(u64vec3, u64vec3);"1127"u64vec4 max(u64vec4, u64vec4);"11281129"int64_t clamp(int64_t, int64_t, int64_t);"1130"i64vec2 clamp(i64vec2, int64_t, int64_t);"1131"i64vec3 clamp(i64vec3, int64_t, int64_t);"1132"i64vec4 clamp(i64vec4, int64_t, int64_t);"1133"i64vec2 clamp(i64vec2, i64vec2, i64vec2);"1134"i64vec3 clamp(i64vec3, i64vec3, i64vec3);"1135"i64vec4 clamp(i64vec4, i64vec4, i64vec4);"1136"uint64_t clamp(uint64_t, uint64_t, uint64_t);"1137"u64vec2 clamp(u64vec2, uint64_t, uint64_t);"1138"u64vec3 clamp(u64vec3, uint64_t, uint64_t);"1139"u64vec4 clamp(u64vec4, uint64_t, uint64_t);"1140"u64vec2 clamp(u64vec2, u64vec2, u64vec2);"1141"u64vec3 clamp(u64vec3, u64vec3, u64vec3);"1142"u64vec4 clamp(u64vec4, u64vec4, u64vec4);"11431144"int64_t mix(int64_t, int64_t, bool);"1145"i64vec2 mix(i64vec2, i64vec2, bvec2);"1146"i64vec3 mix(i64vec3, i64vec3, bvec3);"1147"i64vec4 mix(i64vec4, i64vec4, bvec4);"1148"uint64_t mix(uint64_t, uint64_t, bool);"1149"u64vec2 mix(u64vec2, u64vec2, bvec2);"1150"u64vec3 mix(u64vec3, u64vec3, bvec3);"1151"u64vec4 mix(u64vec4, u64vec4, bvec4);"11521153"int64_t doubleBitsToInt64(float64_t);"1154"i64vec2 doubleBitsToInt64(f64vec2);"1155"i64vec3 doubleBitsToInt64(f64vec3);"1156"i64vec4 doubleBitsToInt64(f64vec4);"11571158"uint64_t doubleBitsToUint64(float64_t);"1159"u64vec2 doubleBitsToUint64(f64vec2);"1160"u64vec3 doubleBitsToUint64(f64vec3);"1161"u64vec4 doubleBitsToUint64(f64vec4);"11621163"float64_t int64BitsToDouble(int64_t);"1164"f64vec2 int64BitsToDouble(i64vec2);"1165"f64vec3 int64BitsToDouble(i64vec3);"1166"f64vec4 int64BitsToDouble(i64vec4);"11671168"float64_t uint64BitsToDouble(uint64_t);"1169"f64vec2 uint64BitsToDouble(u64vec2);"1170"f64vec3 uint64BitsToDouble(u64vec3);"1171"f64vec4 uint64BitsToDouble(u64vec4);"11721173"int64_t packInt2x32(ivec2);"1174"uint64_t packUint2x32(uvec2);"1175"ivec2 unpackInt2x32(int64_t);"1176"uvec2 unpackUint2x32(uint64_t);"11771178"bvec2 lessThan(i64vec2, i64vec2);"1179"bvec3 lessThan(i64vec3, i64vec3);"1180"bvec4 lessThan(i64vec4, i64vec4);"1181"bvec2 lessThan(u64vec2, u64vec2);"1182"bvec3 lessThan(u64vec3, u64vec3);"1183"bvec4 lessThan(u64vec4, u64vec4);"11841185"bvec2 lessThanEqual(i64vec2, i64vec2);"1186"bvec3 lessThanEqual(i64vec3, i64vec3);"1187"bvec4 lessThanEqual(i64vec4, i64vec4);"1188"bvec2 lessThanEqual(u64vec2, u64vec2);"1189"bvec3 lessThanEqual(u64vec3, u64vec3);"1190"bvec4 lessThanEqual(u64vec4, u64vec4);"11911192"bvec2 greaterThan(i64vec2, i64vec2);"1193"bvec3 greaterThan(i64vec3, i64vec3);"1194"bvec4 greaterThan(i64vec4, i64vec4);"1195"bvec2 greaterThan(u64vec2, u64vec2);"1196"bvec3 greaterThan(u64vec3, u64vec3);"1197"bvec4 greaterThan(u64vec4, u64vec4);"11981199"bvec2 greaterThanEqual(i64vec2, i64vec2);"1200"bvec3 greaterThanEqual(i64vec3, i64vec3);"1201"bvec4 greaterThanEqual(i64vec4, i64vec4);"1202"bvec2 greaterThanEqual(u64vec2, u64vec2);"1203"bvec3 greaterThanEqual(u64vec3, u64vec3);"1204"bvec4 greaterThanEqual(u64vec4, u64vec4);"12051206"bvec2 equal(i64vec2, i64vec2);"1207"bvec3 equal(i64vec3, i64vec3);"1208"bvec4 equal(i64vec4, i64vec4);"1209"bvec2 equal(u64vec2, u64vec2);"1210"bvec3 equal(u64vec3, u64vec3);"1211"bvec4 equal(u64vec4, u64vec4);"12121213"bvec2 notEqual(i64vec2, i64vec2);"1214"bvec3 notEqual(i64vec3, i64vec3);"1215"bvec4 notEqual(i64vec4, i64vec4);"1216"bvec2 notEqual(u64vec2, u64vec2);"1217"bvec3 notEqual(u64vec3, u64vec3);"1218"bvec4 notEqual(u64vec4, u64vec4);"12191220"int64_t bitCount(int64_t);"1221"i64vec2 bitCount(i64vec2);"1222"i64vec3 bitCount(i64vec3);"1223"i64vec4 bitCount(i64vec4);"12241225"int64_t bitCount(uint64_t);"1226"i64vec2 bitCount(u64vec2);"1227"i64vec3 bitCount(u64vec3);"1228"i64vec4 bitCount(u64vec4);"12291230"int64_t findLSB(int64_t);"1231"i64vec2 findLSB(i64vec2);"1232"i64vec3 findLSB(i64vec3);"1233"i64vec4 findLSB(i64vec4);"12341235"int64_t findLSB(uint64_t);"1236"i64vec2 findLSB(u64vec2);"1237"i64vec3 findLSB(u64vec3);"1238"i64vec4 findLSB(u64vec4);"12391240"int64_t findMSB(int64_t);"1241"i64vec2 findMSB(i64vec2);"1242"i64vec3 findMSB(i64vec3);"1243"i64vec4 findMSB(i64vec4);"12441245"int64_t findMSB(uint64_t);"1246"i64vec2 findMSB(u64vec2);"1247"i64vec3 findMSB(u64vec3);"1248"i64vec4 findMSB(u64vec4);"12491250"\n"1251);1252}12531254// GL_AMD_shader_trinary_minmax1255if (profile != EEsProfile && version >= 430) {1256commonBuiltins.append(1257"float min3(float, float, float);"1258"vec2 min3(vec2, vec2, vec2);"1259"vec3 min3(vec3, vec3, vec3);"1260"vec4 min3(vec4, vec4, vec4);"12611262"int min3(int, int, int);"1263"ivec2 min3(ivec2, ivec2, ivec2);"1264"ivec3 min3(ivec3, ivec3, ivec3);"1265"ivec4 min3(ivec4, ivec4, ivec4);"12661267"uint min3(uint, uint, uint);"1268"uvec2 min3(uvec2, uvec2, uvec2);"1269"uvec3 min3(uvec3, uvec3, uvec3);"1270"uvec4 min3(uvec4, uvec4, uvec4);"12711272"float max3(float, float, float);"1273"vec2 max3(vec2, vec2, vec2);"1274"vec3 max3(vec3, vec3, vec3);"1275"vec4 max3(vec4, vec4, vec4);"12761277"int max3(int, int, int);"1278"ivec2 max3(ivec2, ivec2, ivec2);"1279"ivec3 max3(ivec3, ivec3, ivec3);"1280"ivec4 max3(ivec4, ivec4, ivec4);"12811282"uint max3(uint, uint, uint);"1283"uvec2 max3(uvec2, uvec2, uvec2);"1284"uvec3 max3(uvec3, uvec3, uvec3);"1285"uvec4 max3(uvec4, uvec4, uvec4);"12861287"float mid3(float, float, float);"1288"vec2 mid3(vec2, vec2, vec2);"1289"vec3 mid3(vec3, vec3, vec3);"1290"vec4 mid3(vec4, vec4, vec4);"12911292"int mid3(int, int, int);"1293"ivec2 mid3(ivec2, ivec2, ivec2);"1294"ivec3 mid3(ivec3, ivec3, ivec3);"1295"ivec4 mid3(ivec4, ivec4, ivec4);"12961297"uint mid3(uint, uint, uint);"1298"uvec2 mid3(uvec2, uvec2, uvec2);"1299"uvec3 mid3(uvec3, uvec3, uvec3);"1300"uvec4 mid3(uvec4, uvec4, uvec4);"13011302"float16_t min3(float16_t, float16_t, float16_t);"1303"f16vec2 min3(f16vec2, f16vec2, f16vec2);"1304"f16vec3 min3(f16vec3, f16vec3, f16vec3);"1305"f16vec4 min3(f16vec4, f16vec4, f16vec4);"13061307"float16_t max3(float16_t, float16_t, float16_t);"1308"f16vec2 max3(f16vec2, f16vec2, f16vec2);"1309"f16vec3 max3(f16vec3, f16vec3, f16vec3);"1310"f16vec4 max3(f16vec4, f16vec4, f16vec4);"13111312"float16_t mid3(float16_t, float16_t, float16_t);"1313"f16vec2 mid3(f16vec2, f16vec2, f16vec2);"1314"f16vec3 mid3(f16vec3, f16vec3, f16vec3);"1315"f16vec4 mid3(f16vec4, f16vec4, f16vec4);"13161317"int16_t min3(int16_t, int16_t, int16_t);"1318"i16vec2 min3(i16vec2, i16vec2, i16vec2);"1319"i16vec3 min3(i16vec3, i16vec3, i16vec3);"1320"i16vec4 min3(i16vec4, i16vec4, i16vec4);"13211322"int16_t max3(int16_t, int16_t, int16_t);"1323"i16vec2 max3(i16vec2, i16vec2, i16vec2);"1324"i16vec3 max3(i16vec3, i16vec3, i16vec3);"1325"i16vec4 max3(i16vec4, i16vec4, i16vec4);"13261327"int16_t mid3(int16_t, int16_t, int16_t);"1328"i16vec2 mid3(i16vec2, i16vec2, i16vec2);"1329"i16vec3 mid3(i16vec3, i16vec3, i16vec3);"1330"i16vec4 mid3(i16vec4, i16vec4, i16vec4);"13311332"uint16_t min3(uint16_t, uint16_t, uint16_t);"1333"u16vec2 min3(u16vec2, u16vec2, u16vec2);"1334"u16vec3 min3(u16vec3, u16vec3, u16vec3);"1335"u16vec4 min3(u16vec4, u16vec4, u16vec4);"13361337"uint16_t max3(uint16_t, uint16_t, uint16_t);"1338"u16vec2 max3(u16vec2, u16vec2, u16vec2);"1339"u16vec3 max3(u16vec3, u16vec3, u16vec3);"1340"u16vec4 max3(u16vec4, u16vec4, u16vec4);"13411342"uint16_t mid3(uint16_t, uint16_t, uint16_t);"1343"u16vec2 mid3(u16vec2, u16vec2, u16vec2);"1344"u16vec3 mid3(u16vec3, u16vec3, u16vec3);"1345"u16vec4 mid3(u16vec4, u16vec4, u16vec4);"13461347"\n"1348);1349}13501351if ((profile == EEsProfile && version >= 310) ||1352(profile != EEsProfile && version >= 430)) {1353commonBuiltins.append(1354"uint atomicAdd(coherent volatile inout uint, uint, int, int, int);"1355" int atomicAdd(coherent volatile inout int, int, int, int, int);"13561357"uint atomicMin(coherent volatile inout uint, uint, int, int, int);"1358" int atomicMin(coherent volatile inout int, int, int, int, int);"13591360"uint atomicMax(coherent volatile inout uint, uint, int, int, int);"1361" int atomicMax(coherent volatile inout int, int, int, int, int);"13621363"uint atomicAnd(coherent volatile inout uint, uint, int, int, int);"1364" int atomicAnd(coherent volatile inout int, int, int, int, int);"13651366"uint atomicOr (coherent volatile inout uint, uint, int, int, int);"1367" int atomicOr (coherent volatile inout int, int, int, int, int);"13681369"uint atomicXor(coherent volatile inout uint, uint, int, int, int);"1370" int atomicXor(coherent volatile inout int, int, int, int, int);"13711372"uint atomicExchange(coherent volatile inout uint, uint, int, int, int);"1373" int atomicExchange(coherent volatile inout int, int, int, int, int);"13741375"uint atomicCompSwap(coherent volatile inout uint, uint, uint, int, int, int, int, int);"1376" int atomicCompSwap(coherent volatile inout int, int, int, int, int, int, int, int);"13771378"uint atomicLoad(coherent volatile in uint, int, int, int);"1379" int atomicLoad(coherent volatile in int, int, int, int);"13801381"void atomicStore(coherent volatile out uint, uint, int, int, int);"1382"void atomicStore(coherent volatile out int, int, int, int, int);"13831384"\n");1385}13861387if (profile != EEsProfile && version >= 440) {1388commonBuiltins.append(1389"uint64_t atomicMin(coherent volatile inout uint64_t, uint64_t);"1390" int64_t atomicMin(coherent volatile inout int64_t, int64_t);"1391"uint64_t atomicMin(coherent volatile inout uint64_t, uint64_t, int, int, int);"1392" int64_t atomicMin(coherent volatile inout int64_t, int64_t, int, int, int);"1393"float16_t atomicMin(coherent volatile inout float16_t, float16_t);"1394"float16_t atomicMin(coherent volatile inout float16_t, float16_t, int, int, int);"1395" float atomicMin(coherent volatile inout float, float);"1396" float atomicMin(coherent volatile inout float, float, int, int, int);"1397" double atomicMin(coherent volatile inout double, double);"1398" double atomicMin(coherent volatile inout double, double, int, int, int);"13991400"uint64_t atomicMax(coherent volatile inout uint64_t, uint64_t);"1401" int64_t atomicMax(coherent volatile inout int64_t, int64_t);"1402"uint64_t atomicMax(coherent volatile inout uint64_t, uint64_t, int, int, int);"1403" int64_t atomicMax(coherent volatile inout int64_t, int64_t, int, int, int);"1404"float16_t atomicMax(coherent volatile inout float16_t, float16_t);"1405"float16_t atomicMax(coherent volatile inout float16_t, float16_t, int, int, int);"1406" float atomicMax(coherent volatile inout float, float);"1407" float atomicMax(coherent volatile inout float, float, int, int, int);"1408" double atomicMax(coherent volatile inout double, double);"1409" double atomicMax(coherent volatile inout double, double, int, int, int);"14101411"uint64_t atomicAnd(coherent volatile inout uint64_t, uint64_t);"1412" int64_t atomicAnd(coherent volatile inout int64_t, int64_t);"1413"uint64_t atomicAnd(coherent volatile inout uint64_t, uint64_t, int, int, int);"1414" int64_t atomicAnd(coherent volatile inout int64_t, int64_t, int, int, int);"14151416"uint64_t atomicOr (coherent volatile inout uint64_t, uint64_t);"1417" int64_t atomicOr (coherent volatile inout int64_t, int64_t);"1418"uint64_t atomicOr (coherent volatile inout uint64_t, uint64_t, int, int, int);"1419" int64_t atomicOr (coherent volatile inout int64_t, int64_t, int, int, int);"14201421"uint64_t atomicXor(coherent volatile inout uint64_t, uint64_t);"1422" int64_t atomicXor(coherent volatile inout int64_t, int64_t);"1423"uint64_t atomicXor(coherent volatile inout uint64_t, uint64_t, int, int, int);"1424" int64_t atomicXor(coherent volatile inout int64_t, int64_t, int, int, int);"14251426"uint64_t atomicAdd(coherent volatile inout uint64_t, uint64_t);"1427" int64_t atomicAdd(coherent volatile inout int64_t, int64_t);"1428"uint64_t atomicAdd(coherent volatile inout uint64_t, uint64_t, int, int, int);"1429" int64_t atomicAdd(coherent volatile inout int64_t, int64_t, int, int, int);"1430"float16_t atomicAdd(coherent volatile inout float16_t, float16_t);"1431"float16_t atomicAdd(coherent volatile inout float16_t, float16_t, int, int, int);"1432" float atomicAdd(coherent volatile inout float, float);"1433" float atomicAdd(coherent volatile inout float, float, int, int, int);"1434" double atomicAdd(coherent volatile inout double, double);"1435" double atomicAdd(coherent volatile inout double, double, int, int, int);"14361437"uint64_t atomicExchange(coherent volatile inout uint64_t, uint64_t);"1438" int64_t atomicExchange(coherent volatile inout int64_t, int64_t);"1439"uint64_t atomicExchange(coherent volatile inout uint64_t, uint64_t, int, int, int);"1440" int64_t atomicExchange(coherent volatile inout int64_t, int64_t, int, int, int);"1441"float16_t atomicExchange(coherent volatile inout float16_t, float16_t);"1442"float16_t atomicExchange(coherent volatile inout float16_t, float16_t, int, int, int);"1443" float atomicExchange(coherent volatile inout float, float);"1444" float atomicExchange(coherent volatile inout float, float, int, int, int);"1445" double atomicExchange(coherent volatile inout double, double);"1446" double atomicExchange(coherent volatile inout double, double, int, int, int);"14471448"uint64_t atomicCompSwap(coherent volatile inout uint64_t, uint64_t, uint64_t);"1449" int64_t atomicCompSwap(coherent volatile inout int64_t, int64_t, int64_t);"1450"uint64_t atomicCompSwap(coherent volatile inout uint64_t, uint64_t, uint64_t, int, int, int, int, int);"1451" int64_t atomicCompSwap(coherent volatile inout int64_t, int64_t, int64_t, int, int, int, int, int);"14521453"uint64_t atomicLoad(coherent volatile in uint64_t, int, int, int);"1454" int64_t atomicLoad(coherent volatile in int64_t, int, int, int);"1455"float16_t atomicLoad(coherent volatile in float16_t, int, int, int);"1456" float atomicLoad(coherent volatile in float, int, int, int);"1457" double atomicLoad(coherent volatile in double, int, int, int);"14581459"void atomicStore(coherent volatile out uint64_t, uint64_t, int, int, int);"1460"void atomicStore(coherent volatile out int64_t, int64_t, int, int, int);"1461"void atomicStore(coherent volatile out float16_t, float16_t, int, int, int);"1462"void atomicStore(coherent volatile out float, float, int, int, int);"1463"void atomicStore(coherent volatile out double, double, int, int, int);"1464"\n");1465}14661467// NV_shader_atomic_fp16_vector1468if (profile != EEsProfile && version >= 430) {1469commonBuiltins.append(1470"f16vec2 atomicAdd(coherent volatile inout f16vec2, f16vec2);"1471"f16vec4 atomicAdd(coherent volatile inout f16vec4, f16vec4);"1472"f16vec2 atomicMin(coherent volatile inout f16vec2, f16vec2);"1473"f16vec4 atomicMin(coherent volatile inout f16vec4, f16vec4);"1474"f16vec2 atomicMax(coherent volatile inout f16vec2, f16vec2);"1475"f16vec4 atomicMax(coherent volatile inout f16vec4, f16vec4);"1476"f16vec2 atomicExchange(coherent volatile inout f16vec2, f16vec2);"1477"f16vec4 atomicExchange(coherent volatile inout f16vec4, f16vec4);"1478"\n");1479}14801481if ((profile == EEsProfile && version >= 300) ||1482(profile != EEsProfile && version >= 150)) { // GL_ARB_shader_bit_encoding1483commonBuiltins.append(1484"int floatBitsToInt(highp float value);"1485"ivec2 floatBitsToInt(highp vec2 value);"1486"ivec3 floatBitsToInt(highp vec3 value);"1487"ivec4 floatBitsToInt(highp vec4 value);"14881489"uint floatBitsToUint(highp float value);"1490"uvec2 floatBitsToUint(highp vec2 value);"1491"uvec3 floatBitsToUint(highp vec3 value);"1492"uvec4 floatBitsToUint(highp vec4 value);"14931494"float intBitsToFloat(highp int value);"1495"vec2 intBitsToFloat(highp ivec2 value);"1496"vec3 intBitsToFloat(highp ivec3 value);"1497"vec4 intBitsToFloat(highp ivec4 value);"14981499"float uintBitsToFloat(highp uint value);"1500"vec2 uintBitsToFloat(highp uvec2 value);"1501"vec3 uintBitsToFloat(highp uvec3 value);"1502"vec4 uintBitsToFloat(highp uvec4 value);"15031504"\n");1505}15061507if ((profile != EEsProfile && version >= 400) ||1508(profile == EEsProfile && version >= 310)) { // GL_OES_gpu_shader515091510commonBuiltins.append(1511"float fma(float, float, float );"1512"vec2 fma(vec2, vec2, vec2 );"1513"vec3 fma(vec3, vec3, vec3 );"1514"vec4 fma(vec4, vec4, vec4 );"1515"\n");1516}15171518if (profile != EEsProfile && version >= 150) { // ARB_gpu_shader_fp641519commonBuiltins.append(1520"double fma(double, double, double);"1521"dvec2 fma(dvec2, dvec2, dvec2 );"1522"dvec3 fma(dvec3, dvec3, dvec3 );"1523"dvec4 fma(dvec4, dvec4, dvec4 );"1524"\n");1525}15261527if (profile == EEsProfile && version >= 310) { // ARB_gpu_shader_fp641528commonBuiltins.append(1529"float64_t fma(float64_t, float64_t, float64_t);"1530"f64vec2 fma(f64vec2, f64vec2, f64vec2 );"1531"f64vec3 fma(f64vec3, f64vec3, f64vec3 );"1532"f64vec4 fma(f64vec4, f64vec4, f64vec4 );"1533"\n");1534}15351536if ((profile == EEsProfile && version >= 310) ||1537(profile != EEsProfile && version >= 400)) {1538commonBuiltins.append(1539"float frexp(highp float, out highp int);"1540"vec2 frexp(highp vec2, out highp ivec2);"1541"vec3 frexp(highp vec3, out highp ivec3);"1542"vec4 frexp(highp vec4, out highp ivec4);"15431544"float ldexp(highp float, highp int);"1545"vec2 ldexp(highp vec2, highp ivec2);"1546"vec3 ldexp(highp vec3, highp ivec3);"1547"vec4 ldexp(highp vec4, highp ivec4);"15481549"\n");1550}15511552if (profile != EEsProfile && version >= 150) { // ARB_gpu_shader_fp641553commonBuiltins.append(1554"double frexp(double, out int);"1555"dvec2 frexp( dvec2, out ivec2);"1556"dvec3 frexp( dvec3, out ivec3);"1557"dvec4 frexp( dvec4, out ivec4);"15581559"double ldexp(double, int);"1560"dvec2 ldexp( dvec2, ivec2);"1561"dvec3 ldexp( dvec3, ivec3);"1562"dvec4 ldexp( dvec4, ivec4);"15631564"double packDouble2x32(uvec2);"1565"uvec2 unpackDouble2x32(double);"15661567"\n");1568}15691570if (profile == EEsProfile && version >= 310) { // ARB_gpu_shader_fp641571commonBuiltins.append(1572"float64_t frexp(float64_t, out int);"1573"f64vec2 frexp( f64vec2, out ivec2);"1574"f64vec3 frexp( f64vec3, out ivec3);"1575"f64vec4 frexp( f64vec4, out ivec4);"15761577"float64_t ldexp(float64_t, int);"1578"f64vec2 ldexp( f64vec2, ivec2);"1579"f64vec3 ldexp( f64vec3, ivec3);"1580"f64vec4 ldexp( f64vec4, ivec4);"15811582"\n");1583}15841585if ((profile == EEsProfile && version >= 300) ||1586(profile != EEsProfile && version >= 150)) {1587commonBuiltins.append(1588"highp uint packUnorm2x16(vec2);"1589"vec2 unpackUnorm2x16(highp uint);"1590"\n");1591}15921593if ((profile == EEsProfile && version >= 300) ||1594(profile != EEsProfile && version >= 150)) {1595commonBuiltins.append(1596"highp uint packSnorm2x16(vec2);"1597" vec2 unpackSnorm2x16(highp uint);"1598"highp uint packHalf2x16(vec2);"1599"\n");1600}16011602if (profile == EEsProfile && version >= 300) {1603commonBuiltins.append(1604"mediump vec2 unpackHalf2x16(highp uint);"1605"\n");1606} else if (profile != EEsProfile && version >= 150) {1607commonBuiltins.append(1608" vec2 unpackHalf2x16(highp uint);"1609"\n");1610}16111612if ((profile == EEsProfile && version >= 310) ||1613(profile != EEsProfile && version >= 150)) {1614commonBuiltins.append(1615"highp uint packSnorm4x8(vec4);"1616"highp uint packUnorm4x8(vec4);"1617"\n");1618}16191620if (profile == EEsProfile && version >= 310) {1621commonBuiltins.append(1622"mediump vec4 unpackSnorm4x8(highp uint);"1623"mediump vec4 unpackUnorm4x8(highp uint);"1624"\n");1625} else if (profile != EEsProfile && version >= 150) {1626commonBuiltins.append(1627"vec4 unpackSnorm4x8(highp uint);"1628"vec4 unpackUnorm4x8(highp uint);"1629"\n");1630}16311632//1633// Matrix Functions.1634//1635commonBuiltins.append(1636"mat2 matrixCompMult(mat2 x, mat2 y);"1637"mat3 matrixCompMult(mat3 x, mat3 y);"1638"mat4 matrixCompMult(mat4 x, mat4 y);"16391640"\n");16411642// 120 is correct for both ES and desktop1643if (version >= 120) {1644commonBuiltins.append(1645"mat2 outerProduct(vec2 c, vec2 r);"1646"mat3 outerProduct(vec3 c, vec3 r);"1647"mat4 outerProduct(vec4 c, vec4 r);"1648"mat2x3 outerProduct(vec3 c, vec2 r);"1649"mat3x2 outerProduct(vec2 c, vec3 r);"1650"mat2x4 outerProduct(vec4 c, vec2 r);"1651"mat4x2 outerProduct(vec2 c, vec4 r);"1652"mat3x4 outerProduct(vec4 c, vec3 r);"1653"mat4x3 outerProduct(vec3 c, vec4 r);"16541655"mat2 transpose(mat2 m);"1656"mat3 transpose(mat3 m);"1657"mat4 transpose(mat4 m);"1658"mat2x3 transpose(mat3x2 m);"1659"mat3x2 transpose(mat2x3 m);"1660"mat2x4 transpose(mat4x2 m);"1661"mat4x2 transpose(mat2x4 m);"1662"mat3x4 transpose(mat4x3 m);"1663"mat4x3 transpose(mat3x4 m);"16641665"mat2x3 matrixCompMult(mat2x3, mat2x3);"1666"mat2x4 matrixCompMult(mat2x4, mat2x4);"1667"mat3x2 matrixCompMult(mat3x2, mat3x2);"1668"mat3x4 matrixCompMult(mat3x4, mat3x4);"1669"mat4x2 matrixCompMult(mat4x2, mat4x2);"1670"mat4x3 matrixCompMult(mat4x3, mat4x3);"16711672"\n");16731674// 150 is correct for both ES and desktop1675if (version >= 150) {1676commonBuiltins.append(1677"float determinant(mat2 m);"1678"float determinant(mat3 m);"1679"float determinant(mat4 m);"16801681"mat2 inverse(mat2 m);"1682"mat3 inverse(mat3 m);"1683"mat4 inverse(mat4 m);"16841685"\n");1686}1687}16881689//1690// Original-style texture functions existing in all stages.1691// (Per-stage functions below.)1692//1693if ((profile == EEsProfile && version == 100) ||1694profile == ECompatibilityProfile ||1695(profile == ECoreProfile && version < 420) ||1696profile == ENoProfile) {1697if (spvVersion.spv == 0) {1698commonBuiltins.append(1699"vec4 texture2D(sampler2D, vec2);"17001701"vec4 texture2DProj(sampler2D, vec3);"1702"vec4 texture2DProj(sampler2D, vec4);"17031704"vec4 texture3D(sampler3D, vec3);" // OES_texture_3D, but caught by keyword check1705"vec4 texture3DProj(sampler3D, vec4);" // OES_texture_3D, but caught by keyword check17061707"vec4 textureCube(samplerCube, vec3);"17081709"\n");1710}1711}17121713if ( profile == ECompatibilityProfile ||1714(profile == ECoreProfile && version < 420) ||1715profile == ENoProfile) {1716if (spvVersion.spv == 0) {1717commonBuiltins.append(1718"vec4 texture1D(sampler1D, float);"17191720"vec4 texture1DProj(sampler1D, vec2);"1721"vec4 texture1DProj(sampler1D, vec4);"17221723"vec4 shadow1D(sampler1DShadow, vec3);"1724"vec4 shadow2D(sampler2DShadow, vec3);"1725"vec4 shadow1DProj(sampler1DShadow, vec4);"1726"vec4 shadow2DProj(sampler2DShadow, vec4);"17271728"vec4 texture2DRect(sampler2DRect, vec2);" // GL_ARB_texture_rectangle, caught by keyword check1729"vec4 texture2DRectProj(sampler2DRect, vec3);" // GL_ARB_texture_rectangle, caught by keyword check1730"vec4 texture2DRectProj(sampler2DRect, vec4);" // GL_ARB_texture_rectangle, caught by keyword check1731"vec4 shadow2DRect(sampler2DRectShadow, vec3);" // GL_ARB_texture_rectangle, caught by keyword check1732"vec4 shadow2DRectProj(sampler2DRectShadow, vec4);" // GL_ARB_texture_rectangle, caught by keyword check17331734"vec4 texture1DArray(sampler1DArray, vec2);" // GL_EXT_texture_array1735"vec4 texture2DArray(sampler2DArray, vec3);" // GL_EXT_texture_array1736"vec4 shadow1DArray(sampler1DArrayShadow, vec3);" // GL_EXT_texture_array1737"vec4 shadow2DArray(sampler2DArrayShadow, vec4);" // GL_EXT_texture_array1738"vec4 texture1DArray(sampler1DArray, vec2, float);" // GL_EXT_texture_array1739"vec4 texture2DArray(sampler2DArray, vec3, float);" // GL_EXT_texture_array1740"vec4 shadow1DArray(sampler1DArrayShadow, vec3, float);" // GL_EXT_texture_array1741"vec4 texture1DArrayLod(sampler1DArray, vec2, float);" // GL_EXT_texture_array1742"vec4 texture2DArrayLod(sampler2DArray, vec3, float);" // GL_EXT_texture_array1743"vec4 shadow1DArrayLod(sampler1DArrayShadow, vec3, float);" // GL_EXT_texture_array1744"\n");1745}1746}17471748if (profile == EEsProfile) {1749if (spvVersion.spv == 0) {1750if (version < 300) {1751commonBuiltins.append(1752"vec4 texture2D(samplerExternalOES, vec2 coord);" // GL_OES_EGL_image_external1753"vec4 texture2DProj(samplerExternalOES, vec3);" // GL_OES_EGL_image_external1754"vec4 texture2DProj(samplerExternalOES, vec4);" // GL_OES_EGL_image_external1755"\n");1756} else {1757commonBuiltins.append(1758"highp ivec2 textureSize(samplerExternalOES, int lod);" // GL_OES_EGL_image_external_essl31759"vec4 texture(samplerExternalOES, vec2);" // GL_OES_EGL_image_external_essl31760"vec4 texture(samplerExternalOES, vec2, float bias);" // GL_OES_EGL_image_external_essl31761"vec4 textureProj(samplerExternalOES, vec3);" // GL_OES_EGL_image_external_essl31762"vec4 textureProj(samplerExternalOES, vec3, float bias);" // GL_OES_EGL_image_external_essl31763"vec4 textureProj(samplerExternalOES, vec4);" // GL_OES_EGL_image_external_essl31764"vec4 textureProj(samplerExternalOES, vec4, float bias);" // GL_OES_EGL_image_external_essl31765"vec4 texelFetch(samplerExternalOES, ivec2, int lod);" // GL_OES_EGL_image_external_essl31766"\n");1767}1768commonBuiltins.append(1769"highp ivec2 textureSize(__samplerExternal2DY2YEXT, int lod);" // GL_EXT_YUV_target1770"vec4 texture(__samplerExternal2DY2YEXT, vec2);" // GL_EXT_YUV_target1771"vec4 texture(__samplerExternal2DY2YEXT, vec2, float bias);" // GL_EXT_YUV_target1772"vec4 textureProj(__samplerExternal2DY2YEXT, vec3);" // GL_EXT_YUV_target1773"vec4 textureProj(__samplerExternal2DY2YEXT, vec3, float bias);" // GL_EXT_YUV_target1774"vec4 textureProj(__samplerExternal2DY2YEXT, vec4);" // GL_EXT_YUV_target1775"vec4 textureProj(__samplerExternal2DY2YEXT, vec4, float bias);" // GL_EXT_YUV_target1776"vec4 texelFetch(__samplerExternal2DY2YEXT sampler, ivec2, int lod);" // GL_EXT_YUV_target1777"\n");1778commonBuiltins.append(1779"vec4 texture2DGradEXT(sampler2D, vec2, vec2, vec2);" // GL_EXT_shader_texture_lod1780"vec4 texture2DProjGradEXT(sampler2D, vec3, vec2, vec2);" // GL_EXT_shader_texture_lod1781"vec4 texture2DProjGradEXT(sampler2D, vec4, vec2, vec2);" // GL_EXT_shader_texture_lod1782"vec4 textureCubeGradEXT(samplerCube, vec3, vec3, vec3);" // GL_EXT_shader_texture_lod17831784"float shadow2DEXT(sampler2DShadow, vec3);" // GL_EXT_shadow_samplers1785"float shadow2DProjEXT(sampler2DShadow, vec4);" // GL_EXT_shadow_samplers17861787"\n");1788}1789}17901791//1792// Noise functions.1793//1794if (spvVersion.spv == 0 && profile != EEsProfile) {1795commonBuiltins.append(1796"float noise1(float x);"1797"float noise1(vec2 x);"1798"float noise1(vec3 x);"1799"float noise1(vec4 x);"18001801"vec2 noise2(float x);"1802"vec2 noise2(vec2 x);"1803"vec2 noise2(vec3 x);"1804"vec2 noise2(vec4 x);"18051806"vec3 noise3(float x);"1807"vec3 noise3(vec2 x);"1808"vec3 noise3(vec3 x);"1809"vec3 noise3(vec4 x);"18101811"vec4 noise4(float x);"1812"vec4 noise4(vec2 x);"1813"vec4 noise4(vec3 x);"1814"vec4 noise4(vec4 x);"18151816"\n");1817}18181819if (spvVersion.vulkan == 0) {1820//1821// Atomic counter functions.1822//1823if ((profile != EEsProfile && version >= 300) ||1824(profile == EEsProfile && version >= 310)) {1825commonBuiltins.append(1826"uint atomicCounterIncrement(atomic_uint);"1827"uint atomicCounterDecrement(atomic_uint);"1828"uint atomicCounter(atomic_uint);"18291830"\n");1831}1832if (profile != EEsProfile && version == 450) {1833commonBuiltins.append(1834"uint atomicCounterAddARB(atomic_uint, uint);"1835"uint atomicCounterSubtractARB(atomic_uint, uint);"1836"uint atomicCounterMinARB(atomic_uint, uint);"1837"uint atomicCounterMaxARB(atomic_uint, uint);"1838"uint atomicCounterAndARB(atomic_uint, uint);"1839"uint atomicCounterOrARB(atomic_uint, uint);"1840"uint atomicCounterXorARB(atomic_uint, uint);"1841"uint atomicCounterExchangeARB(atomic_uint, uint);"1842"uint atomicCounterCompSwapARB(atomic_uint, uint, uint);"18431844"\n");1845}184618471848if (profile != EEsProfile && version >= 460) {1849commonBuiltins.append(1850"uint atomicCounterAdd(atomic_uint, uint);"1851"uint atomicCounterSubtract(atomic_uint, uint);"1852"uint atomicCounterMin(atomic_uint, uint);"1853"uint atomicCounterMax(atomic_uint, uint);"1854"uint atomicCounterAnd(atomic_uint, uint);"1855"uint atomicCounterOr(atomic_uint, uint);"1856"uint atomicCounterXor(atomic_uint, uint);"1857"uint atomicCounterExchange(atomic_uint, uint);"1858"uint atomicCounterCompSwap(atomic_uint, uint, uint);"18591860"\n");1861}1862}1863else if (spvVersion.vulkanRelaxed) {1864//1865// Atomic counter functions act as aliases to normal atomic functions.1866// replace definitions to take 'volatile coherent uint' instead of 'atomic_uint'1867// and map to equivalent non-counter atomic op1868//1869if ((profile != EEsProfile && version >= 300) ||1870(profile == EEsProfile && version >= 310)) {1871commonBuiltins.append(1872"uint atomicCounterIncrement(volatile coherent uint);"1873"uint atomicCounterDecrement(volatile coherent uint);"1874"uint atomicCounter(volatile coherent uint);"18751876"\n");1877}1878if (profile != EEsProfile && version >= 460) {1879commonBuiltins.append(1880"uint atomicCounterAdd(volatile coherent uint, uint);"1881"uint atomicCounterSubtract(volatile coherent uint, uint);"1882"uint atomicCounterMin(volatile coherent uint, uint);"1883"uint atomicCounterMax(volatile coherent uint, uint);"1884"uint atomicCounterAnd(volatile coherent uint, uint);"1885"uint atomicCounterOr(volatile coherent uint, uint);"1886"uint atomicCounterXor(volatile coherent uint, uint);"1887"uint atomicCounterExchange(volatile coherent uint, uint);"1888"uint atomicCounterCompSwap(volatile coherent uint, uint, uint);"18891890"\n");1891}1892}18931894// Bitfield1895if ((profile == EEsProfile && version >= 310) ||1896(profile != EEsProfile && version >= 400)) {1897commonBuiltins.append(1898" int bitfieldExtract( int, int, int);"1899"ivec2 bitfieldExtract(ivec2, int, int);"1900"ivec3 bitfieldExtract(ivec3, int, int);"1901"ivec4 bitfieldExtract(ivec4, int, int);"19021903" uint bitfieldExtract( uint, int, int);"1904"uvec2 bitfieldExtract(uvec2, int, int);"1905"uvec3 bitfieldExtract(uvec3, int, int);"1906"uvec4 bitfieldExtract(uvec4, int, int);"19071908" int bitfieldInsert( int base, int, int, int);"1909"ivec2 bitfieldInsert(ivec2 base, ivec2, int, int);"1910"ivec3 bitfieldInsert(ivec3 base, ivec3, int, int);"1911"ivec4 bitfieldInsert(ivec4 base, ivec4, int, int);"19121913" uint bitfieldInsert( uint base, uint, int, int);"1914"uvec2 bitfieldInsert(uvec2 base, uvec2, int, int);"1915"uvec3 bitfieldInsert(uvec3 base, uvec3, int, int);"1916"uvec4 bitfieldInsert(uvec4 base, uvec4, int, int);"19171918"\n");1919}19201921if (profile != EEsProfile && version >= 400) {1922commonBuiltins.append(1923" int findLSB( int);"1924"ivec2 findLSB(ivec2);"1925"ivec3 findLSB(ivec3);"1926"ivec4 findLSB(ivec4);"19271928" int findLSB( uint);"1929"ivec2 findLSB(uvec2);"1930"ivec3 findLSB(uvec3);"1931"ivec4 findLSB(uvec4);"19321933"\n");1934} else if (profile == EEsProfile && version >= 310) {1935commonBuiltins.append(1936"lowp int findLSB( int);"1937"lowp ivec2 findLSB(ivec2);"1938"lowp ivec3 findLSB(ivec3);"1939"lowp ivec4 findLSB(ivec4);"19401941"lowp int findLSB( uint);"1942"lowp ivec2 findLSB(uvec2);"1943"lowp ivec3 findLSB(uvec3);"1944"lowp ivec4 findLSB(uvec4);"19451946"\n");1947}19481949if (profile != EEsProfile && version >= 400) {1950commonBuiltins.append(1951" int bitCount( int);"1952"ivec2 bitCount(ivec2);"1953"ivec3 bitCount(ivec3);"1954"ivec4 bitCount(ivec4);"19551956" int bitCount( uint);"1957"ivec2 bitCount(uvec2);"1958"ivec3 bitCount(uvec3);"1959"ivec4 bitCount(uvec4);"19601961" int findMSB(highp int);"1962"ivec2 findMSB(highp ivec2);"1963"ivec3 findMSB(highp ivec3);"1964"ivec4 findMSB(highp ivec4);"19651966" int findMSB(highp uint);"1967"ivec2 findMSB(highp uvec2);"1968"ivec3 findMSB(highp uvec3);"1969"ivec4 findMSB(highp uvec4);"19701971"\n");1972}19731974if ((profile == EEsProfile && version >= 310) ||1975(profile != EEsProfile && version >= 400)) {1976commonBuiltins.append(1977" uint uaddCarry(highp uint, highp uint, out lowp uint carry);"1978"uvec2 uaddCarry(highp uvec2, highp uvec2, out lowp uvec2 carry);"1979"uvec3 uaddCarry(highp uvec3, highp uvec3, out lowp uvec3 carry);"1980"uvec4 uaddCarry(highp uvec4, highp uvec4, out lowp uvec4 carry);"19811982" uint usubBorrow(highp uint, highp uint, out lowp uint borrow);"1983"uvec2 usubBorrow(highp uvec2, highp uvec2, out lowp uvec2 borrow);"1984"uvec3 usubBorrow(highp uvec3, highp uvec3, out lowp uvec3 borrow);"1985"uvec4 usubBorrow(highp uvec4, highp uvec4, out lowp uvec4 borrow);"19861987"void umulExtended(highp uint, highp uint, out highp uint, out highp uint lsb);"1988"void umulExtended(highp uvec2, highp uvec2, out highp uvec2, out highp uvec2 lsb);"1989"void umulExtended(highp uvec3, highp uvec3, out highp uvec3, out highp uvec3 lsb);"1990"void umulExtended(highp uvec4, highp uvec4, out highp uvec4, out highp uvec4 lsb);"19911992"void imulExtended(highp int, highp int, out highp int, out highp int lsb);"1993"void imulExtended(highp ivec2, highp ivec2, out highp ivec2, out highp ivec2 lsb);"1994"void imulExtended(highp ivec3, highp ivec3, out highp ivec3, out highp ivec3 lsb);"1995"void imulExtended(highp ivec4, highp ivec4, out highp ivec4, out highp ivec4 lsb);"19961997" int bitfieldReverse(highp int);"1998"ivec2 bitfieldReverse(highp ivec2);"1999"ivec3 bitfieldReverse(highp ivec3);"2000"ivec4 bitfieldReverse(highp ivec4);"20012002" uint bitfieldReverse(highp uint);"2003"uvec2 bitfieldReverse(highp uvec2);"2004"uvec3 bitfieldReverse(highp uvec3);"2005"uvec4 bitfieldReverse(highp uvec4);"20062007"\n");2008}20092010if (profile == EEsProfile && version >= 310) {2011commonBuiltins.append(2012"lowp int bitCount( int);"2013"lowp ivec2 bitCount(ivec2);"2014"lowp ivec3 bitCount(ivec3);"2015"lowp ivec4 bitCount(ivec4);"20162017"lowp int bitCount( uint);"2018"lowp ivec2 bitCount(uvec2);"2019"lowp ivec3 bitCount(uvec3);"2020"lowp ivec4 bitCount(uvec4);"20212022"lowp int findMSB(highp int);"2023"lowp ivec2 findMSB(highp ivec2);"2024"lowp ivec3 findMSB(highp ivec3);"2025"lowp ivec4 findMSB(highp ivec4);"20262027"lowp int findMSB(highp uint);"2028"lowp ivec2 findMSB(highp uvec2);"2029"lowp ivec3 findMSB(highp uvec3);"2030"lowp ivec4 findMSB(highp uvec4);"20312032"\n");2033}20342035// GL_ARB_shader_ballot2036if (profile != EEsProfile && version >= 450) {2037commonBuiltins.append(2038"uint64_t ballotARB(bool);"20392040"float readInvocationARB(float, uint);"2041"vec2 readInvocationARB(vec2, uint);"2042"vec3 readInvocationARB(vec3, uint);"2043"vec4 readInvocationARB(vec4, uint);"20442045"int readInvocationARB(int, uint);"2046"ivec2 readInvocationARB(ivec2, uint);"2047"ivec3 readInvocationARB(ivec3, uint);"2048"ivec4 readInvocationARB(ivec4, uint);"20492050"uint readInvocationARB(uint, uint);"2051"uvec2 readInvocationARB(uvec2, uint);"2052"uvec3 readInvocationARB(uvec3, uint);"2053"uvec4 readInvocationARB(uvec4, uint);"20542055"float readFirstInvocationARB(float);"2056"vec2 readFirstInvocationARB(vec2);"2057"vec3 readFirstInvocationARB(vec3);"2058"vec4 readFirstInvocationARB(vec4);"20592060"int readFirstInvocationARB(int);"2061"ivec2 readFirstInvocationARB(ivec2);"2062"ivec3 readFirstInvocationARB(ivec3);"2063"ivec4 readFirstInvocationARB(ivec4);"20642065"uint readFirstInvocationARB(uint);"2066"uvec2 readFirstInvocationARB(uvec2);"2067"uvec3 readFirstInvocationARB(uvec3);"2068"uvec4 readFirstInvocationARB(uvec4);"20692070"\n");2071}20722073// GL_ARB_shader_group_vote2074if (profile != EEsProfile && version >= 430) {2075commonBuiltins.append(2076"bool anyInvocationARB(bool);"2077"bool allInvocationsARB(bool);"2078"bool allInvocationsEqualARB(bool);"20792080"\n");2081}20822083// GL_KHR_shader_subgroup2084if ((profile == EEsProfile && version >= 310) ||2085(profile != EEsProfile && version >= 140)) {2086commonBuiltins.append(2087"void subgroupBarrier();"2088"void subgroupMemoryBarrier();"2089"void subgroupMemoryBarrierBuffer();"2090"void subgroupMemoryBarrierImage();"2091"bool subgroupElect();"20922093"bool subgroupAll(bool);\n"2094"bool subgroupAny(bool);\n"2095"uvec4 subgroupBallot(bool);\n"2096"bool subgroupInverseBallot(uvec4);\n"2097"bool subgroupBallotBitExtract(uvec4, uint);\n"2098"uint subgroupBallotBitCount(uvec4);\n"2099"uint subgroupBallotInclusiveBitCount(uvec4);\n"2100"uint subgroupBallotExclusiveBitCount(uvec4);\n"2101"uint subgroupBallotFindLSB(uvec4);\n"2102"uint subgroupBallotFindMSB(uvec4);\n"2103);21042105// Generate all flavors of subgroup ops.2106static const char *subgroupOps[] =2107{2108"bool subgroupAllEqual(%s);\n",2109"%s subgroupBroadcast(%s, uint);\n",2110"%s subgroupBroadcastFirst(%s);\n",2111"%s subgroupShuffle(%s, uint);\n",2112"%s subgroupShuffleXor(%s, uint);\n",2113"%s subgroupShuffleUp(%s, uint delta);\n",2114"%s subgroupShuffleDown(%s, uint delta);\n",2115"%s subgroupRotate(%s, uint);\n",2116"%s subgroupClusteredRotate(%s, uint, uint);\n",2117"%s subgroupAdd(%s);\n",2118"%s subgroupMul(%s);\n",2119"%s subgroupMin(%s);\n",2120"%s subgroupMax(%s);\n",2121"%s subgroupAnd(%s);\n",2122"%s subgroupOr(%s);\n",2123"%s subgroupXor(%s);\n",2124"%s subgroupInclusiveAdd(%s);\n",2125"%s subgroupInclusiveMul(%s);\n",2126"%s subgroupInclusiveMin(%s);\n",2127"%s subgroupInclusiveMax(%s);\n",2128"%s subgroupInclusiveAnd(%s);\n",2129"%s subgroupInclusiveOr(%s);\n",2130"%s subgroupInclusiveXor(%s);\n",2131"%s subgroupExclusiveAdd(%s);\n",2132"%s subgroupExclusiveMul(%s);\n",2133"%s subgroupExclusiveMin(%s);\n",2134"%s subgroupExclusiveMax(%s);\n",2135"%s subgroupExclusiveAnd(%s);\n",2136"%s subgroupExclusiveOr(%s);\n",2137"%s subgroupExclusiveXor(%s);\n",2138"%s subgroupClusteredAdd(%s, uint);\n",2139"%s subgroupClusteredMul(%s, uint);\n",2140"%s subgroupClusteredMin(%s, uint);\n",2141"%s subgroupClusteredMax(%s, uint);\n",2142"%s subgroupClusteredAnd(%s, uint);\n",2143"%s subgroupClusteredOr(%s, uint);\n",2144"%s subgroupClusteredXor(%s, uint);\n",2145"%s subgroupQuadBroadcast(%s, uint);\n",2146"%s subgroupQuadSwapHorizontal(%s);\n",2147"%s subgroupQuadSwapVertical(%s);\n",2148"%s subgroupQuadSwapDiagonal(%s);\n",2149"uvec4 subgroupPartitionNV(%s);\n",2150"%s subgroupPartitionedAddNV(%s, uvec4 ballot);\n",2151"%s subgroupPartitionedMulNV(%s, uvec4 ballot);\n",2152"%s subgroupPartitionedMinNV(%s, uvec4 ballot);\n",2153"%s subgroupPartitionedMaxNV(%s, uvec4 ballot);\n",2154"%s subgroupPartitionedAndNV(%s, uvec4 ballot);\n",2155"%s subgroupPartitionedOrNV(%s, uvec4 ballot);\n",2156"%s subgroupPartitionedXorNV(%s, uvec4 ballot);\n",2157"%s subgroupPartitionedInclusiveAddNV(%s, uvec4 ballot);\n",2158"%s subgroupPartitionedInclusiveMulNV(%s, uvec4 ballot);\n",2159"%s subgroupPartitionedInclusiveMinNV(%s, uvec4 ballot);\n",2160"%s subgroupPartitionedInclusiveMaxNV(%s, uvec4 ballot);\n",2161"%s subgroupPartitionedInclusiveAndNV(%s, uvec4 ballot);\n",2162"%s subgroupPartitionedInclusiveOrNV(%s, uvec4 ballot);\n",2163"%s subgroupPartitionedInclusiveXorNV(%s, uvec4 ballot);\n",2164"%s subgroupPartitionedExclusiveAddNV(%s, uvec4 ballot);\n",2165"%s subgroupPartitionedExclusiveMulNV(%s, uvec4 ballot);\n",2166"%s subgroupPartitionedExclusiveMinNV(%s, uvec4 ballot);\n",2167"%s subgroupPartitionedExclusiveMaxNV(%s, uvec4 ballot);\n",2168"%s subgroupPartitionedExclusiveAndNV(%s, uvec4 ballot);\n",2169"%s subgroupPartitionedExclusiveOrNV(%s, uvec4 ballot);\n",2170"%s subgroupPartitionedExclusiveXorNV(%s, uvec4 ballot);\n",2171};21722173static const char *floatTypes[] = {2174"float", "vec2", "vec3", "vec4",2175"float16_t", "f16vec2", "f16vec3", "f16vec4",2176};2177static const char *doubleTypes[] = {2178"double", "dvec2", "dvec3", "dvec4",2179};2180static const char *intTypes[] = {2181"int8_t", "i8vec2", "i8vec3", "i8vec4",2182"int16_t", "i16vec2", "i16vec3", "i16vec4",2183"int", "ivec2", "ivec3", "ivec4",2184"int64_t", "i64vec2", "i64vec3", "i64vec4",2185"uint8_t", "u8vec2", "u8vec3", "u8vec4",2186"uint16_t", "u16vec2", "u16vec3", "u16vec4",2187"uint", "uvec2", "uvec3", "uvec4",2188"uint64_t", "u64vec2", "u64vec3", "u64vec4",2189};2190static const char *boolTypes[] = {2191"bool", "bvec2", "bvec3", "bvec4",2192};21932194for (size_t i = 0; i < sizeof(subgroupOps)/sizeof(subgroupOps[0]); ++i) {2195const char *op = subgroupOps[i];21962197// Logical operations don't support float2198bool logicalOp = strstr(op, "Or") || strstr(op, "And") ||2199(strstr(op, "Xor") && !strstr(op, "ShuffleXor"));2200// Math operations don't support bool2201bool mathOp = strstr(op, "Add") || strstr(op, "Mul") || strstr(op, "Min") || strstr(op, "Max");22022203const int bufSize = 256;2204char buf[bufSize];22052206if (!logicalOp) {2207for (size_t j = 0; j < sizeof(floatTypes)/sizeof(floatTypes[0]); ++j) {2208snprintf(buf, bufSize, op, floatTypes[j], floatTypes[j]);2209commonBuiltins.append(buf);2210}2211if (profile != EEsProfile && version >= 400) {2212for (size_t j = 0; j < sizeof(doubleTypes)/sizeof(doubleTypes[0]); ++j) {2213snprintf(buf, bufSize, op, doubleTypes[j], doubleTypes[j]);2214commonBuiltins.append(buf);2215}2216}2217}2218if (!mathOp) {2219for (size_t j = 0; j < sizeof(boolTypes)/sizeof(boolTypes[0]); ++j) {2220snprintf(buf, bufSize, op, boolTypes[j], boolTypes[j]);2221commonBuiltins.append(buf);2222}2223}2224for (size_t j = 0; j < sizeof(intTypes)/sizeof(intTypes[0]); ++j) {2225snprintf(buf, bufSize, op, intTypes[j], intTypes[j]);2226commonBuiltins.append(buf);2227}2228}22292230stageBuiltins[EShLangCompute].append(2231"void subgroupMemoryBarrierShared();"22322233"\n"2234);2235stageBuiltins[EShLangMesh].append(2236"void subgroupMemoryBarrierShared();"2237"\n"2238);2239stageBuiltins[EShLangTask].append(2240"void subgroupMemoryBarrierShared();"2241"\n"2242);2243}22442245// GL_EXT_shader_quad_control2246if ((profile == EEsProfile && version >= 310) ||2247(profile != EEsProfile && version >= 140)) {2248commonBuiltins.append(2249"bool subgroupQuadAll(bool);\n"2250"bool subgroupQuadAny(bool);\n"2251);2252}22532254if (profile != EEsProfile && version >= 460) {2255commonBuiltins.append(2256"bool anyInvocation(bool);"2257"bool allInvocations(bool);"2258"bool allInvocationsEqual(bool);"22592260"\n");2261}22622263// GL_AMD_shader_ballot2264if (profile != EEsProfile && version >= 450) {2265commonBuiltins.append(2266"float minInvocationsAMD(float);"2267"vec2 minInvocationsAMD(vec2);"2268"vec3 minInvocationsAMD(vec3);"2269"vec4 minInvocationsAMD(vec4);"22702271"int minInvocationsAMD(int);"2272"ivec2 minInvocationsAMD(ivec2);"2273"ivec3 minInvocationsAMD(ivec3);"2274"ivec4 minInvocationsAMD(ivec4);"22752276"uint minInvocationsAMD(uint);"2277"uvec2 minInvocationsAMD(uvec2);"2278"uvec3 minInvocationsAMD(uvec3);"2279"uvec4 minInvocationsAMD(uvec4);"22802281"double minInvocationsAMD(double);"2282"dvec2 minInvocationsAMD(dvec2);"2283"dvec3 minInvocationsAMD(dvec3);"2284"dvec4 minInvocationsAMD(dvec4);"22852286"int64_t minInvocationsAMD(int64_t);"2287"i64vec2 minInvocationsAMD(i64vec2);"2288"i64vec3 minInvocationsAMD(i64vec3);"2289"i64vec4 minInvocationsAMD(i64vec4);"22902291"uint64_t minInvocationsAMD(uint64_t);"2292"u64vec2 minInvocationsAMD(u64vec2);"2293"u64vec3 minInvocationsAMD(u64vec3);"2294"u64vec4 minInvocationsAMD(u64vec4);"22952296"float16_t minInvocationsAMD(float16_t);"2297"f16vec2 minInvocationsAMD(f16vec2);"2298"f16vec3 minInvocationsAMD(f16vec3);"2299"f16vec4 minInvocationsAMD(f16vec4);"23002301"int16_t minInvocationsAMD(int16_t);"2302"i16vec2 minInvocationsAMD(i16vec2);"2303"i16vec3 minInvocationsAMD(i16vec3);"2304"i16vec4 minInvocationsAMD(i16vec4);"23052306"uint16_t minInvocationsAMD(uint16_t);"2307"u16vec2 minInvocationsAMD(u16vec2);"2308"u16vec3 minInvocationsAMD(u16vec3);"2309"u16vec4 minInvocationsAMD(u16vec4);"23102311"float minInvocationsInclusiveScanAMD(float);"2312"vec2 minInvocationsInclusiveScanAMD(vec2);"2313"vec3 minInvocationsInclusiveScanAMD(vec3);"2314"vec4 minInvocationsInclusiveScanAMD(vec4);"23152316"int minInvocationsInclusiveScanAMD(int);"2317"ivec2 minInvocationsInclusiveScanAMD(ivec2);"2318"ivec3 minInvocationsInclusiveScanAMD(ivec3);"2319"ivec4 minInvocationsInclusiveScanAMD(ivec4);"23202321"uint minInvocationsInclusiveScanAMD(uint);"2322"uvec2 minInvocationsInclusiveScanAMD(uvec2);"2323"uvec3 minInvocationsInclusiveScanAMD(uvec3);"2324"uvec4 minInvocationsInclusiveScanAMD(uvec4);"23252326"double minInvocationsInclusiveScanAMD(double);"2327"dvec2 minInvocationsInclusiveScanAMD(dvec2);"2328"dvec3 minInvocationsInclusiveScanAMD(dvec3);"2329"dvec4 minInvocationsInclusiveScanAMD(dvec4);"23302331"int64_t minInvocationsInclusiveScanAMD(int64_t);"2332"i64vec2 minInvocationsInclusiveScanAMD(i64vec2);"2333"i64vec3 minInvocationsInclusiveScanAMD(i64vec3);"2334"i64vec4 minInvocationsInclusiveScanAMD(i64vec4);"23352336"uint64_t minInvocationsInclusiveScanAMD(uint64_t);"2337"u64vec2 minInvocationsInclusiveScanAMD(u64vec2);"2338"u64vec3 minInvocationsInclusiveScanAMD(u64vec3);"2339"u64vec4 minInvocationsInclusiveScanAMD(u64vec4);"23402341"float16_t minInvocationsInclusiveScanAMD(float16_t);"2342"f16vec2 minInvocationsInclusiveScanAMD(f16vec2);"2343"f16vec3 minInvocationsInclusiveScanAMD(f16vec3);"2344"f16vec4 minInvocationsInclusiveScanAMD(f16vec4);"23452346"int16_t minInvocationsInclusiveScanAMD(int16_t);"2347"i16vec2 minInvocationsInclusiveScanAMD(i16vec2);"2348"i16vec3 minInvocationsInclusiveScanAMD(i16vec3);"2349"i16vec4 minInvocationsInclusiveScanAMD(i16vec4);"23502351"uint16_t minInvocationsInclusiveScanAMD(uint16_t);"2352"u16vec2 minInvocationsInclusiveScanAMD(u16vec2);"2353"u16vec3 minInvocationsInclusiveScanAMD(u16vec3);"2354"u16vec4 minInvocationsInclusiveScanAMD(u16vec4);"23552356"float minInvocationsExclusiveScanAMD(float);"2357"vec2 minInvocationsExclusiveScanAMD(vec2);"2358"vec3 minInvocationsExclusiveScanAMD(vec3);"2359"vec4 minInvocationsExclusiveScanAMD(vec4);"23602361"int minInvocationsExclusiveScanAMD(int);"2362"ivec2 minInvocationsExclusiveScanAMD(ivec2);"2363"ivec3 minInvocationsExclusiveScanAMD(ivec3);"2364"ivec4 minInvocationsExclusiveScanAMD(ivec4);"23652366"uint minInvocationsExclusiveScanAMD(uint);"2367"uvec2 minInvocationsExclusiveScanAMD(uvec2);"2368"uvec3 minInvocationsExclusiveScanAMD(uvec3);"2369"uvec4 minInvocationsExclusiveScanAMD(uvec4);"23702371"double minInvocationsExclusiveScanAMD(double);"2372"dvec2 minInvocationsExclusiveScanAMD(dvec2);"2373"dvec3 minInvocationsExclusiveScanAMD(dvec3);"2374"dvec4 minInvocationsExclusiveScanAMD(dvec4);"23752376"int64_t minInvocationsExclusiveScanAMD(int64_t);"2377"i64vec2 minInvocationsExclusiveScanAMD(i64vec2);"2378"i64vec3 minInvocationsExclusiveScanAMD(i64vec3);"2379"i64vec4 minInvocationsExclusiveScanAMD(i64vec4);"23802381"uint64_t minInvocationsExclusiveScanAMD(uint64_t);"2382"u64vec2 minInvocationsExclusiveScanAMD(u64vec2);"2383"u64vec3 minInvocationsExclusiveScanAMD(u64vec3);"2384"u64vec4 minInvocationsExclusiveScanAMD(u64vec4);"23852386"float16_t minInvocationsExclusiveScanAMD(float16_t);"2387"f16vec2 minInvocationsExclusiveScanAMD(f16vec2);"2388"f16vec3 minInvocationsExclusiveScanAMD(f16vec3);"2389"f16vec4 minInvocationsExclusiveScanAMD(f16vec4);"23902391"int16_t minInvocationsExclusiveScanAMD(int16_t);"2392"i16vec2 minInvocationsExclusiveScanAMD(i16vec2);"2393"i16vec3 minInvocationsExclusiveScanAMD(i16vec3);"2394"i16vec4 minInvocationsExclusiveScanAMD(i16vec4);"23952396"uint16_t minInvocationsExclusiveScanAMD(uint16_t);"2397"u16vec2 minInvocationsExclusiveScanAMD(u16vec2);"2398"u16vec3 minInvocationsExclusiveScanAMD(u16vec3);"2399"u16vec4 minInvocationsExclusiveScanAMD(u16vec4);"24002401"float maxInvocationsAMD(float);"2402"vec2 maxInvocationsAMD(vec2);"2403"vec3 maxInvocationsAMD(vec3);"2404"vec4 maxInvocationsAMD(vec4);"24052406"int maxInvocationsAMD(int);"2407"ivec2 maxInvocationsAMD(ivec2);"2408"ivec3 maxInvocationsAMD(ivec3);"2409"ivec4 maxInvocationsAMD(ivec4);"24102411"uint maxInvocationsAMD(uint);"2412"uvec2 maxInvocationsAMD(uvec2);"2413"uvec3 maxInvocationsAMD(uvec3);"2414"uvec4 maxInvocationsAMD(uvec4);"24152416"double maxInvocationsAMD(double);"2417"dvec2 maxInvocationsAMD(dvec2);"2418"dvec3 maxInvocationsAMD(dvec3);"2419"dvec4 maxInvocationsAMD(dvec4);"24202421"int64_t maxInvocationsAMD(int64_t);"2422"i64vec2 maxInvocationsAMD(i64vec2);"2423"i64vec3 maxInvocationsAMD(i64vec3);"2424"i64vec4 maxInvocationsAMD(i64vec4);"24252426"uint64_t maxInvocationsAMD(uint64_t);"2427"u64vec2 maxInvocationsAMD(u64vec2);"2428"u64vec3 maxInvocationsAMD(u64vec3);"2429"u64vec4 maxInvocationsAMD(u64vec4);"24302431"float16_t maxInvocationsAMD(float16_t);"2432"f16vec2 maxInvocationsAMD(f16vec2);"2433"f16vec3 maxInvocationsAMD(f16vec3);"2434"f16vec4 maxInvocationsAMD(f16vec4);"24352436"int16_t maxInvocationsAMD(int16_t);"2437"i16vec2 maxInvocationsAMD(i16vec2);"2438"i16vec3 maxInvocationsAMD(i16vec3);"2439"i16vec4 maxInvocationsAMD(i16vec4);"24402441"uint16_t maxInvocationsAMD(uint16_t);"2442"u16vec2 maxInvocationsAMD(u16vec2);"2443"u16vec3 maxInvocationsAMD(u16vec3);"2444"u16vec4 maxInvocationsAMD(u16vec4);"24452446"float maxInvocationsInclusiveScanAMD(float);"2447"vec2 maxInvocationsInclusiveScanAMD(vec2);"2448"vec3 maxInvocationsInclusiveScanAMD(vec3);"2449"vec4 maxInvocationsInclusiveScanAMD(vec4);"24502451"int maxInvocationsInclusiveScanAMD(int);"2452"ivec2 maxInvocationsInclusiveScanAMD(ivec2);"2453"ivec3 maxInvocationsInclusiveScanAMD(ivec3);"2454"ivec4 maxInvocationsInclusiveScanAMD(ivec4);"24552456"uint maxInvocationsInclusiveScanAMD(uint);"2457"uvec2 maxInvocationsInclusiveScanAMD(uvec2);"2458"uvec3 maxInvocationsInclusiveScanAMD(uvec3);"2459"uvec4 maxInvocationsInclusiveScanAMD(uvec4);"24602461"double maxInvocationsInclusiveScanAMD(double);"2462"dvec2 maxInvocationsInclusiveScanAMD(dvec2);"2463"dvec3 maxInvocationsInclusiveScanAMD(dvec3);"2464"dvec4 maxInvocationsInclusiveScanAMD(dvec4);"24652466"int64_t maxInvocationsInclusiveScanAMD(int64_t);"2467"i64vec2 maxInvocationsInclusiveScanAMD(i64vec2);"2468"i64vec3 maxInvocationsInclusiveScanAMD(i64vec3);"2469"i64vec4 maxInvocationsInclusiveScanAMD(i64vec4);"24702471"uint64_t maxInvocationsInclusiveScanAMD(uint64_t);"2472"u64vec2 maxInvocationsInclusiveScanAMD(u64vec2);"2473"u64vec3 maxInvocationsInclusiveScanAMD(u64vec3);"2474"u64vec4 maxInvocationsInclusiveScanAMD(u64vec4);"24752476"float16_t maxInvocationsInclusiveScanAMD(float16_t);"2477"f16vec2 maxInvocationsInclusiveScanAMD(f16vec2);"2478"f16vec3 maxInvocationsInclusiveScanAMD(f16vec3);"2479"f16vec4 maxInvocationsInclusiveScanAMD(f16vec4);"24802481"int16_t maxInvocationsInclusiveScanAMD(int16_t);"2482"i16vec2 maxInvocationsInclusiveScanAMD(i16vec2);"2483"i16vec3 maxInvocationsInclusiveScanAMD(i16vec3);"2484"i16vec4 maxInvocationsInclusiveScanAMD(i16vec4);"24852486"uint16_t maxInvocationsInclusiveScanAMD(uint16_t);"2487"u16vec2 maxInvocationsInclusiveScanAMD(u16vec2);"2488"u16vec3 maxInvocationsInclusiveScanAMD(u16vec3);"2489"u16vec4 maxInvocationsInclusiveScanAMD(u16vec4);"24902491"float maxInvocationsExclusiveScanAMD(float);"2492"vec2 maxInvocationsExclusiveScanAMD(vec2);"2493"vec3 maxInvocationsExclusiveScanAMD(vec3);"2494"vec4 maxInvocationsExclusiveScanAMD(vec4);"24952496"int maxInvocationsExclusiveScanAMD(int);"2497"ivec2 maxInvocationsExclusiveScanAMD(ivec2);"2498"ivec3 maxInvocationsExclusiveScanAMD(ivec3);"2499"ivec4 maxInvocationsExclusiveScanAMD(ivec4);"25002501"uint maxInvocationsExclusiveScanAMD(uint);"2502"uvec2 maxInvocationsExclusiveScanAMD(uvec2);"2503"uvec3 maxInvocationsExclusiveScanAMD(uvec3);"2504"uvec4 maxInvocationsExclusiveScanAMD(uvec4);"25052506"double maxInvocationsExclusiveScanAMD(double);"2507"dvec2 maxInvocationsExclusiveScanAMD(dvec2);"2508"dvec3 maxInvocationsExclusiveScanAMD(dvec3);"2509"dvec4 maxInvocationsExclusiveScanAMD(dvec4);"25102511"int64_t maxInvocationsExclusiveScanAMD(int64_t);"2512"i64vec2 maxInvocationsExclusiveScanAMD(i64vec2);"2513"i64vec3 maxInvocationsExclusiveScanAMD(i64vec3);"2514"i64vec4 maxInvocationsExclusiveScanAMD(i64vec4);"25152516"uint64_t maxInvocationsExclusiveScanAMD(uint64_t);"2517"u64vec2 maxInvocationsExclusiveScanAMD(u64vec2);"2518"u64vec3 maxInvocationsExclusiveScanAMD(u64vec3);"2519"u64vec4 maxInvocationsExclusiveScanAMD(u64vec4);"25202521"float16_t maxInvocationsExclusiveScanAMD(float16_t);"2522"f16vec2 maxInvocationsExclusiveScanAMD(f16vec2);"2523"f16vec3 maxInvocationsExclusiveScanAMD(f16vec3);"2524"f16vec4 maxInvocationsExclusiveScanAMD(f16vec4);"25252526"int16_t maxInvocationsExclusiveScanAMD(int16_t);"2527"i16vec2 maxInvocationsExclusiveScanAMD(i16vec2);"2528"i16vec3 maxInvocationsExclusiveScanAMD(i16vec3);"2529"i16vec4 maxInvocationsExclusiveScanAMD(i16vec4);"25302531"uint16_t maxInvocationsExclusiveScanAMD(uint16_t);"2532"u16vec2 maxInvocationsExclusiveScanAMD(u16vec2);"2533"u16vec3 maxInvocationsExclusiveScanAMD(u16vec3);"2534"u16vec4 maxInvocationsExclusiveScanAMD(u16vec4);"25352536"float addInvocationsAMD(float);"2537"vec2 addInvocationsAMD(vec2);"2538"vec3 addInvocationsAMD(vec3);"2539"vec4 addInvocationsAMD(vec4);"25402541"int addInvocationsAMD(int);"2542"ivec2 addInvocationsAMD(ivec2);"2543"ivec3 addInvocationsAMD(ivec3);"2544"ivec4 addInvocationsAMD(ivec4);"25452546"uint addInvocationsAMD(uint);"2547"uvec2 addInvocationsAMD(uvec2);"2548"uvec3 addInvocationsAMD(uvec3);"2549"uvec4 addInvocationsAMD(uvec4);"25502551"double addInvocationsAMD(double);"2552"dvec2 addInvocationsAMD(dvec2);"2553"dvec3 addInvocationsAMD(dvec3);"2554"dvec4 addInvocationsAMD(dvec4);"25552556"int64_t addInvocationsAMD(int64_t);"2557"i64vec2 addInvocationsAMD(i64vec2);"2558"i64vec3 addInvocationsAMD(i64vec3);"2559"i64vec4 addInvocationsAMD(i64vec4);"25602561"uint64_t addInvocationsAMD(uint64_t);"2562"u64vec2 addInvocationsAMD(u64vec2);"2563"u64vec3 addInvocationsAMD(u64vec3);"2564"u64vec4 addInvocationsAMD(u64vec4);"25652566"float16_t addInvocationsAMD(float16_t);"2567"f16vec2 addInvocationsAMD(f16vec2);"2568"f16vec3 addInvocationsAMD(f16vec3);"2569"f16vec4 addInvocationsAMD(f16vec4);"25702571"int16_t addInvocationsAMD(int16_t);"2572"i16vec2 addInvocationsAMD(i16vec2);"2573"i16vec3 addInvocationsAMD(i16vec3);"2574"i16vec4 addInvocationsAMD(i16vec4);"25752576"uint16_t addInvocationsAMD(uint16_t);"2577"u16vec2 addInvocationsAMD(u16vec2);"2578"u16vec3 addInvocationsAMD(u16vec3);"2579"u16vec4 addInvocationsAMD(u16vec4);"25802581"float addInvocationsInclusiveScanAMD(float);"2582"vec2 addInvocationsInclusiveScanAMD(vec2);"2583"vec3 addInvocationsInclusiveScanAMD(vec3);"2584"vec4 addInvocationsInclusiveScanAMD(vec4);"25852586"int addInvocationsInclusiveScanAMD(int);"2587"ivec2 addInvocationsInclusiveScanAMD(ivec2);"2588"ivec3 addInvocationsInclusiveScanAMD(ivec3);"2589"ivec4 addInvocationsInclusiveScanAMD(ivec4);"25902591"uint addInvocationsInclusiveScanAMD(uint);"2592"uvec2 addInvocationsInclusiveScanAMD(uvec2);"2593"uvec3 addInvocationsInclusiveScanAMD(uvec3);"2594"uvec4 addInvocationsInclusiveScanAMD(uvec4);"25952596"double addInvocationsInclusiveScanAMD(double);"2597"dvec2 addInvocationsInclusiveScanAMD(dvec2);"2598"dvec3 addInvocationsInclusiveScanAMD(dvec3);"2599"dvec4 addInvocationsInclusiveScanAMD(dvec4);"26002601"int64_t addInvocationsInclusiveScanAMD(int64_t);"2602"i64vec2 addInvocationsInclusiveScanAMD(i64vec2);"2603"i64vec3 addInvocationsInclusiveScanAMD(i64vec3);"2604"i64vec4 addInvocationsInclusiveScanAMD(i64vec4);"26052606"uint64_t addInvocationsInclusiveScanAMD(uint64_t);"2607"u64vec2 addInvocationsInclusiveScanAMD(u64vec2);"2608"u64vec3 addInvocationsInclusiveScanAMD(u64vec3);"2609"u64vec4 addInvocationsInclusiveScanAMD(u64vec4);"26102611"float16_t addInvocationsInclusiveScanAMD(float16_t);"2612"f16vec2 addInvocationsInclusiveScanAMD(f16vec2);"2613"f16vec3 addInvocationsInclusiveScanAMD(f16vec3);"2614"f16vec4 addInvocationsInclusiveScanAMD(f16vec4);"26152616"int16_t addInvocationsInclusiveScanAMD(int16_t);"2617"i16vec2 addInvocationsInclusiveScanAMD(i16vec2);"2618"i16vec3 addInvocationsInclusiveScanAMD(i16vec3);"2619"i16vec4 addInvocationsInclusiveScanAMD(i16vec4);"26202621"uint16_t addInvocationsInclusiveScanAMD(uint16_t);"2622"u16vec2 addInvocationsInclusiveScanAMD(u16vec2);"2623"u16vec3 addInvocationsInclusiveScanAMD(u16vec3);"2624"u16vec4 addInvocationsInclusiveScanAMD(u16vec4);"26252626"float addInvocationsExclusiveScanAMD(float);"2627"vec2 addInvocationsExclusiveScanAMD(vec2);"2628"vec3 addInvocationsExclusiveScanAMD(vec3);"2629"vec4 addInvocationsExclusiveScanAMD(vec4);"26302631"int addInvocationsExclusiveScanAMD(int);"2632"ivec2 addInvocationsExclusiveScanAMD(ivec2);"2633"ivec3 addInvocationsExclusiveScanAMD(ivec3);"2634"ivec4 addInvocationsExclusiveScanAMD(ivec4);"26352636"uint addInvocationsExclusiveScanAMD(uint);"2637"uvec2 addInvocationsExclusiveScanAMD(uvec2);"2638"uvec3 addInvocationsExclusiveScanAMD(uvec3);"2639"uvec4 addInvocationsExclusiveScanAMD(uvec4);"26402641"double addInvocationsExclusiveScanAMD(double);"2642"dvec2 addInvocationsExclusiveScanAMD(dvec2);"2643"dvec3 addInvocationsExclusiveScanAMD(dvec3);"2644"dvec4 addInvocationsExclusiveScanAMD(dvec4);"26452646"int64_t addInvocationsExclusiveScanAMD(int64_t);"2647"i64vec2 addInvocationsExclusiveScanAMD(i64vec2);"2648"i64vec3 addInvocationsExclusiveScanAMD(i64vec3);"2649"i64vec4 addInvocationsExclusiveScanAMD(i64vec4);"26502651"uint64_t addInvocationsExclusiveScanAMD(uint64_t);"2652"u64vec2 addInvocationsExclusiveScanAMD(u64vec2);"2653"u64vec3 addInvocationsExclusiveScanAMD(u64vec3);"2654"u64vec4 addInvocationsExclusiveScanAMD(u64vec4);"26552656"float16_t addInvocationsExclusiveScanAMD(float16_t);"2657"f16vec2 addInvocationsExclusiveScanAMD(f16vec2);"2658"f16vec3 addInvocationsExclusiveScanAMD(f16vec3);"2659"f16vec4 addInvocationsExclusiveScanAMD(f16vec4);"26602661"int16_t addInvocationsExclusiveScanAMD(int16_t);"2662"i16vec2 addInvocationsExclusiveScanAMD(i16vec2);"2663"i16vec3 addInvocationsExclusiveScanAMD(i16vec3);"2664"i16vec4 addInvocationsExclusiveScanAMD(i16vec4);"26652666"uint16_t addInvocationsExclusiveScanAMD(uint16_t);"2667"u16vec2 addInvocationsExclusiveScanAMD(u16vec2);"2668"u16vec3 addInvocationsExclusiveScanAMD(u16vec3);"2669"u16vec4 addInvocationsExclusiveScanAMD(u16vec4);"26702671"float minInvocationsNonUniformAMD(float);"2672"vec2 minInvocationsNonUniformAMD(vec2);"2673"vec3 minInvocationsNonUniformAMD(vec3);"2674"vec4 minInvocationsNonUniformAMD(vec4);"26752676"int minInvocationsNonUniformAMD(int);"2677"ivec2 minInvocationsNonUniformAMD(ivec2);"2678"ivec3 minInvocationsNonUniformAMD(ivec3);"2679"ivec4 minInvocationsNonUniformAMD(ivec4);"26802681"uint minInvocationsNonUniformAMD(uint);"2682"uvec2 minInvocationsNonUniformAMD(uvec2);"2683"uvec3 minInvocationsNonUniformAMD(uvec3);"2684"uvec4 minInvocationsNonUniformAMD(uvec4);"26852686"double minInvocationsNonUniformAMD(double);"2687"dvec2 minInvocationsNonUniformAMD(dvec2);"2688"dvec3 minInvocationsNonUniformAMD(dvec3);"2689"dvec4 minInvocationsNonUniformAMD(dvec4);"26902691"int64_t minInvocationsNonUniformAMD(int64_t);"2692"i64vec2 minInvocationsNonUniformAMD(i64vec2);"2693"i64vec3 minInvocationsNonUniformAMD(i64vec3);"2694"i64vec4 minInvocationsNonUniformAMD(i64vec4);"26952696"uint64_t minInvocationsNonUniformAMD(uint64_t);"2697"u64vec2 minInvocationsNonUniformAMD(u64vec2);"2698"u64vec3 minInvocationsNonUniformAMD(u64vec3);"2699"u64vec4 minInvocationsNonUniformAMD(u64vec4);"27002701"float16_t minInvocationsNonUniformAMD(float16_t);"2702"f16vec2 minInvocationsNonUniformAMD(f16vec2);"2703"f16vec3 minInvocationsNonUniformAMD(f16vec3);"2704"f16vec4 minInvocationsNonUniformAMD(f16vec4);"27052706"int16_t minInvocationsNonUniformAMD(int16_t);"2707"i16vec2 minInvocationsNonUniformAMD(i16vec2);"2708"i16vec3 minInvocationsNonUniformAMD(i16vec3);"2709"i16vec4 minInvocationsNonUniformAMD(i16vec4);"27102711"uint16_t minInvocationsNonUniformAMD(uint16_t);"2712"u16vec2 minInvocationsNonUniformAMD(u16vec2);"2713"u16vec3 minInvocationsNonUniformAMD(u16vec3);"2714"u16vec4 minInvocationsNonUniformAMD(u16vec4);"27152716"float minInvocationsInclusiveScanNonUniformAMD(float);"2717"vec2 minInvocationsInclusiveScanNonUniformAMD(vec2);"2718"vec3 minInvocationsInclusiveScanNonUniformAMD(vec3);"2719"vec4 minInvocationsInclusiveScanNonUniformAMD(vec4);"27202721"int minInvocationsInclusiveScanNonUniformAMD(int);"2722"ivec2 minInvocationsInclusiveScanNonUniformAMD(ivec2);"2723"ivec3 minInvocationsInclusiveScanNonUniformAMD(ivec3);"2724"ivec4 minInvocationsInclusiveScanNonUniformAMD(ivec4);"27252726"uint minInvocationsInclusiveScanNonUniformAMD(uint);"2727"uvec2 minInvocationsInclusiveScanNonUniformAMD(uvec2);"2728"uvec3 minInvocationsInclusiveScanNonUniformAMD(uvec3);"2729"uvec4 minInvocationsInclusiveScanNonUniformAMD(uvec4);"27302731"double minInvocationsInclusiveScanNonUniformAMD(double);"2732"dvec2 minInvocationsInclusiveScanNonUniformAMD(dvec2);"2733"dvec3 minInvocationsInclusiveScanNonUniformAMD(dvec3);"2734"dvec4 minInvocationsInclusiveScanNonUniformAMD(dvec4);"27352736"int64_t minInvocationsInclusiveScanNonUniformAMD(int64_t);"2737"i64vec2 minInvocationsInclusiveScanNonUniformAMD(i64vec2);"2738"i64vec3 minInvocationsInclusiveScanNonUniformAMD(i64vec3);"2739"i64vec4 minInvocationsInclusiveScanNonUniformAMD(i64vec4);"27402741"uint64_t minInvocationsInclusiveScanNonUniformAMD(uint64_t);"2742"u64vec2 minInvocationsInclusiveScanNonUniformAMD(u64vec2);"2743"u64vec3 minInvocationsInclusiveScanNonUniformAMD(u64vec3);"2744"u64vec4 minInvocationsInclusiveScanNonUniformAMD(u64vec4);"27452746"float16_t minInvocationsInclusiveScanNonUniformAMD(float16_t);"2747"f16vec2 minInvocationsInclusiveScanNonUniformAMD(f16vec2);"2748"f16vec3 minInvocationsInclusiveScanNonUniformAMD(f16vec3);"2749"f16vec4 minInvocationsInclusiveScanNonUniformAMD(f16vec4);"27502751"int16_t minInvocationsInclusiveScanNonUniformAMD(int16_t);"2752"i16vec2 minInvocationsInclusiveScanNonUniformAMD(i16vec2);"2753"i16vec3 minInvocationsInclusiveScanNonUniformAMD(i16vec3);"2754"i16vec4 minInvocationsInclusiveScanNonUniformAMD(i16vec4);"27552756"uint16_t minInvocationsInclusiveScanNonUniformAMD(uint16_t);"2757"u16vec2 minInvocationsInclusiveScanNonUniformAMD(u16vec2);"2758"u16vec3 minInvocationsInclusiveScanNonUniformAMD(u16vec3);"2759"u16vec4 minInvocationsInclusiveScanNonUniformAMD(u16vec4);"27602761"float minInvocationsExclusiveScanNonUniformAMD(float);"2762"vec2 minInvocationsExclusiveScanNonUniformAMD(vec2);"2763"vec3 minInvocationsExclusiveScanNonUniformAMD(vec3);"2764"vec4 minInvocationsExclusiveScanNonUniformAMD(vec4);"27652766"int minInvocationsExclusiveScanNonUniformAMD(int);"2767"ivec2 minInvocationsExclusiveScanNonUniformAMD(ivec2);"2768"ivec3 minInvocationsExclusiveScanNonUniformAMD(ivec3);"2769"ivec4 minInvocationsExclusiveScanNonUniformAMD(ivec4);"27702771"uint minInvocationsExclusiveScanNonUniformAMD(uint);"2772"uvec2 minInvocationsExclusiveScanNonUniformAMD(uvec2);"2773"uvec3 minInvocationsExclusiveScanNonUniformAMD(uvec3);"2774"uvec4 minInvocationsExclusiveScanNonUniformAMD(uvec4);"27752776"double minInvocationsExclusiveScanNonUniformAMD(double);"2777"dvec2 minInvocationsExclusiveScanNonUniformAMD(dvec2);"2778"dvec3 minInvocationsExclusiveScanNonUniformAMD(dvec3);"2779"dvec4 minInvocationsExclusiveScanNonUniformAMD(dvec4);"27802781"int64_t minInvocationsExclusiveScanNonUniformAMD(int64_t);"2782"i64vec2 minInvocationsExclusiveScanNonUniformAMD(i64vec2);"2783"i64vec3 minInvocationsExclusiveScanNonUniformAMD(i64vec3);"2784"i64vec4 minInvocationsExclusiveScanNonUniformAMD(i64vec4);"27852786"uint64_t minInvocationsExclusiveScanNonUniformAMD(uint64_t);"2787"u64vec2 minInvocationsExclusiveScanNonUniformAMD(u64vec2);"2788"u64vec3 minInvocationsExclusiveScanNonUniformAMD(u64vec3);"2789"u64vec4 minInvocationsExclusiveScanNonUniformAMD(u64vec4);"27902791"float16_t minInvocationsExclusiveScanNonUniformAMD(float16_t);"2792"f16vec2 minInvocationsExclusiveScanNonUniformAMD(f16vec2);"2793"f16vec3 minInvocationsExclusiveScanNonUniformAMD(f16vec3);"2794"f16vec4 minInvocationsExclusiveScanNonUniformAMD(f16vec4);"27952796"int16_t minInvocationsExclusiveScanNonUniformAMD(int16_t);"2797"i16vec2 minInvocationsExclusiveScanNonUniformAMD(i16vec2);"2798"i16vec3 minInvocationsExclusiveScanNonUniformAMD(i16vec3);"2799"i16vec4 minInvocationsExclusiveScanNonUniformAMD(i16vec4);"28002801"uint16_t minInvocationsExclusiveScanNonUniformAMD(uint16_t);"2802"u16vec2 minInvocationsExclusiveScanNonUniformAMD(u16vec2);"2803"u16vec3 minInvocationsExclusiveScanNonUniformAMD(u16vec3);"2804"u16vec4 minInvocationsExclusiveScanNonUniformAMD(u16vec4);"28052806"float maxInvocationsNonUniformAMD(float);"2807"vec2 maxInvocationsNonUniformAMD(vec2);"2808"vec3 maxInvocationsNonUniformAMD(vec3);"2809"vec4 maxInvocationsNonUniformAMD(vec4);"28102811"int maxInvocationsNonUniformAMD(int);"2812"ivec2 maxInvocationsNonUniformAMD(ivec2);"2813"ivec3 maxInvocationsNonUniformAMD(ivec3);"2814"ivec4 maxInvocationsNonUniformAMD(ivec4);"28152816"uint maxInvocationsNonUniformAMD(uint);"2817"uvec2 maxInvocationsNonUniformAMD(uvec2);"2818"uvec3 maxInvocationsNonUniformAMD(uvec3);"2819"uvec4 maxInvocationsNonUniformAMD(uvec4);"28202821"double maxInvocationsNonUniformAMD(double);"2822"dvec2 maxInvocationsNonUniformAMD(dvec2);"2823"dvec3 maxInvocationsNonUniformAMD(dvec3);"2824"dvec4 maxInvocationsNonUniformAMD(dvec4);"28252826"int64_t maxInvocationsNonUniformAMD(int64_t);"2827"i64vec2 maxInvocationsNonUniformAMD(i64vec2);"2828"i64vec3 maxInvocationsNonUniformAMD(i64vec3);"2829"i64vec4 maxInvocationsNonUniformAMD(i64vec4);"28302831"uint64_t maxInvocationsNonUniformAMD(uint64_t);"2832"u64vec2 maxInvocationsNonUniformAMD(u64vec2);"2833"u64vec3 maxInvocationsNonUniformAMD(u64vec3);"2834"u64vec4 maxInvocationsNonUniformAMD(u64vec4);"28352836"float16_t maxInvocationsNonUniformAMD(float16_t);"2837"f16vec2 maxInvocationsNonUniformAMD(f16vec2);"2838"f16vec3 maxInvocationsNonUniformAMD(f16vec3);"2839"f16vec4 maxInvocationsNonUniformAMD(f16vec4);"28402841"int16_t maxInvocationsNonUniformAMD(int16_t);"2842"i16vec2 maxInvocationsNonUniformAMD(i16vec2);"2843"i16vec3 maxInvocationsNonUniformAMD(i16vec3);"2844"i16vec4 maxInvocationsNonUniformAMD(i16vec4);"28452846"uint16_t maxInvocationsNonUniformAMD(uint16_t);"2847"u16vec2 maxInvocationsNonUniformAMD(u16vec2);"2848"u16vec3 maxInvocationsNonUniformAMD(u16vec3);"2849"u16vec4 maxInvocationsNonUniformAMD(u16vec4);"28502851"float maxInvocationsInclusiveScanNonUniformAMD(float);"2852"vec2 maxInvocationsInclusiveScanNonUniformAMD(vec2);"2853"vec3 maxInvocationsInclusiveScanNonUniformAMD(vec3);"2854"vec4 maxInvocationsInclusiveScanNonUniformAMD(vec4);"28552856"int maxInvocationsInclusiveScanNonUniformAMD(int);"2857"ivec2 maxInvocationsInclusiveScanNonUniformAMD(ivec2);"2858"ivec3 maxInvocationsInclusiveScanNonUniformAMD(ivec3);"2859"ivec4 maxInvocationsInclusiveScanNonUniformAMD(ivec4);"28602861"uint maxInvocationsInclusiveScanNonUniformAMD(uint);"2862"uvec2 maxInvocationsInclusiveScanNonUniformAMD(uvec2);"2863"uvec3 maxInvocationsInclusiveScanNonUniformAMD(uvec3);"2864"uvec4 maxInvocationsInclusiveScanNonUniformAMD(uvec4);"28652866"double maxInvocationsInclusiveScanNonUniformAMD(double);"2867"dvec2 maxInvocationsInclusiveScanNonUniformAMD(dvec2);"2868"dvec3 maxInvocationsInclusiveScanNonUniformAMD(dvec3);"2869"dvec4 maxInvocationsInclusiveScanNonUniformAMD(dvec4);"28702871"int64_t maxInvocationsInclusiveScanNonUniformAMD(int64_t);"2872"i64vec2 maxInvocationsInclusiveScanNonUniformAMD(i64vec2);"2873"i64vec3 maxInvocationsInclusiveScanNonUniformAMD(i64vec3);"2874"i64vec4 maxInvocationsInclusiveScanNonUniformAMD(i64vec4);"28752876"uint64_t maxInvocationsInclusiveScanNonUniformAMD(uint64_t);"2877"u64vec2 maxInvocationsInclusiveScanNonUniformAMD(u64vec2);"2878"u64vec3 maxInvocationsInclusiveScanNonUniformAMD(u64vec3);"2879"u64vec4 maxInvocationsInclusiveScanNonUniformAMD(u64vec4);"28802881"float16_t maxInvocationsInclusiveScanNonUniformAMD(float16_t);"2882"f16vec2 maxInvocationsInclusiveScanNonUniformAMD(f16vec2);"2883"f16vec3 maxInvocationsInclusiveScanNonUniformAMD(f16vec3);"2884"f16vec4 maxInvocationsInclusiveScanNonUniformAMD(f16vec4);"28852886"int16_t maxInvocationsInclusiveScanNonUniformAMD(int16_t);"2887"i16vec2 maxInvocationsInclusiveScanNonUniformAMD(i16vec2);"2888"i16vec3 maxInvocationsInclusiveScanNonUniformAMD(i16vec3);"2889"i16vec4 maxInvocationsInclusiveScanNonUniformAMD(i16vec4);"28902891"uint16_t maxInvocationsInclusiveScanNonUniformAMD(uint16_t);"2892"u16vec2 maxInvocationsInclusiveScanNonUniformAMD(u16vec2);"2893"u16vec3 maxInvocationsInclusiveScanNonUniformAMD(u16vec3);"2894"u16vec4 maxInvocationsInclusiveScanNonUniformAMD(u16vec4);"28952896"float maxInvocationsExclusiveScanNonUniformAMD(float);"2897"vec2 maxInvocationsExclusiveScanNonUniformAMD(vec2);"2898"vec3 maxInvocationsExclusiveScanNonUniformAMD(vec3);"2899"vec4 maxInvocationsExclusiveScanNonUniformAMD(vec4);"29002901"int maxInvocationsExclusiveScanNonUniformAMD(int);"2902"ivec2 maxInvocationsExclusiveScanNonUniformAMD(ivec2);"2903"ivec3 maxInvocationsExclusiveScanNonUniformAMD(ivec3);"2904"ivec4 maxInvocationsExclusiveScanNonUniformAMD(ivec4);"29052906"uint maxInvocationsExclusiveScanNonUniformAMD(uint);"2907"uvec2 maxInvocationsExclusiveScanNonUniformAMD(uvec2);"2908"uvec3 maxInvocationsExclusiveScanNonUniformAMD(uvec3);"2909"uvec4 maxInvocationsExclusiveScanNonUniformAMD(uvec4);"29102911"double maxInvocationsExclusiveScanNonUniformAMD(double);"2912"dvec2 maxInvocationsExclusiveScanNonUniformAMD(dvec2);"2913"dvec3 maxInvocationsExclusiveScanNonUniformAMD(dvec3);"2914"dvec4 maxInvocationsExclusiveScanNonUniformAMD(dvec4);"29152916"int64_t maxInvocationsExclusiveScanNonUniformAMD(int64_t);"2917"i64vec2 maxInvocationsExclusiveScanNonUniformAMD(i64vec2);"2918"i64vec3 maxInvocationsExclusiveScanNonUniformAMD(i64vec3);"2919"i64vec4 maxInvocationsExclusiveScanNonUniformAMD(i64vec4);"29202921"uint64_t maxInvocationsExclusiveScanNonUniformAMD(uint64_t);"2922"u64vec2 maxInvocationsExclusiveScanNonUniformAMD(u64vec2);"2923"u64vec3 maxInvocationsExclusiveScanNonUniformAMD(u64vec3);"2924"u64vec4 maxInvocationsExclusiveScanNonUniformAMD(u64vec4);"29252926"float16_t maxInvocationsExclusiveScanNonUniformAMD(float16_t);"2927"f16vec2 maxInvocationsExclusiveScanNonUniformAMD(f16vec2);"2928"f16vec3 maxInvocationsExclusiveScanNonUniformAMD(f16vec3);"2929"f16vec4 maxInvocationsExclusiveScanNonUniformAMD(f16vec4);"29302931"int16_t maxInvocationsExclusiveScanNonUniformAMD(int16_t);"2932"i16vec2 maxInvocationsExclusiveScanNonUniformAMD(i16vec2);"2933"i16vec3 maxInvocationsExclusiveScanNonUniformAMD(i16vec3);"2934"i16vec4 maxInvocationsExclusiveScanNonUniformAMD(i16vec4);"29352936"uint16_t maxInvocationsExclusiveScanNonUniformAMD(uint16_t);"2937"u16vec2 maxInvocationsExclusiveScanNonUniformAMD(u16vec2);"2938"u16vec3 maxInvocationsExclusiveScanNonUniformAMD(u16vec3);"2939"u16vec4 maxInvocationsExclusiveScanNonUniformAMD(u16vec4);"29402941"float addInvocationsNonUniformAMD(float);"2942"vec2 addInvocationsNonUniformAMD(vec2);"2943"vec3 addInvocationsNonUniformAMD(vec3);"2944"vec4 addInvocationsNonUniformAMD(vec4);"29452946"int addInvocationsNonUniformAMD(int);"2947"ivec2 addInvocationsNonUniformAMD(ivec2);"2948"ivec3 addInvocationsNonUniformAMD(ivec3);"2949"ivec4 addInvocationsNonUniformAMD(ivec4);"29502951"uint addInvocationsNonUniformAMD(uint);"2952"uvec2 addInvocationsNonUniformAMD(uvec2);"2953"uvec3 addInvocationsNonUniformAMD(uvec3);"2954"uvec4 addInvocationsNonUniformAMD(uvec4);"29552956"double addInvocationsNonUniformAMD(double);"2957"dvec2 addInvocationsNonUniformAMD(dvec2);"2958"dvec3 addInvocationsNonUniformAMD(dvec3);"2959"dvec4 addInvocationsNonUniformAMD(dvec4);"29602961"int64_t addInvocationsNonUniformAMD(int64_t);"2962"i64vec2 addInvocationsNonUniformAMD(i64vec2);"2963"i64vec3 addInvocationsNonUniformAMD(i64vec3);"2964"i64vec4 addInvocationsNonUniformAMD(i64vec4);"29652966"uint64_t addInvocationsNonUniformAMD(uint64_t);"2967"u64vec2 addInvocationsNonUniformAMD(u64vec2);"2968"u64vec3 addInvocationsNonUniformAMD(u64vec3);"2969"u64vec4 addInvocationsNonUniformAMD(u64vec4);"29702971"float16_t addInvocationsNonUniformAMD(float16_t);"2972"f16vec2 addInvocationsNonUniformAMD(f16vec2);"2973"f16vec3 addInvocationsNonUniformAMD(f16vec3);"2974"f16vec4 addInvocationsNonUniformAMD(f16vec4);"29752976"int16_t addInvocationsNonUniformAMD(int16_t);"2977"i16vec2 addInvocationsNonUniformAMD(i16vec2);"2978"i16vec3 addInvocationsNonUniformAMD(i16vec3);"2979"i16vec4 addInvocationsNonUniformAMD(i16vec4);"29802981"uint16_t addInvocationsNonUniformAMD(uint16_t);"2982"u16vec2 addInvocationsNonUniformAMD(u16vec2);"2983"u16vec3 addInvocationsNonUniformAMD(u16vec3);"2984"u16vec4 addInvocationsNonUniformAMD(u16vec4);"29852986"float addInvocationsInclusiveScanNonUniformAMD(float);"2987"vec2 addInvocationsInclusiveScanNonUniformAMD(vec2);"2988"vec3 addInvocationsInclusiveScanNonUniformAMD(vec3);"2989"vec4 addInvocationsInclusiveScanNonUniformAMD(vec4);"29902991"int addInvocationsInclusiveScanNonUniformAMD(int);"2992"ivec2 addInvocationsInclusiveScanNonUniformAMD(ivec2);"2993"ivec3 addInvocationsInclusiveScanNonUniformAMD(ivec3);"2994"ivec4 addInvocationsInclusiveScanNonUniformAMD(ivec4);"29952996"uint addInvocationsInclusiveScanNonUniformAMD(uint);"2997"uvec2 addInvocationsInclusiveScanNonUniformAMD(uvec2);"2998"uvec3 addInvocationsInclusiveScanNonUniformAMD(uvec3);"2999"uvec4 addInvocationsInclusiveScanNonUniformAMD(uvec4);"30003001"double addInvocationsInclusiveScanNonUniformAMD(double);"3002"dvec2 addInvocationsInclusiveScanNonUniformAMD(dvec2);"3003"dvec3 addInvocationsInclusiveScanNonUniformAMD(dvec3);"3004"dvec4 addInvocationsInclusiveScanNonUniformAMD(dvec4);"30053006"int64_t addInvocationsInclusiveScanNonUniformAMD(int64_t);"3007"i64vec2 addInvocationsInclusiveScanNonUniformAMD(i64vec2);"3008"i64vec3 addInvocationsInclusiveScanNonUniformAMD(i64vec3);"3009"i64vec4 addInvocationsInclusiveScanNonUniformAMD(i64vec4);"30103011"uint64_t addInvocationsInclusiveScanNonUniformAMD(uint64_t);"3012"u64vec2 addInvocationsInclusiveScanNonUniformAMD(u64vec2);"3013"u64vec3 addInvocationsInclusiveScanNonUniformAMD(u64vec3);"3014"u64vec4 addInvocationsInclusiveScanNonUniformAMD(u64vec4);"30153016"float16_t addInvocationsInclusiveScanNonUniformAMD(float16_t);"3017"f16vec2 addInvocationsInclusiveScanNonUniformAMD(f16vec2);"3018"f16vec3 addInvocationsInclusiveScanNonUniformAMD(f16vec3);"3019"f16vec4 addInvocationsInclusiveScanNonUniformAMD(f16vec4);"30203021"int16_t addInvocationsInclusiveScanNonUniformAMD(int16_t);"3022"i16vec2 addInvocationsInclusiveScanNonUniformAMD(i16vec2);"3023"i16vec3 addInvocationsInclusiveScanNonUniformAMD(i16vec3);"3024"i16vec4 addInvocationsInclusiveScanNonUniformAMD(i16vec4);"30253026"uint16_t addInvocationsInclusiveScanNonUniformAMD(uint16_t);"3027"u16vec2 addInvocationsInclusiveScanNonUniformAMD(u16vec2);"3028"u16vec3 addInvocationsInclusiveScanNonUniformAMD(u16vec3);"3029"u16vec4 addInvocationsInclusiveScanNonUniformAMD(u16vec4);"30303031"float addInvocationsExclusiveScanNonUniformAMD(float);"3032"vec2 addInvocationsExclusiveScanNonUniformAMD(vec2);"3033"vec3 addInvocationsExclusiveScanNonUniformAMD(vec3);"3034"vec4 addInvocationsExclusiveScanNonUniformAMD(vec4);"30353036"int addInvocationsExclusiveScanNonUniformAMD(int);"3037"ivec2 addInvocationsExclusiveScanNonUniformAMD(ivec2);"3038"ivec3 addInvocationsExclusiveScanNonUniformAMD(ivec3);"3039"ivec4 addInvocationsExclusiveScanNonUniformAMD(ivec4);"30403041"uint addInvocationsExclusiveScanNonUniformAMD(uint);"3042"uvec2 addInvocationsExclusiveScanNonUniformAMD(uvec2);"3043"uvec3 addInvocationsExclusiveScanNonUniformAMD(uvec3);"3044"uvec4 addInvocationsExclusiveScanNonUniformAMD(uvec4);"30453046"double addInvocationsExclusiveScanNonUniformAMD(double);"3047"dvec2 addInvocationsExclusiveScanNonUniformAMD(dvec2);"3048"dvec3 addInvocationsExclusiveScanNonUniformAMD(dvec3);"3049"dvec4 addInvocationsExclusiveScanNonUniformAMD(dvec4);"30503051"int64_t addInvocationsExclusiveScanNonUniformAMD(int64_t);"3052"i64vec2 addInvocationsExclusiveScanNonUniformAMD(i64vec2);"3053"i64vec3 addInvocationsExclusiveScanNonUniformAMD(i64vec3);"3054"i64vec4 addInvocationsExclusiveScanNonUniformAMD(i64vec4);"30553056"uint64_t addInvocationsExclusiveScanNonUniformAMD(uint64_t);"3057"u64vec2 addInvocationsExclusiveScanNonUniformAMD(u64vec2);"3058"u64vec3 addInvocationsExclusiveScanNonUniformAMD(u64vec3);"3059"u64vec4 addInvocationsExclusiveScanNonUniformAMD(u64vec4);"30603061"float16_t addInvocationsExclusiveScanNonUniformAMD(float16_t);"3062"f16vec2 addInvocationsExclusiveScanNonUniformAMD(f16vec2);"3063"f16vec3 addInvocationsExclusiveScanNonUniformAMD(f16vec3);"3064"f16vec4 addInvocationsExclusiveScanNonUniformAMD(f16vec4);"30653066"int16_t addInvocationsExclusiveScanNonUniformAMD(int16_t);"3067"i16vec2 addInvocationsExclusiveScanNonUniformAMD(i16vec2);"3068"i16vec3 addInvocationsExclusiveScanNonUniformAMD(i16vec3);"3069"i16vec4 addInvocationsExclusiveScanNonUniformAMD(i16vec4);"30703071"uint16_t addInvocationsExclusiveScanNonUniformAMD(uint16_t);"3072"u16vec2 addInvocationsExclusiveScanNonUniformAMD(u16vec2);"3073"u16vec3 addInvocationsExclusiveScanNonUniformAMD(u16vec3);"3074"u16vec4 addInvocationsExclusiveScanNonUniformAMD(u16vec4);"30753076"float swizzleInvocationsAMD(float, uvec4);"3077"vec2 swizzleInvocationsAMD(vec2, uvec4);"3078"vec3 swizzleInvocationsAMD(vec3, uvec4);"3079"vec4 swizzleInvocationsAMD(vec4, uvec4);"30803081"int swizzleInvocationsAMD(int, uvec4);"3082"ivec2 swizzleInvocationsAMD(ivec2, uvec4);"3083"ivec3 swizzleInvocationsAMD(ivec3, uvec4);"3084"ivec4 swizzleInvocationsAMD(ivec4, uvec4);"30853086"uint swizzleInvocationsAMD(uint, uvec4);"3087"uvec2 swizzleInvocationsAMD(uvec2, uvec4);"3088"uvec3 swizzleInvocationsAMD(uvec3, uvec4);"3089"uvec4 swizzleInvocationsAMD(uvec4, uvec4);"30903091"float swizzleInvocationsMaskedAMD(float, uvec3);"3092"vec2 swizzleInvocationsMaskedAMD(vec2, uvec3);"3093"vec3 swizzleInvocationsMaskedAMD(vec3, uvec3);"3094"vec4 swizzleInvocationsMaskedAMD(vec4, uvec3);"30953096"int swizzleInvocationsMaskedAMD(int, uvec3);"3097"ivec2 swizzleInvocationsMaskedAMD(ivec2, uvec3);"3098"ivec3 swizzleInvocationsMaskedAMD(ivec3, uvec3);"3099"ivec4 swizzleInvocationsMaskedAMD(ivec4, uvec3);"31003101"uint swizzleInvocationsMaskedAMD(uint, uvec3);"3102"uvec2 swizzleInvocationsMaskedAMD(uvec2, uvec3);"3103"uvec3 swizzleInvocationsMaskedAMD(uvec3, uvec3);"3104"uvec4 swizzleInvocationsMaskedAMD(uvec4, uvec3);"31053106"float writeInvocationAMD(float, float, uint);"3107"vec2 writeInvocationAMD(vec2, vec2, uint);"3108"vec3 writeInvocationAMD(vec3, vec3, uint);"3109"vec4 writeInvocationAMD(vec4, vec4, uint);"31103111"int writeInvocationAMD(int, int, uint);"3112"ivec2 writeInvocationAMD(ivec2, ivec2, uint);"3113"ivec3 writeInvocationAMD(ivec3, ivec3, uint);"3114"ivec4 writeInvocationAMD(ivec4, ivec4, uint);"31153116"uint writeInvocationAMD(uint, uint, uint);"3117"uvec2 writeInvocationAMD(uvec2, uvec2, uint);"3118"uvec3 writeInvocationAMD(uvec3, uvec3, uint);"3119"uvec4 writeInvocationAMD(uvec4, uvec4, uint);"31203121"uint mbcntAMD(uint64_t);"31223123"\n");3124}31253126// GL_AMD_gcn_shader3127if (profile != EEsProfile && version >= 440) {3128commonBuiltins.append(3129"float cubeFaceIndexAMD(vec3);"3130"vec2 cubeFaceCoordAMD(vec3);"3131"uint64_t timeAMD();"31323133"in int gl_SIMDGroupSizeAMD;"3134"\n");3135}31363137// GL_AMD_shader_fragment_mask3138if (profile != EEsProfile && version >= 450) {3139commonBuiltins.append(3140"uint fragmentMaskFetchAMD(sampler2DMS, ivec2);"3141"uint fragmentMaskFetchAMD(isampler2DMS, ivec2);"3142"uint fragmentMaskFetchAMD(usampler2DMS, ivec2);"31433144"uint fragmentMaskFetchAMD(sampler2DMSArray, ivec3);"3145"uint fragmentMaskFetchAMD(isampler2DMSArray, ivec3);"3146"uint fragmentMaskFetchAMD(usampler2DMSArray, ivec3);"31473148"vec4 fragmentFetchAMD(sampler2DMS, ivec2, uint);"3149"ivec4 fragmentFetchAMD(isampler2DMS, ivec2, uint);"3150"uvec4 fragmentFetchAMD(usampler2DMS, ivec2, uint);"31513152"vec4 fragmentFetchAMD(sampler2DMSArray, ivec3, uint);"3153"ivec4 fragmentFetchAMD(isampler2DMSArray, ivec3, uint);"3154"uvec4 fragmentFetchAMD(usampler2DMSArray, ivec3, uint);"31553156"\n");3157}31583159if ((profile != EEsProfile && version >= 130) ||3160(profile == EEsProfile && version >= 300)) {3161commonBuiltins.append(3162"uint countLeadingZeros(uint);"3163"uvec2 countLeadingZeros(uvec2);"3164"uvec3 countLeadingZeros(uvec3);"3165"uvec4 countLeadingZeros(uvec4);"31663167"uint countTrailingZeros(uint);"3168"uvec2 countTrailingZeros(uvec2);"3169"uvec3 countTrailingZeros(uvec3);"3170"uvec4 countTrailingZeros(uvec4);"31713172"uint absoluteDifference(int, int);"3173"uvec2 absoluteDifference(ivec2, ivec2);"3174"uvec3 absoluteDifference(ivec3, ivec3);"3175"uvec4 absoluteDifference(ivec4, ivec4);"31763177"uint16_t absoluteDifference(int16_t, int16_t);"3178"u16vec2 absoluteDifference(i16vec2, i16vec2);"3179"u16vec3 absoluteDifference(i16vec3, i16vec3);"3180"u16vec4 absoluteDifference(i16vec4, i16vec4);"31813182"uint64_t absoluteDifference(int64_t, int64_t);"3183"u64vec2 absoluteDifference(i64vec2, i64vec2);"3184"u64vec3 absoluteDifference(i64vec3, i64vec3);"3185"u64vec4 absoluteDifference(i64vec4, i64vec4);"31863187"uint absoluteDifference(uint, uint);"3188"uvec2 absoluteDifference(uvec2, uvec2);"3189"uvec3 absoluteDifference(uvec3, uvec3);"3190"uvec4 absoluteDifference(uvec4, uvec4);"31913192"uint16_t absoluteDifference(uint16_t, uint16_t);"3193"u16vec2 absoluteDifference(u16vec2, u16vec2);"3194"u16vec3 absoluteDifference(u16vec3, u16vec3);"3195"u16vec4 absoluteDifference(u16vec4, u16vec4);"31963197"uint64_t absoluteDifference(uint64_t, uint64_t);"3198"u64vec2 absoluteDifference(u64vec2, u64vec2);"3199"u64vec3 absoluteDifference(u64vec3, u64vec3);"3200"u64vec4 absoluteDifference(u64vec4, u64vec4);"32013202"int addSaturate(int, int);"3203"ivec2 addSaturate(ivec2, ivec2);"3204"ivec3 addSaturate(ivec3, ivec3);"3205"ivec4 addSaturate(ivec4, ivec4);"32063207"int16_t addSaturate(int16_t, int16_t);"3208"i16vec2 addSaturate(i16vec2, i16vec2);"3209"i16vec3 addSaturate(i16vec3, i16vec3);"3210"i16vec4 addSaturate(i16vec4, i16vec4);"32113212"int64_t addSaturate(int64_t, int64_t);"3213"i64vec2 addSaturate(i64vec2, i64vec2);"3214"i64vec3 addSaturate(i64vec3, i64vec3);"3215"i64vec4 addSaturate(i64vec4, i64vec4);"32163217"uint addSaturate(uint, uint);"3218"uvec2 addSaturate(uvec2, uvec2);"3219"uvec3 addSaturate(uvec3, uvec3);"3220"uvec4 addSaturate(uvec4, uvec4);"32213222"uint16_t addSaturate(uint16_t, uint16_t);"3223"u16vec2 addSaturate(u16vec2, u16vec2);"3224"u16vec3 addSaturate(u16vec3, u16vec3);"3225"u16vec4 addSaturate(u16vec4, u16vec4);"32263227"uint64_t addSaturate(uint64_t, uint64_t);"3228"u64vec2 addSaturate(u64vec2, u64vec2);"3229"u64vec3 addSaturate(u64vec3, u64vec3);"3230"u64vec4 addSaturate(u64vec4, u64vec4);"32313232"int subtractSaturate(int, int);"3233"ivec2 subtractSaturate(ivec2, ivec2);"3234"ivec3 subtractSaturate(ivec3, ivec3);"3235"ivec4 subtractSaturate(ivec4, ivec4);"32363237"int16_t subtractSaturate(int16_t, int16_t);"3238"i16vec2 subtractSaturate(i16vec2, i16vec2);"3239"i16vec3 subtractSaturate(i16vec3, i16vec3);"3240"i16vec4 subtractSaturate(i16vec4, i16vec4);"32413242"int64_t subtractSaturate(int64_t, int64_t);"3243"i64vec2 subtractSaturate(i64vec2, i64vec2);"3244"i64vec3 subtractSaturate(i64vec3, i64vec3);"3245"i64vec4 subtractSaturate(i64vec4, i64vec4);"32463247"uint subtractSaturate(uint, uint);"3248"uvec2 subtractSaturate(uvec2, uvec2);"3249"uvec3 subtractSaturate(uvec3, uvec3);"3250"uvec4 subtractSaturate(uvec4, uvec4);"32513252"uint16_t subtractSaturate(uint16_t, uint16_t);"3253"u16vec2 subtractSaturate(u16vec2, u16vec2);"3254"u16vec3 subtractSaturate(u16vec3, u16vec3);"3255"u16vec4 subtractSaturate(u16vec4, u16vec4);"32563257"uint64_t subtractSaturate(uint64_t, uint64_t);"3258"u64vec2 subtractSaturate(u64vec2, u64vec2);"3259"u64vec3 subtractSaturate(u64vec3, u64vec3);"3260"u64vec4 subtractSaturate(u64vec4, u64vec4);"32613262"int average(int, int);"3263"ivec2 average(ivec2, ivec2);"3264"ivec3 average(ivec3, ivec3);"3265"ivec4 average(ivec4, ivec4);"32663267"int16_t average(int16_t, int16_t);"3268"i16vec2 average(i16vec2, i16vec2);"3269"i16vec3 average(i16vec3, i16vec3);"3270"i16vec4 average(i16vec4, i16vec4);"32713272"int64_t average(int64_t, int64_t);"3273"i64vec2 average(i64vec2, i64vec2);"3274"i64vec3 average(i64vec3, i64vec3);"3275"i64vec4 average(i64vec4, i64vec4);"32763277"uint average(uint, uint);"3278"uvec2 average(uvec2, uvec2);"3279"uvec3 average(uvec3, uvec3);"3280"uvec4 average(uvec4, uvec4);"32813282"uint16_t average(uint16_t, uint16_t);"3283"u16vec2 average(u16vec2, u16vec2);"3284"u16vec3 average(u16vec3, u16vec3);"3285"u16vec4 average(u16vec4, u16vec4);"32863287"uint64_t average(uint64_t, uint64_t);"3288"u64vec2 average(u64vec2, u64vec2);"3289"u64vec3 average(u64vec3, u64vec3);"3290"u64vec4 average(u64vec4, u64vec4);"32913292"int averageRounded(int, int);"3293"ivec2 averageRounded(ivec2, ivec2);"3294"ivec3 averageRounded(ivec3, ivec3);"3295"ivec4 averageRounded(ivec4, ivec4);"32963297"int16_t averageRounded(int16_t, int16_t);"3298"i16vec2 averageRounded(i16vec2, i16vec2);"3299"i16vec3 averageRounded(i16vec3, i16vec3);"3300"i16vec4 averageRounded(i16vec4, i16vec4);"33013302"int64_t averageRounded(int64_t, int64_t);"3303"i64vec2 averageRounded(i64vec2, i64vec2);"3304"i64vec3 averageRounded(i64vec3, i64vec3);"3305"i64vec4 averageRounded(i64vec4, i64vec4);"33063307"uint averageRounded(uint, uint);"3308"uvec2 averageRounded(uvec2, uvec2);"3309"uvec3 averageRounded(uvec3, uvec3);"3310"uvec4 averageRounded(uvec4, uvec4);"33113312"uint16_t averageRounded(uint16_t, uint16_t);"3313"u16vec2 averageRounded(u16vec2, u16vec2);"3314"u16vec3 averageRounded(u16vec3, u16vec3);"3315"u16vec4 averageRounded(u16vec4, u16vec4);"33163317"uint64_t averageRounded(uint64_t, uint64_t);"3318"u64vec2 averageRounded(u64vec2, u64vec2);"3319"u64vec3 averageRounded(u64vec3, u64vec3);"3320"u64vec4 averageRounded(u64vec4, u64vec4);"33213322"int multiply32x16(int, int);"3323"ivec2 multiply32x16(ivec2, ivec2);"3324"ivec3 multiply32x16(ivec3, ivec3);"3325"ivec4 multiply32x16(ivec4, ivec4);"33263327"uint multiply32x16(uint, uint);"3328"uvec2 multiply32x16(uvec2, uvec2);"3329"uvec3 multiply32x16(uvec3, uvec3);"3330"uvec4 multiply32x16(uvec4, uvec4);"3331"\n");3332}33333334if ((profile != EEsProfile && version >= 450) ||3335(profile == EEsProfile && version >= 320)) {3336commonBuiltins.append(3337"struct gl_TextureFootprint2DNV {"3338"uvec2 anchor;"3339"uvec2 offset;"3340"uvec2 mask;"3341"uint lod;"3342"uint granularity;"3343"};"33443345"struct gl_TextureFootprint3DNV {"3346"uvec3 anchor;"3347"uvec3 offset;"3348"uvec2 mask;"3349"uint lod;"3350"uint granularity;"3351"};"3352"bool textureFootprintNV(sampler2D, vec2, int, bool, out gl_TextureFootprint2DNV);"3353"bool textureFootprintNV(sampler3D, vec3, int, bool, out gl_TextureFootprint3DNV);"3354"bool textureFootprintNV(sampler2D, vec2, int, bool, out gl_TextureFootprint2DNV, float);"3355"bool textureFootprintNV(sampler3D, vec3, int, bool, out gl_TextureFootprint3DNV, float);"3356"bool textureFootprintClampNV(sampler2D, vec2, float, int, bool, out gl_TextureFootprint2DNV);"3357"bool textureFootprintClampNV(sampler3D, vec3, float, int, bool, out gl_TextureFootprint3DNV);"3358"bool textureFootprintClampNV(sampler2D, vec2, float, int, bool, out gl_TextureFootprint2DNV, float);"3359"bool textureFootprintClampNV(sampler3D, vec3, float, int, bool, out gl_TextureFootprint3DNV, float);"3360"bool textureFootprintLodNV(sampler2D, vec2, float, int, bool, out gl_TextureFootprint2DNV);"3361"bool textureFootprintLodNV(sampler3D, vec3, float, int, bool, out gl_TextureFootprint3DNV);"3362"bool textureFootprintGradNV(sampler2D, vec2, vec2, vec2, int, bool, out gl_TextureFootprint2DNV);"3363"bool textureFootprintGradClampNV(sampler2D, vec2, vec2, vec2, float, int, bool, out gl_TextureFootprint2DNV);"3364"\n");3365}33663367if ((profile == EEsProfile && version >= 300 && version < 310) ||3368(profile != EEsProfile && version >= 150 && version < 450)) { // GL_EXT_shader_integer_mix3369commonBuiltins.append("int mix(int, int, bool);"3370"ivec2 mix(ivec2, ivec2, bvec2);"3371"ivec3 mix(ivec3, ivec3, bvec3);"3372"ivec4 mix(ivec4, ivec4, bvec4);"3373"uint mix(uint, uint, bool );"3374"uvec2 mix(uvec2, uvec2, bvec2);"3375"uvec3 mix(uvec3, uvec3, bvec3);"3376"uvec4 mix(uvec4, uvec4, bvec4);"3377"bool mix(bool, bool, bool );"3378"bvec2 mix(bvec2, bvec2, bvec2);"3379"bvec3 mix(bvec3, bvec3, bvec3);"3380"bvec4 mix(bvec4, bvec4, bvec4);"33813382"\n");3383}33843385// GL_AMD_gpu_shader_half_float/Explicit types3386if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 310)) {3387commonBuiltins.append(3388"float16_t radians(float16_t);"3389"f16vec2 radians(f16vec2);"3390"f16vec3 radians(f16vec3);"3391"f16vec4 radians(f16vec4);"33923393"float16_t degrees(float16_t);"3394"f16vec2 degrees(f16vec2);"3395"f16vec3 degrees(f16vec3);"3396"f16vec4 degrees(f16vec4);"33973398"float16_t sin(float16_t);"3399"f16vec2 sin(f16vec2);"3400"f16vec3 sin(f16vec3);"3401"f16vec4 sin(f16vec4);"34023403"float16_t cos(float16_t);"3404"f16vec2 cos(f16vec2);"3405"f16vec3 cos(f16vec3);"3406"f16vec4 cos(f16vec4);"34073408"float16_t tan(float16_t);"3409"f16vec2 tan(f16vec2);"3410"f16vec3 tan(f16vec3);"3411"f16vec4 tan(f16vec4);"34123413"float16_t asin(float16_t);"3414"f16vec2 asin(f16vec2);"3415"f16vec3 asin(f16vec3);"3416"f16vec4 asin(f16vec4);"34173418"float16_t acos(float16_t);"3419"f16vec2 acos(f16vec2);"3420"f16vec3 acos(f16vec3);"3421"f16vec4 acos(f16vec4);"34223423"float16_t atan(float16_t, float16_t);"3424"f16vec2 atan(f16vec2, f16vec2);"3425"f16vec3 atan(f16vec3, f16vec3);"3426"f16vec4 atan(f16vec4, f16vec4);"34273428"float16_t atan(float16_t);"3429"f16vec2 atan(f16vec2);"3430"f16vec3 atan(f16vec3);"3431"f16vec4 atan(f16vec4);"34323433"float16_t sinh(float16_t);"3434"f16vec2 sinh(f16vec2);"3435"f16vec3 sinh(f16vec3);"3436"f16vec4 sinh(f16vec4);"34373438"float16_t cosh(float16_t);"3439"f16vec2 cosh(f16vec2);"3440"f16vec3 cosh(f16vec3);"3441"f16vec4 cosh(f16vec4);"34423443"float16_t tanh(float16_t);"3444"f16vec2 tanh(f16vec2);"3445"f16vec3 tanh(f16vec3);"3446"f16vec4 tanh(f16vec4);"34473448"float16_t asinh(float16_t);"3449"f16vec2 asinh(f16vec2);"3450"f16vec3 asinh(f16vec3);"3451"f16vec4 asinh(f16vec4);"34523453"float16_t acosh(float16_t);"3454"f16vec2 acosh(f16vec2);"3455"f16vec3 acosh(f16vec3);"3456"f16vec4 acosh(f16vec4);"34573458"float16_t atanh(float16_t);"3459"f16vec2 atanh(f16vec2);"3460"f16vec3 atanh(f16vec3);"3461"f16vec4 atanh(f16vec4);"34623463"float16_t pow(float16_t, float16_t);"3464"f16vec2 pow(f16vec2, f16vec2);"3465"f16vec3 pow(f16vec3, f16vec3);"3466"f16vec4 pow(f16vec4, f16vec4);"34673468"float16_t exp(float16_t);"3469"f16vec2 exp(f16vec2);"3470"f16vec3 exp(f16vec3);"3471"f16vec4 exp(f16vec4);"34723473"float16_t log(float16_t);"3474"f16vec2 log(f16vec2);"3475"f16vec3 log(f16vec3);"3476"f16vec4 log(f16vec4);"34773478"float16_t exp2(float16_t);"3479"f16vec2 exp2(f16vec2);"3480"f16vec3 exp2(f16vec3);"3481"f16vec4 exp2(f16vec4);"34823483"float16_t log2(float16_t);"3484"f16vec2 log2(f16vec2);"3485"f16vec3 log2(f16vec3);"3486"f16vec4 log2(f16vec4);"34873488"float16_t sqrt(float16_t);"3489"f16vec2 sqrt(f16vec2);"3490"f16vec3 sqrt(f16vec3);"3491"f16vec4 sqrt(f16vec4);"34923493"float16_t inversesqrt(float16_t);"3494"f16vec2 inversesqrt(f16vec2);"3495"f16vec3 inversesqrt(f16vec3);"3496"f16vec4 inversesqrt(f16vec4);"34973498"float16_t abs(float16_t);"3499"f16vec2 abs(f16vec2);"3500"f16vec3 abs(f16vec3);"3501"f16vec4 abs(f16vec4);"35023503"float16_t sign(float16_t);"3504"f16vec2 sign(f16vec2);"3505"f16vec3 sign(f16vec3);"3506"f16vec4 sign(f16vec4);"35073508"float16_t floor(float16_t);"3509"f16vec2 floor(f16vec2);"3510"f16vec3 floor(f16vec3);"3511"f16vec4 floor(f16vec4);"35123513"float16_t trunc(float16_t);"3514"f16vec2 trunc(f16vec2);"3515"f16vec3 trunc(f16vec3);"3516"f16vec4 trunc(f16vec4);"35173518"float16_t round(float16_t);"3519"f16vec2 round(f16vec2);"3520"f16vec3 round(f16vec3);"3521"f16vec4 round(f16vec4);"35223523"float16_t roundEven(float16_t);"3524"f16vec2 roundEven(f16vec2);"3525"f16vec3 roundEven(f16vec3);"3526"f16vec4 roundEven(f16vec4);"35273528"float16_t ceil(float16_t);"3529"f16vec2 ceil(f16vec2);"3530"f16vec3 ceil(f16vec3);"3531"f16vec4 ceil(f16vec4);"35323533"float16_t fract(float16_t);"3534"f16vec2 fract(f16vec2);"3535"f16vec3 fract(f16vec3);"3536"f16vec4 fract(f16vec4);"35373538"float16_t mod(float16_t, float16_t);"3539"f16vec2 mod(f16vec2, float16_t);"3540"f16vec3 mod(f16vec3, float16_t);"3541"f16vec4 mod(f16vec4, float16_t);"3542"f16vec2 mod(f16vec2, f16vec2);"3543"f16vec3 mod(f16vec3, f16vec3);"3544"f16vec4 mod(f16vec4, f16vec4);"35453546"float16_t modf(float16_t, out float16_t);"3547"f16vec2 modf(f16vec2, out f16vec2);"3548"f16vec3 modf(f16vec3, out f16vec3);"3549"f16vec4 modf(f16vec4, out f16vec4);"35503551"float16_t min(float16_t, float16_t);"3552"f16vec2 min(f16vec2, float16_t);"3553"f16vec3 min(f16vec3, float16_t);"3554"f16vec4 min(f16vec4, float16_t);"3555"f16vec2 min(f16vec2, f16vec2);"3556"f16vec3 min(f16vec3, f16vec3);"3557"f16vec4 min(f16vec4, f16vec4);"35583559"float16_t max(float16_t, float16_t);"3560"f16vec2 max(f16vec2, float16_t);"3561"f16vec3 max(f16vec3, float16_t);"3562"f16vec4 max(f16vec4, float16_t);"3563"f16vec2 max(f16vec2, f16vec2);"3564"f16vec3 max(f16vec3, f16vec3);"3565"f16vec4 max(f16vec4, f16vec4);"35663567"float16_t clamp(float16_t, float16_t, float16_t);"3568"f16vec2 clamp(f16vec2, float16_t, float16_t);"3569"f16vec3 clamp(f16vec3, float16_t, float16_t);"3570"f16vec4 clamp(f16vec4, float16_t, float16_t);"3571"f16vec2 clamp(f16vec2, f16vec2, f16vec2);"3572"f16vec3 clamp(f16vec3, f16vec3, f16vec3);"3573"f16vec4 clamp(f16vec4, f16vec4, f16vec4);"35743575"float16_t mix(float16_t, float16_t, float16_t);"3576"f16vec2 mix(f16vec2, f16vec2, float16_t);"3577"f16vec3 mix(f16vec3, f16vec3, float16_t);"3578"f16vec4 mix(f16vec4, f16vec4, float16_t);"3579"f16vec2 mix(f16vec2, f16vec2, f16vec2);"3580"f16vec3 mix(f16vec3, f16vec3, f16vec3);"3581"f16vec4 mix(f16vec4, f16vec4, f16vec4);"3582"float16_t mix(float16_t, float16_t, bool);"3583"f16vec2 mix(f16vec2, f16vec2, bvec2);"3584"f16vec3 mix(f16vec3, f16vec3, bvec3);"3585"f16vec4 mix(f16vec4, f16vec4, bvec4);"35863587"float16_t step(float16_t, float16_t);"3588"f16vec2 step(f16vec2, f16vec2);"3589"f16vec3 step(f16vec3, f16vec3);"3590"f16vec4 step(f16vec4, f16vec4);"3591"f16vec2 step(float16_t, f16vec2);"3592"f16vec3 step(float16_t, f16vec3);"3593"f16vec4 step(float16_t, f16vec4);"35943595"float16_t smoothstep(float16_t, float16_t, float16_t);"3596"f16vec2 smoothstep(f16vec2, f16vec2, f16vec2);"3597"f16vec3 smoothstep(f16vec3, f16vec3, f16vec3);"3598"f16vec4 smoothstep(f16vec4, f16vec4, f16vec4);"3599"f16vec2 smoothstep(float16_t, float16_t, f16vec2);"3600"f16vec3 smoothstep(float16_t, float16_t, f16vec3);"3601"f16vec4 smoothstep(float16_t, float16_t, f16vec4);"36023603"bool isnan(float16_t);"3604"bvec2 isnan(f16vec2);"3605"bvec3 isnan(f16vec3);"3606"bvec4 isnan(f16vec4);"36073608"bool isinf(float16_t);"3609"bvec2 isinf(f16vec2);"3610"bvec3 isinf(f16vec3);"3611"bvec4 isinf(f16vec4);"36123613"float16_t fma(float16_t, float16_t, float16_t);"3614"f16vec2 fma(f16vec2, f16vec2, f16vec2);"3615"f16vec3 fma(f16vec3, f16vec3, f16vec3);"3616"f16vec4 fma(f16vec4, f16vec4, f16vec4);"36173618"float16_t frexp(float16_t, out int);"3619"f16vec2 frexp(f16vec2, out ivec2);"3620"f16vec3 frexp(f16vec3, out ivec3);"3621"f16vec4 frexp(f16vec4, out ivec4);"36223623"float16_t ldexp(float16_t, in int);"3624"f16vec2 ldexp(f16vec2, in ivec2);"3625"f16vec3 ldexp(f16vec3, in ivec3);"3626"f16vec4 ldexp(f16vec4, in ivec4);"36273628"uint packFloat2x16(f16vec2);"3629"f16vec2 unpackFloat2x16(uint);"36303631"float16_t length(float16_t);"3632"float16_t length(f16vec2);"3633"float16_t length(f16vec3);"3634"float16_t length(f16vec4);"36353636"float16_t distance(float16_t, float16_t);"3637"float16_t distance(f16vec2, f16vec2);"3638"float16_t distance(f16vec3, f16vec3);"3639"float16_t distance(f16vec4, f16vec4);"36403641"float16_t dot(float16_t, float16_t);"3642"float16_t dot(f16vec2, f16vec2);"3643"float16_t dot(f16vec3, f16vec3);"3644"float16_t dot(f16vec4, f16vec4);"36453646"f16vec3 cross(f16vec3, f16vec3);"36473648"float16_t normalize(float16_t);"3649"f16vec2 normalize(f16vec2);"3650"f16vec3 normalize(f16vec3);"3651"f16vec4 normalize(f16vec4);"36523653"float16_t faceforward(float16_t, float16_t, float16_t);"3654"f16vec2 faceforward(f16vec2, f16vec2, f16vec2);"3655"f16vec3 faceforward(f16vec3, f16vec3, f16vec3);"3656"f16vec4 faceforward(f16vec4, f16vec4, f16vec4);"36573658"float16_t reflect(float16_t, float16_t);"3659"f16vec2 reflect(f16vec2, f16vec2);"3660"f16vec3 reflect(f16vec3, f16vec3);"3661"f16vec4 reflect(f16vec4, f16vec4);"36623663"float16_t refract(float16_t, float16_t, float16_t);"3664"f16vec2 refract(f16vec2, f16vec2, float16_t);"3665"f16vec3 refract(f16vec3, f16vec3, float16_t);"3666"f16vec4 refract(f16vec4, f16vec4, float16_t);"36673668"f16mat2 matrixCompMult(f16mat2, f16mat2);"3669"f16mat3 matrixCompMult(f16mat3, f16mat3);"3670"f16mat4 matrixCompMult(f16mat4, f16mat4);"3671"f16mat2x3 matrixCompMult(f16mat2x3, f16mat2x3);"3672"f16mat2x4 matrixCompMult(f16mat2x4, f16mat2x4);"3673"f16mat3x2 matrixCompMult(f16mat3x2, f16mat3x2);"3674"f16mat3x4 matrixCompMult(f16mat3x4, f16mat3x4);"3675"f16mat4x2 matrixCompMult(f16mat4x2, f16mat4x2);"3676"f16mat4x3 matrixCompMult(f16mat4x3, f16mat4x3);"36773678"f16mat2 outerProduct(f16vec2, f16vec2);"3679"f16mat3 outerProduct(f16vec3, f16vec3);"3680"f16mat4 outerProduct(f16vec4, f16vec4);"3681"f16mat2x3 outerProduct(f16vec3, f16vec2);"3682"f16mat3x2 outerProduct(f16vec2, f16vec3);"3683"f16mat2x4 outerProduct(f16vec4, f16vec2);"3684"f16mat4x2 outerProduct(f16vec2, f16vec4);"3685"f16mat3x4 outerProduct(f16vec4, f16vec3);"3686"f16mat4x3 outerProduct(f16vec3, f16vec4);"36873688"f16mat2 transpose(f16mat2);"3689"f16mat3 transpose(f16mat3);"3690"f16mat4 transpose(f16mat4);"3691"f16mat2x3 transpose(f16mat3x2);"3692"f16mat3x2 transpose(f16mat2x3);"3693"f16mat2x4 transpose(f16mat4x2);"3694"f16mat4x2 transpose(f16mat2x4);"3695"f16mat3x4 transpose(f16mat4x3);"3696"f16mat4x3 transpose(f16mat3x4);"36973698"float16_t determinant(f16mat2);"3699"float16_t determinant(f16mat3);"3700"float16_t determinant(f16mat4);"37013702"f16mat2 inverse(f16mat2);"3703"f16mat3 inverse(f16mat3);"3704"f16mat4 inverse(f16mat4);"37053706"bvec2 lessThan(f16vec2, f16vec2);"3707"bvec3 lessThan(f16vec3, f16vec3);"3708"bvec4 lessThan(f16vec4, f16vec4);"37093710"bvec2 lessThanEqual(f16vec2, f16vec2);"3711"bvec3 lessThanEqual(f16vec3, f16vec3);"3712"bvec4 lessThanEqual(f16vec4, f16vec4);"37133714"bvec2 greaterThan(f16vec2, f16vec2);"3715"bvec3 greaterThan(f16vec3, f16vec3);"3716"bvec4 greaterThan(f16vec4, f16vec4);"37173718"bvec2 greaterThanEqual(f16vec2, f16vec2);"3719"bvec3 greaterThanEqual(f16vec3, f16vec3);"3720"bvec4 greaterThanEqual(f16vec4, f16vec4);"37213722"bvec2 equal(f16vec2, f16vec2);"3723"bvec3 equal(f16vec3, f16vec3);"3724"bvec4 equal(f16vec4, f16vec4);"37253726"bvec2 notEqual(f16vec2, f16vec2);"3727"bvec3 notEqual(f16vec3, f16vec3);"3728"bvec4 notEqual(f16vec4, f16vec4);"37293730"\n");3731}37323733// Explicit types3734if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 310)) {3735commonBuiltins.append(3736"int8_t abs(int8_t);"3737"i8vec2 abs(i8vec2);"3738"i8vec3 abs(i8vec3);"3739"i8vec4 abs(i8vec4);"37403741"int8_t sign(int8_t);"3742"i8vec2 sign(i8vec2);"3743"i8vec3 sign(i8vec3);"3744"i8vec4 sign(i8vec4);"37453746"int8_t min(int8_t x, int8_t y);"3747"i8vec2 min(i8vec2 x, int8_t y);"3748"i8vec3 min(i8vec3 x, int8_t y);"3749"i8vec4 min(i8vec4 x, int8_t y);"3750"i8vec2 min(i8vec2 x, i8vec2 y);"3751"i8vec3 min(i8vec3 x, i8vec3 y);"3752"i8vec4 min(i8vec4 x, i8vec4 y);"37533754"uint8_t min(uint8_t x, uint8_t y);"3755"u8vec2 min(u8vec2 x, uint8_t y);"3756"u8vec3 min(u8vec3 x, uint8_t y);"3757"u8vec4 min(u8vec4 x, uint8_t y);"3758"u8vec2 min(u8vec2 x, u8vec2 y);"3759"u8vec3 min(u8vec3 x, u8vec3 y);"3760"u8vec4 min(u8vec4 x, u8vec4 y);"37613762"int8_t max(int8_t x, int8_t y);"3763"i8vec2 max(i8vec2 x, int8_t y);"3764"i8vec3 max(i8vec3 x, int8_t y);"3765"i8vec4 max(i8vec4 x, int8_t y);"3766"i8vec2 max(i8vec2 x, i8vec2 y);"3767"i8vec3 max(i8vec3 x, i8vec3 y);"3768"i8vec4 max(i8vec4 x, i8vec4 y);"37693770"uint8_t max(uint8_t x, uint8_t y);"3771"u8vec2 max(u8vec2 x, uint8_t y);"3772"u8vec3 max(u8vec3 x, uint8_t y);"3773"u8vec4 max(u8vec4 x, uint8_t y);"3774"u8vec2 max(u8vec2 x, u8vec2 y);"3775"u8vec3 max(u8vec3 x, u8vec3 y);"3776"u8vec4 max(u8vec4 x, u8vec4 y);"37773778"int8_t clamp(int8_t x, int8_t minVal, int8_t maxVal);"3779"i8vec2 clamp(i8vec2 x, int8_t minVal, int8_t maxVal);"3780"i8vec3 clamp(i8vec3 x, int8_t minVal, int8_t maxVal);"3781"i8vec4 clamp(i8vec4 x, int8_t minVal, int8_t maxVal);"3782"i8vec2 clamp(i8vec2 x, i8vec2 minVal, i8vec2 maxVal);"3783"i8vec3 clamp(i8vec3 x, i8vec3 minVal, i8vec3 maxVal);"3784"i8vec4 clamp(i8vec4 x, i8vec4 minVal, i8vec4 maxVal);"37853786"uint8_t clamp(uint8_t x, uint8_t minVal, uint8_t maxVal);"3787"u8vec2 clamp(u8vec2 x, uint8_t minVal, uint8_t maxVal);"3788"u8vec3 clamp(u8vec3 x, uint8_t minVal, uint8_t maxVal);"3789"u8vec4 clamp(u8vec4 x, uint8_t minVal, uint8_t maxVal);"3790"u8vec2 clamp(u8vec2 x, u8vec2 minVal, u8vec2 maxVal);"3791"u8vec3 clamp(u8vec3 x, u8vec3 minVal, u8vec3 maxVal);"3792"u8vec4 clamp(u8vec4 x, u8vec4 minVal, u8vec4 maxVal);"37933794"int8_t mix(int8_t, int8_t, bool);"3795"i8vec2 mix(i8vec2, i8vec2, bvec2);"3796"i8vec3 mix(i8vec3, i8vec3, bvec3);"3797"i8vec4 mix(i8vec4, i8vec4, bvec4);"3798"uint8_t mix(uint8_t, uint8_t, bool);"3799"u8vec2 mix(u8vec2, u8vec2, bvec2);"3800"u8vec3 mix(u8vec3, u8vec3, bvec3);"3801"u8vec4 mix(u8vec4, u8vec4, bvec4);"38023803"bvec2 lessThan(i8vec2, i8vec2);"3804"bvec3 lessThan(i8vec3, i8vec3);"3805"bvec4 lessThan(i8vec4, i8vec4);"3806"bvec2 lessThan(u8vec2, u8vec2);"3807"bvec3 lessThan(u8vec3, u8vec3);"3808"bvec4 lessThan(u8vec4, u8vec4);"38093810"bvec2 lessThanEqual(i8vec2, i8vec2);"3811"bvec3 lessThanEqual(i8vec3, i8vec3);"3812"bvec4 lessThanEqual(i8vec4, i8vec4);"3813"bvec2 lessThanEqual(u8vec2, u8vec2);"3814"bvec3 lessThanEqual(u8vec3, u8vec3);"3815"bvec4 lessThanEqual(u8vec4, u8vec4);"38163817"bvec2 greaterThan(i8vec2, i8vec2);"3818"bvec3 greaterThan(i8vec3, i8vec3);"3819"bvec4 greaterThan(i8vec4, i8vec4);"3820"bvec2 greaterThan(u8vec2, u8vec2);"3821"bvec3 greaterThan(u8vec3, u8vec3);"3822"bvec4 greaterThan(u8vec4, u8vec4);"38233824"bvec2 greaterThanEqual(i8vec2, i8vec2);"3825"bvec3 greaterThanEqual(i8vec3, i8vec3);"3826"bvec4 greaterThanEqual(i8vec4, i8vec4);"3827"bvec2 greaterThanEqual(u8vec2, u8vec2);"3828"bvec3 greaterThanEqual(u8vec3, u8vec3);"3829"bvec4 greaterThanEqual(u8vec4, u8vec4);"38303831"bvec2 equal(i8vec2, i8vec2);"3832"bvec3 equal(i8vec3, i8vec3);"3833"bvec4 equal(i8vec4, i8vec4);"3834"bvec2 equal(u8vec2, u8vec2);"3835"bvec3 equal(u8vec3, u8vec3);"3836"bvec4 equal(u8vec4, u8vec4);"38373838"bvec2 notEqual(i8vec2, i8vec2);"3839"bvec3 notEqual(i8vec3, i8vec3);"3840"bvec4 notEqual(i8vec4, i8vec4);"3841"bvec2 notEqual(u8vec2, u8vec2);"3842"bvec3 notEqual(u8vec3, u8vec3);"3843"bvec4 notEqual(u8vec4, u8vec4);"38443845" int8_t bitfieldExtract( int8_t, int8_t, int8_t);"3846"i8vec2 bitfieldExtract(i8vec2, int8_t, int8_t);"3847"i8vec3 bitfieldExtract(i8vec3, int8_t, int8_t);"3848"i8vec4 bitfieldExtract(i8vec4, int8_t, int8_t);"38493850" uint8_t bitfieldExtract( uint8_t, int8_t, int8_t);"3851"u8vec2 bitfieldExtract(u8vec2, int8_t, int8_t);"3852"u8vec3 bitfieldExtract(u8vec3, int8_t, int8_t);"3853"u8vec4 bitfieldExtract(u8vec4, int8_t, int8_t);"38543855" int8_t bitfieldInsert( int8_t base, int8_t, int8_t, int8_t);"3856"i8vec2 bitfieldInsert(i8vec2 base, i8vec2, int8_t, int8_t);"3857"i8vec3 bitfieldInsert(i8vec3 base, i8vec3, int8_t, int8_t);"3858"i8vec4 bitfieldInsert(i8vec4 base, i8vec4, int8_t, int8_t);"38593860" uint8_t bitfieldInsert( uint8_t base, uint8_t, int8_t, int8_t);"3861"u8vec2 bitfieldInsert(u8vec2 base, u8vec2, int8_t, int8_t);"3862"u8vec3 bitfieldInsert(u8vec3 base, u8vec3, int8_t, int8_t);"3863"u8vec4 bitfieldInsert(u8vec4 base, u8vec4, int8_t, int8_t);"38643865" int8_t bitCount( int8_t);"3866"i8vec2 bitCount(i8vec2);"3867"i8vec3 bitCount(i8vec3);"3868"i8vec4 bitCount(i8vec4);"38693870" int8_t bitCount( uint8_t);"3871"i8vec2 bitCount(u8vec2);"3872"i8vec3 bitCount(u8vec3);"3873"i8vec4 bitCount(u8vec4);"38743875" int8_t findLSB( int8_t);"3876"i8vec2 findLSB(i8vec2);"3877"i8vec3 findLSB(i8vec3);"3878"i8vec4 findLSB(i8vec4);"38793880" int8_t findLSB( uint8_t);"3881"i8vec2 findLSB(u8vec2);"3882"i8vec3 findLSB(u8vec3);"3883"i8vec4 findLSB(u8vec4);"38843885" int8_t findMSB( int8_t);"3886"i8vec2 findMSB(i8vec2);"3887"i8vec3 findMSB(i8vec3);"3888"i8vec4 findMSB(i8vec4);"38893890" int8_t findMSB( uint8_t);"3891"i8vec2 findMSB(u8vec2);"3892"i8vec3 findMSB(u8vec3);"3893"i8vec4 findMSB(u8vec4);"38943895"int16_t abs(int16_t);"3896"i16vec2 abs(i16vec2);"3897"i16vec3 abs(i16vec3);"3898"i16vec4 abs(i16vec4);"38993900"int16_t sign(int16_t);"3901"i16vec2 sign(i16vec2);"3902"i16vec3 sign(i16vec3);"3903"i16vec4 sign(i16vec4);"39043905"int16_t min(int16_t x, int16_t y);"3906"i16vec2 min(i16vec2 x, int16_t y);"3907"i16vec3 min(i16vec3 x, int16_t y);"3908"i16vec4 min(i16vec4 x, int16_t y);"3909"i16vec2 min(i16vec2 x, i16vec2 y);"3910"i16vec3 min(i16vec3 x, i16vec3 y);"3911"i16vec4 min(i16vec4 x, i16vec4 y);"39123913"uint16_t min(uint16_t x, uint16_t y);"3914"u16vec2 min(u16vec2 x, uint16_t y);"3915"u16vec3 min(u16vec3 x, uint16_t y);"3916"u16vec4 min(u16vec4 x, uint16_t y);"3917"u16vec2 min(u16vec2 x, u16vec2 y);"3918"u16vec3 min(u16vec3 x, u16vec3 y);"3919"u16vec4 min(u16vec4 x, u16vec4 y);"39203921"int16_t max(int16_t x, int16_t y);"3922"i16vec2 max(i16vec2 x, int16_t y);"3923"i16vec3 max(i16vec3 x, int16_t y);"3924"i16vec4 max(i16vec4 x, int16_t y);"3925"i16vec2 max(i16vec2 x, i16vec2 y);"3926"i16vec3 max(i16vec3 x, i16vec3 y);"3927"i16vec4 max(i16vec4 x, i16vec4 y);"39283929"uint16_t max(uint16_t x, uint16_t y);"3930"u16vec2 max(u16vec2 x, uint16_t y);"3931"u16vec3 max(u16vec3 x, uint16_t y);"3932"u16vec4 max(u16vec4 x, uint16_t y);"3933"u16vec2 max(u16vec2 x, u16vec2 y);"3934"u16vec3 max(u16vec3 x, u16vec3 y);"3935"u16vec4 max(u16vec4 x, u16vec4 y);"39363937"int16_t clamp(int16_t x, int16_t minVal, int16_t maxVal);"3938"i16vec2 clamp(i16vec2 x, int16_t minVal, int16_t maxVal);"3939"i16vec3 clamp(i16vec3 x, int16_t minVal, int16_t maxVal);"3940"i16vec4 clamp(i16vec4 x, int16_t minVal, int16_t maxVal);"3941"i16vec2 clamp(i16vec2 x, i16vec2 minVal, i16vec2 maxVal);"3942"i16vec3 clamp(i16vec3 x, i16vec3 minVal, i16vec3 maxVal);"3943"i16vec4 clamp(i16vec4 x, i16vec4 minVal, i16vec4 maxVal);"39443945"uint16_t clamp(uint16_t x, uint16_t minVal, uint16_t maxVal);"3946"u16vec2 clamp(u16vec2 x, uint16_t minVal, uint16_t maxVal);"3947"u16vec3 clamp(u16vec3 x, uint16_t minVal, uint16_t maxVal);"3948"u16vec4 clamp(u16vec4 x, uint16_t minVal, uint16_t maxVal);"3949"u16vec2 clamp(u16vec2 x, u16vec2 minVal, u16vec2 maxVal);"3950"u16vec3 clamp(u16vec3 x, u16vec3 minVal, u16vec3 maxVal);"3951"u16vec4 clamp(u16vec4 x, u16vec4 minVal, u16vec4 maxVal);"39523953"int16_t mix(int16_t, int16_t, bool);"3954"i16vec2 mix(i16vec2, i16vec2, bvec2);"3955"i16vec3 mix(i16vec3, i16vec3, bvec3);"3956"i16vec4 mix(i16vec4, i16vec4, bvec4);"3957"uint16_t mix(uint16_t, uint16_t, bool);"3958"u16vec2 mix(u16vec2, u16vec2, bvec2);"3959"u16vec3 mix(u16vec3, u16vec3, bvec3);"3960"u16vec4 mix(u16vec4, u16vec4, bvec4);"39613962"float16_t frexp(float16_t, out int16_t);"3963"f16vec2 frexp(f16vec2, out i16vec2);"3964"f16vec3 frexp(f16vec3, out i16vec3);"3965"f16vec4 frexp(f16vec4, out i16vec4);"39663967"float16_t ldexp(float16_t, int16_t);"3968"f16vec2 ldexp(f16vec2, i16vec2);"3969"f16vec3 ldexp(f16vec3, i16vec3);"3970"f16vec4 ldexp(f16vec4, i16vec4);"39713972"int16_t halfBitsToInt16(float16_t);"3973"i16vec2 halfBitsToInt16(f16vec2);"3974"i16vec3 halhBitsToInt16(f16vec3);"3975"i16vec4 halfBitsToInt16(f16vec4);"39763977"uint16_t halfBitsToUint16(float16_t);"3978"u16vec2 halfBitsToUint16(f16vec2);"3979"u16vec3 halfBitsToUint16(f16vec3);"3980"u16vec4 halfBitsToUint16(f16vec4);"39813982"int16_t float16BitsToInt16(float16_t);"3983"i16vec2 float16BitsToInt16(f16vec2);"3984"i16vec3 float16BitsToInt16(f16vec3);"3985"i16vec4 float16BitsToInt16(f16vec4);"39863987"uint16_t float16BitsToUint16(float16_t);"3988"u16vec2 float16BitsToUint16(f16vec2);"3989"u16vec3 float16BitsToUint16(f16vec3);"3990"u16vec4 float16BitsToUint16(f16vec4);"39913992"float16_t int16BitsToFloat16(int16_t);"3993"f16vec2 int16BitsToFloat16(i16vec2);"3994"f16vec3 int16BitsToFloat16(i16vec3);"3995"f16vec4 int16BitsToFloat16(i16vec4);"39963997"float16_t uint16BitsToFloat16(uint16_t);"3998"f16vec2 uint16BitsToFloat16(u16vec2);"3999"f16vec3 uint16BitsToFloat16(u16vec3);"4000"f16vec4 uint16BitsToFloat16(u16vec4);"40014002"float16_t int16BitsToHalf(int16_t);"4003"f16vec2 int16BitsToHalf(i16vec2);"4004"f16vec3 int16BitsToHalf(i16vec3);"4005"f16vec4 int16BitsToHalf(i16vec4);"40064007"float16_t uint16BitsToHalf(uint16_t);"4008"f16vec2 uint16BitsToHalf(u16vec2);"4009"f16vec3 uint16BitsToHalf(u16vec3);"4010"f16vec4 uint16BitsToHalf(u16vec4);"40114012"int packInt2x16(i16vec2);"4013"uint packUint2x16(u16vec2);"4014"int64_t packInt4x16(i16vec4);"4015"uint64_t packUint4x16(u16vec4);"4016"i16vec2 unpackInt2x16(int);"4017"u16vec2 unpackUint2x16(uint);"4018"i16vec4 unpackInt4x16(int64_t);"4019"u16vec4 unpackUint4x16(uint64_t);"40204021"bvec2 lessThan(i16vec2, i16vec2);"4022"bvec3 lessThan(i16vec3, i16vec3);"4023"bvec4 lessThan(i16vec4, i16vec4);"4024"bvec2 lessThan(u16vec2, u16vec2);"4025"bvec3 lessThan(u16vec3, u16vec3);"4026"bvec4 lessThan(u16vec4, u16vec4);"40274028"bvec2 lessThanEqual(i16vec2, i16vec2);"4029"bvec3 lessThanEqual(i16vec3, i16vec3);"4030"bvec4 lessThanEqual(i16vec4, i16vec4);"4031"bvec2 lessThanEqual(u16vec2, u16vec2);"4032"bvec3 lessThanEqual(u16vec3, u16vec3);"4033"bvec4 lessThanEqual(u16vec4, u16vec4);"40344035"bvec2 greaterThan(i16vec2, i16vec2);"4036"bvec3 greaterThan(i16vec3, i16vec3);"4037"bvec4 greaterThan(i16vec4, i16vec4);"4038"bvec2 greaterThan(u16vec2, u16vec2);"4039"bvec3 greaterThan(u16vec3, u16vec3);"4040"bvec4 greaterThan(u16vec4, u16vec4);"40414042"bvec2 greaterThanEqual(i16vec2, i16vec2);"4043"bvec3 greaterThanEqual(i16vec3, i16vec3);"4044"bvec4 greaterThanEqual(i16vec4, i16vec4);"4045"bvec2 greaterThanEqual(u16vec2, u16vec2);"4046"bvec3 greaterThanEqual(u16vec3, u16vec3);"4047"bvec4 greaterThanEqual(u16vec4, u16vec4);"40484049"bvec2 equal(i16vec2, i16vec2);"4050"bvec3 equal(i16vec3, i16vec3);"4051"bvec4 equal(i16vec4, i16vec4);"4052"bvec2 equal(u16vec2, u16vec2);"4053"bvec3 equal(u16vec3, u16vec3);"4054"bvec4 equal(u16vec4, u16vec4);"40554056"bvec2 notEqual(i16vec2, i16vec2);"4057"bvec3 notEqual(i16vec3, i16vec3);"4058"bvec4 notEqual(i16vec4, i16vec4);"4059"bvec2 notEqual(u16vec2, u16vec2);"4060"bvec3 notEqual(u16vec3, u16vec3);"4061"bvec4 notEqual(u16vec4, u16vec4);"40624063" int16_t bitfieldExtract( int16_t, int16_t, int16_t);"4064"i16vec2 bitfieldExtract(i16vec2, int16_t, int16_t);"4065"i16vec3 bitfieldExtract(i16vec3, int16_t, int16_t);"4066"i16vec4 bitfieldExtract(i16vec4, int16_t, int16_t);"40674068" uint16_t bitfieldExtract( uint16_t, int16_t, int16_t);"4069"u16vec2 bitfieldExtract(u16vec2, int16_t, int16_t);"4070"u16vec3 bitfieldExtract(u16vec3, int16_t, int16_t);"4071"u16vec4 bitfieldExtract(u16vec4, int16_t, int16_t);"40724073" int16_t bitfieldInsert( int16_t base, int16_t, int16_t, int16_t);"4074"i16vec2 bitfieldInsert(i16vec2 base, i16vec2, int16_t, int16_t);"4075"i16vec3 bitfieldInsert(i16vec3 base, i16vec3, int16_t, int16_t);"4076"i16vec4 bitfieldInsert(i16vec4 base, i16vec4, int16_t, int16_t);"40774078" uint16_t bitfieldInsert( uint16_t base, uint16_t, int16_t, int16_t);"4079"u16vec2 bitfieldInsert(u16vec2 base, u16vec2, int16_t, int16_t);"4080"u16vec3 bitfieldInsert(u16vec3 base, u16vec3, int16_t, int16_t);"4081"u16vec4 bitfieldInsert(u16vec4 base, u16vec4, int16_t, int16_t);"40824083" int16_t bitCount( int16_t);"4084"i16vec2 bitCount(i16vec2);"4085"i16vec3 bitCount(i16vec3);"4086"i16vec4 bitCount(i16vec4);"40874088" int16_t bitCount( uint16_t);"4089"i16vec2 bitCount(u16vec2);"4090"i16vec3 bitCount(u16vec3);"4091"i16vec4 bitCount(u16vec4);"40924093" int16_t findLSB( int16_t);"4094"i16vec2 findLSB(i16vec2);"4095"i16vec3 findLSB(i16vec3);"4096"i16vec4 findLSB(i16vec4);"40974098" int16_t findLSB( uint16_t);"4099"i16vec2 findLSB(u16vec2);"4100"i16vec3 findLSB(u16vec3);"4101"i16vec4 findLSB(u16vec4);"41024103" int16_t findMSB( int16_t);"4104"i16vec2 findMSB(i16vec2);"4105"i16vec3 findMSB(i16vec3);"4106"i16vec4 findMSB(i16vec4);"41074108" int16_t findMSB( uint16_t);"4109"i16vec2 findMSB(u16vec2);"4110"i16vec3 findMSB(u16vec3);"4111"i16vec4 findMSB(u16vec4);"41124113"int16_t pack16(i8vec2);"4114"uint16_t pack16(u8vec2);"4115"int32_t pack32(i8vec4);"4116"uint32_t pack32(u8vec4);"4117"int32_t pack32(i16vec2);"4118"uint32_t pack32(u16vec2);"4119"int64_t pack64(i16vec4);"4120"uint64_t pack64(u16vec4);"4121"int64_t pack64(i32vec2);"4122"uint64_t pack64(u32vec2);"41234124"i8vec2 unpack8(int16_t);"4125"u8vec2 unpack8(uint16_t);"4126"i8vec4 unpack8(int32_t);"4127"u8vec4 unpack8(uint32_t);"4128"i16vec2 unpack16(int32_t);"4129"u16vec2 unpack16(uint32_t);"4130"i16vec4 unpack16(int64_t);"4131"u16vec4 unpack16(uint64_t);"4132"i32vec2 unpack32(int64_t);"4133"u32vec2 unpack32(uint64_t);"41344135// GL_EXT_expect_assume4136"int8_t expectEXT(int8_t, int8_t);"4137"i8vec2 expectEXT(i8vec2, i8vec2);"4138"i8vec3 expectEXT(i8vec3, i8vec3);"4139"i8vec4 expectEXT(i8vec4, i8vec4);"41404141"uint8_t expectEXT(uint8_t, uint8_t);"4142"u8vec2 expectEXT(u8vec2, u8vec2);"4143"u8vec3 expectEXT(u8vec3, u8vec3);"4144"u8vec4 expectEXT(u8vec4, u8vec4);"41454146"int16_t expectEXT(int16_t, int16_t);"4147"i16vec2 expectEXT(i16vec2, i16vec2);"4148"i16vec3 expectEXT(i16vec3, i16vec3);"4149"i16vec4 expectEXT(i16vec4, i16vec4);"41504151"uint16_t expectEXT(uint16_t, uint16_t);"4152"u16vec2 expectEXT(u16vec2, u16vec2);"4153"u16vec3 expectEXT(u16vec3, u16vec3);"4154"u16vec4 expectEXT(u16vec4, u16vec4);"41554156"int64_t expectEXT(int64_t, int64_t);"4157"i64vec2 expectEXT(i64vec2, i64vec2);"4158"i64vec3 expectEXT(i64vec3, i64vec3);"4159"i64vec4 expectEXT(i64vec4, i64vec4);"41604161"uint64_t expectEXT(uint64_t, uint64_t);"4162"u64vec2 expectEXT(u64vec2, u64vec2);"4163"u64vec3 expectEXT(u64vec3, u64vec3);"4164"u64vec4 expectEXT(u64vec4, u64vec4);"4165"\n");4166}41674168// Builtins for GL_EXT_texture_shadow_lod4169if ((profile == EEsProfile && version >= 300) || ((profile != EEsProfile && version >= 130))) {4170commonBuiltins.append(4171"float texture(sampler2DArrayShadow, vec4, float);"4172"float texture(samplerCubeArrayShadow, vec4, float, float);"4173"float textureLod(sampler2DArrayShadow, vec4, float);"4174"float textureLod(samplerCubeShadow, vec4, float);"4175"float textureLod(samplerCubeArrayShadow, vec4, float, float);"4176"float textureLodOffset(sampler2DArrayShadow, vec4, float, ivec2);"4177"float textureOffset(sampler2DArrayShadow, vec4 , ivec2, float);"4178"\n");4179}41804181if (profile != EEsProfile && version >= 450) {4182stageBuiltins[EShLangFragment].append(derivativesAndControl64bits);4183stageBuiltins[EShLangFragment].append(4184"float64_t interpolateAtCentroid(float64_t);"4185"f64vec2 interpolateAtCentroid(f64vec2);"4186"f64vec3 interpolateAtCentroid(f64vec3);"4187"f64vec4 interpolateAtCentroid(f64vec4);"41884189"float64_t interpolateAtSample(float64_t, int);"4190"f64vec2 interpolateAtSample(f64vec2, int);"4191"f64vec3 interpolateAtSample(f64vec3, int);"4192"f64vec4 interpolateAtSample(f64vec4, int);"41934194"float64_t interpolateAtOffset(float64_t, f64vec2);"4195"f64vec2 interpolateAtOffset(f64vec2, f64vec2);"4196"f64vec3 interpolateAtOffset(f64vec3, f64vec2);"4197"f64vec4 interpolateAtOffset(f64vec4, f64vec2);"41984199"\n");42004201}42024203// GL_EXT_expect_assume4204if ((profile == EEsProfile && version >= 310) ||4205((profile != EEsProfile && version >= 140))) {4206commonBuiltins.append(4207"void assumeEXT(bool);"42084209"bool expectEXT(bool, bool);"4210"bvec2 expectEXT(bvec2, bvec2);"4211"bvec3 expectEXT(bvec3, bvec3);"4212"bvec4 expectEXT(bvec4, bvec4);"42134214"int expectEXT(int, int);"4215"ivec2 expectEXT(ivec2, ivec2);"4216"ivec3 expectEXT(ivec3, ivec3);"4217"ivec4 expectEXT(ivec4, ivec4);"42184219"uint expectEXT(uint, uint);"4220"uvec2 expectEXT(uvec2, uvec2);"4221"uvec3 expectEXT(uvec3, uvec3);"4222"uvec4 expectEXT(uvec4, uvec4);"4223"\n");4224}42254226// QCOM_image_processing4227if ((profile == EEsProfile && version >= 310) ||4228(profile != EEsProfile && version >= 140)) {4229commonBuiltins.append(4230"vec4 textureWeightedQCOM(sampler2D, vec2, sampler2DArray);"4231"vec4 textureWeightedQCOM(sampler2D, vec2, sampler1DArray);"4232"vec4 textureBoxFilterQCOM(sampler2D, vec2, vec2);"4233"vec4 textureBlockMatchSADQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);"4234"vec4 textureBlockMatchSSDQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);"42354236"vec4 textureBlockMatchWindowSSDQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);"4237"vec4 textureBlockMatchWindowSADQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);"4238"vec4 textureBlockMatchGatherSSDQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);"4239"vec4 textureBlockMatchGatherSADQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);"4240"\n");4241}42424243//============================================================================4244//4245// Prototypes for built-in functions seen by vertex shaders only.4246// (Except legacy lod functions, where it depends which release they are4247// vertex only.)4248//4249//============================================================================42504251//4252// Geometric Functions.4253//4254if (spvVersion.vulkan == 0 && IncludeLegacy(version, profile, spvVersion))4255stageBuiltins[EShLangVertex].append("vec4 ftransform();");42564257//4258// Original-style texture Functions with lod.4259//4260TString* s;4261if (version == 100)4262s = &stageBuiltins[EShLangVertex];4263else4264s = &commonBuiltins;4265if ((profile == EEsProfile && version == 100) ||4266profile == ECompatibilityProfile ||4267(profile == ECoreProfile && version < 420) ||4268profile == ENoProfile) {4269if (spvVersion.spv == 0) {4270s->append(4271"vec4 texture2DLod(sampler2D, vec2, float);" // GL_ARB_shader_texture_lod4272"vec4 texture2DProjLod(sampler2D, vec3, float);" // GL_ARB_shader_texture_lod4273"vec4 texture2DProjLod(sampler2D, vec4, float);" // GL_ARB_shader_texture_lod4274"vec4 texture3DLod(sampler3D, vec3, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check4275"vec4 texture3DProjLod(sampler3D, vec4, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check4276"vec4 textureCubeLod(samplerCube, vec3, float);" // GL_ARB_shader_texture_lod42774278"\n");4279}4280}4281if ( profile == ECompatibilityProfile ||4282(profile == ECoreProfile && version < 420) ||4283profile == ENoProfile) {4284if (spvVersion.spv == 0) {4285s->append(4286"vec4 texture1DLod(sampler1D, float, float);" // GL_ARB_shader_texture_lod4287"vec4 texture1DProjLod(sampler1D, vec2, float);" // GL_ARB_shader_texture_lod4288"vec4 texture1DProjLod(sampler1D, vec4, float);" // GL_ARB_shader_texture_lod4289"vec4 shadow1DLod(sampler1DShadow, vec3, float);" // GL_ARB_shader_texture_lod4290"vec4 shadow2DLod(sampler2DShadow, vec3, float);" // GL_ARB_shader_texture_lod4291"vec4 shadow1DProjLod(sampler1DShadow, vec4, float);" // GL_ARB_shader_texture_lod4292"vec4 shadow2DProjLod(sampler2DShadow, vec4, float);" // GL_ARB_shader_texture_lod42934294"vec4 texture1DGradARB(sampler1D, float, float, float);" // GL_ARB_shader_texture_lod4295"vec4 texture1DProjGradARB(sampler1D, vec2, float, float);" // GL_ARB_shader_texture_lod4296"vec4 texture1DProjGradARB(sampler1D, vec4, float, float);" // GL_ARB_shader_texture_lod4297"vec4 texture2DGradARB(sampler2D, vec2, vec2, vec2);" // GL_ARB_shader_texture_lod4298"vec4 texture2DProjGradARB(sampler2D, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod4299"vec4 texture2DProjGradARB(sampler2D, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod4300"vec4 texture3DGradARB(sampler3D, vec3, vec3, vec3);" // GL_ARB_shader_texture_lod4301"vec4 texture3DProjGradARB(sampler3D, vec4, vec3, vec3);" // GL_ARB_shader_texture_lod4302"vec4 textureCubeGradARB(samplerCube, vec3, vec3, vec3);" // GL_ARB_shader_texture_lod4303"vec4 shadow1DGradARB(sampler1DShadow, vec3, float, float);" // GL_ARB_shader_texture_lod4304"vec4 shadow1DProjGradARB( sampler1DShadow, vec4, float, float);" // GL_ARB_shader_texture_lod4305"vec4 shadow2DGradARB(sampler2DShadow, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod4306"vec4 shadow2DProjGradARB( sampler2DShadow, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod4307"vec4 texture2DRectGradARB(sampler2DRect, vec2, vec2, vec2);" // GL_ARB_shader_texture_lod4308"vec4 texture2DRectProjGradARB( sampler2DRect, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod4309"vec4 texture2DRectProjGradARB( sampler2DRect, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod4310"vec4 shadow2DRectGradARB( sampler2DRectShadow, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod4311"vec4 shadow2DRectProjGradARB(sampler2DRectShadow, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod43124313"\n");4314}4315}43164317if ((profile != EEsProfile && version >= 150) ||4318(profile == EEsProfile && version >= 310)) {4319//============================================================================4320//4321// Prototypes for built-in functions seen by geometry shaders only.4322//4323//============================================================================43244325if (profile != EEsProfile && (version >= 400 || version == 150)) {4326stageBuiltins[EShLangGeometry].append(4327"void EmitStreamVertex(int);"4328"void EndStreamPrimitive(int);"4329);4330}4331stageBuiltins[EShLangGeometry].append(4332"void EmitVertex();"4333"void EndPrimitive();"4334"\n");4335}43364337//============================================================================4338//4339// Prototypes for all control functions.4340//4341//============================================================================4342bool esBarrier = (profile == EEsProfile && version >= 310);4343if ((profile != EEsProfile && version >= 150) || esBarrier)4344stageBuiltins[EShLangTessControl].append(4345"void barrier();"4346);4347if ((profile != EEsProfile && version >= 420) || esBarrier)4348stageBuiltins[EShLangCompute].append(4349"void barrier();"4350);4351if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {4352stageBuiltins[EShLangMesh].append(4353"void barrier();"4354);4355stageBuiltins[EShLangTask].append(4356"void barrier();"4357);4358}4359if ((profile != EEsProfile && version >= 130) || esBarrier)4360commonBuiltins.append(4361"void memoryBarrier();"4362);4363if ((profile != EEsProfile && version >= 420) || esBarrier) {4364commonBuiltins.append(4365"void memoryBarrierBuffer();"4366);4367stageBuiltins[EShLangCompute].append(4368"void memoryBarrierShared();"4369"void groupMemoryBarrier();"4370);4371}4372if ((profile != EEsProfile && version >= 420) || esBarrier) {4373if (spvVersion.vulkan == 0 || spvVersion.vulkanRelaxed) {4374commonBuiltins.append("void memoryBarrierAtomicCounter();");4375}4376commonBuiltins.append("void memoryBarrierImage();");4377}4378if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {4379stageBuiltins[EShLangMesh].append(4380"void memoryBarrierShared();"4381"void groupMemoryBarrier();"4382);4383stageBuiltins[EShLangTask].append(4384"void memoryBarrierShared();"4385"void groupMemoryBarrier();"4386);4387}43884389commonBuiltins.append("void controlBarrier(int, int, int, int);\n"4390"void memoryBarrier(int, int, int);\n");43914392commonBuiltins.append("void debugPrintfEXT();\n");43934394if (profile != EEsProfile && version >= 450) {4395// coopMatStoreNV perhaps ought to have "out" on the buf parameter, but4396// adding it introduces undesirable tempArgs on the stack. What we want4397// is more like "buf" thought of as a pointer value being an in parameter.4398stageBuiltins[EShLangCompute].append(4399"void coopMatLoadNV(out fcoopmatNV m, volatile coherent float16_t[] buf, uint element, uint stride, bool colMajor);\n"4400"void coopMatLoadNV(out fcoopmatNV m, volatile coherent float[] buf, uint element, uint stride, bool colMajor);\n"4401"void coopMatLoadNV(out fcoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"4402"void coopMatLoadNV(out fcoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"4403"void coopMatLoadNV(out fcoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"4404"void coopMatLoadNV(out fcoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"4405"void coopMatLoadNV(out fcoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"4406"void coopMatLoadNV(out fcoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"44074408"void coopMatStoreNV(fcoopmatNV m, volatile coherent float16_t[] buf, uint element, uint stride, bool colMajor);\n"4409"void coopMatStoreNV(fcoopmatNV m, volatile coherent float[] buf, uint element, uint stride, bool colMajor);\n"4410"void coopMatStoreNV(fcoopmatNV m, volatile coherent float64_t[] buf, uint element, uint stride, bool colMajor);\n"4411"void coopMatStoreNV(fcoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"4412"void coopMatStoreNV(fcoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"4413"void coopMatStoreNV(fcoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"4414"void coopMatStoreNV(fcoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"4415"void coopMatStoreNV(fcoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"4416"void coopMatStoreNV(fcoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"44174418"fcoopmatNV coopMatMulAddNV(fcoopmatNV A, fcoopmatNV B, fcoopmatNV C);\n"4419"void coopMatLoadNV(out icoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"4420"void coopMatLoadNV(out icoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"4421"void coopMatLoadNV(out icoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"4422"void coopMatLoadNV(out icoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"4423"void coopMatLoadNV(out icoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"4424"void coopMatLoadNV(out icoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"4425"void coopMatLoadNV(out icoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"4426"void coopMatLoadNV(out icoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"4427"void coopMatLoadNV(out icoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"4428"void coopMatLoadNV(out icoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"4429"void coopMatLoadNV(out icoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"4430"void coopMatLoadNV(out icoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"44314432"void coopMatLoadNV(out ucoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"4433"void coopMatLoadNV(out ucoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"4434"void coopMatLoadNV(out ucoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"4435"void coopMatLoadNV(out ucoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"4436"void coopMatLoadNV(out ucoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"4437"void coopMatLoadNV(out ucoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"4438"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"4439"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"4440"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"4441"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"4442"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"4443"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"44444445"void coopMatStoreNV(icoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"4446"void coopMatStoreNV(icoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"4447"void coopMatStoreNV(icoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"4448"void coopMatStoreNV(icoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"4449"void coopMatStoreNV(icoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"4450"void coopMatStoreNV(icoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"4451"void coopMatStoreNV(icoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"4452"void coopMatStoreNV(icoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"4453"void coopMatStoreNV(icoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"4454"void coopMatStoreNV(icoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"4455"void coopMatStoreNV(icoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"4456"void coopMatStoreNV(icoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"44574458"void coopMatStoreNV(ucoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"4459"void coopMatStoreNV(ucoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"4460"void coopMatStoreNV(ucoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"4461"void coopMatStoreNV(ucoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"4462"void coopMatStoreNV(ucoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"4463"void coopMatStoreNV(ucoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"4464"void coopMatStoreNV(ucoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"4465"void coopMatStoreNV(ucoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"4466"void coopMatStoreNV(ucoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"4467"void coopMatStoreNV(ucoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"4468"void coopMatStoreNV(ucoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"4469"void coopMatStoreNV(ucoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"44704471"icoopmatNV coopMatMulAddNV(icoopmatNV A, icoopmatNV B, icoopmatNV C);\n"4472"ucoopmatNV coopMatMulAddNV(ucoopmatNV A, ucoopmatNV B, ucoopmatNV C);\n"4473);44744475std::string cooperativeMatrixFuncs =4476"void coopMatLoad(out coopmat m, volatile coherent int8_t[] buf, uint element, uint stride, int matrixLayout);\n"4477"void coopMatLoad(out coopmat m, volatile coherent int16_t[] buf, uint element, uint stride, int matrixLayout);\n"4478"void coopMatLoad(out coopmat m, volatile coherent int32_t[] buf, uint element, uint stride, int matrixLayout);\n"4479"void coopMatLoad(out coopmat m, volatile coherent int64_t[] buf, uint element, uint stride, int matrixLayout);\n"4480"void coopMatLoad(out coopmat m, volatile coherent uint8_t[] buf, uint element, uint stride, int matrixLayout);\n"4481"void coopMatLoad(out coopmat m, volatile coherent uint16_t[] buf, uint element, uint stride, int matrixLayout);\n"4482"void coopMatLoad(out coopmat m, volatile coherent uint32_t[] buf, uint element, uint stride, int matrixLayout);\n"4483"void coopMatLoad(out coopmat m, volatile coherent uint64_t[] buf, uint element, uint stride, int matrixLayout);\n"4484"void coopMatLoad(out coopmat m, volatile coherent float16_t[] buf, uint element, uint stride, int matrixLayout);\n"4485"void coopMatLoad(out coopmat m, volatile coherent float[] buf, uint element, uint stride, int matrixLayout);\n"4486"void coopMatLoad(out coopmat m, volatile coherent float64_t[] buf, uint element, uint stride, int matrixLayout);\n"44874488"void coopMatLoad(out coopmat m, volatile coherent i8vec2[] buf, uint element, uint stride, int matrixLayout);\n"4489"void coopMatLoad(out coopmat m, volatile coherent i16vec2[] buf, uint element, uint stride, int matrixLayout);\n"4490"void coopMatLoad(out coopmat m, volatile coherent i32vec2[] buf, uint element, uint stride, int matrixLayout);\n"4491"void coopMatLoad(out coopmat m, volatile coherent i64vec2[] buf, uint element, uint stride, int matrixLayout);\n"4492"void coopMatLoad(out coopmat m, volatile coherent u8vec2[] buf, uint element, uint stride, int matrixLayout);\n"4493"void coopMatLoad(out coopmat m, volatile coherent u16vec2[] buf, uint element, uint stride, int matrixLayout);\n"4494"void coopMatLoad(out coopmat m, volatile coherent u32vec2[] buf, uint element, uint stride, int matrixLayout);\n"4495"void coopMatLoad(out coopmat m, volatile coherent u64vec2[] buf, uint element, uint stride, int matrixLayout);\n"4496"void coopMatLoad(out coopmat m, volatile coherent f16vec2[] buf, uint element, uint stride, int matrixLayout);\n"4497"void coopMatLoad(out coopmat m, volatile coherent f32vec2[] buf, uint element, uint stride, int matrixLayout);\n"4498"void coopMatLoad(out coopmat m, volatile coherent f64vec2[] buf, uint element, uint stride, int matrixLayout);\n"44994500"void coopMatLoad(out coopmat m, volatile coherent i8vec4[] buf, uint element, uint stride, int matrixLayout);\n"4501"void coopMatLoad(out coopmat m, volatile coherent i16vec4[] buf, uint element, uint stride, int matrixLayout);\n"4502"void coopMatLoad(out coopmat m, volatile coherent i32vec4[] buf, uint element, uint stride, int matrixLayout);\n"4503"void coopMatLoad(out coopmat m, volatile coherent i64vec4[] buf, uint element, uint stride, int matrixLayout);\n"4504"void coopMatLoad(out coopmat m, volatile coherent u8vec4[] buf, uint element, uint stride, int matrixLayout);\n"4505"void coopMatLoad(out coopmat m, volatile coherent u16vec4[] buf, uint element, uint stride, int matrixLayout);\n"4506"void coopMatLoad(out coopmat m, volatile coherent u32vec4[] buf, uint element, uint stride, int matrixLayout);\n"4507"void coopMatLoad(out coopmat m, volatile coherent u64vec4[] buf, uint element, uint stride, int matrixLayout);\n"4508"void coopMatLoad(out coopmat m, volatile coherent f16vec4[] buf, uint element, uint stride, int matrixLayout);\n"4509"void coopMatLoad(out coopmat m, volatile coherent f32vec4[] buf, uint element, uint stride, int matrixLayout);\n"4510"void coopMatLoad(out coopmat m, volatile coherent f64vec4[] buf, uint element, uint stride, int matrixLayout);\n"45114512"void coopMatStore(coopmat m, volatile coherent int8_t[] buf, uint element, uint stride, int matrixLayout);\n"4513"void coopMatStore(coopmat m, volatile coherent int16_t[] buf, uint element, uint stride, int matrixLayout);\n"4514"void coopMatStore(coopmat m, volatile coherent int32_t[] buf, uint element, uint stride, int matrixLayout);\n"4515"void coopMatStore(coopmat m, volatile coherent int64_t[] buf, uint element, uint stride, int matrixLayout);\n"4516"void coopMatStore(coopmat m, volatile coherent uint8_t[] buf, uint element, uint stride, int matrixLayout);\n"4517"void coopMatStore(coopmat m, volatile coherent uint16_t[] buf, uint element, uint stride, int matrixLayout);\n"4518"void coopMatStore(coopmat m, volatile coherent uint32_t[] buf, uint element, uint stride, int matrixLayout);\n"4519"void coopMatStore(coopmat m, volatile coherent uint64_t[] buf, uint element, uint stride, int matrixLayout);\n"4520"void coopMatStore(coopmat m, volatile coherent float16_t[] buf, uint element, uint stride, int matrixLayout);\n"4521"void coopMatStore(coopmat m, volatile coherent float[] buf, uint element, uint stride, int matrixLayout);\n"4522"void coopMatStore(coopmat m, volatile coherent float64_t[] buf, uint element, uint stride, int matrixLayout);\n"45234524"void coopMatStore(coopmat m, volatile coherent i8vec2[] buf, uint element, uint stride, int matrixLayout);\n"4525"void coopMatStore(coopmat m, volatile coherent i16vec2[] buf, uint element, uint stride, int matrixLayout);\n"4526"void coopMatStore(coopmat m, volatile coherent i32vec2[] buf, uint element, uint stride, int matrixLayout);\n"4527"void coopMatStore(coopmat m, volatile coherent i64vec2[] buf, uint element, uint stride, int matrixLayout);\n"4528"void coopMatStore(coopmat m, volatile coherent u8vec2[] buf, uint element, uint stride, int matrixLayout);\n"4529"void coopMatStore(coopmat m, volatile coherent u16vec2[] buf, uint element, uint stride, int matrixLayout);\n"4530"void coopMatStore(coopmat m, volatile coherent u32vec2[] buf, uint element, uint stride, int matrixLayout);\n"4531"void coopMatStore(coopmat m, volatile coherent u64vec2[] buf, uint element, uint stride, int matrixLayout);\n"4532"void coopMatStore(coopmat m, volatile coherent f16vec2[] buf, uint element, uint stride, int matrixLayout);\n"4533"void coopMatStore(coopmat m, volatile coherent f32vec2[] buf, uint element, uint stride, int matrixLayout);\n"4534"void coopMatStore(coopmat m, volatile coherent f64vec2[] buf, uint element, uint stride, int matrixLayout);\n"45354536"void coopMatStore(coopmat m, volatile coherent i8vec4[] buf, uint element, uint stride, int matrixLayout);\n"4537"void coopMatStore(coopmat m, volatile coherent i16vec4[] buf, uint element, uint stride, int matrixLayout);\n"4538"void coopMatStore(coopmat m, volatile coherent i32vec4[] buf, uint element, uint stride, int matrixLayout);\n"4539"void coopMatStore(coopmat m, volatile coherent i64vec4[] buf, uint element, uint stride, int matrixLayout);\n"4540"void coopMatStore(coopmat m, volatile coherent u8vec4[] buf, uint element, uint stride, int matrixLayout);\n"4541"void coopMatStore(coopmat m, volatile coherent u16vec4[] buf, uint element, uint stride, int matrixLayout);\n"4542"void coopMatStore(coopmat m, volatile coherent u32vec4[] buf, uint element, uint stride, int matrixLayout);\n"4543"void coopMatStore(coopmat m, volatile coherent u64vec4[] buf, uint element, uint stride, int matrixLayout);\n"4544"void coopMatStore(coopmat m, volatile coherent f16vec4[] buf, uint element, uint stride, int matrixLayout);\n"4545"void coopMatStore(coopmat m, volatile coherent f32vec4[] buf, uint element, uint stride, int matrixLayout);\n"4546"void coopMatStore(coopmat m, volatile coherent f64vec4[] buf, uint element, uint stride, int matrixLayout);\n"45474548"coopmat coopMatMulAdd(coopmat A, coopmat B, coopmat C);\n"4549"coopmat coopMatMulAdd(coopmat A, coopmat B, coopmat C, int matrixOperands);\n";45504551commonBuiltins.append(cooperativeMatrixFuncs.c_str());45524553commonBuiltins.append(4554"const int gl_MatrixUseA = 0;\n"4555"const int gl_MatrixUseB = 1;\n"4556"const int gl_MatrixUseAccumulator = 2;\n"4557"const int gl_MatrixOperandsSaturatingAccumulation = 0x10;\n"4558"const int gl_CooperativeMatrixLayoutRowMajor = 0;\n"4559"const int gl_CooperativeMatrixLayoutColumnMajor = 1;\n"4560"\n"4561);4562}45634564//============================================================================4565//4566// Prototypes for built-in functions seen by fragment shaders only.4567//4568//============================================================================45694570//4571// Original-style texture Functions with bias.4572//4573if (spvVersion.spv == 0 && (profile != EEsProfile || version == 100)) {4574stageBuiltins[EShLangFragment].append(4575"vec4 texture2D(sampler2D, vec2, float);"4576"vec4 texture2DProj(sampler2D, vec3, float);"4577"vec4 texture2DProj(sampler2D, vec4, float);"4578"vec4 texture3D(sampler3D, vec3, float);" // OES_texture_3D4579"vec4 texture3DProj(sampler3D, vec4, float);" // OES_texture_3D4580"vec4 textureCube(samplerCube, vec3, float);"45814582"\n");4583}4584if (spvVersion.spv == 0 && (profile != EEsProfile && version > 100)) {4585stageBuiltins[EShLangFragment].append(4586"vec4 texture1D(sampler1D, float, float);"4587"vec4 texture1DProj(sampler1D, vec2, float);"4588"vec4 texture1DProj(sampler1D, vec4, float);"4589"vec4 shadow1D(sampler1DShadow, vec3, float);"4590"vec4 shadow2D(sampler2DShadow, vec3, float);"4591"vec4 shadow1DProj(sampler1DShadow, vec4, float);"4592"vec4 shadow2DProj(sampler2DShadow, vec4, float);"45934594"\n");4595}4596if (spvVersion.spv == 0 && profile == EEsProfile) {4597stageBuiltins[EShLangFragment].append(4598"vec4 texture2DLodEXT(sampler2D, vec2, float);" // GL_EXT_shader_texture_lod4599"vec4 texture2DProjLodEXT(sampler2D, vec3, float);" // GL_EXT_shader_texture_lod4600"vec4 texture2DProjLodEXT(sampler2D, vec4, float);" // GL_EXT_shader_texture_lod4601"vec4 textureCubeLodEXT(samplerCube, vec3, float);" // GL_EXT_shader_texture_lod46024603"\n");4604}46054606// GL_EXT_shader_tile_image4607if (spvVersion.vulkan > 0) {4608stageBuiltins[EShLangFragment].append(4609"lowp uint stencilAttachmentReadEXT();"4610"lowp uint stencilAttachmentReadEXT(int);"4611"highp float depthAttachmentReadEXT();"4612"highp float depthAttachmentReadEXT(int);"4613"\n");4614stageBuiltins[EShLangFragment].append(4615"vec4 colorAttachmentReadEXT(attachmentEXT);"4616"vec4 colorAttachmentReadEXT(attachmentEXT, int);"4617"ivec4 colorAttachmentReadEXT(iattachmentEXT);"4618"ivec4 colorAttachmentReadEXT(iattachmentEXT, int);"4619"uvec4 colorAttachmentReadEXT(uattachmentEXT);"4620"uvec4 colorAttachmentReadEXT(uattachmentEXT, int);"4621"\n");4622}46234624// GL_ARB_derivative_control4625if (profile != EEsProfile && version >= 400) {4626stageBuiltins[EShLangFragment].append(derivativeControls);4627stageBuiltins[EShLangFragment].append("\n");4628}46294630// GL_OES_shader_multisample_interpolation4631if ((profile == EEsProfile && version >= 310) ||4632(profile != EEsProfile && version >= 400)) {4633stageBuiltins[EShLangFragment].append(4634"float interpolateAtCentroid(float);"4635"vec2 interpolateAtCentroid(vec2);"4636"vec3 interpolateAtCentroid(vec3);"4637"vec4 interpolateAtCentroid(vec4);"46384639"float interpolateAtSample(float, int);"4640"vec2 interpolateAtSample(vec2, int);"4641"vec3 interpolateAtSample(vec3, int);"4642"vec4 interpolateAtSample(vec4, int);"46434644"float interpolateAtOffset(float, vec2);"4645"vec2 interpolateAtOffset(vec2, vec2);"4646"vec3 interpolateAtOffset(vec3, vec2);"4647"vec4 interpolateAtOffset(vec4, vec2);"46484649"\n");4650}46514652stageBuiltins[EShLangFragment].append(4653"void beginInvocationInterlockARB(void);"4654"void endInvocationInterlockARB(void);");46554656stageBuiltins[EShLangFragment].append(4657"bool helperInvocationEXT();"4658"\n");46594660// GL_AMD_shader_explicit_vertex_parameter4661if (profile != EEsProfile && version >= 450) {4662stageBuiltins[EShLangFragment].append(4663"float interpolateAtVertexAMD(float, uint);"4664"vec2 interpolateAtVertexAMD(vec2, uint);"4665"vec3 interpolateAtVertexAMD(vec3, uint);"4666"vec4 interpolateAtVertexAMD(vec4, uint);"46674668"int interpolateAtVertexAMD(int, uint);"4669"ivec2 interpolateAtVertexAMD(ivec2, uint);"4670"ivec3 interpolateAtVertexAMD(ivec3, uint);"4671"ivec4 interpolateAtVertexAMD(ivec4, uint);"46724673"uint interpolateAtVertexAMD(uint, uint);"4674"uvec2 interpolateAtVertexAMD(uvec2, uint);"4675"uvec3 interpolateAtVertexAMD(uvec3, uint);"4676"uvec4 interpolateAtVertexAMD(uvec4, uint);"46774678"float16_t interpolateAtVertexAMD(float16_t, uint);"4679"f16vec2 interpolateAtVertexAMD(f16vec2, uint);"4680"f16vec3 interpolateAtVertexAMD(f16vec3, uint);"4681"f16vec4 interpolateAtVertexAMD(f16vec4, uint);"46824683"\n");4684}46854686// GL_AMD_gpu_shader_half_float4687if (profile != EEsProfile && version >= 450) {4688stageBuiltins[EShLangFragment].append(derivativesAndControl16bits);4689stageBuiltins[EShLangFragment].append("\n");46904691stageBuiltins[EShLangFragment].append(4692"float16_t interpolateAtCentroid(float16_t);"4693"f16vec2 interpolateAtCentroid(f16vec2);"4694"f16vec3 interpolateAtCentroid(f16vec3);"4695"f16vec4 interpolateAtCentroid(f16vec4);"46964697"float16_t interpolateAtSample(float16_t, int);"4698"f16vec2 interpolateAtSample(f16vec2, int);"4699"f16vec3 interpolateAtSample(f16vec3, int);"4700"f16vec4 interpolateAtSample(f16vec4, int);"47014702"float16_t interpolateAtOffset(float16_t, f16vec2);"4703"f16vec2 interpolateAtOffset(f16vec2, f16vec2);"4704"f16vec3 interpolateAtOffset(f16vec3, f16vec2);"4705"f16vec4 interpolateAtOffset(f16vec4, f16vec2);"47064707"\n");4708}47094710// GL_ARB_shader_clock& GL_EXT_shader_realtime_clock4711if (profile != EEsProfile && version >= 450) {4712commonBuiltins.append(4713"uvec2 clock2x32ARB();"4714"uint64_t clockARB();"4715"uvec2 clockRealtime2x32EXT();"4716"uint64_t clockRealtimeEXT();"4717"\n");4718}47194720// GL_AMD_shader_fragment_mask4721if (profile != EEsProfile && version >= 450 && spvVersion.vulkan > 0) {4722stageBuiltins[EShLangFragment].append(4723"uint fragmentMaskFetchAMD(subpassInputMS);"4724"uint fragmentMaskFetchAMD(isubpassInputMS);"4725"uint fragmentMaskFetchAMD(usubpassInputMS);"47264727"vec4 fragmentFetchAMD(subpassInputMS, uint);"4728"ivec4 fragmentFetchAMD(isubpassInputMS, uint);"4729"uvec4 fragmentFetchAMD(usubpassInputMS, uint);"47304731"\n");4732}47334734// Builtins for GL_NV_ray_tracing/GL_NV_ray_tracing_motion_blur/GL_EXT_ray_tracing/GL_EXT_ray_query/4735// GL_NV_shader_invocation_reorder/GL_KHR_ray_tracing_position_Fetch4736if (profile != EEsProfile && version >= 460) {4737commonBuiltins.append("void rayQueryInitializeEXT(rayQueryEXT, accelerationStructureEXT, uint, uint, vec3, float, vec3, float);"4738"void rayQueryTerminateEXT(rayQueryEXT);"4739"void rayQueryGenerateIntersectionEXT(rayQueryEXT, float);"4740"void rayQueryConfirmIntersectionEXT(rayQueryEXT);"4741"bool rayQueryProceedEXT(rayQueryEXT);"4742"uint rayQueryGetIntersectionTypeEXT(rayQueryEXT, bool);"4743"float rayQueryGetRayTMinEXT(rayQueryEXT);"4744"uint rayQueryGetRayFlagsEXT(rayQueryEXT);"4745"vec3 rayQueryGetWorldRayOriginEXT(rayQueryEXT);"4746"vec3 rayQueryGetWorldRayDirectionEXT(rayQueryEXT);"4747"float rayQueryGetIntersectionTEXT(rayQueryEXT, bool);"4748"int rayQueryGetIntersectionInstanceCustomIndexEXT(rayQueryEXT, bool);"4749"int rayQueryGetIntersectionInstanceIdEXT(rayQueryEXT, bool);"4750"uint rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(rayQueryEXT, bool);"4751"int rayQueryGetIntersectionGeometryIndexEXT(rayQueryEXT, bool);"4752"int rayQueryGetIntersectionPrimitiveIndexEXT(rayQueryEXT, bool);"4753"vec2 rayQueryGetIntersectionBarycentricsEXT(rayQueryEXT, bool);"4754"bool rayQueryGetIntersectionFrontFaceEXT(rayQueryEXT, bool);"4755"bool rayQueryGetIntersectionCandidateAABBOpaqueEXT(rayQueryEXT);"4756"vec3 rayQueryGetIntersectionObjectRayDirectionEXT(rayQueryEXT, bool);"4757"vec3 rayQueryGetIntersectionObjectRayOriginEXT(rayQueryEXT, bool);"4758"mat4x3 rayQueryGetIntersectionObjectToWorldEXT(rayQueryEXT, bool);"4759"mat4x3 rayQueryGetIntersectionWorldToObjectEXT(rayQueryEXT, bool);"4760"void rayQueryGetIntersectionTriangleVertexPositionsEXT(rayQueryEXT, bool, out vec3[3]);"4761"\n");47624763stageBuiltins[EShLangRayGen].append(4764"void traceNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"4765"void traceRayMotionNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);"4766"void traceRayEXT(accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"4767"void executeCallableNV(uint, int);"4768"void executeCallableEXT(uint, int);"4769"void hitObjectTraceRayNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"4770"void hitObjectTraceRayMotionNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);"4771"void hitObjectRecordHitNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,int);"4772"void hitObjectRecordHitMotionNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,float,int);"4773"void hitObjectRecordHitWithIndexNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,int);"4774"void hitObjectRecordHitWithIndexMotionNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,float,int);"4775"void hitObjectRecordMissNV(hitObjectNV,uint,vec3,float,vec3,float);"4776"void hitObjectRecordMissMotionNV(hitObjectNV,uint,vec3,float,vec3,float,float);"4777"void hitObjectRecordEmptyNV(hitObjectNV);"4778"void hitObjectExecuteShaderNV(hitObjectNV,int);"4779"bool hitObjectIsEmptyNV(hitObjectNV);"4780"bool hitObjectIsMissNV(hitObjectNV);"4781"bool hitObjectIsHitNV(hitObjectNV);"4782"float hitObjectGetRayTMinNV(hitObjectNV);"4783"float hitObjectGetRayTMaxNV(hitObjectNV);"4784"vec3 hitObjectGetWorldRayOriginNV(hitObjectNV);"4785"vec3 hitObjectGetWorldRayDirectionNV(hitObjectNV);"4786"vec3 hitObjectGetObjectRayOriginNV(hitObjectNV);"4787"vec3 hitObjectGetObjectRayDirectionNV(hitObjectNV);"4788"mat4x3 hitObjectGetWorldToObjectNV(hitObjectNV);"4789"mat4x3 hitObjectGetObjectToWorldNV(hitObjectNV);"4790"int hitObjectGetInstanceCustomIndexNV(hitObjectNV);"4791"int hitObjectGetInstanceIdNV(hitObjectNV);"4792"int hitObjectGetGeometryIndexNV(hitObjectNV);"4793"int hitObjectGetPrimitiveIndexNV(hitObjectNV);"4794"uint hitObjectGetHitKindNV(hitObjectNV);"4795"void hitObjectGetAttributesNV(hitObjectNV,int);"4796"float hitObjectGetCurrentTimeNV(hitObjectNV);"4797"uint hitObjectGetShaderBindingTableRecordIndexNV(hitObjectNV);"4798"uvec2 hitObjectGetShaderRecordBufferHandleNV(hitObjectNV);"4799"void reorderThreadNV(uint, uint);"4800"void reorderThreadNV(hitObjectNV);"4801"void reorderThreadNV(hitObjectNV, uint, uint);"4802"vec3 fetchMicroTriangleVertexPositionNV(accelerationStructureEXT, int, int, int, ivec2);"4803"vec2 fetchMicroTriangleVertexBarycentricNV(accelerationStructureEXT, int, int, int, ivec2);"4804"\n");4805stageBuiltins[EShLangIntersect].append(4806"bool reportIntersectionNV(float, uint);"4807"bool reportIntersectionEXT(float, uint);"4808"\n");4809stageBuiltins[EShLangAnyHit].append(4810"void ignoreIntersectionNV();"4811"void terminateRayNV();"4812"\n");4813stageBuiltins[EShLangClosestHit].append(4814"void traceNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"4815"void traceRayMotionNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);"4816"void traceRayEXT(accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"4817"void executeCallableNV(uint, int);"4818"void executeCallableEXT(uint, int);"4819"void hitObjectTraceRayNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"4820"void hitObjectTraceRayMotionNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);"4821"void hitObjectRecordHitNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,int);"4822"void hitObjectRecordHitMotionNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,float,int);"4823"void hitObjectRecordHitWithIndexNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,int);"4824"void hitObjectRecordHitWithIndexMotionNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,float,int);"4825"void hitObjectRecordMissNV(hitObjectNV, uint, vec3, float, vec3, float);"4826"void hitObjectRecordMissMotionNV(hitObjectNV,uint,vec3,float,vec3,float,float);"4827"void hitObjectRecordEmptyNV(hitObjectNV);"4828"void hitObjectExecuteShaderNV(hitObjectNV, int);"4829"bool hitObjectIsEmptyNV(hitObjectNV);"4830"bool hitObjectIsMissNV(hitObjectNV);"4831"bool hitObjectIsHitNV(hitObjectNV);"4832"float hitObjectGetRayTMinNV(hitObjectNV);"4833"float hitObjectGetRayTMaxNV(hitObjectNV);"4834"vec3 hitObjectGetWorldRayOriginNV(hitObjectNV);"4835"vec3 hitObjectGetWorldRayDirectionNV(hitObjectNV);"4836"vec3 hitObjectGetObjectRayOriginNV(hitObjectNV);"4837"vec3 hitObjectGetObjectRayDirectionNV(hitObjectNV);"4838"mat4x3 hitObjectGetWorldToObjectNV(hitObjectNV);"4839"mat4x3 hitObjectGetObjectToWorldNV(hitObjectNV);"4840"int hitObjectGetInstanceCustomIndexNV(hitObjectNV);"4841"int hitObjectGetInstanceIdNV(hitObjectNV);"4842"int hitObjectGetGeometryIndexNV(hitObjectNV);"4843"int hitObjectGetPrimitiveIndexNV(hitObjectNV);"4844"uint hitObjectGetHitKindNV(hitObjectNV);"4845"void hitObjectGetAttributesNV(hitObjectNV,int);"4846"float hitObjectGetCurrentTimeNV(hitObjectNV);"4847"uint hitObjectGetShaderBindingTableRecordIndexNV(hitObjectNV);"4848"uvec2 hitObjectGetShaderRecordBufferHandleNV(hitObjectNV);"4849"\n");4850stageBuiltins[EShLangMiss].append(4851"void traceNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"4852"void traceRayMotionNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);"4853"void traceRayEXT(accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"4854"void executeCallableNV(uint, int);"4855"void executeCallableEXT(uint, int);"4856"void hitObjectTraceRayNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"4857"void hitObjectTraceRayMotionNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);"4858"void hitObjectRecordHitNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,int);"4859"void hitObjectRecordHitMotionNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,float,int);"4860"void hitObjectRecordHitWithIndexNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,int);"4861"void hitObjectRecordHitWithIndexMotionNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,float,int);"4862"void hitObjectRecordMissNV(hitObjectNV, uint, vec3, float, vec3, float);"4863"void hitObjectRecordMissMotionNV(hitObjectNV,uint,vec3,float,vec3,float,float);"4864"void hitObjectRecordEmptyNV(hitObjectNV);"4865"void hitObjectExecuteShaderNV(hitObjectNV, int);"4866"bool hitObjectIsEmptyNV(hitObjectNV);"4867"bool hitObjectIsMissNV(hitObjectNV);"4868"bool hitObjectIsHitNV(hitObjectNV);"4869"float hitObjectGetRayTMinNV(hitObjectNV);"4870"float hitObjectGetRayTMaxNV(hitObjectNV);"4871"vec3 hitObjectGetWorldRayOriginNV(hitObjectNV);"4872"vec3 hitObjectGetWorldRayDirectionNV(hitObjectNV);"4873"vec3 hitObjectGetObjectRayOriginNV(hitObjectNV);"4874"vec3 hitObjectGetObjectRayDirectionNV(hitObjectNV);"4875"mat4x3 hitObjectGetWorldToObjectNV(hitObjectNV);"4876"mat4x3 hitObjectGetObjectToWorldNV(hitObjectNV);"4877"int hitObjectGetInstanceCustomIndexNV(hitObjectNV);"4878"int hitObjectGetInstanceIdNV(hitObjectNV);"4879"int hitObjectGetGeometryIndexNV(hitObjectNV);"4880"int hitObjectGetPrimitiveIndexNV(hitObjectNV);"4881"uint hitObjectGetHitKindNV(hitObjectNV);"4882"void hitObjectGetAttributesNV(hitObjectNV,int);"4883"float hitObjectGetCurrentTimeNV(hitObjectNV);"4884"uint hitObjectGetShaderBindingTableRecordIndexNV(hitObjectNV);"4885"uvec2 hitObjectGetShaderRecordBufferHandleNV(hitObjectNV);"4886"\n");4887stageBuiltins[EShLangCallable].append(4888"void executeCallableNV(uint, int);"4889"void executeCallableEXT(uint, int);"4890"\n");4891}48924893//E_SPV_NV_compute_shader_derivatives4894if ((profile == EEsProfile && version >= 320) || (profile != EEsProfile && version >= 450)) {4895stageBuiltins[EShLangCompute].append(derivativeControls);4896stageBuiltins[EShLangCompute].append("\n");4897}4898if (profile != EEsProfile && version >= 450) {4899stageBuiltins[EShLangCompute].append(derivativesAndControl16bits);4900stageBuiltins[EShLangCompute].append(derivativesAndControl64bits);4901stageBuiltins[EShLangCompute].append("\n");4902}49034904// Builtins for GL_NV_mesh_shader4905if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {4906stageBuiltins[EShLangMesh].append(4907"void writePackedPrimitiveIndices4x8NV(uint, uint);"4908"\n");4909}4910// Builtins for GL_EXT_mesh_shader4911if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {4912// Builtins for GL_EXT_mesh_shader4913stageBuiltins[EShLangTask].append(4914"void EmitMeshTasksEXT(uint, uint, uint);"4915"\n");49164917stageBuiltins[EShLangMesh].append(4918"void SetMeshOutputsEXT(uint, uint);"4919"\n");4920}4921// Builtins for GL_NV_displacement_micromap4922if ((profile != EEsProfile && version >= 460) || (profile == EEsProfile && version >= 320)) {4923stageBuiltins[EShLangMesh].append(4924"vec3 fetchMicroTriangleVertexPositionNV(accelerationStructureEXT, int, int, int, ivec2);"4925"vec2 fetchMicroTriangleVertexBarycentricNV(accelerationStructureEXT, int, int, int, ivec2);"4926"\n");49274928stageBuiltins[EShLangCompute].append(4929"vec3 fetchMicroTriangleVertexPositionNV(accelerationStructureEXT, int, int, int, ivec2);"4930"vec2 fetchMicroTriangleVertexBarycentricNV(accelerationStructureEXT, int, int, int, ivec2);"4931"\n");49324933}493449354936//============================================================================4937//4938// Standard Uniforms4939//4940//============================================================================49414942//4943// Depth range in window coordinates, p. 334944//4945if (spvVersion.spv == 0) {4946commonBuiltins.append(4947"struct gl_DepthRangeParameters {"4948);4949if (profile == EEsProfile) {4950commonBuiltins.append(4951"highp float near;" // n4952"highp float far;" // f4953"highp float diff;" // f - n4954);4955} else {4956commonBuiltins.append(4957"float near;" // n4958"float far;" // f4959"float diff;" // f - n4960);4961}49624963commonBuiltins.append(4964"};"4965"uniform gl_DepthRangeParameters gl_DepthRange;"4966"\n");4967}49684969if (spvVersion.spv == 0 && IncludeLegacy(version, profile, spvVersion)) {4970//4971// Matrix state. p. 31, 32, 37, 39, 40.4972//4973commonBuiltins.append(4974"uniform mat4 gl_ModelViewMatrix;"4975"uniform mat4 gl_ProjectionMatrix;"4976"uniform mat4 gl_ModelViewProjectionMatrix;"49774978//4979// Derived matrix state that provides inverse and transposed versions4980// of the matrices above.4981//4982"uniform mat3 gl_NormalMatrix;"49834984"uniform mat4 gl_ModelViewMatrixInverse;"4985"uniform mat4 gl_ProjectionMatrixInverse;"4986"uniform mat4 gl_ModelViewProjectionMatrixInverse;"49874988"uniform mat4 gl_ModelViewMatrixTranspose;"4989"uniform mat4 gl_ProjectionMatrixTranspose;"4990"uniform mat4 gl_ModelViewProjectionMatrixTranspose;"49914992"uniform mat4 gl_ModelViewMatrixInverseTranspose;"4993"uniform mat4 gl_ProjectionMatrixInverseTranspose;"4994"uniform mat4 gl_ModelViewProjectionMatrixInverseTranspose;"49954996//4997// Normal scaling p. 39.4998//4999"uniform float gl_NormalScale;"50005001//5002// Point Size, p. 66, 67.5003//5004"struct gl_PointParameters {"5005"float size;"5006"float sizeMin;"5007"float sizeMax;"5008"float fadeThresholdSize;"5009"float distanceConstantAttenuation;"5010"float distanceLinearAttenuation;"5011"float distanceQuadraticAttenuation;"5012"};"50135014"uniform gl_PointParameters gl_Point;"50155016//5017// Material State p. 50, 55.5018//5019"struct gl_MaterialParameters {"5020"vec4 emission;" // Ecm5021"vec4 ambient;" // Acm5022"vec4 diffuse;" // Dcm5023"vec4 specular;" // Scm5024"float shininess;" // Srm5025"};"5026"uniform gl_MaterialParameters gl_FrontMaterial;"5027"uniform gl_MaterialParameters gl_BackMaterial;"50285029//5030// Light State p 50, 53, 55.5031//5032"struct gl_LightSourceParameters {"5033"vec4 ambient;" // Acli5034"vec4 diffuse;" // Dcli5035"vec4 specular;" // Scli5036"vec4 position;" // Ppli5037"vec4 halfVector;" // Derived: Hi5038"vec3 spotDirection;" // Sdli5039"float spotExponent;" // Srli5040"float spotCutoff;" // Crli5041// (range: [0.0,90.0], 180.0)5042"float spotCosCutoff;" // Derived: cos(Crli)5043// (range: [1.0,0.0],-1.0)5044"float constantAttenuation;" // K05045"float linearAttenuation;" // K15046"float quadraticAttenuation;"// K25047"};"50485049"struct gl_LightModelParameters {"5050"vec4 ambient;" // Acs5051"};"50525053"uniform gl_LightModelParameters gl_LightModel;"50545055//5056// Derived state from products of light and material.5057//5058"struct gl_LightModelProducts {"5059"vec4 sceneColor;" // Derived. Ecm + Acm * Acs5060"};"50615062"uniform gl_LightModelProducts gl_FrontLightModelProduct;"5063"uniform gl_LightModelProducts gl_BackLightModelProduct;"50645065"struct gl_LightProducts {"5066"vec4 ambient;" // Acm * Acli5067"vec4 diffuse;" // Dcm * Dcli5068"vec4 specular;" // Scm * Scli5069"};"50705071//5072// Fog p. 1615073//5074"struct gl_FogParameters {"5075"vec4 color;"5076"float density;"5077"float start;"5078"float end;"5079"float scale;" // 1 / (gl_FogEnd - gl_FogStart)5080"};"50815082"uniform gl_FogParameters gl_Fog;"50835084"\n");5085}50865087//============================================================================5088//5089// Define the interface to the compute shader.5090//5091//============================================================================50925093if ((profile != EEsProfile && version >= 420) ||5094(profile == EEsProfile && version >= 310)) {5095stageBuiltins[EShLangCompute].append(5096"in highp uvec3 gl_NumWorkGroups;"5097"const highp uvec3 gl_WorkGroupSize = uvec3(1,1,1);"50985099"in highp uvec3 gl_WorkGroupID;"5100"in highp uvec3 gl_LocalInvocationID;"51015102"in highp uvec3 gl_GlobalInvocationID;"5103"in highp uint gl_LocalInvocationIndex;"51045105"\n");5106}51075108if ((profile != EEsProfile && version >= 140) ||5109(profile == EEsProfile && version >= 310)) {5110stageBuiltins[EShLangCompute].append(5111"in highp int gl_DeviceIndex;" // GL_EXT_device_group5112"\n");5113}51145115//============================================================================5116//5117// Define the interface to the mesh/task shader.5118//5119//============================================================================51205121if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {5122// per-vertex attributes5123stageBuiltins[EShLangMesh].append(5124"out gl_MeshPerVertexNV {"5125"vec4 gl_Position;"5126"float gl_PointSize;"5127"float gl_ClipDistance[];"5128"float gl_CullDistance[];"5129"perviewNV vec4 gl_PositionPerViewNV[];"5130"perviewNV float gl_ClipDistancePerViewNV[][];"5131"perviewNV float gl_CullDistancePerViewNV[][];"5132"} gl_MeshVerticesNV[];"5133);51345135// per-primitive attributes5136stageBuiltins[EShLangMesh].append(5137"perprimitiveNV out gl_MeshPerPrimitiveNV {"5138"int gl_PrimitiveID;"5139"int gl_Layer;"5140"int gl_ViewportIndex;"5141"int gl_ViewportMask[];"5142"perviewNV int gl_LayerPerViewNV[];"5143"perviewNV int gl_ViewportMaskPerViewNV[][];"5144"} gl_MeshPrimitivesNV[];"5145);51465147stageBuiltins[EShLangMesh].append(5148"out uint gl_PrimitiveCountNV;"5149"out uint gl_PrimitiveIndicesNV[];"51505151"in uint gl_MeshViewCountNV;"5152"in uint gl_MeshViewIndicesNV[4];"51535154"const highp uvec3 gl_WorkGroupSize = uvec3(1,1,1);"51555156"in highp uvec3 gl_WorkGroupID;"5157"in highp uvec3 gl_LocalInvocationID;"51585159"in highp uvec3 gl_GlobalInvocationID;"5160"in highp uint gl_LocalInvocationIndex;"5161"\n");51625163// GL_EXT_mesh_shader5164stageBuiltins[EShLangMesh].append(5165"out uint gl_PrimitivePointIndicesEXT[];"5166"out uvec2 gl_PrimitiveLineIndicesEXT[];"5167"out uvec3 gl_PrimitiveTriangleIndicesEXT[];"5168"in highp uvec3 gl_NumWorkGroups;"5169"\n");51705171// per-vertex attributes5172stageBuiltins[EShLangMesh].append(5173"out gl_MeshPerVertexEXT {"5174"vec4 gl_Position;"5175"float gl_PointSize;"5176"float gl_ClipDistance[];"5177"float gl_CullDistance[];"5178"} gl_MeshVerticesEXT[];"5179);51805181// per-primitive attributes5182stageBuiltins[EShLangMesh].append(5183"perprimitiveEXT out gl_MeshPerPrimitiveEXT {"5184"int gl_PrimitiveID;"5185"int gl_Layer;"5186"int gl_ViewportIndex;"5187"bool gl_CullPrimitiveEXT;"5188"int gl_PrimitiveShadingRateEXT;"5189"} gl_MeshPrimitivesEXT[];"5190);51915192stageBuiltins[EShLangTask].append(5193"out uint gl_TaskCountNV;"51945195"const highp uvec3 gl_WorkGroupSize = uvec3(1,1,1);"51965197"in highp uvec3 gl_WorkGroupID;"5198"in highp uvec3 gl_LocalInvocationID;"51995200"in highp uvec3 gl_GlobalInvocationID;"5201"in highp uint gl_LocalInvocationIndex;"52025203"in uint gl_MeshViewCountNV;"5204"in uint gl_MeshViewIndicesNV[4];"5205"in highp uvec3 gl_NumWorkGroups;"5206"\n");5207}52085209if (profile != EEsProfile && version >= 450) {5210stageBuiltins[EShLangMesh].append(5211"in highp int gl_DeviceIndex;" // GL_EXT_device_group5212"in int gl_DrawIDARB;" // GL_ARB_shader_draw_parameters5213"in int gl_ViewIndex;" // GL_EXT_multiview5214"\n");52155216stageBuiltins[EShLangTask].append(5217"in highp int gl_DeviceIndex;" // GL_EXT_device_group5218"in int gl_DrawIDARB;" // GL_ARB_shader_draw_parameters5219"\n");52205221if (version >= 460) {5222stageBuiltins[EShLangMesh].append(5223"in int gl_DrawID;"5224"\n");52255226stageBuiltins[EShLangTask].append(5227"in int gl_DrawID;"5228"\n");5229}5230}52315232//============================================================================5233//5234// Define the interface to the vertex shader.5235//5236//============================================================================52375238if (profile != EEsProfile) {5239if (version < 130) {5240stageBuiltins[EShLangVertex].append(5241"attribute vec4 gl_Color;"5242"attribute vec4 gl_SecondaryColor;"5243"attribute vec3 gl_Normal;"5244"attribute vec4 gl_Vertex;"5245"attribute vec4 gl_MultiTexCoord0;"5246"attribute vec4 gl_MultiTexCoord1;"5247"attribute vec4 gl_MultiTexCoord2;"5248"attribute vec4 gl_MultiTexCoord3;"5249"attribute vec4 gl_MultiTexCoord4;"5250"attribute vec4 gl_MultiTexCoord5;"5251"attribute vec4 gl_MultiTexCoord6;"5252"attribute vec4 gl_MultiTexCoord7;"5253"attribute float gl_FogCoord;"5254"\n");5255} else if (IncludeLegacy(version, profile, spvVersion)) {5256stageBuiltins[EShLangVertex].append(5257"in vec4 gl_Color;"5258"in vec4 gl_SecondaryColor;"5259"in vec3 gl_Normal;"5260"in vec4 gl_Vertex;"5261"in vec4 gl_MultiTexCoord0;"5262"in vec4 gl_MultiTexCoord1;"5263"in vec4 gl_MultiTexCoord2;"5264"in vec4 gl_MultiTexCoord3;"5265"in vec4 gl_MultiTexCoord4;"5266"in vec4 gl_MultiTexCoord5;"5267"in vec4 gl_MultiTexCoord6;"5268"in vec4 gl_MultiTexCoord7;"5269"in float gl_FogCoord;"5270"\n");5271}52725273if (version < 150) {5274if (version < 130) {5275stageBuiltins[EShLangVertex].append(5276" vec4 gl_ClipVertex;" // needs qualifier fixed later5277"varying vec4 gl_FrontColor;"5278"varying vec4 gl_BackColor;"5279"varying vec4 gl_FrontSecondaryColor;"5280"varying vec4 gl_BackSecondaryColor;"5281"varying vec4 gl_TexCoord[];"5282"varying float gl_FogFragCoord;"5283"\n");5284} else if (IncludeLegacy(version, profile, spvVersion)) {5285stageBuiltins[EShLangVertex].append(5286" vec4 gl_ClipVertex;" // needs qualifier fixed later5287"out vec4 gl_FrontColor;"5288"out vec4 gl_BackColor;"5289"out vec4 gl_FrontSecondaryColor;"5290"out vec4 gl_BackSecondaryColor;"5291"out vec4 gl_TexCoord[];"5292"out float gl_FogFragCoord;"5293"\n");5294}5295stageBuiltins[EShLangVertex].append(5296"vec4 gl_Position;" // needs qualifier fixed later5297"float gl_PointSize;" // needs qualifier fixed later5298);52995300if (version == 130 || version == 140)5301stageBuiltins[EShLangVertex].append(5302"out float gl_ClipDistance[];"5303);5304} else {5305// version >= 1505306stageBuiltins[EShLangVertex].append(5307"out gl_PerVertex {"5308"vec4 gl_Position;" // needs qualifier fixed later5309"float gl_PointSize;" // needs qualifier fixed later5310"float gl_ClipDistance[];"5311);5312if (IncludeLegacy(version, profile, spvVersion))5313stageBuiltins[EShLangVertex].append(5314"vec4 gl_ClipVertex;" // needs qualifier fixed later5315"vec4 gl_FrontColor;"5316"vec4 gl_BackColor;"5317"vec4 gl_FrontSecondaryColor;"5318"vec4 gl_BackSecondaryColor;"5319"vec4 gl_TexCoord[];"5320"float gl_FogFragCoord;"5321);5322if (version >= 450)5323stageBuiltins[EShLangVertex].append(5324"float gl_CullDistance[];"5325);5326stageBuiltins[EShLangVertex].append(5327"};"5328"\n");5329}5330if (version >= 130 && spvVersion.vulkan == 0)5331stageBuiltins[EShLangVertex].append(5332"int gl_VertexID;" // needs qualifier fixed later5333);5334if (spvVersion.vulkan == 0)5335stageBuiltins[EShLangVertex].append(5336"int gl_InstanceID;" // needs qualifier fixed later5337);5338if (spvVersion.vulkan > 0 && version >= 140)5339stageBuiltins[EShLangVertex].append(5340"in int gl_VertexIndex;"5341"in int gl_InstanceIndex;"5342);53435344if (spvVersion.vulkan > 0 && version >= 140 && spvVersion.vulkanRelaxed)5345stageBuiltins[EShLangVertex].append(5346"in int gl_VertexID;" // declare with 'in' qualifier5347"in int gl_InstanceID;"5348);53495350if (version >= 440) {5351stageBuiltins[EShLangVertex].append(5352"in int gl_BaseVertexARB;"5353"in int gl_BaseInstanceARB;"5354"in int gl_DrawIDARB;"5355);5356}5357if (version >= 410) {5358stageBuiltins[EShLangVertex].append(5359"out int gl_ViewportIndex;"5360"out int gl_Layer;"5361);5362}5363if (version >= 460) {5364stageBuiltins[EShLangVertex].append(5365"in int gl_BaseVertex;"5366"in int gl_BaseInstance;"5367"in int gl_DrawID;"5368);5369}53705371if (version >= 430)5372stageBuiltins[EShLangVertex].append(5373"out int gl_ViewportMask[];" // GL_NV_viewport_array25374);53755376if (version >= 450)5377stageBuiltins[EShLangVertex].append(5378"out int gl_SecondaryViewportMaskNV[];" // GL_NV_stereo_view_rendering5379"out vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering5380"out vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes5381"out int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes5382);5383} else {5384// ES profile5385if (version == 100) {5386stageBuiltins[EShLangVertex].append(5387"highp vec4 gl_Position;" // needs qualifier fixed later5388"mediump float gl_PointSize;" // needs qualifier fixed later5389"highp int gl_InstanceID;" // needs qualifier fixed later5390);5391} else {5392if (spvVersion.vulkan == 0 || spvVersion.vulkanRelaxed)5393stageBuiltins[EShLangVertex].append(5394"in highp int gl_VertexID;" // needs qualifier fixed later5395"in highp int gl_InstanceID;" // needs qualifier fixed later5396);5397if (spvVersion.vulkan > 0)5398stageBuiltins[EShLangVertex].append(5399"in highp int gl_VertexIndex;"5400"in highp int gl_InstanceIndex;"5401);5402if (version < 310)5403stageBuiltins[EShLangVertex].append(5404"highp vec4 gl_Position;" // needs qualifier fixed later5405"highp float gl_PointSize;" // needs qualifier fixed later5406);5407else5408stageBuiltins[EShLangVertex].append(5409"out gl_PerVertex {"5410"highp vec4 gl_Position;" // needs qualifier fixed later5411"highp float gl_PointSize;" // needs qualifier fixed later5412"};"5413);5414}5415}54165417if ((profile != EEsProfile && version >= 140) ||5418(profile == EEsProfile && version >= 310)) {5419stageBuiltins[EShLangVertex].append(5420"in highp int gl_DeviceIndex;" // GL_EXT_device_group5421"in highp int gl_ViewIndex;" // GL_EXT_multiview5422"\n");5423}54245425if (version >= 300 /* both ES and non-ES */) {5426stageBuiltins[EShLangVertex].append(5427"in highp uint gl_ViewID_OVR;" // GL_OVR_multiview, GL_OVR_multiview25428"\n");5429}54305431if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 310)) {5432stageBuiltins[EShLangVertex].append(5433"out highp int gl_PrimitiveShadingRateEXT;" // GL_EXT_fragment_shading_rate5434"\n");5435}54365437//============================================================================5438//5439// Define the interface to the geometry shader.5440//5441//============================================================================54425443if (profile == ECoreProfile || profile == ECompatibilityProfile) {5444stageBuiltins[EShLangGeometry].append(5445"in gl_PerVertex {"5446"vec4 gl_Position;"5447"float gl_PointSize;"5448"float gl_ClipDistance[];"5449);5450if (profile == ECompatibilityProfile)5451stageBuiltins[EShLangGeometry].append(5452"vec4 gl_ClipVertex;"5453"vec4 gl_FrontColor;"5454"vec4 gl_BackColor;"5455"vec4 gl_FrontSecondaryColor;"5456"vec4 gl_BackSecondaryColor;"5457"vec4 gl_TexCoord[];"5458"float gl_FogFragCoord;"5459);5460if (version >= 450)5461stageBuiltins[EShLangGeometry].append(5462"float gl_CullDistance[];"5463"vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering5464"vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes5465);5466stageBuiltins[EShLangGeometry].append(5467"} gl_in[];"54685469"in int gl_PrimitiveIDIn;"5470"out gl_PerVertex {"5471"vec4 gl_Position;"5472"float gl_PointSize;"5473"float gl_ClipDistance[];"5474"\n");5475if (profile == ECompatibilityProfile && version >= 400)5476stageBuiltins[EShLangGeometry].append(5477"vec4 gl_ClipVertex;"5478"vec4 gl_FrontColor;"5479"vec4 gl_BackColor;"5480"vec4 gl_FrontSecondaryColor;"5481"vec4 gl_BackSecondaryColor;"5482"vec4 gl_TexCoord[];"5483"float gl_FogFragCoord;"5484);5485if (version >= 450)5486stageBuiltins[EShLangGeometry].append(5487"float gl_CullDistance[];"5488);5489stageBuiltins[EShLangGeometry].append(5490"};"54915492"out int gl_PrimitiveID;"5493"out int gl_Layer;");54945495if (version >= 150)5496stageBuiltins[EShLangGeometry].append(5497"out int gl_ViewportIndex;"5498);54995500if (profile == ECompatibilityProfile && version < 400)5501stageBuiltins[EShLangGeometry].append(5502"out vec4 gl_ClipVertex;"5503);55045505if (version >= 400)5506stageBuiltins[EShLangGeometry].append(5507"in int gl_InvocationID;"5508);55095510if (version >= 430)5511stageBuiltins[EShLangGeometry].append(5512"out int gl_ViewportMask[];" // GL_NV_viewport_array25513);55145515if (version >= 450)5516stageBuiltins[EShLangGeometry].append(5517"out int gl_SecondaryViewportMaskNV[];" // GL_NV_stereo_view_rendering5518"out vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering5519"out vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes5520"out int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes5521);55225523stageBuiltins[EShLangGeometry].append("\n");5524} else if (profile == EEsProfile && version >= 310) {5525stageBuiltins[EShLangGeometry].append(5526"in gl_PerVertex {"5527"highp vec4 gl_Position;"5528"highp float gl_PointSize;"5529"} gl_in[];"5530"\n"5531"in highp int gl_PrimitiveIDIn;"5532"in highp int gl_InvocationID;"5533"\n"5534"out gl_PerVertex {"5535"highp vec4 gl_Position;"5536"highp float gl_PointSize;"5537"};"5538"\n"5539"out highp int gl_PrimitiveID;"5540"out highp int gl_Layer;"5541"\n"5542);5543}55445545if ((profile != EEsProfile && version >= 140) ||5546(profile == EEsProfile && version >= 310)) {5547stageBuiltins[EShLangGeometry].append(5548"in highp int gl_DeviceIndex;" // GL_EXT_device_group5549"in highp int gl_ViewIndex;" // GL_EXT_multiview5550"\n");5551}55525553if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 310)) {5554stageBuiltins[EShLangGeometry].append(5555"out highp int gl_PrimitiveShadingRateEXT;" // GL_EXT_fragment_shading_rate5556"\n");5557}55585559//============================================================================5560//5561// Define the interface to the tessellation control shader.5562//5563//============================================================================55645565if (profile != EEsProfile && version >= 150) {5566// Note: "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below,5567// as it depends on the resource sizing of gl_MaxPatchVertices.55685569stageBuiltins[EShLangTessControl].append(5570"in int gl_PatchVerticesIn;"5571"in int gl_PrimitiveID;"5572"in int gl_InvocationID;"55735574"out gl_PerVertex {"5575"vec4 gl_Position;"5576"float gl_PointSize;"5577"float gl_ClipDistance[];"5578);5579if (profile == ECompatibilityProfile)5580stageBuiltins[EShLangTessControl].append(5581"vec4 gl_ClipVertex;"5582"vec4 gl_FrontColor;"5583"vec4 gl_BackColor;"5584"vec4 gl_FrontSecondaryColor;"5585"vec4 gl_BackSecondaryColor;"5586"vec4 gl_TexCoord[];"5587"float gl_FogFragCoord;"5588);5589if (version >= 450)5590stageBuiltins[EShLangTessControl].append(5591"float gl_CullDistance[];"5592);5593if (version >= 430)5594stageBuiltins[EShLangTessControl].append(5595"int gl_ViewportMask[];" // GL_NV_viewport_array25596);5597if (version >= 450)5598stageBuiltins[EShLangTessControl].append(5599"vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering5600"int gl_SecondaryViewportMaskNV[];" // GL_NV_stereo_view_rendering5601"vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes5602"int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes5603);5604stageBuiltins[EShLangTessControl].append(5605"} gl_out[];"56065607"patch out float gl_TessLevelOuter[4];"5608"patch out float gl_TessLevelInner[2];"5609"\n");56105611if (version >= 410)5612stageBuiltins[EShLangTessControl].append(5613"out int gl_ViewportIndex;"5614"out int gl_Layer;"5615"\n");56165617} else {5618// Note: "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below,5619// as it depends on the resource sizing of gl_MaxPatchVertices.56205621stageBuiltins[EShLangTessControl].append(5622"in highp int gl_PatchVerticesIn;"5623"in highp int gl_PrimitiveID;"5624"in highp int gl_InvocationID;"56255626"out gl_PerVertex {"5627"highp vec4 gl_Position;"5628"highp float gl_PointSize;"5629);5630stageBuiltins[EShLangTessControl].append(5631"} gl_out[];"56325633"patch out highp float gl_TessLevelOuter[4];"5634"patch out highp float gl_TessLevelInner[2];"5635"patch out highp vec4 gl_BoundingBoxOES[2];"5636"patch out highp vec4 gl_BoundingBoxEXT[2];"5637"\n");5638if (profile == EEsProfile && version >= 320) {5639stageBuiltins[EShLangTessControl].append(5640"patch out highp vec4 gl_BoundingBox[2];"5641"\n"5642);5643}5644}56455646if ((profile != EEsProfile && version >= 140) ||5647(profile == EEsProfile && version >= 310)) {5648stageBuiltins[EShLangTessControl].append(5649"in highp int gl_DeviceIndex;" // GL_EXT_device_group5650"in highp int gl_ViewIndex;" // GL_EXT_multiview5651"\n");5652}56535654//============================================================================5655//5656// Define the interface to the tessellation evaluation shader.5657//5658//============================================================================56595660if (profile != EEsProfile && version >= 150) {5661// Note: "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below,5662// as it depends on the resource sizing of gl_MaxPatchVertices.56635664stageBuiltins[EShLangTessEvaluation].append(5665"in int gl_PatchVerticesIn;"5666"in int gl_PrimitiveID;"5667"in vec3 gl_TessCoord;"56685669"patch in float gl_TessLevelOuter[4];"5670"patch in float gl_TessLevelInner[2];"56715672"out gl_PerVertex {"5673"vec4 gl_Position;"5674"float gl_PointSize;"5675"float gl_ClipDistance[];"5676);5677if (version >= 400 && profile == ECompatibilityProfile)5678stageBuiltins[EShLangTessEvaluation].append(5679"vec4 gl_ClipVertex;"5680"vec4 gl_FrontColor;"5681"vec4 gl_BackColor;"5682"vec4 gl_FrontSecondaryColor;"5683"vec4 gl_BackSecondaryColor;"5684"vec4 gl_TexCoord[];"5685"float gl_FogFragCoord;"5686);5687if (version >= 450)5688stageBuiltins[EShLangTessEvaluation].append(5689"float gl_CullDistance[];"5690);5691stageBuiltins[EShLangTessEvaluation].append(5692"};"5693"\n");56945695if (version >= 410)5696stageBuiltins[EShLangTessEvaluation].append(5697"out int gl_ViewportIndex;"5698"out int gl_Layer;"5699"\n");57005701if (version >= 430)5702stageBuiltins[EShLangTessEvaluation].append(5703"out int gl_ViewportMask[];" // GL_NV_viewport_array25704);57055706if (version >= 450)5707stageBuiltins[EShLangTessEvaluation].append(5708"out vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering5709"out int gl_SecondaryViewportMaskNV[];" // GL_NV_stereo_view_rendering5710"out vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes5711"out int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes5712);57135714} else if (profile == EEsProfile && version >= 310) {5715// Note: "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below,5716// as it depends on the resource sizing of gl_MaxPatchVertices.57175718stageBuiltins[EShLangTessEvaluation].append(5719"in highp int gl_PatchVerticesIn;"5720"in highp int gl_PrimitiveID;"5721"in highp vec3 gl_TessCoord;"57225723"patch in highp float gl_TessLevelOuter[4];"5724"patch in highp float gl_TessLevelInner[2];"57255726"out gl_PerVertex {"5727"highp vec4 gl_Position;"5728"highp float gl_PointSize;"5729);5730stageBuiltins[EShLangTessEvaluation].append(5731"};"5732"\n");5733}57345735if ((profile != EEsProfile && version >= 140) ||5736(profile == EEsProfile && version >= 310)) {5737stageBuiltins[EShLangTessEvaluation].append(5738"in highp int gl_DeviceIndex;" // GL_EXT_device_group5739"in highp int gl_ViewIndex;" // GL_EXT_multiview5740"\n");5741}57425743//============================================================================5744//5745// Define the interface to the fragment shader.5746//5747//============================================================================57485749if (profile != EEsProfile) {57505751stageBuiltins[EShLangFragment].append(5752"vec4 gl_FragCoord;" // needs qualifier fixed later5753"bool gl_FrontFacing;" // needs qualifier fixed later5754"float gl_FragDepth;" // needs qualifier fixed later5755);5756if (version >= 120)5757stageBuiltins[EShLangFragment].append(5758"vec2 gl_PointCoord;" // needs qualifier fixed later5759);5760if (version >= 140)5761stageBuiltins[EShLangFragment].append(5762"out int gl_FragStencilRefARB;"5763);5764if (IncludeLegacy(version, profile, spvVersion) || (! ForwardCompatibility && version < 420))5765stageBuiltins[EShLangFragment].append(5766"vec4 gl_FragColor;" // needs qualifier fixed later5767);57685769if (version < 130) {5770stageBuiltins[EShLangFragment].append(5771"varying vec4 gl_Color;"5772"varying vec4 gl_SecondaryColor;"5773"varying vec4 gl_TexCoord[];"5774"varying float gl_FogFragCoord;"5775);5776} else {5777stageBuiltins[EShLangFragment].append(5778"in float gl_ClipDistance[];"5779);57805781if (IncludeLegacy(version, profile, spvVersion)) {5782if (version < 150)5783stageBuiltins[EShLangFragment].append(5784"in float gl_FogFragCoord;"5785"in vec4 gl_TexCoord[];"5786"in vec4 gl_Color;"5787"in vec4 gl_SecondaryColor;"5788);5789else5790stageBuiltins[EShLangFragment].append(5791"in gl_PerFragment {"5792"in float gl_FogFragCoord;"5793"in vec4 gl_TexCoord[];"5794"in vec4 gl_Color;"5795"in vec4 gl_SecondaryColor;"5796"};"5797);5798}5799}58005801if (version >= 150)5802stageBuiltins[EShLangFragment].append(5803"flat in int gl_PrimitiveID;"5804);58055806if (version >= 130) { // ARB_sample_shading5807stageBuiltins[EShLangFragment].append(5808"flat in int gl_SampleID;"5809" in vec2 gl_SamplePosition;"5810" out int gl_SampleMask[];"5811);58125813if (spvVersion.spv == 0) {5814stageBuiltins[EShLangFragment].append(5815"uniform int gl_NumSamples;"5816);5817}5818}58195820if (version >= 400)5821stageBuiltins[EShLangFragment].append(5822"flat in int gl_SampleMaskIn[];"5823);58245825if (version >= 430)5826stageBuiltins[EShLangFragment].append(5827"flat in int gl_Layer;"5828"flat in int gl_ViewportIndex;"5829);58305831if (version >= 450)5832stageBuiltins[EShLangFragment].append(5833"in float gl_CullDistance[];"5834"bool gl_HelperInvocation;" // needs qualifier fixed later5835);58365837if (version >= 450)5838stageBuiltins[EShLangFragment].append( // GL_EXT_fragment_invocation_density5839"flat in ivec2 gl_FragSizeEXT;"5840"flat in int gl_FragInvocationCountEXT;"5841);58425843if (version >= 450)5844stageBuiltins[EShLangFragment].append(5845"in vec2 gl_BaryCoordNoPerspAMD;"5846"in vec2 gl_BaryCoordNoPerspCentroidAMD;"5847"in vec2 gl_BaryCoordNoPerspSampleAMD;"5848"in vec2 gl_BaryCoordSmoothAMD;"5849"in vec2 gl_BaryCoordSmoothCentroidAMD;"5850"in vec2 gl_BaryCoordSmoothSampleAMD;"5851"in vec3 gl_BaryCoordPullModelAMD;"5852);58535854if (version >= 430)5855stageBuiltins[EShLangFragment].append(5856"in bool gl_FragFullyCoveredNV;"5857);5858if (version >= 450)5859stageBuiltins[EShLangFragment].append(5860"flat in ivec2 gl_FragmentSizeNV;" // GL_NV_shading_rate_image5861"flat in int gl_InvocationsPerPixelNV;"5862"in vec3 gl_BaryCoordNV;" // GL_NV_fragment_shader_barycentric5863"in vec3 gl_BaryCoordNoPerspNV;"5864"in vec3 gl_BaryCoordEXT;" // GL_EXT_fragment_shader_barycentric5865"in vec3 gl_BaryCoordNoPerspEXT;"5866);58675868if (version >= 450)5869stageBuiltins[EShLangFragment].append(5870"flat in int gl_ShadingRateEXT;" // GL_EXT_fragment_shading_rate5871);58725873} else {5874// ES profile58755876if (version == 100) {5877stageBuiltins[EShLangFragment].append(5878"mediump vec4 gl_FragCoord;" // needs qualifier fixed later5879" bool gl_FrontFacing;" // needs qualifier fixed later5880"mediump vec4 gl_FragColor;" // needs qualifier fixed later5881"mediump vec2 gl_PointCoord;" // needs qualifier fixed later5882);5883}5884if (version >= 300) {5885stageBuiltins[EShLangFragment].append(5886"highp vec4 gl_FragCoord;" // needs qualifier fixed later5887" bool gl_FrontFacing;" // needs qualifier fixed later5888"mediump vec2 gl_PointCoord;" // needs qualifier fixed later5889"highp float gl_FragDepth;" // needs qualifier fixed later5890);5891}5892if (version >= 310) {5893stageBuiltins[EShLangFragment].append(5894"bool gl_HelperInvocation;" // needs qualifier fixed later5895"flat in highp int gl_PrimitiveID;" // needs qualifier fixed later5896"flat in highp int gl_Layer;" // needs qualifier fixed later5897);58985899stageBuiltins[EShLangFragment].append( // GL_OES_sample_variables5900"flat in lowp int gl_SampleID;"5901" in mediump vec2 gl_SamplePosition;"5902"flat in highp int gl_SampleMaskIn[];"5903" out highp int gl_SampleMask[];"5904);5905if (spvVersion.spv == 0)5906stageBuiltins[EShLangFragment].append( // GL_OES_sample_variables5907"uniform lowp int gl_NumSamples;"5908);5909}5910stageBuiltins[EShLangFragment].append(5911"highp float gl_FragDepthEXT;" // GL_EXT_frag_depth5912);59135914if (version >= 310)5915stageBuiltins[EShLangFragment].append( // GL_EXT_fragment_invocation_density5916"flat in ivec2 gl_FragSizeEXT;"5917"flat in int gl_FragInvocationCountEXT;"5918);5919if (version >= 320)5920stageBuiltins[EShLangFragment].append( // GL_NV_shading_rate_image5921"flat in ivec2 gl_FragmentSizeNV;"5922"flat in int gl_InvocationsPerPixelNV;"5923);5924if (version >= 320)5925stageBuiltins[EShLangFragment].append(5926"in vec3 gl_BaryCoordNV;"5927"in vec3 gl_BaryCoordNoPerspNV;"5928"in vec3 gl_BaryCoordEXT;"5929"in vec3 gl_BaryCoordNoPerspEXT;"5930);5931if (version >= 310)5932stageBuiltins[EShLangFragment].append(5933"flat in highp int gl_ShadingRateEXT;" // GL_EXT_fragment_shading_rate5934);5935}59365937stageBuiltins[EShLangFragment].append("\n");59385939if (version >= 130)5940add2ndGenerationSamplingImaging(version, profile, spvVersion);59415942if ((profile != EEsProfile && version >= 140) ||5943(profile == EEsProfile && version >= 310)) {5944stageBuiltins[EShLangFragment].append(5945"flat in highp int gl_DeviceIndex;" // GL_EXT_device_group5946"flat in highp int gl_ViewIndex;" // GL_EXT_multiview5947"\n");5948}59495950if (version >= 300 /* both ES and non-ES */) {5951stageBuiltins[EShLangFragment].append(5952"flat in highp uint gl_ViewID_OVR;" // GL_OVR_multiview, GL_OVR_multiview25953"\n");5954}59555956// GL_ARB_shader_ballot5957if (profile != EEsProfile && version >= 450) {5958const char* ballotDecls =5959"uniform uint gl_SubGroupSizeARB;"5960"in uint gl_SubGroupInvocationARB;"5961"in uint64_t gl_SubGroupEqMaskARB;"5962"in uint64_t gl_SubGroupGeMaskARB;"5963"in uint64_t gl_SubGroupGtMaskARB;"5964"in uint64_t gl_SubGroupLeMaskARB;"5965"in uint64_t gl_SubGroupLtMaskARB;"5966"\n";5967const char* rtBallotDecls =5968"uniform volatile uint gl_SubGroupSizeARB;"5969"in volatile uint gl_SubGroupInvocationARB;"5970"in volatile uint64_t gl_SubGroupEqMaskARB;"5971"in volatile uint64_t gl_SubGroupGeMaskARB;"5972"in volatile uint64_t gl_SubGroupGtMaskARB;"5973"in volatile uint64_t gl_SubGroupLeMaskARB;"5974"in volatile uint64_t gl_SubGroupLtMaskARB;"5975"\n";5976const char* fragmentBallotDecls =5977"uniform uint gl_SubGroupSizeARB;"5978"flat in uint gl_SubGroupInvocationARB;"5979"flat in uint64_t gl_SubGroupEqMaskARB;"5980"flat in uint64_t gl_SubGroupGeMaskARB;"5981"flat in uint64_t gl_SubGroupGtMaskARB;"5982"flat in uint64_t gl_SubGroupLeMaskARB;"5983"flat in uint64_t gl_SubGroupLtMaskARB;"5984"\n";5985stageBuiltins[EShLangVertex] .append(ballotDecls);5986stageBuiltins[EShLangTessControl] .append(ballotDecls);5987stageBuiltins[EShLangTessEvaluation].append(ballotDecls);5988stageBuiltins[EShLangGeometry] .append(ballotDecls);5989stageBuiltins[EShLangCompute] .append(ballotDecls);5990stageBuiltins[EShLangFragment] .append(fragmentBallotDecls);5991stageBuiltins[EShLangMesh] .append(ballotDecls);5992stageBuiltins[EShLangTask] .append(ballotDecls);5993stageBuiltins[EShLangRayGen] .append(rtBallotDecls);5994stageBuiltins[EShLangIntersect] .append(rtBallotDecls);5995// No volatile qualifier on these builtins in any-hit5996stageBuiltins[EShLangAnyHit] .append(ballotDecls);5997stageBuiltins[EShLangClosestHit] .append(rtBallotDecls);5998stageBuiltins[EShLangMiss] .append(rtBallotDecls);5999stageBuiltins[EShLangCallable] .append(rtBallotDecls);6000}60016002// GL_KHR_shader_subgroup6003if ((profile == EEsProfile && version >= 310) ||6004(profile != EEsProfile && version >= 140)) {6005const char* subgroupDecls =6006"in mediump uint gl_SubgroupSize;"6007"in mediump uint gl_SubgroupInvocationID;"6008"in highp uvec4 gl_SubgroupEqMask;"6009"in highp uvec4 gl_SubgroupGeMask;"6010"in highp uvec4 gl_SubgroupGtMask;"6011"in highp uvec4 gl_SubgroupLeMask;"6012"in highp uvec4 gl_SubgroupLtMask;"6013// GL_NV_shader_sm_builtins6014"in highp uint gl_WarpsPerSMNV;"6015"in highp uint gl_SMCountNV;"6016"in highp uint gl_WarpIDNV;"6017"in highp uint gl_SMIDNV;"6018// GL_ARM_shader_core_builtins6019"in highp uint gl_CoreIDARM;"6020"in highp uint gl_CoreCountARM;"6021"in highp uint gl_CoreMaxIDARM;"6022"in highp uint gl_WarpIDARM;"6023"in highp uint gl_WarpMaxIDARM;"6024"\n";6025const char* fragmentSubgroupDecls =6026"flat in mediump uint gl_SubgroupSize;"6027"flat in mediump uint gl_SubgroupInvocationID;"6028"flat in highp uvec4 gl_SubgroupEqMask;"6029"flat in highp uvec4 gl_SubgroupGeMask;"6030"flat in highp uvec4 gl_SubgroupGtMask;"6031"flat in highp uvec4 gl_SubgroupLeMask;"6032"flat in highp uvec4 gl_SubgroupLtMask;"6033// GL_NV_shader_sm_builtins6034"flat in highp uint gl_WarpsPerSMNV;"6035"flat in highp uint gl_SMCountNV;"6036"flat in highp uint gl_WarpIDNV;"6037"flat in highp uint gl_SMIDNV;"6038// GL_ARM_shader_core_builtins6039"flat in highp uint gl_CoreIDARM;"6040"flat in highp uint gl_CoreCountARM;"6041"flat in highp uint gl_CoreMaxIDARM;"6042"flat in highp uint gl_WarpIDARM;"6043"flat in highp uint gl_WarpMaxIDARM;"6044"\n";6045const char* computeSubgroupDecls =6046"in highp uint gl_NumSubgroups;"6047"in highp uint gl_SubgroupID;"6048"\n";6049// These builtins are volatile for RT stages6050const char* rtSubgroupDecls =6051"in mediump volatile uint gl_SubgroupSize;"6052"in mediump volatile uint gl_SubgroupInvocationID;"6053"in highp volatile uvec4 gl_SubgroupEqMask;"6054"in highp volatile uvec4 gl_SubgroupGeMask;"6055"in highp volatile uvec4 gl_SubgroupGtMask;"6056"in highp volatile uvec4 gl_SubgroupLeMask;"6057"in highp volatile uvec4 gl_SubgroupLtMask;"6058// GL_NV_shader_sm_builtins6059"in highp uint gl_WarpsPerSMNV;"6060"in highp uint gl_SMCountNV;"6061"in highp volatile uint gl_WarpIDNV;"6062"in highp volatile uint gl_SMIDNV;"6063// GL_ARM_shader_core_builtins6064"in highp uint gl_CoreIDARM;"6065"in highp uint gl_CoreCountARM;"6066"in highp uint gl_CoreMaxIDARM;"6067"in highp uint gl_WarpIDARM;"6068"in highp uint gl_WarpMaxIDARM;"6069"\n";60706071stageBuiltins[EShLangVertex] .append(subgroupDecls);6072stageBuiltins[EShLangTessControl] .append(subgroupDecls);6073stageBuiltins[EShLangTessEvaluation].append(subgroupDecls);6074stageBuiltins[EShLangGeometry] .append(subgroupDecls);6075stageBuiltins[EShLangCompute] .append(subgroupDecls);6076stageBuiltins[EShLangCompute] .append(computeSubgroupDecls);6077stageBuiltins[EShLangFragment] .append(fragmentSubgroupDecls);6078stageBuiltins[EShLangMesh] .append(subgroupDecls);6079stageBuiltins[EShLangMesh] .append(computeSubgroupDecls);6080stageBuiltins[EShLangTask] .append(subgroupDecls);6081stageBuiltins[EShLangTask] .append(computeSubgroupDecls);6082stageBuiltins[EShLangRayGen] .append(rtSubgroupDecls);6083stageBuiltins[EShLangIntersect] .append(rtSubgroupDecls);6084// No volatile qualifier on these builtins in any-hit6085stageBuiltins[EShLangAnyHit] .append(subgroupDecls);6086stageBuiltins[EShLangClosestHit] .append(rtSubgroupDecls);6087stageBuiltins[EShLangMiss] .append(rtSubgroupDecls);6088stageBuiltins[EShLangCallable] .append(rtSubgroupDecls);6089}60906091// GL_NV_ray_tracing/GL_EXT_ray_tracing6092if (profile != EEsProfile && version >= 460) {60936094const char *constRayFlags =6095"const uint gl_RayFlagsNoneNV = 0U;"6096"const uint gl_RayFlagsNoneEXT = 0U;"6097"const uint gl_RayFlagsOpaqueNV = 1U;"6098"const uint gl_RayFlagsOpaqueEXT = 1U;"6099"const uint gl_RayFlagsNoOpaqueNV = 2U;"6100"const uint gl_RayFlagsNoOpaqueEXT = 2U;"6101"const uint gl_RayFlagsTerminateOnFirstHitNV = 4U;"6102"const uint gl_RayFlagsTerminateOnFirstHitEXT = 4U;"6103"const uint gl_RayFlagsSkipClosestHitShaderNV = 8U;"6104"const uint gl_RayFlagsSkipClosestHitShaderEXT = 8U;"6105"const uint gl_RayFlagsCullBackFacingTrianglesNV = 16U;"6106"const uint gl_RayFlagsCullBackFacingTrianglesEXT = 16U;"6107"const uint gl_RayFlagsCullFrontFacingTrianglesNV = 32U;"6108"const uint gl_RayFlagsCullFrontFacingTrianglesEXT = 32U;"6109"const uint gl_RayFlagsCullOpaqueNV = 64U;"6110"const uint gl_RayFlagsCullOpaqueEXT = 64U;"6111"const uint gl_RayFlagsCullNoOpaqueNV = 128U;"6112"const uint gl_RayFlagsCullNoOpaqueEXT = 128U;"6113"const uint gl_RayFlagsSkipTrianglesEXT = 256U;"6114"const uint gl_RayFlagsSkipAABBEXT = 512U;"6115"const uint gl_RayFlagsForceOpacityMicromap2StateEXT = 1024U;"6116"const uint gl_HitKindFrontFacingTriangleEXT = 254U;"6117"const uint gl_HitKindBackFacingTriangleEXT = 255U;"6118"in uint gl_HitKindFrontFacingMicroTriangleNV;"6119"in uint gl_HitKindBackFacingMicroTriangleNV;"6120"\n";61216122const char *constRayQueryIntersection =6123"const uint gl_RayQueryCandidateIntersectionEXT = 0U;"6124"const uint gl_RayQueryCommittedIntersectionEXT = 1U;"6125"const uint gl_RayQueryCommittedIntersectionNoneEXT = 0U;"6126"const uint gl_RayQueryCommittedIntersectionTriangleEXT = 1U;"6127"const uint gl_RayQueryCommittedIntersectionGeneratedEXT = 2U;"6128"const uint gl_RayQueryCandidateIntersectionTriangleEXT = 0U;"6129"const uint gl_RayQueryCandidateIntersectionAABBEXT = 1U;"6130"\n";61316132const char *rayGenDecls =6133"in uvec3 gl_LaunchIDNV;"6134"in uvec3 gl_LaunchIDEXT;"6135"in uvec3 gl_LaunchSizeNV;"6136"in uvec3 gl_LaunchSizeEXT;"6137"\n";6138const char *intersectDecls =6139"in uvec3 gl_LaunchIDNV;"6140"in uvec3 gl_LaunchIDEXT;"6141"in uvec3 gl_LaunchSizeNV;"6142"in uvec3 gl_LaunchSizeEXT;"6143"in int gl_PrimitiveID;"6144"in int gl_InstanceID;"6145"in int gl_InstanceCustomIndexNV;"6146"in int gl_InstanceCustomIndexEXT;"6147"in int gl_GeometryIndexEXT;"6148"in vec3 gl_WorldRayOriginNV;"6149"in vec3 gl_WorldRayOriginEXT;"6150"in vec3 gl_WorldRayDirectionNV;"6151"in vec3 gl_WorldRayDirectionEXT;"6152"in vec3 gl_ObjectRayOriginNV;"6153"in vec3 gl_ObjectRayOriginEXT;"6154"in vec3 gl_ObjectRayDirectionNV;"6155"in vec3 gl_ObjectRayDirectionEXT;"6156"in float gl_RayTminNV;"6157"in float gl_RayTminEXT;"6158"in float gl_RayTmaxNV;"6159"in volatile float gl_RayTmaxEXT;"6160"in mat4x3 gl_ObjectToWorldNV;"6161"in mat4x3 gl_ObjectToWorldEXT;"6162"in mat3x4 gl_ObjectToWorld3x4EXT;"6163"in mat4x3 gl_WorldToObjectNV;"6164"in mat4x3 gl_WorldToObjectEXT;"6165"in mat3x4 gl_WorldToObject3x4EXT;"6166"in uint gl_IncomingRayFlagsNV;"6167"in uint gl_IncomingRayFlagsEXT;"6168"in float gl_CurrentRayTimeNV;"6169"in uint gl_CullMaskEXT;"6170"\n";6171const char *hitDecls =6172"in uvec3 gl_LaunchIDNV;"6173"in uvec3 gl_LaunchIDEXT;"6174"in uvec3 gl_LaunchSizeNV;"6175"in uvec3 gl_LaunchSizeEXT;"6176"in int gl_PrimitiveID;"6177"in int gl_InstanceID;"6178"in int gl_InstanceCustomIndexNV;"6179"in int gl_InstanceCustomIndexEXT;"6180"in int gl_GeometryIndexEXT;"6181"in vec3 gl_WorldRayOriginNV;"6182"in vec3 gl_WorldRayOriginEXT;"6183"in vec3 gl_WorldRayDirectionNV;"6184"in vec3 gl_WorldRayDirectionEXT;"6185"in vec3 gl_ObjectRayOriginNV;"6186"in vec3 gl_ObjectRayOriginEXT;"6187"in vec3 gl_ObjectRayDirectionNV;"6188"in vec3 gl_ObjectRayDirectionEXT;"6189"in float gl_RayTminNV;"6190"in float gl_RayTminEXT;"6191"in float gl_RayTmaxNV;"6192"in float gl_RayTmaxEXT;"6193"in float gl_HitTNV;"6194"in float gl_HitTEXT;"6195"in uint gl_HitKindNV;"6196"in uint gl_HitKindEXT;"6197"in mat4x3 gl_ObjectToWorldNV;"6198"in mat4x3 gl_ObjectToWorldEXT;"6199"in mat3x4 gl_ObjectToWorld3x4EXT;"6200"in mat4x3 gl_WorldToObjectNV;"6201"in mat4x3 gl_WorldToObjectEXT;"6202"in mat3x4 gl_WorldToObject3x4EXT;"6203"in uint gl_IncomingRayFlagsNV;"6204"in uint gl_IncomingRayFlagsEXT;"6205"in float gl_CurrentRayTimeNV;"6206"in uint gl_CullMaskEXT;"6207"in vec3 gl_HitTriangleVertexPositionsEXT[3];"6208"in vec3 gl_HitMicroTriangleVertexPositionsNV[3];"6209"in vec2 gl_HitMicroTriangleVertexBarycentricsNV[3];"6210"\n";62116212const char *missDecls =6213"in uvec3 gl_LaunchIDNV;"6214"in uvec3 gl_LaunchIDEXT;"6215"in uvec3 gl_LaunchSizeNV;"6216"in uvec3 gl_LaunchSizeEXT;"6217"in vec3 gl_WorldRayOriginNV;"6218"in vec3 gl_WorldRayOriginEXT;"6219"in vec3 gl_WorldRayDirectionNV;"6220"in vec3 gl_WorldRayDirectionEXT;"6221"in vec3 gl_ObjectRayOriginNV;"6222"in vec3 gl_ObjectRayDirectionNV;"6223"in float gl_RayTminNV;"6224"in float gl_RayTminEXT;"6225"in float gl_RayTmaxNV;"6226"in float gl_RayTmaxEXT;"6227"in uint gl_IncomingRayFlagsNV;"6228"in uint gl_IncomingRayFlagsEXT;"6229"in float gl_CurrentRayTimeNV;"6230"in uint gl_CullMaskEXT;"6231"\n";62326233const char *callableDecls =6234"in uvec3 gl_LaunchIDNV;"6235"in uvec3 gl_LaunchIDEXT;"6236"in uvec3 gl_LaunchSizeNV;"6237"in uvec3 gl_LaunchSizeEXT;"6238"\n";623962406241commonBuiltins.append(constRayQueryIntersection);6242commonBuiltins.append(constRayFlags);62436244stageBuiltins[EShLangRayGen].append(rayGenDecls);6245stageBuiltins[EShLangIntersect].append(intersectDecls);6246stageBuiltins[EShLangAnyHit].append(hitDecls);6247stageBuiltins[EShLangClosestHit].append(hitDecls);6248stageBuiltins[EShLangMiss].append(missDecls);6249stageBuiltins[EShLangCallable].append(callableDecls);62506251}62526253if ((profile != EEsProfile && version >= 140)) {6254const char *deviceIndex =6255"in highp int gl_DeviceIndex;" // GL_EXT_device_group6256"\n";62576258stageBuiltins[EShLangRayGen].append(deviceIndex);6259stageBuiltins[EShLangIntersect].append(deviceIndex);6260stageBuiltins[EShLangAnyHit].append(deviceIndex);6261stageBuiltins[EShLangClosestHit].append(deviceIndex);6262stageBuiltins[EShLangMiss].append(deviceIndex);6263}62646265if ((profile != EEsProfile && version >= 420) ||6266(profile == EEsProfile && version >= 310)) {6267commonBuiltins.append("const int gl_ScopeDevice = 1;\n");6268commonBuiltins.append("const int gl_ScopeWorkgroup = 2;\n");6269commonBuiltins.append("const int gl_ScopeSubgroup = 3;\n");6270commonBuiltins.append("const int gl_ScopeInvocation = 4;\n");6271commonBuiltins.append("const int gl_ScopeQueueFamily = 5;\n");6272commonBuiltins.append("const int gl_ScopeShaderCallEXT = 6;\n");62736274commonBuiltins.append("const int gl_SemanticsRelaxed = 0x0;\n");6275commonBuiltins.append("const int gl_SemanticsAcquire = 0x2;\n");6276commonBuiltins.append("const int gl_SemanticsRelease = 0x4;\n");6277commonBuiltins.append("const int gl_SemanticsAcquireRelease = 0x8;\n");6278commonBuiltins.append("const int gl_SemanticsMakeAvailable = 0x2000;\n");6279commonBuiltins.append("const int gl_SemanticsMakeVisible = 0x4000;\n");6280commonBuiltins.append("const int gl_SemanticsVolatile = 0x8000;\n");62816282commonBuiltins.append("const int gl_StorageSemanticsNone = 0x0;\n");6283commonBuiltins.append("const int gl_StorageSemanticsBuffer = 0x40;\n");6284commonBuiltins.append("const int gl_StorageSemanticsShared = 0x100;\n");6285commonBuiltins.append("const int gl_StorageSemanticsImage = 0x800;\n");6286commonBuiltins.append("const int gl_StorageSemanticsOutput = 0x1000;\n");6287}62886289// Adding these to common built-ins triggers an assert due to a memory corruption in related code when testing6290// So instead add to each stage individually, avoiding the GLSLang bug6291if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 310)) {6292for (int stage=EShLangVertex; stage<EShLangCount; stage++)6293{6294stageBuiltins[static_cast<EShLanguage>(stage)].append("const highp int gl_ShadingRateFlag2VerticalPixelsEXT = 1;\n");6295stageBuiltins[static_cast<EShLanguage>(stage)].append("const highp int gl_ShadingRateFlag4VerticalPixelsEXT = 2;\n");6296stageBuiltins[static_cast<EShLanguage>(stage)].append("const highp int gl_ShadingRateFlag2HorizontalPixelsEXT = 4;\n");6297stageBuiltins[static_cast<EShLanguage>(stage)].append("const highp int gl_ShadingRateFlag4HorizontalPixelsEXT = 8;\n");6298}6299}63006301// GL_EXT_shader_image_int646302if ((profile != EEsProfile && version >= 420) ||6303(profile == EEsProfile && version >= 310)) {63046305const TBasicType bTypes[] = { EbtInt64, EbtUint64 };6306for (int ms = 0; ms <= 1; ++ms) { // loop over "bool" multisample or not6307for (int arrayed = 0; arrayed <= 1; ++arrayed) { // loop over "bool" arrayed or not6308for (int dim = Esd1D; dim < EsdSubpass; ++dim) { // 1D, ..., buffer6309if ((dim == Esd1D || dim == EsdRect) && profile == EEsProfile)6310continue;63116312if ((dim == Esd3D || dim == EsdRect || dim == EsdBuffer) && arrayed)6313continue;63146315if (dim != Esd2D && ms)6316continue;63176318// Loop over the bTypes6319for (size_t bType = 0; bType < sizeof(bTypes)/sizeof(TBasicType); ++bType) {6320//6321// Now, make all the function prototypes for the type we just built...6322//6323TSampler sampler;63246325sampler.setImage(bTypes[bType], (TSamplerDim)dim, arrayed ? true : false,6326false,6327ms ? true : false);63286329TString typeName = sampler.getString();63306331addQueryFunctions(sampler, typeName, version, profile);6332addImageFunctions(sampler, typeName, version, profile);6333}6334}6335}6336}6337}63386339// printf("%s\n", commonBuiltins.c_str());6340// printf("%s\n", stageBuiltins[EShLangFragment].c_str());6341}63426343//6344// Helper function for initialize(), to add the second set of names for texturing,6345// when adding context-independent built-in functions.6346//6347void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, const SpvVersion& spvVersion)6348{6349//6350// In this function proper, enumerate the types, then calls the next set of functions6351// to enumerate all the uses for that type.6352//63536354// enumerate all the types6355const TBasicType bTypes[] = { EbtFloat, EbtInt, EbtUint,6356EbtFloat166357};6358bool skipBuffer = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 140);6359bool skipCubeArrayed = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 130);6360for (int image = 0; image <= 1; ++image) // loop over "bool" image vs sampler6361{6362for (int shadow = 0; shadow <= 1; ++shadow) { // loop over "bool" shadow or not6363for (int ms = 0; ms <= 1; ++ms) // loop over "bool" multisample or not6364{6365if ((ms || image) && shadow)6366continue;6367if (ms && profile != EEsProfile && version < 140)6368continue;6369if (ms && image && profile == EEsProfile)6370continue;6371if (ms && profile == EEsProfile && version < 310)6372continue;63736374for (int arrayed = 0; arrayed <= 1; ++arrayed) { // loop over "bool" arrayed or not6375for (int dim = Esd1D; dim < EsdNumDims; ++dim) { // 1D, ..., buffer, subpass6376if (dim == EsdAttachmentEXT)6377continue;6378if (dim == EsdSubpass && spvVersion.vulkan == 0)6379continue;6380if (dim == EsdSubpass && (image || shadow || arrayed))6381continue;6382if ((dim == Esd1D || dim == EsdRect) && profile == EEsProfile)6383continue;6384if (dim == EsdSubpass && spvVersion.vulkan == 0)6385continue;6386if (dim == EsdSubpass && (image || shadow || arrayed))6387continue;6388if ((dim == Esd1D || dim == EsdRect) && profile == EEsProfile)6389continue;6390if (dim != Esd2D && dim != EsdSubpass && ms)6391continue;6392if (dim == EsdBuffer && skipBuffer)6393continue;6394if (dim == EsdBuffer && (shadow || arrayed || ms))6395continue;6396if (ms && arrayed && profile == EEsProfile && version < 310)6397continue;6398if (dim == Esd3D && shadow)6399continue;6400if (dim == EsdCube && arrayed && skipCubeArrayed)6401continue;6402if ((dim == Esd3D || dim == EsdRect) && arrayed)6403continue;64046405// Loop over the bTypes6406for (size_t bType = 0; bType < sizeof(bTypes)/sizeof(TBasicType); ++bType) {6407if (bTypes[bType] == EbtFloat16 && (profile == EEsProfile || version < 450))6408continue;6409if (dim == EsdRect && version < 140 && bType > 0)6410continue;6411if (shadow && (bTypes[bType] == EbtInt || bTypes[bType] == EbtUint))6412continue;6413//6414// Now, make all the function prototypes for the type we just built...6415//6416TSampler sampler;6417if (dim == EsdSubpass) {6418sampler.setSubpass(bTypes[bType], ms ? true : false);6419} else if (dim == EsdAttachmentEXT) {6420sampler.setAttachmentEXT(bTypes[bType]);6421} else6422if (image) {6423sampler.setImage(bTypes[bType], (TSamplerDim)dim, arrayed ? true : false,6424shadow ? true : false,6425ms ? true : false);6426} else {6427sampler.set(bTypes[bType], (TSamplerDim)dim, arrayed ? true : false,6428shadow ? true : false,6429ms ? true : false);6430}64316432TString typeName = sampler.getString();64336434if (dim == EsdSubpass) {6435addSubpassSampling(sampler, typeName, version, profile);6436continue;6437}64386439addQueryFunctions(sampler, typeName, version, profile);64406441if (image)6442addImageFunctions(sampler, typeName, version, profile);6443else {6444addSamplingFunctions(sampler, typeName, version, profile);6445addGatherFunctions(sampler, typeName, version, profile);6446if (spvVersion.vulkan > 0 && sampler.isCombined() && !sampler.shadow) {6447// Base Vulkan allows texelFetch() for6448// textureBuffer (i.e. without sampler).6449//6450// GL_EXT_samplerless_texture_functions6451// allows texelFetch() and query functions6452// (other than textureQueryLod()) for all6453// texture types.6454sampler.setTexture(sampler.type, sampler.dim, sampler.arrayed, sampler.shadow,6455sampler.ms);6456TString textureTypeName = sampler.getString();6457addSamplingFunctions(sampler, textureTypeName, version, profile);6458addQueryFunctions(sampler, textureTypeName, version, profile);6459}6460}6461}6462}6463}6464}6465}6466}64676468//6469// sparseTexelsResidentARB()6470//6471if (profile != EEsProfile && version >= 450) {6472commonBuiltins.append("bool sparseTexelsResidentARB(int code);\n");6473}6474}64756476//6477// Helper function for add2ndGenerationSamplingImaging(),6478// when adding context-independent built-in functions.6479//6480// Add all the query functions for the given type.6481//6482void TBuiltIns::addQueryFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile)6483{6484//6485// textureSize() and imageSize()6486//64876488int sizeDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0) - (sampler.dim == EsdCube ? 1 : 0);64896490if (sampler.isImage() && ((profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 420)))6491return;64926493if (profile == EEsProfile)6494commonBuiltins.append("highp ");6495if (sizeDims == 1)6496commonBuiltins.append("int");6497else {6498commonBuiltins.append("ivec");6499commonBuiltins.append(postfixes[sizeDims]);6500}6501if (sampler.isImage())6502commonBuiltins.append(" imageSize(readonly writeonly volatile coherent ");6503else6504commonBuiltins.append(" textureSize(");6505commonBuiltins.append(typeName);6506if (! sampler.isImage() && ! sampler.isRect() && ! sampler.isBuffer() && ! sampler.isMultiSample())6507commonBuiltins.append(",int);\n");6508else6509commonBuiltins.append(");\n");65106511//6512// textureSamples() and imageSamples()6513//65146515// GL_ARB_shader_texture_image_samples6516// TODO: spec issue? there are no memory qualifiers; how to query a writeonly/readonly image, etc?6517if (profile != EEsProfile && version >= 430 && sampler.isMultiSample()) {6518commonBuiltins.append("int ");6519if (sampler.isImage())6520commonBuiltins.append("imageSamples(readonly writeonly volatile coherent ");6521else6522commonBuiltins.append("textureSamples(");6523commonBuiltins.append(typeName);6524commonBuiltins.append(");\n");6525}65266527//6528// textureQueryLod(), fragment stage only6529// Also enabled with extension GL_ARB_texture_query_lod6530// Extension GL_ARB_texture_query_lod says that textureQueryLOD() also exist at extension.65316532if (profile != EEsProfile && version >= 150 && sampler.isCombined() && sampler.dim != EsdRect &&6533! sampler.isMultiSample() && ! sampler.isBuffer()) {65346535const TString funcName[2] = {"vec2 textureQueryLod(", "vec2 textureQueryLOD("};65366537for (int i = 0; i < 2; ++i){6538for (int f16TexAddr = 0; f16TexAddr < 2; ++f16TexAddr) {6539if (f16TexAddr && sampler.type != EbtFloat16)6540continue;6541stageBuiltins[EShLangFragment].append(funcName[i]);6542stageBuiltins[EShLangFragment].append(typeName);6543if (dimMap[sampler.dim] == 1)6544if (f16TexAddr)6545stageBuiltins[EShLangFragment].append(", float16_t");6546else6547stageBuiltins[EShLangFragment].append(", float");6548else {6549if (f16TexAddr)6550stageBuiltins[EShLangFragment].append(", f16vec");6551else6552stageBuiltins[EShLangFragment].append(", vec");6553stageBuiltins[EShLangFragment].append(postfixes[dimMap[sampler.dim]]);6554}6555stageBuiltins[EShLangFragment].append(");\n");6556}65576558stageBuiltins[EShLangCompute].append(funcName[i]);6559stageBuiltins[EShLangCompute].append(typeName);6560if (dimMap[sampler.dim] == 1)6561stageBuiltins[EShLangCompute].append(", float");6562else {6563stageBuiltins[EShLangCompute].append(", vec");6564stageBuiltins[EShLangCompute].append(postfixes[dimMap[sampler.dim]]);6565}6566stageBuiltins[EShLangCompute].append(");\n");6567}6568}65696570//6571// textureQueryLevels()6572//65736574if (profile != EEsProfile && version >= 430 && ! sampler.isImage() && sampler.dim != EsdRect &&6575! sampler.isMultiSample() && ! sampler.isBuffer()) {6576commonBuiltins.append("int textureQueryLevels(");6577commonBuiltins.append(typeName);6578commonBuiltins.append(");\n");6579}6580}65816582//6583// Helper function for add2ndGenerationSamplingImaging(),6584// when adding context-independent built-in functions.6585//6586// Add all the image access functions for the given type.6587//6588void TBuiltIns::addImageFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile)6589{6590int dims = dimMap[sampler.dim];6591// most things with an array add a dimension, except for cubemaps6592if (sampler.arrayed && sampler.dim != EsdCube)6593++dims;65946595TString imageParams = typeName;6596if (dims == 1)6597imageParams.append(", int");6598else {6599imageParams.append(", ivec");6600imageParams.append(postfixes[dims]);6601}6602if (sampler.isMultiSample())6603imageParams.append(", int");66046605if (profile == EEsProfile)6606commonBuiltins.append("highp ");6607commonBuiltins.append(prefixes[sampler.type]);6608commonBuiltins.append("vec4 imageLoad(readonly volatile coherent ");6609commonBuiltins.append(imageParams);6610commonBuiltins.append(");\n");66116612commonBuiltins.append("void imageStore(writeonly volatile coherent ");6613commonBuiltins.append(imageParams);6614commonBuiltins.append(", ");6615commonBuiltins.append(prefixes[sampler.type]);6616commonBuiltins.append("vec4);\n");66176618if (! sampler.is1D() && ! sampler.isBuffer() && profile != EEsProfile && version >= 450) {6619commonBuiltins.append("int sparseImageLoadARB(readonly volatile coherent ");6620commonBuiltins.append(imageParams);6621commonBuiltins.append(", out ");6622commonBuiltins.append(prefixes[sampler.type]);6623commonBuiltins.append("vec4");6624commonBuiltins.append(");\n");6625}66266627if ( profile != EEsProfile ||6628(profile == EEsProfile && version >= 310)) {6629if (sampler.type == EbtInt || sampler.type == EbtUint || sampler.type == EbtInt64 || sampler.type == EbtUint64 ) {66306631const char* dataType;6632switch (sampler.type) {6633case(EbtInt): dataType = "highp int"; break;6634case(EbtUint): dataType = "highp uint"; break;6635case(EbtInt64): dataType = "highp int64_t"; break;6636case(EbtUint64): dataType = "highp uint64_t"; break;6637default: dataType = "";6638}66396640const int numBuiltins = 7;66416642static const char* atomicFunc[numBuiltins] = {6643" imageAtomicAdd(volatile coherent ",6644" imageAtomicMin(volatile coherent ",6645" imageAtomicMax(volatile coherent ",6646" imageAtomicAnd(volatile coherent ",6647" imageAtomicOr(volatile coherent ",6648" imageAtomicXor(volatile coherent ",6649" imageAtomicExchange(volatile coherent "6650};66516652// Loop twice to add prototypes with/without scope/semantics6653for (int j = 0; j < 2; ++j) {6654for (size_t i = 0; i < numBuiltins; ++i) {6655commonBuiltins.append(dataType);6656commonBuiltins.append(atomicFunc[i]);6657commonBuiltins.append(imageParams);6658commonBuiltins.append(", ");6659commonBuiltins.append(dataType);6660if (j == 1) {6661commonBuiltins.append(", int, int, int");6662}6663commonBuiltins.append(");\n");6664}66656666commonBuiltins.append(dataType);6667commonBuiltins.append(" imageAtomicCompSwap(volatile coherent ");6668commonBuiltins.append(imageParams);6669commonBuiltins.append(", ");6670commonBuiltins.append(dataType);6671commonBuiltins.append(", ");6672commonBuiltins.append(dataType);6673if (j == 1) {6674commonBuiltins.append(", int, int, int, int, int");6675}6676commonBuiltins.append(");\n");6677}66786679commonBuiltins.append(dataType);6680commonBuiltins.append(" imageAtomicLoad(volatile coherent ");6681commonBuiltins.append(imageParams);6682commonBuiltins.append(", int, int, int);\n");66836684commonBuiltins.append("void imageAtomicStore(volatile coherent ");6685commonBuiltins.append(imageParams);6686commonBuiltins.append(", ");6687commonBuiltins.append(dataType);6688commonBuiltins.append(", int, int, int);\n");66896690} else {6691// not int or uint6692// GL_ARB_ES3_1_compatibility6693// TODO: spec issue: are there restrictions on the kind of layout() that can be used? what about dropping memory qualifiers?6694if (profile == EEsProfile && version >= 310) {6695commonBuiltins.append("float imageAtomicExchange(volatile coherent ");6696commonBuiltins.append(imageParams);6697commonBuiltins.append(", float);\n");6698}66996700// GL_NV_shader_atomic_fp16_vector6701if (profile != EEsProfile && version >= 430) {6702const int numFp16Builtins = 4;6703const char* atomicFp16Func[numFp16Builtins] = {6704" imageAtomicAdd(volatile coherent ",6705" imageAtomicMin(volatile coherent ",6706" imageAtomicMax(volatile coherent ",6707" imageAtomicExchange(volatile coherent "6708};6709const int numFp16DataTypes = 2;6710const char* atomicFp16DataTypes[numFp16DataTypes] = {6711"f16vec2",6712"f16vec4"6713};6714// Loop twice to add prototypes with/without scope/semantics6715for (int j = 0; j < numFp16DataTypes; ++j) {6716for (int i = 0; i < numFp16Builtins; ++i) {6717commonBuiltins.append(atomicFp16DataTypes[j]);6718commonBuiltins.append(atomicFp16Func[i]);6719commonBuiltins.append(imageParams);6720commonBuiltins.append(", ");6721commonBuiltins.append(atomicFp16DataTypes[j]);6722commonBuiltins.append(");\n");6723}6724}6725}67266727if (profile != EEsProfile && version >= 450) {6728commonBuiltins.append("float imageAtomicAdd(volatile coherent ");6729commonBuiltins.append(imageParams);6730commonBuiltins.append(", float);\n");67316732commonBuiltins.append("float imageAtomicAdd(volatile coherent ");6733commonBuiltins.append(imageParams);6734commonBuiltins.append(", float");6735commonBuiltins.append(", int, int, int);\n");67366737commonBuiltins.append("float imageAtomicExchange(volatile coherent ");6738commonBuiltins.append(imageParams);6739commonBuiltins.append(", float);\n");67406741commonBuiltins.append("float imageAtomicExchange(volatile coherent ");6742commonBuiltins.append(imageParams);6743commonBuiltins.append(", float");6744commonBuiltins.append(", int, int, int);\n");67456746commonBuiltins.append("float imageAtomicLoad(readonly volatile coherent ");6747commonBuiltins.append(imageParams);6748commonBuiltins.append(", int, int, int);\n");67496750commonBuiltins.append("void imageAtomicStore(writeonly volatile coherent ");6751commonBuiltins.append(imageParams);6752commonBuiltins.append(", float");6753commonBuiltins.append(", int, int, int);\n");67546755commonBuiltins.append("float imageAtomicMin(volatile coherent ");6756commonBuiltins.append(imageParams);6757commonBuiltins.append(", float);\n");67586759commonBuiltins.append("float imageAtomicMin(volatile coherent ");6760commonBuiltins.append(imageParams);6761commonBuiltins.append(", float");6762commonBuiltins.append(", int, int, int);\n");67636764commonBuiltins.append("float imageAtomicMax(volatile coherent ");6765commonBuiltins.append(imageParams);6766commonBuiltins.append(", float);\n");67676768commonBuiltins.append("float imageAtomicMax(volatile coherent ");6769commonBuiltins.append(imageParams);6770commonBuiltins.append(", float");6771commonBuiltins.append(", int, int, int);\n");6772}6773}6774}67756776if (sampler.dim == EsdRect || sampler.dim == EsdBuffer || sampler.shadow || sampler.isMultiSample())6777return;67786779if (profile == EEsProfile || version < 450)6780return;67816782TString imageLodParams = typeName;6783if (dims == 1)6784imageLodParams.append(", int");6785else {6786imageLodParams.append(", ivec");6787imageLodParams.append(postfixes[dims]);6788}6789imageLodParams.append(", int");67906791commonBuiltins.append(prefixes[sampler.type]);6792commonBuiltins.append("vec4 imageLoadLodAMD(readonly volatile coherent ");6793commonBuiltins.append(imageLodParams);6794commonBuiltins.append(");\n");67956796commonBuiltins.append("void imageStoreLodAMD(writeonly volatile coherent ");6797commonBuiltins.append(imageLodParams);6798commonBuiltins.append(", ");6799commonBuiltins.append(prefixes[sampler.type]);6800commonBuiltins.append("vec4);\n");68016802if (! sampler.is1D()) {6803commonBuiltins.append("int sparseImageLoadLodAMD(readonly volatile coherent ");6804commonBuiltins.append(imageLodParams);6805commonBuiltins.append(", out ");6806commonBuiltins.append(prefixes[sampler.type]);6807commonBuiltins.append("vec4");6808commonBuiltins.append(");\n");6809}6810}68116812//6813// Helper function for initialize(),6814// when adding context-independent built-in functions.6815//6816// Add all the subpass access functions for the given type.6817//6818void TBuiltIns::addSubpassSampling(TSampler sampler, const TString& typeName, int /*version*/, EProfile /*profile*/)6819{6820stageBuiltins[EShLangFragment].append(prefixes[sampler.type]);6821stageBuiltins[EShLangFragment].append("vec4 subpassLoad");6822stageBuiltins[EShLangFragment].append("(");6823stageBuiltins[EShLangFragment].append(typeName.c_str());6824if (sampler.isMultiSample())6825stageBuiltins[EShLangFragment].append(", int");6826stageBuiltins[EShLangFragment].append(");\n");6827}68286829//6830// Helper function for add2ndGenerationSamplingImaging(),6831// when adding context-independent built-in functions.6832//6833// Add all the texture lookup functions for the given type.6834//6835void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile)6836{6837//6838// texturing6839//6840for (int proj = 0; proj <= 1; ++proj) { // loop over "bool" projective or not68416842if (proj && (sampler.dim == EsdCube || sampler.isBuffer() || sampler.arrayed || sampler.isMultiSample()6843|| !sampler.isCombined()))6844continue;68456846for (int lod = 0; lod <= 1; ++lod) {68476848if (lod && (sampler.isBuffer() || sampler.isRect() || sampler.isMultiSample() || !sampler.isCombined()))6849continue;6850if (lod && sampler.dim == Esd2D && sampler.arrayed && sampler.shadow)6851continue;6852if (lod && sampler.dim == EsdCube && sampler.shadow)6853continue;68546855for (int bias = 0; bias <= 1; ++bias) {68566857if (bias && (lod || sampler.isMultiSample() || !sampler.isCombined()))6858continue;6859if (bias && (sampler.dim == Esd2D || sampler.dim == EsdCube) && sampler.shadow && sampler.arrayed)6860continue;6861if (bias && (sampler.isRect() || sampler.isBuffer()))6862continue;68636864for (int offset = 0; offset <= 1; ++offset) { // loop over "bool" offset or not68656866if (proj + offset + bias + lod > 3)6867continue;6868if (offset && (sampler.dim == EsdCube || sampler.isBuffer() || sampler.isMultiSample()))6869continue;68706871for (int fetch = 0; fetch <= 1; ++fetch) { // loop over "bool" fetch or not68726873if (proj + offset + fetch + bias + lod > 3)6874continue;6875if (fetch && (lod || bias))6876continue;6877if (fetch && (sampler.shadow || sampler.dim == EsdCube))6878continue;6879if (fetch == 0 && (sampler.isMultiSample() || sampler.isBuffer()6880|| !sampler.isCombined()))6881continue;68826883for (int grad = 0; grad <= 1; ++grad) { // loop over "bool" grad or not68846885if (grad && (lod || bias || sampler.isMultiSample() || !sampler.isCombined()))6886continue;6887if (grad && sampler.isBuffer())6888continue;6889if (proj + offset + fetch + grad + bias + lod > 3)6890continue;68916892for (int extraProj = 0; extraProj <= 1; ++extraProj) {6893bool compare = false;6894int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0);6895// skip dummy unused second component for 1D non-array shadows6896if (sampler.shadow && totalDims < 2)6897totalDims = 2;6898totalDims += (sampler.shadow ? 1 : 0) + proj;6899if (totalDims > 4 && sampler.shadow) {6900compare = true;6901totalDims = 4;6902}6903assert(totalDims <= 4);69046905if (extraProj && ! proj)6906continue;6907if (extraProj && (sampler.dim == Esd3D || sampler.shadow || !sampler.isCombined()))6908continue;69096910// loop over 16-bit floating-point texel addressing6911for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr)6912{6913if (f16TexAddr && sampler.type != EbtFloat16)6914continue;6915if (f16TexAddr && sampler.shadow && ! compare) {6916compare = true; // compare argument is always present6917totalDims--;6918}6919// loop over "bool" lod clamp6920for (int lodClamp = 0; lodClamp <= 1 ;++lodClamp)6921{6922if (lodClamp && (profile == EEsProfile || version < 450))6923continue;6924if (lodClamp && (proj || lod || fetch))6925continue;69266927// loop over "bool" sparse or not6928for (int sparse = 0; sparse <= 1; ++sparse)6929{6930if (sparse && (profile == EEsProfile || version < 450))6931continue;6932// Sparse sampling is not for 1D/1D array texture, buffer texture, and6933// projective texture6934if (sparse && (sampler.is1D() || sampler.isBuffer() || proj))6935continue;69366937TString s;69386939// return type6940if (sparse)6941s.append("int ");6942else {6943if (sampler.shadow)6944if (sampler.type == EbtFloat16)6945s.append("float16_t ");6946else6947s.append("float ");6948else {6949s.append(prefixes[sampler.type]);6950s.append("vec4 ");6951}6952}69536954// name6955if (sparse) {6956if (fetch)6957s.append("sparseTexel");6958else6959s.append("sparseTexture");6960}6961else {6962if (fetch)6963s.append("texel");6964else6965s.append("texture");6966}6967if (proj)6968s.append("Proj");6969if (lod)6970s.append("Lod");6971if (grad)6972s.append("Grad");6973if (fetch)6974s.append("Fetch");6975if (offset)6976s.append("Offset");6977if (lodClamp)6978s.append("Clamp");6979if (lodClamp != 0 || sparse)6980s.append("ARB");6981s.append("(");69826983// sampler type6984s.append(typeName);6985// P coordinate6986if (extraProj) {6987if (f16TexAddr)6988s.append(",f16vec4");6989else6990s.append(",vec4");6991} else {6992s.append(",");6993TBasicType t = fetch ? EbtInt : (f16TexAddr ? EbtFloat16 : EbtFloat);6994if (totalDims == 1)6995s.append(TType::getBasicString(t));6996else {6997s.append(prefixes[t]);6998s.append("vec");6999s.append(postfixes[totalDims]);7000}7001}7002// non-optional compare7003if (compare)7004s.append(",float");70057006// non-optional lod argument (lod that's not driven by lod loop) or sample7007if ((fetch && !sampler.isBuffer() &&7008!sampler.isRect() && !sampler.isMultiSample())7009|| (sampler.isMultiSample() && fetch))7010s.append(",int");7011// non-optional lod7012if (lod) {7013if (f16TexAddr)7014s.append(",float16_t");7015else7016s.append(",float");7017}70187019// gradient arguments7020if (grad) {7021if (dimMap[sampler.dim] == 1) {7022if (f16TexAddr)7023s.append(",float16_t,float16_t");7024else7025s.append(",float,float");7026} else {7027if (f16TexAddr)7028s.append(",f16vec");7029else7030s.append(",vec");7031s.append(postfixes[dimMap[sampler.dim]]);7032if (f16TexAddr)7033s.append(",f16vec");7034else7035s.append(",vec");7036s.append(postfixes[dimMap[sampler.dim]]);7037}7038}7039// offset7040if (offset) {7041if (dimMap[sampler.dim] == 1)7042s.append(",int");7043else {7044s.append(",ivec");7045s.append(postfixes[dimMap[sampler.dim]]);7046}7047}70487049// lod clamp7050if (lodClamp) {7051if (f16TexAddr)7052s.append(",float16_t");7053else7054s.append(",float");7055}7056// texel out (for sparse texture)7057if (sparse) {7058s.append(",out ");7059if (sampler.shadow)7060if (sampler.type == EbtFloat16)7061s.append("float16_t");7062else7063s.append("float");7064else {7065s.append(prefixes[sampler.type]);7066s.append("vec4");7067}7068}7069// optional bias7070if (bias) {7071if (f16TexAddr)7072s.append(",float16_t");7073else7074s.append(",float");7075}7076s.append(");\n");70777078// Add to the per-language set of built-ins7079if (!grad && (bias || lodClamp != 0)) {7080stageBuiltins[EShLangFragment].append(s);7081stageBuiltins[EShLangCompute].append(s);7082} else7083commonBuiltins.append(s);70847085}7086}7087}7088}7089}7090}7091}7092}7093}7094}7095}70967097//7098// Helper function for add2ndGenerationSamplingImaging(),7099// when adding context-independent built-in functions.7100//7101// Add all the texture gather functions for the given type.7102//7103void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile)7104{7105switch (sampler.dim) {7106case Esd2D:7107case EsdRect:7108case EsdCube:7109break;7110default:7111return;7112}71137114if (sampler.isMultiSample())7115return;71167117if (version < 140 && sampler.dim == EsdRect && sampler.type != EbtFloat)7118return;71197120for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr) { // loop over 16-bit floating-point texel addressing71217122if (f16TexAddr && sampler.type != EbtFloat16)7123continue;7124for (int offset = 0; offset < 3; ++offset) { // loop over three forms of offset in the call name: none, Offset, and Offsets71257126for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument71277128if (comp > 0 && sampler.shadow)7129continue;71307131if (offset > 0 && sampler.dim == EsdCube)7132continue;71337134for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not7135if (sparse && (profile == EEsProfile || version < 450))7136continue;71377138TString s;71397140// return type7141if (sparse)7142s.append("int ");7143else {7144s.append(prefixes[sampler.type]);7145s.append("vec4 ");7146}71477148// name7149if (sparse)7150s.append("sparseTextureGather");7151else7152s.append("textureGather");7153switch (offset) {7154case 1:7155s.append("Offset");7156break;7157case 2:7158s.append("Offsets");7159break;7160default:7161break;7162}7163if (sparse)7164s.append("ARB");7165s.append("(");71667167// sampler type argument7168s.append(typeName);71697170// P coordinate argument7171if (f16TexAddr)7172s.append(",f16vec");7173else7174s.append(",vec");7175int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0);7176s.append(postfixes[totalDims]);71777178// refZ argument7179if (sampler.shadow)7180s.append(",float");71817182// offset argument7183if (offset > 0) {7184s.append(",ivec2");7185if (offset == 2)7186s.append("[4]");7187}71887189// texel out (for sparse texture)7190if (sparse) {7191s.append(",out ");7192s.append(prefixes[sampler.type]);7193s.append("vec4 ");7194}71957196// comp argument7197if (comp)7198s.append(",int");71997200s.append(");\n");7201commonBuiltins.append(s);7202}7203}7204}7205}72067207if (sampler.dim == EsdRect || sampler.shadow)7208return;72097210if (profile == EEsProfile || version < 450)7211return;72127213for (int bias = 0; bias < 2; ++bias) { // loop over presence of bias argument72147215for (int lod = 0; lod < 2; ++lod) { // loop over presence of lod argument72167217if ((lod && bias) || (lod == 0 && bias == 0))7218continue;72197220for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr) { // loop over 16-bit floating-point texel addressing72217222if (f16TexAddr && sampler.type != EbtFloat16)7223continue;72247225for (int offset = 0; offset < 3; ++offset) { // loop over three forms of offset in the call name: none, Offset, and Offsets72267227for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument72287229if (comp == 0 && bias)7230continue;72317232if (offset > 0 && sampler.dim == EsdCube)7233continue;72347235for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not7236if (sparse && (profile == EEsProfile || version < 450))7237continue;72387239TString s;72407241// return type7242if (sparse)7243s.append("int ");7244else {7245s.append(prefixes[sampler.type]);7246s.append("vec4 ");7247}72487249// name7250if (sparse)7251s.append("sparseTextureGather");7252else7253s.append("textureGather");72547255if (lod)7256s.append("Lod");72577258switch (offset) {7259case 1:7260s.append("Offset");7261break;7262case 2:7263s.append("Offsets");7264break;7265default:7266break;7267}72687269if (lod)7270s.append("AMD");7271else if (sparse)7272s.append("ARB");72737274s.append("(");72757276// sampler type argument7277s.append(typeName);72787279// P coordinate argument7280if (f16TexAddr)7281s.append(",f16vec");7282else7283s.append(",vec");7284int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0);7285s.append(postfixes[totalDims]);72867287// lod argument7288if (lod) {7289if (f16TexAddr)7290s.append(",float16_t");7291else7292s.append(",float");7293}72947295// offset argument7296if (offset > 0) {7297s.append(",ivec2");7298if (offset == 2)7299s.append("[4]");7300}73017302// texel out (for sparse texture)7303if (sparse) {7304s.append(",out ");7305s.append(prefixes[sampler.type]);7306s.append("vec4 ");7307}73087309// comp argument7310if (comp)7311s.append(",int");73127313// bias argument7314if (bias) {7315if (f16TexAddr)7316s.append(",float16_t");7317else7318s.append(",float");7319}73207321s.append(");\n");7322if (bias)7323stageBuiltins[EShLangFragment].append(s);7324else7325commonBuiltins.append(s);7326}7327}7328}7329}7330}7331}7332}73337334//7335// Add context-dependent built-in functions and variables that are present7336// for the given version and profile. All the results are put into just the7337// commonBuiltins, because it is called for just a specific stage. So,7338// add stage-specific entries to the commonBuiltins, and only if that stage7339// was requested.7340//7341void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language)7342{7343//7344// Initialize the context-dependent (resource-dependent) built-in strings for parsing.7345//73467347//============================================================================7348//7349// Standard Uniforms7350//7351//============================================================================73527353TString& s = commonBuiltins;7354const int maxSize = 200;7355char builtInConstant[maxSize];73567357//7358// Build string of implementation dependent constants.7359//73607361if (profile == EEsProfile) {7362snprintf(builtInConstant, maxSize, "const mediump int gl_MaxVertexAttribs = %d;", resources.maxVertexAttribs);7363s.append(builtInConstant);73647365snprintf(builtInConstant, maxSize, "const mediump int gl_MaxVertexUniformVectors = %d;", resources.maxVertexUniformVectors);7366s.append(builtInConstant);73677368snprintf(builtInConstant, maxSize, "const mediump int gl_MaxVertexTextureImageUnits = %d;", resources.maxVertexTextureImageUnits);7369s.append(builtInConstant);73707371snprintf(builtInConstant, maxSize, "const mediump int gl_MaxCombinedTextureImageUnits = %d;", resources.maxCombinedTextureImageUnits);7372s.append(builtInConstant);73737374snprintf(builtInConstant, maxSize, "const mediump int gl_MaxTextureImageUnits = %d;", resources.maxTextureImageUnits);7375s.append(builtInConstant);73767377snprintf(builtInConstant, maxSize, "const mediump int gl_MaxFragmentUniformVectors = %d;", resources.maxFragmentUniformVectors);7378s.append(builtInConstant);73797380snprintf(builtInConstant, maxSize, "const mediump int gl_MaxDrawBuffers = %d;", resources.maxDrawBuffers);7381s.append(builtInConstant);73827383if (version == 100) {7384snprintf(builtInConstant, maxSize, "const mediump int gl_MaxVaryingVectors = %d;", resources.maxVaryingVectors);7385s.append(builtInConstant);7386} else {7387snprintf(builtInConstant, maxSize, "const mediump int gl_MaxVertexOutputVectors = %d;", resources.maxVertexOutputVectors);7388s.append(builtInConstant);73897390snprintf(builtInConstant, maxSize, "const mediump int gl_MaxFragmentInputVectors = %d;", resources.maxFragmentInputVectors);7391s.append(builtInConstant);73927393snprintf(builtInConstant, maxSize, "const mediump int gl_MinProgramTexelOffset = %d;", resources.minProgramTexelOffset);7394s.append(builtInConstant);73957396snprintf(builtInConstant, maxSize, "const mediump int gl_MaxProgramTexelOffset = %d;", resources.maxProgramTexelOffset);7397s.append(builtInConstant);7398}73997400if (version >= 310) {7401// geometry74027403snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryInputComponents = %d;", resources.maxGeometryInputComponents);7404s.append(builtInConstant);7405snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputComponents = %d;", resources.maxGeometryOutputComponents);7406s.append(builtInConstant);7407snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryImageUniforms = %d;", resources.maxGeometryImageUniforms);7408s.append(builtInConstant);7409snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTextureImageUnits = %d;", resources.maxGeometryTextureImageUnits);7410s.append(builtInConstant);7411snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputVertices = %d;", resources.maxGeometryOutputVertices);7412s.append(builtInConstant);7413snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTotalOutputComponents = %d;", resources.maxGeometryTotalOutputComponents);7414s.append(builtInConstant);7415snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryUniformComponents = %d;", resources.maxGeometryUniformComponents);7416s.append(builtInConstant);7417snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounters = %d;", resources.maxGeometryAtomicCounters);7418s.append(builtInConstant);7419snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounterBuffers = %d;", resources.maxGeometryAtomicCounterBuffers);7420s.append(builtInConstant);74217422// tessellation74237424snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlInputComponents = %d;", resources.maxTessControlInputComponents);7425s.append(builtInConstant);7426snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlOutputComponents = %d;", resources.maxTessControlOutputComponents);7427s.append(builtInConstant);7428snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlTextureImageUnits = %d;", resources.maxTessControlTextureImageUnits);7429s.append(builtInConstant);7430snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlUniformComponents = %d;", resources.maxTessControlUniformComponents);7431s.append(builtInConstant);7432snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlTotalOutputComponents = %d;", resources.maxTessControlTotalOutputComponents);7433s.append(builtInConstant);74347435snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationInputComponents = %d;", resources.maxTessEvaluationInputComponents);7436s.append(builtInConstant);7437snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationOutputComponents = %d;", resources.maxTessEvaluationOutputComponents);7438s.append(builtInConstant);7439snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationTextureImageUnits = %d;", resources.maxTessEvaluationTextureImageUnits);7440s.append(builtInConstant);7441snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationUniformComponents = %d;", resources.maxTessEvaluationUniformComponents);7442s.append(builtInConstant);74437444snprintf(builtInConstant, maxSize, "const int gl_MaxTessPatchComponents = %d;", resources.maxTessPatchComponents);7445s.append(builtInConstant);74467447snprintf(builtInConstant, maxSize, "const int gl_MaxPatchVertices = %d;", resources.maxPatchVertices);7448s.append(builtInConstant);7449snprintf(builtInConstant, maxSize, "const int gl_MaxTessGenLevel = %d;", resources.maxTessGenLevel);7450s.append(builtInConstant);74517452// this is here instead of with the others in initialize(version, profile) due to the dependence on gl_MaxPatchVertices7453if (language == EShLangTessControl || language == EShLangTessEvaluation) {7454s.append(7455"in gl_PerVertex {"7456"highp vec4 gl_Position;"7457"highp float gl_PointSize;"7458"highp vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering7459"highp vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes7460"} gl_in[gl_MaxPatchVertices];"7461"\n");7462}7463}74647465if (version >= 320) {7466// tessellation74677468snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlImageUniforms = %d;", resources.maxTessControlImageUniforms);7469s.append(builtInConstant);7470snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationImageUniforms = %d;", resources.maxTessEvaluationImageUniforms);7471s.append(builtInConstant);7472snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlAtomicCounters = %d;", resources.maxTessControlAtomicCounters);7473s.append(builtInConstant);7474snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationAtomicCounters = %d;", resources.maxTessEvaluationAtomicCounters);7475s.append(builtInConstant);7476snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlAtomicCounterBuffers = %d;", resources.maxTessControlAtomicCounterBuffers);7477s.append(builtInConstant);7478snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationAtomicCounterBuffers = %d;", resources.maxTessEvaluationAtomicCounterBuffers);7479s.append(builtInConstant);7480}74817482if (version >= 100) {7483// GL_EXT_blend_func_extended7484snprintf(builtInConstant, maxSize, "const mediump int gl_MaxDualSourceDrawBuffersEXT = %d;", resources.maxDualSourceDrawBuffersEXT);7485s.append(builtInConstant);7486// this is here instead of with the others in initialize(version, profile) due to the dependence on gl_MaxDualSourceDrawBuffersEXT7487if (language == EShLangFragment) {7488s.append(7489"mediump vec4 gl_SecondaryFragColorEXT;"7490"mediump vec4 gl_SecondaryFragDataEXT[gl_MaxDualSourceDrawBuffersEXT];"7491"\n");7492}7493}7494} else {7495// non-ES profile74967497if (version > 400) {7498snprintf(builtInConstant, maxSize, "const int gl_MaxVertexUniformVectors = %d;", resources.maxVertexUniformVectors);7499s.append(builtInConstant);75007501snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentUniformVectors = %d;", resources.maxFragmentUniformVectors);7502s.append(builtInConstant);75037504snprintf(builtInConstant, maxSize, "const int gl_MaxVaryingVectors = %d;", resources.maxVaryingVectors);7505s.append(builtInConstant);7506}75077508snprintf(builtInConstant, maxSize, "const int gl_MaxVertexAttribs = %d;", resources.maxVertexAttribs);7509s.append(builtInConstant);75107511snprintf(builtInConstant, maxSize, "const int gl_MaxVertexTextureImageUnits = %d;", resources.maxVertexTextureImageUnits);7512s.append(builtInConstant);75137514snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedTextureImageUnits = %d;", resources.maxCombinedTextureImageUnits);7515s.append(builtInConstant);75167517snprintf(builtInConstant, maxSize, "const int gl_MaxTextureImageUnits = %d;", resources.maxTextureImageUnits);7518s.append(builtInConstant);75197520snprintf(builtInConstant, maxSize, "const int gl_MaxDrawBuffers = %d;", resources.maxDrawBuffers);7521s.append(builtInConstant);75227523snprintf(builtInConstant, maxSize, "const int gl_MaxLights = %d;", resources.maxLights);7524s.append(builtInConstant);75257526snprintf(builtInConstant, maxSize, "const int gl_MaxClipPlanes = %d;", resources.maxClipPlanes);7527s.append(builtInConstant);75287529snprintf(builtInConstant, maxSize, "const int gl_MaxTextureUnits = %d;", resources.maxTextureUnits);7530s.append(builtInConstant);75317532snprintf(builtInConstant, maxSize, "const int gl_MaxTextureCoords = %d;", resources.maxTextureCoords);7533s.append(builtInConstant);75347535snprintf(builtInConstant, maxSize, "const int gl_MaxVertexUniformComponents = %d;", resources.maxVertexUniformComponents);7536s.append(builtInConstant);75377538// Moved from just being deprecated into compatibility profile only as of 4.207539if (version < 420 || profile == ECompatibilityProfile) {7540snprintf(builtInConstant, maxSize, "const int gl_MaxVaryingFloats = %d;", resources.maxVaryingFloats);7541s.append(builtInConstant);7542}75437544snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentUniformComponents = %d;", resources.maxFragmentUniformComponents);7545s.append(builtInConstant);75467547if (spvVersion.spv == 0 && IncludeLegacy(version, profile, spvVersion)) {7548//7549// OpenGL'uniform' state. Page numbers are in reference to version7550// 1.4 of the OpenGL specification.7551//75527553//7554// Matrix state. p. 31, 32, 37, 39, 40.7555//7556s.append("uniform mat4 gl_TextureMatrix[gl_MaxTextureCoords];"75577558//7559// Derived matrix state that provides inverse and transposed versions7560// of the matrices above.7561//7562"uniform mat4 gl_TextureMatrixInverse[gl_MaxTextureCoords];"75637564"uniform mat4 gl_TextureMatrixTranspose[gl_MaxTextureCoords];"75657566"uniform mat4 gl_TextureMatrixInverseTranspose[gl_MaxTextureCoords];"75677568//7569// Clip planes p. 42.7570//7571"uniform vec4 gl_ClipPlane[gl_MaxClipPlanes];"75727573//7574// Light State p 50, 53, 55.7575//7576"uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights];"75777578//7579// Derived state from products of light.7580//7581"uniform gl_LightProducts gl_FrontLightProduct[gl_MaxLights];"7582"uniform gl_LightProducts gl_BackLightProduct[gl_MaxLights];"75837584//7585// Texture Environment and Generation, p. 152, p. 40-42.7586//7587"uniform vec4 gl_TextureEnvColor[gl_MaxTextureImageUnits];"7588"uniform vec4 gl_EyePlaneS[gl_MaxTextureCoords];"7589"uniform vec4 gl_EyePlaneT[gl_MaxTextureCoords];"7590"uniform vec4 gl_EyePlaneR[gl_MaxTextureCoords];"7591"uniform vec4 gl_EyePlaneQ[gl_MaxTextureCoords];"7592"uniform vec4 gl_ObjectPlaneS[gl_MaxTextureCoords];"7593"uniform vec4 gl_ObjectPlaneT[gl_MaxTextureCoords];"7594"uniform vec4 gl_ObjectPlaneR[gl_MaxTextureCoords];"7595"uniform vec4 gl_ObjectPlaneQ[gl_MaxTextureCoords];");7596}75977598if (version >= 130) {7599snprintf(builtInConstant, maxSize, "const int gl_MaxClipDistances = %d;", resources.maxClipDistances);7600s.append(builtInConstant);7601snprintf(builtInConstant, maxSize, "const int gl_MaxVaryingComponents = %d;", resources.maxVaryingComponents);7602s.append(builtInConstant);76037604// GL_ARB_shading_language_420pack7605snprintf(builtInConstant, maxSize, "const mediump int gl_MinProgramTexelOffset = %d;", resources.minProgramTexelOffset);7606s.append(builtInConstant);7607snprintf(builtInConstant, maxSize, "const mediump int gl_MaxProgramTexelOffset = %d;", resources.maxProgramTexelOffset);7608s.append(builtInConstant);7609}76107611// geometry7612if (version >= 150) {7613snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryInputComponents = %d;", resources.maxGeometryInputComponents);7614s.append(builtInConstant);7615snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputComponents = %d;", resources.maxGeometryOutputComponents);7616s.append(builtInConstant);7617snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTextureImageUnits = %d;", resources.maxGeometryTextureImageUnits);7618s.append(builtInConstant);7619snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputVertices = %d;", resources.maxGeometryOutputVertices);7620s.append(builtInConstant);7621snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTotalOutputComponents = %d;", resources.maxGeometryTotalOutputComponents);7622s.append(builtInConstant);7623snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryUniformComponents = %d;", resources.maxGeometryUniformComponents);7624s.append(builtInConstant);7625snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryVaryingComponents = %d;", resources.maxGeometryVaryingComponents);7626s.append(builtInConstant);76277628}76297630if (version >= 150) {7631snprintf(builtInConstant, maxSize, "const int gl_MaxVertexOutputComponents = %d;", resources.maxVertexOutputComponents);7632s.append(builtInConstant);7633snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentInputComponents = %d;", resources.maxFragmentInputComponents);7634s.append(builtInConstant);7635}76367637// tessellation7638if (version >= 150) {7639snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlInputComponents = %d;", resources.maxTessControlInputComponents);7640s.append(builtInConstant);7641snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlOutputComponents = %d;", resources.maxTessControlOutputComponents);7642s.append(builtInConstant);7643snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlTextureImageUnits = %d;", resources.maxTessControlTextureImageUnits);7644s.append(builtInConstant);7645snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlUniformComponents = %d;", resources.maxTessControlUniformComponents);7646s.append(builtInConstant);7647snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlTotalOutputComponents = %d;", resources.maxTessControlTotalOutputComponents);7648s.append(builtInConstant);76497650snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationInputComponents = %d;", resources.maxTessEvaluationInputComponents);7651s.append(builtInConstant);7652snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationOutputComponents = %d;", resources.maxTessEvaluationOutputComponents);7653s.append(builtInConstant);7654snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationTextureImageUnits = %d;", resources.maxTessEvaluationTextureImageUnits);7655s.append(builtInConstant);7656snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationUniformComponents = %d;", resources.maxTessEvaluationUniformComponents);7657s.append(builtInConstant);76587659snprintf(builtInConstant, maxSize, "const int gl_MaxTessPatchComponents = %d;", resources.maxTessPatchComponents);7660s.append(builtInConstant);7661snprintf(builtInConstant, maxSize, "const int gl_MaxTessGenLevel = %d;", resources.maxTessGenLevel);7662s.append(builtInConstant);7663snprintf(builtInConstant, maxSize, "const int gl_MaxPatchVertices = %d;", resources.maxPatchVertices);7664s.append(builtInConstant);76657666// this is here instead of with the others in initialize(version, profile) due to the dependence on gl_MaxPatchVertices7667if (language == EShLangTessControl || language == EShLangTessEvaluation) {7668s.append(7669"in gl_PerVertex {"7670"vec4 gl_Position;"7671"float gl_PointSize;"7672"float gl_ClipDistance[];"7673);7674if (profile == ECompatibilityProfile)7675s.append(7676"vec4 gl_ClipVertex;"7677"vec4 gl_FrontColor;"7678"vec4 gl_BackColor;"7679"vec4 gl_FrontSecondaryColor;"7680"vec4 gl_BackSecondaryColor;"7681"vec4 gl_TexCoord[];"7682"float gl_FogFragCoord;"7683);7684if (profile != EEsProfile && version >= 450)7685s.append(7686"float gl_CullDistance[];"7687"vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering7688"vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes7689);7690s.append(7691"} gl_in[gl_MaxPatchVertices];"7692"\n");7693}7694}76957696if (version >= 150) {7697snprintf(builtInConstant, maxSize, "const int gl_MaxViewports = %d;", resources.maxViewports);7698s.append(builtInConstant);7699}77007701// images7702if (version >= 130) {7703snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedImageUnitsAndFragmentOutputs = %d;", resources.maxCombinedImageUnitsAndFragmentOutputs);7704s.append(builtInConstant);7705snprintf(builtInConstant, maxSize, "const int gl_MaxImageSamples = %d;", resources.maxImageSamples);7706s.append(builtInConstant);7707snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlImageUniforms = %d;", resources.maxTessControlImageUniforms);7708s.append(builtInConstant);7709snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationImageUniforms = %d;", resources.maxTessEvaluationImageUniforms);7710s.append(builtInConstant);7711snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryImageUniforms = %d;", resources.maxGeometryImageUniforms);7712s.append(builtInConstant);7713}77147715// enhanced layouts7716if (version >= 430) {7717snprintf(builtInConstant, maxSize, "const int gl_MaxTransformFeedbackBuffers = %d;", resources.maxTransformFeedbackBuffers);7718s.append(builtInConstant);7719snprintf(builtInConstant, maxSize, "const int gl_MaxTransformFeedbackInterleavedComponents = %d;", resources.maxTransformFeedbackInterleavedComponents);7720s.append(builtInConstant);7721}7722}77237724// compute7725if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) {7726snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupCount = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupCountX,7727resources.maxComputeWorkGroupCountY,7728resources.maxComputeWorkGroupCountZ);7729s.append(builtInConstant);7730snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupSize = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupSizeX,7731resources.maxComputeWorkGroupSizeY,7732resources.maxComputeWorkGroupSizeZ);7733s.append(builtInConstant);77347735snprintf(builtInConstant, maxSize, "const int gl_MaxComputeUniformComponents = %d;", resources.maxComputeUniformComponents);7736s.append(builtInConstant);7737snprintf(builtInConstant, maxSize, "const int gl_MaxComputeTextureImageUnits = %d;", resources.maxComputeTextureImageUnits);7738s.append(builtInConstant);77397740s.append("\n");7741}77427743// images (some in compute below)7744if ((profile == EEsProfile && version >= 310) ||7745(profile != EEsProfile && version >= 130)) {7746snprintf(builtInConstant, maxSize, "const int gl_MaxImageUnits = %d;", resources.maxImageUnits);7747s.append(builtInConstant);7748snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedShaderOutputResources = %d;", resources.maxCombinedShaderOutputResources);7749s.append(builtInConstant);7750snprintf(builtInConstant, maxSize, "const int gl_MaxVertexImageUniforms = %d;", resources.maxVertexImageUniforms);7751s.append(builtInConstant);7752snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentImageUniforms = %d;", resources.maxFragmentImageUniforms);7753s.append(builtInConstant);7754snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedImageUniforms = %d;", resources.maxCombinedImageUniforms);7755s.append(builtInConstant);7756}77577758// compute7759if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) {7760snprintf(builtInConstant, maxSize, "const int gl_MaxComputeImageUniforms = %d;", resources.maxComputeImageUniforms);7761s.append(builtInConstant);7762snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounters = %d;", resources.maxComputeAtomicCounters);7763s.append(builtInConstant);7764snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounterBuffers = %d;", resources.maxComputeAtomicCounterBuffers);7765s.append(builtInConstant);77667767s.append("\n");7768}77697770// atomic counters (some in compute below)7771if ((profile == EEsProfile && version >= 310) ||7772(profile != EEsProfile && version >= 420)) {7773snprintf(builtInConstant, maxSize, "const int gl_MaxVertexAtomicCounters = %d;", resources. maxVertexAtomicCounters);7774s.append(builtInConstant);7775snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentAtomicCounters = %d;", resources. maxFragmentAtomicCounters);7776s.append(builtInConstant);7777snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedAtomicCounters = %d;", resources. maxCombinedAtomicCounters);7778s.append(builtInConstant);7779snprintf(builtInConstant, maxSize, "const int gl_MaxAtomicCounterBindings = %d;", resources. maxAtomicCounterBindings);7780s.append(builtInConstant);7781snprintf(builtInConstant, maxSize, "const int gl_MaxVertexAtomicCounterBuffers = %d;", resources. maxVertexAtomicCounterBuffers);7782s.append(builtInConstant);7783snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentAtomicCounterBuffers = %d;", resources. maxFragmentAtomicCounterBuffers);7784s.append(builtInConstant);7785snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedAtomicCounterBuffers = %d;", resources. maxCombinedAtomicCounterBuffers);7786s.append(builtInConstant);7787snprintf(builtInConstant, maxSize, "const int gl_MaxAtomicCounterBufferSize = %d;", resources. maxAtomicCounterBufferSize);7788s.append(builtInConstant);7789}7790if (profile != EEsProfile && version >= 420) {7791snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlAtomicCounters = %d;", resources. maxTessControlAtomicCounters);7792s.append(builtInConstant);7793snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationAtomicCounters = %d;", resources. maxTessEvaluationAtomicCounters);7794s.append(builtInConstant);7795snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounters = %d;", resources. maxGeometryAtomicCounters);7796s.append(builtInConstant);7797snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlAtomicCounterBuffers = %d;", resources. maxTessControlAtomicCounterBuffers);7798s.append(builtInConstant);7799snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationAtomicCounterBuffers = %d;", resources. maxTessEvaluationAtomicCounterBuffers);7800s.append(builtInConstant);7801snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounterBuffers = %d;", resources. maxGeometryAtomicCounterBuffers);7802s.append(builtInConstant);78037804s.append("\n");7805}78067807// GL_ARB_cull_distance7808if (profile != EEsProfile && version >= 450) {7809snprintf(builtInConstant, maxSize, "const int gl_MaxCullDistances = %d;", resources.maxCullDistances);7810s.append(builtInConstant);7811snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedClipAndCullDistances = %d;", resources.maxCombinedClipAndCullDistances);7812s.append(builtInConstant);7813}78147815// GL_ARB_ES3_1_compatibility7816if ((profile != EEsProfile && version >= 450) ||7817(profile == EEsProfile && version >= 310)) {7818snprintf(builtInConstant, maxSize, "const int gl_MaxSamples = %d;", resources.maxSamples);7819s.append(builtInConstant);7820}78217822// SPV_NV_mesh_shader7823if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {7824snprintf(builtInConstant, maxSize, "const int gl_MaxMeshOutputVerticesNV = %d;", resources.maxMeshOutputVerticesNV);7825s.append(builtInConstant);78267827snprintf(builtInConstant, maxSize, "const int gl_MaxMeshOutputPrimitivesNV = %d;", resources.maxMeshOutputPrimitivesNV);7828s.append(builtInConstant);78297830snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxMeshWorkGroupSizeNV = ivec3(%d,%d,%d);", resources.maxMeshWorkGroupSizeX_NV,7831resources.maxMeshWorkGroupSizeY_NV,7832resources.maxMeshWorkGroupSizeZ_NV);7833s.append(builtInConstant);7834snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxTaskWorkGroupSizeNV = ivec3(%d,%d,%d);", resources.maxTaskWorkGroupSizeX_NV,7835resources.maxTaskWorkGroupSizeY_NV,7836resources.maxTaskWorkGroupSizeZ_NV);7837s.append(builtInConstant);78387839snprintf(builtInConstant, maxSize, "const int gl_MaxMeshViewCountNV = %d;", resources.maxMeshViewCountNV);7840s.append(builtInConstant);78417842s.append("\n");7843}78447845s.append("\n");7846}78477848//7849// To support special built-ins that have a special qualifier that cannot be declared textually7850// in a shader, like gl_Position.7851//7852// This lets the type of the built-in be declared textually, and then have just its qualifier be7853// updated afterward.7854//7855// Safe to call even if name is not present.7856//7857// Only use this for built-in variables that have a special qualifier in TStorageQualifier.7858// New built-in variables should use a generic (textually declarable) qualifier in7859// TStoraregQualifier and only call BuiltInVariable().7860//7861static void SpecialQualifier(const char* name, TStorageQualifier qualifier, TBuiltInVariable builtIn, TSymbolTable& symbolTable)7862{7863TSymbol* symbol = symbolTable.find(name);7864if (symbol == nullptr)7865return;78667867TQualifier& symQualifier = symbol->getWritableType().getQualifier();7868symQualifier.storage = qualifier;7869symQualifier.builtIn = builtIn;7870}78717872//7873// Modify the symbol's flat decoration.7874//7875// Safe to call even if name is not present.7876//7877// Originally written to transform gl_SubGroupSizeARB from uniform to fragment input in Vulkan.7878//7879static void ModifyFlatDecoration(const char* name, bool flat, TSymbolTable& symbolTable)7880{7881TSymbol* symbol = symbolTable.find(name);7882if (symbol == nullptr)7883return;78847885TQualifier& symQualifier = symbol->getWritableType().getQualifier();7886symQualifier.flat = flat;7887}78887889//7890// To tag built-in variables with their TBuiltInVariable enum. Use this when the7891// normal declaration text already gets the qualifier right, and all that's needed7892// is setting the builtIn field. This should be the normal way for all new7893// built-in variables.7894//7895// If SpecialQualifier() was called, this does not need to be called.7896//7897// Safe to call even if name is not present.7898//7899static void BuiltInVariable(const char* name, TBuiltInVariable builtIn, TSymbolTable& symbolTable)7900{7901TSymbol* symbol = symbolTable.find(name);7902if (symbol == nullptr)7903return;79047905TQualifier& symQualifier = symbol->getWritableType().getQualifier();7906symQualifier.builtIn = builtIn;7907}79087909static void RetargetVariable(const char* from, const char* to, TSymbolTable& symbolTable)7910{7911symbolTable.retargetSymbol(from, to);7912}79137914//7915// For built-in variables inside a named block.7916// SpecialQualifier() won't ever go inside a block; their member's qualifier come7917// from the qualification of the block.7918//7919// See comments above for other detail.7920//7921static void BuiltInVariable(const char* blockName, const char* name, TBuiltInVariable builtIn, TSymbolTable& symbolTable)7922{7923TSymbol* symbol = symbolTable.find(blockName);7924if (symbol == nullptr)7925return;79267927TTypeList& structure = *symbol->getWritableType().getWritableStruct();7928for (int i = 0; i < (int)structure.size(); ++i) {7929if (structure[i].type->getFieldName().compare(name) == 0) {7930structure[i].type->getQualifier().builtIn = builtIn;7931return;7932}7933}7934}79357936//7937// Finish adding/processing context-independent built-in symbols.7938// 1) Programmatically add symbols that could not be added by simple text strings above.7939// 2) Map built-in functions to operators, for those that will turn into an operation node7940// instead of remaining a function call.7941// 3) Tag extension-related symbols added to their base version with their extensions, so7942// that if an early version has the extension turned off, there is an error reported on use.7943//7944void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable)7945{7946//7947// Tag built-in variables and functions with additional qualifier and extension information7948// that cannot be declared with the text strings.7949//79507951// N.B.: a symbol should only be tagged once, and this function is called multiple times, once7952// per stage that's used for this profile. So7953// - generally, stick common ones in the fragment stage to ensure they are tagged exactly once7954// - for ES, which has different precisions for different stages, the coarsest-grained tagging7955// for a built-in used in many stages needs to be once for the fragment stage and once for7956// the vertex stage79577958switch(language) {7959case EShLangVertex:7960if (spvVersion.vulkan > 0) {7961BuiltInVariable("gl_VertexIndex", EbvVertexIndex, symbolTable);7962BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable);7963}79647965if (spvVersion.vulkan == 0) {7966SpecialQualifier("gl_VertexID", EvqVertexId, EbvVertexId, symbolTable);7967SpecialQualifier("gl_InstanceID", EvqInstanceId, EbvInstanceId, symbolTable);7968if (version < 140)7969symbolTable.setVariableExtensions("gl_InstanceID", 1, &E_GL_EXT_draw_instanced);7970}79717972if (spvVersion.vulkan > 0 && spvVersion.vulkanRelaxed) {7973// treat these built-ins as aliases of VertexIndex and InstanceIndex7974RetargetVariable("gl_InstanceID", "gl_InstanceIndex", symbolTable);7975RetargetVariable("gl_VertexID", "gl_VertexIndex", symbolTable);7976}79777978if (profile != EEsProfile) {7979if (version >= 440) {7980symbolTable.setVariableExtensions("gl_BaseVertexARB", 1, &E_GL_ARB_shader_draw_parameters);7981symbolTable.setVariableExtensions("gl_BaseInstanceARB", 1, &E_GL_ARB_shader_draw_parameters);7982symbolTable.setVariableExtensions("gl_DrawIDARB", 1, &E_GL_ARB_shader_draw_parameters);7983BuiltInVariable("gl_BaseVertexARB", EbvBaseVertex, symbolTable);7984BuiltInVariable("gl_BaseInstanceARB", EbvBaseInstance, symbolTable);7985BuiltInVariable("gl_DrawIDARB", EbvDrawId, symbolTable);7986}7987if (version >= 460) {7988BuiltInVariable("gl_BaseVertex", EbvBaseVertex, symbolTable);7989BuiltInVariable("gl_BaseInstance", EbvBaseInstance, symbolTable);7990BuiltInVariable("gl_DrawID", EbvDrawId, symbolTable);7991}7992symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);7993symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot);7994symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot);7995symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot);7996symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot);7997symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot);7998symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot);79998000symbolTable.setFunctionExtensions("ballotARB", 1, &E_GL_ARB_shader_ballot);8001symbolTable.setFunctionExtensions("readInvocationARB", 1, &E_GL_ARB_shader_ballot);8002symbolTable.setFunctionExtensions("readFirstInvocationARB", 1, &E_GL_ARB_shader_ballot);80038004if (version >= 430) {8005symbolTable.setFunctionExtensions("anyInvocationARB", 1, &E_GL_ARB_shader_group_vote);8006symbolTable.setFunctionExtensions("allInvocationsARB", 1, &E_GL_ARB_shader_group_vote);8007symbolTable.setFunctionExtensions("allInvocationsEqualARB", 1, &E_GL_ARB_shader_group_vote);8008}8009}801080118012if (profile != EEsProfile) {8013symbolTable.setFunctionExtensions("minInvocationsAMD", 1, &E_GL_AMD_shader_ballot);8014symbolTable.setFunctionExtensions("maxInvocationsAMD", 1, &E_GL_AMD_shader_ballot);8015symbolTable.setFunctionExtensions("addInvocationsAMD", 1, &E_GL_AMD_shader_ballot);8016symbolTable.setFunctionExtensions("minInvocationsNonUniformAMD", 1, &E_GL_AMD_shader_ballot);8017symbolTable.setFunctionExtensions("maxInvocationsNonUniformAMD", 1, &E_GL_AMD_shader_ballot);8018symbolTable.setFunctionExtensions("addInvocationsNonUniformAMD", 1, &E_GL_AMD_shader_ballot);8019symbolTable.setFunctionExtensions("swizzleInvocationsAMD", 1, &E_GL_AMD_shader_ballot);8020symbolTable.setFunctionExtensions("swizzleInvocationsWithPatternAMD", 1, &E_GL_AMD_shader_ballot);8021symbolTable.setFunctionExtensions("writeInvocationAMD", 1, &E_GL_AMD_shader_ballot);8022symbolTable.setFunctionExtensions("mbcntAMD", 1, &E_GL_AMD_shader_ballot);80238024symbolTable.setFunctionExtensions("minInvocationsInclusiveScanAMD", 1, &E_GL_AMD_shader_ballot);8025symbolTable.setFunctionExtensions("maxInvocationsInclusiveScanAMD", 1, &E_GL_AMD_shader_ballot);8026symbolTable.setFunctionExtensions("addInvocationsInclusiveScanAMD", 1, &E_GL_AMD_shader_ballot);8027symbolTable.setFunctionExtensions("minInvocationsInclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot);8028symbolTable.setFunctionExtensions("maxInvocationsInclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot);8029symbolTable.setFunctionExtensions("addInvocationsInclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot);8030symbolTable.setFunctionExtensions("minInvocationsExclusiveScanAMD", 1, &E_GL_AMD_shader_ballot);8031symbolTable.setFunctionExtensions("maxInvocationsExclusiveScanAMD", 1, &E_GL_AMD_shader_ballot);8032symbolTable.setFunctionExtensions("addInvocationsExclusiveScanAMD", 1, &E_GL_AMD_shader_ballot);8033symbolTable.setFunctionExtensions("minInvocationsExclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot);8034symbolTable.setFunctionExtensions("maxInvocationsExclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot);8035symbolTable.setFunctionExtensions("addInvocationsExclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot);8036}80378038if (profile != EEsProfile) {8039symbolTable.setFunctionExtensions("min3", 1, &E_GL_AMD_shader_trinary_minmax);8040symbolTable.setFunctionExtensions("max3", 1, &E_GL_AMD_shader_trinary_minmax);8041symbolTable.setFunctionExtensions("mid3", 1, &E_GL_AMD_shader_trinary_minmax);8042}80438044if (profile != EEsProfile) {8045symbolTable.setVariableExtensions("gl_SIMDGroupSizeAMD", 1, &E_GL_AMD_gcn_shader);8046SpecialQualifier("gl_SIMDGroupSizeAMD", EvqVaryingIn, EbvSubGroupSize, symbolTable);80478048symbolTable.setFunctionExtensions("cubeFaceIndexAMD", 1, &E_GL_AMD_gcn_shader);8049symbolTable.setFunctionExtensions("cubeFaceCoordAMD", 1, &E_GL_AMD_gcn_shader);8050symbolTable.setFunctionExtensions("timeAMD", 1, &E_GL_AMD_gcn_shader);8051}80528053if (profile != EEsProfile) {8054symbolTable.setFunctionExtensions("fragmentMaskFetchAMD", 1, &E_GL_AMD_shader_fragment_mask);8055symbolTable.setFunctionExtensions("fragmentFetchAMD", 1, &E_GL_AMD_shader_fragment_mask);8056}80578058symbolTable.setFunctionExtensions("countLeadingZeros", 1, &E_GL_INTEL_shader_integer_functions2);8059symbolTable.setFunctionExtensions("countTrailingZeros", 1, &E_GL_INTEL_shader_integer_functions2);8060symbolTable.setFunctionExtensions("absoluteDifference", 1, &E_GL_INTEL_shader_integer_functions2);8061symbolTable.setFunctionExtensions("addSaturate", 1, &E_GL_INTEL_shader_integer_functions2);8062symbolTable.setFunctionExtensions("subtractSaturate", 1, &E_GL_INTEL_shader_integer_functions2);8063symbolTable.setFunctionExtensions("average", 1, &E_GL_INTEL_shader_integer_functions2);8064symbolTable.setFunctionExtensions("averageRounded", 1, &E_GL_INTEL_shader_integer_functions2);8065symbolTable.setFunctionExtensions("multiply32x16", 1, &E_GL_INTEL_shader_integer_functions2);80668067symbolTable.setFunctionExtensions("textureFootprintNV", 1, &E_GL_NV_shader_texture_footprint);8068symbolTable.setFunctionExtensions("textureFootprintClampNV", 1, &E_GL_NV_shader_texture_footprint);8069symbolTable.setFunctionExtensions("textureFootprintLodNV", 1, &E_GL_NV_shader_texture_footprint);8070symbolTable.setFunctionExtensions("textureFootprintGradNV", 1, &E_GL_NV_shader_texture_footprint);8071symbolTable.setFunctionExtensions("textureFootprintGradClampNV", 1, &E_GL_NV_shader_texture_footprint);8072// Compatibility variables, vertex only8073if (spvVersion.spv == 0) {8074BuiltInVariable("gl_Color", EbvColor, symbolTable);8075BuiltInVariable("gl_SecondaryColor", EbvSecondaryColor, symbolTable);8076BuiltInVariable("gl_Normal", EbvNormal, symbolTable);8077BuiltInVariable("gl_Vertex", EbvVertex, symbolTable);8078BuiltInVariable("gl_MultiTexCoord0", EbvMultiTexCoord0, symbolTable);8079BuiltInVariable("gl_MultiTexCoord1", EbvMultiTexCoord1, symbolTable);8080BuiltInVariable("gl_MultiTexCoord2", EbvMultiTexCoord2, symbolTable);8081BuiltInVariable("gl_MultiTexCoord3", EbvMultiTexCoord3, symbolTable);8082BuiltInVariable("gl_MultiTexCoord4", EbvMultiTexCoord4, symbolTable);8083BuiltInVariable("gl_MultiTexCoord5", EbvMultiTexCoord5, symbolTable);8084BuiltInVariable("gl_MultiTexCoord6", EbvMultiTexCoord6, symbolTable);8085BuiltInVariable("gl_MultiTexCoord7", EbvMultiTexCoord7, symbolTable);8086BuiltInVariable("gl_FogCoord", EbvFogFragCoord, symbolTable);8087}80888089if (profile == EEsProfile) {8090if (spvVersion.spv == 0) {8091symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod);8092symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod);8093symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod);8094if (version == 310)8095symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5);8096}8097if (version == 310)8098symbolTable.setFunctionExtensions("fma", Num_AEP_gpu_shader5, AEP_gpu_shader5);8099}81008101if (profile == EEsProfile && version < 320) {8102symbolTable.setFunctionExtensions("imageAtomicAdd", 1, &E_GL_OES_shader_image_atomic);8103symbolTable.setFunctionExtensions("imageAtomicMin", 1, &E_GL_OES_shader_image_atomic);8104symbolTable.setFunctionExtensions("imageAtomicMax", 1, &E_GL_OES_shader_image_atomic);8105symbolTable.setFunctionExtensions("imageAtomicAnd", 1, &E_GL_OES_shader_image_atomic);8106symbolTable.setFunctionExtensions("imageAtomicOr", 1, &E_GL_OES_shader_image_atomic);8107symbolTable.setFunctionExtensions("imageAtomicXor", 1, &E_GL_OES_shader_image_atomic);8108symbolTable.setFunctionExtensions("imageAtomicExchange", 1, &E_GL_OES_shader_image_atomic);8109symbolTable.setFunctionExtensions("imageAtomicCompSwap", 1, &E_GL_OES_shader_image_atomic);8110}81118112if (version >= 300 /* both ES and non-ES */) {8113symbolTable.setVariableExtensions("gl_ViewID_OVR", Num_OVR_multiview_EXTs, OVR_multiview_EXTs);8114BuiltInVariable("gl_ViewID_OVR", EbvViewIndex, symbolTable);8115}81168117if (profile == EEsProfile) {8118symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers);8119symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers);8120}81218122// E_GL_EXT_texture_array8123if (profile != EEsProfile && spvVersion.spv == 0) {8124symbolTable.setFunctionExtensions("texture1DArray", 1, &E_GL_EXT_texture_array);8125symbolTable.setFunctionExtensions("texture2DArray", 1, &E_GL_EXT_texture_array);8126symbolTable.setFunctionExtensions("shadow1DArray", 1, &E_GL_EXT_texture_array);8127symbolTable.setFunctionExtensions("shadow2DArray", 1, &E_GL_EXT_texture_array);81288129symbolTable.setFunctionExtensions("texture1DArrayLod", 1, &E_GL_EXT_texture_array);8130symbolTable.setFunctionExtensions("texture2DArrayLod", 1, &E_GL_EXT_texture_array);8131symbolTable.setFunctionExtensions("shadow1DArrayLod", 1, &E_GL_EXT_texture_array);8132}8133[[fallthrough]];81348135case EShLangTessControl:8136if (profile == EEsProfile && version >= 310) {8137BuiltInVariable("gl_BoundingBoxEXT", EbvBoundingBox, symbolTable);8138symbolTable.setVariableExtensions("gl_BoundingBoxEXT", 1,8139&E_GL_EXT_primitive_bounding_box);8140BuiltInVariable("gl_BoundingBoxOES", EbvBoundingBox, symbolTable);8141symbolTable.setVariableExtensions("gl_BoundingBoxOES", 1,8142&E_GL_OES_primitive_bounding_box);81438144if (version >= 320) {8145BuiltInVariable("gl_BoundingBox", EbvBoundingBox, symbolTable);8146}8147}8148[[fallthrough]];81498150case EShLangTessEvaluation:8151case EShLangGeometry:8152SpecialQualifier("gl_Position", EvqPosition, EbvPosition, symbolTable);8153SpecialQualifier("gl_PointSize", EvqPointSize, EbvPointSize, symbolTable);81548155BuiltInVariable("gl_in", "gl_Position", EbvPosition, symbolTable);8156BuiltInVariable("gl_in", "gl_PointSize", EbvPointSize, symbolTable);81578158BuiltInVariable("gl_out", "gl_Position", EbvPosition, symbolTable);8159BuiltInVariable("gl_out", "gl_PointSize", EbvPointSize, symbolTable);81608161SpecialQualifier("gl_ClipVertex", EvqClipVertex, EbvClipVertex, symbolTable);81628163BuiltInVariable("gl_in", "gl_ClipDistance", EbvClipDistance, symbolTable);8164BuiltInVariable("gl_in", "gl_CullDistance", EbvCullDistance, symbolTable);81658166BuiltInVariable("gl_out", "gl_ClipDistance", EbvClipDistance, symbolTable);8167BuiltInVariable("gl_out", "gl_CullDistance", EbvCullDistance, symbolTable);81688169BuiltInVariable("gl_ClipDistance", EbvClipDistance, symbolTable);8170BuiltInVariable("gl_CullDistance", EbvCullDistance, symbolTable);8171BuiltInVariable("gl_PrimitiveIDIn", EbvPrimitiveId, symbolTable);8172BuiltInVariable("gl_PrimitiveID", EbvPrimitiveId, symbolTable);8173BuiltInVariable("gl_InvocationID", EbvInvocationId, symbolTable);8174BuiltInVariable("gl_Layer", EbvLayer, symbolTable);8175BuiltInVariable("gl_ViewportIndex", EbvViewportIndex, symbolTable);81768177if (language != EShLangGeometry) {8178symbolTable.setVariableExtensions("gl_Layer", Num_viewportEXTs, viewportEXTs);8179symbolTable.setVariableExtensions("gl_ViewportIndex", Num_viewportEXTs, viewportEXTs);8180}8181symbolTable.setVariableExtensions("gl_ViewportMask", 1, &E_GL_NV_viewport_array2);8182symbolTable.setVariableExtensions("gl_SecondaryPositionNV", 1, &E_GL_NV_stereo_view_rendering);8183symbolTable.setVariableExtensions("gl_SecondaryViewportMaskNV", 1, &E_GL_NV_stereo_view_rendering);8184symbolTable.setVariableExtensions("gl_PositionPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes);8185symbolTable.setVariableExtensions("gl_ViewportMaskPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes);81868187BuiltInVariable("gl_ViewportMask", EbvViewportMaskNV, symbolTable);8188BuiltInVariable("gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable);8189BuiltInVariable("gl_SecondaryViewportMaskNV", EbvSecondaryViewportMaskNV, symbolTable);8190BuiltInVariable("gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable);8191BuiltInVariable("gl_ViewportMaskPerViewNV", EbvViewportMaskPerViewNV, symbolTable);81928193if (language == EShLangVertex || language == EShLangGeometry) {8194symbolTable.setVariableExtensions("gl_in", "gl_SecondaryPositionNV", 1, &E_GL_NV_stereo_view_rendering);8195symbolTable.setVariableExtensions("gl_in", "gl_PositionPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes);81968197BuiltInVariable("gl_in", "gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable);8198BuiltInVariable("gl_in", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable);8199}8200symbolTable.setVariableExtensions("gl_out", "gl_ViewportMask", 1, &E_GL_NV_viewport_array2);8201symbolTable.setVariableExtensions("gl_out", "gl_SecondaryPositionNV", 1, &E_GL_NV_stereo_view_rendering);8202symbolTable.setVariableExtensions("gl_out", "gl_SecondaryViewportMaskNV", 1, &E_GL_NV_stereo_view_rendering);8203symbolTable.setVariableExtensions("gl_out", "gl_PositionPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes);8204symbolTable.setVariableExtensions("gl_out", "gl_ViewportMaskPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes);82058206BuiltInVariable("gl_out", "gl_ViewportMask", EbvViewportMaskNV, symbolTable);8207BuiltInVariable("gl_out", "gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable);8208BuiltInVariable("gl_out", "gl_SecondaryViewportMaskNV", EbvSecondaryViewportMaskNV, symbolTable);8209BuiltInVariable("gl_out", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable);8210BuiltInVariable("gl_out", "gl_ViewportMaskPerViewNV", EbvViewportMaskPerViewNV, symbolTable);82118212BuiltInVariable("gl_PatchVerticesIn", EbvPatchVertices, symbolTable);8213BuiltInVariable("gl_TessLevelOuter", EbvTessLevelOuter, symbolTable);8214BuiltInVariable("gl_TessLevelInner", EbvTessLevelInner, symbolTable);8215BuiltInVariable("gl_TessCoord", EbvTessCoord, symbolTable);82168217if (version < 410)8218symbolTable.setVariableExtensions("gl_ViewportIndex", 1, &E_GL_ARB_viewport_array);82198220// Compatibility variables82218222BuiltInVariable("gl_in", "gl_ClipVertex", EbvClipVertex, symbolTable);8223BuiltInVariable("gl_in", "gl_FrontColor", EbvFrontColor, symbolTable);8224BuiltInVariable("gl_in", "gl_BackColor", EbvBackColor, symbolTable);8225BuiltInVariable("gl_in", "gl_FrontSecondaryColor", EbvFrontSecondaryColor, symbolTable);8226BuiltInVariable("gl_in", "gl_BackSecondaryColor", EbvBackSecondaryColor, symbolTable);8227BuiltInVariable("gl_in", "gl_TexCoord", EbvTexCoord, symbolTable);8228BuiltInVariable("gl_in", "gl_FogFragCoord", EbvFogFragCoord, symbolTable);82298230BuiltInVariable("gl_out", "gl_ClipVertex", EbvClipVertex, symbolTable);8231BuiltInVariable("gl_out", "gl_FrontColor", EbvFrontColor, symbolTable);8232BuiltInVariable("gl_out", "gl_BackColor", EbvBackColor, symbolTable);8233BuiltInVariable("gl_out", "gl_FrontSecondaryColor", EbvFrontSecondaryColor, symbolTable);8234BuiltInVariable("gl_out", "gl_BackSecondaryColor", EbvBackSecondaryColor, symbolTable);8235BuiltInVariable("gl_out", "gl_TexCoord", EbvTexCoord, symbolTable);8236BuiltInVariable("gl_out", "gl_FogFragCoord", EbvFogFragCoord, symbolTable);82378238BuiltInVariable("gl_ClipVertex", EbvClipVertex, symbolTable);8239BuiltInVariable("gl_FrontColor", EbvFrontColor, symbolTable);8240BuiltInVariable("gl_BackColor", EbvBackColor, symbolTable);8241BuiltInVariable("gl_FrontSecondaryColor", EbvFrontSecondaryColor, symbolTable);8242BuiltInVariable("gl_BackSecondaryColor", EbvBackSecondaryColor, symbolTable);8243BuiltInVariable("gl_TexCoord", EbvTexCoord, symbolTable);8244BuiltInVariable("gl_FogFragCoord", EbvFogFragCoord, symbolTable);82458246// gl_PointSize, when it needs to be tied to an extension, is always a member of a block.8247// (Sometimes with an instance name, sometimes anonymous).8248if (profile == EEsProfile) {8249if (language == EShLangGeometry) {8250symbolTable.setVariableExtensions("gl_PointSize", Num_AEP_geometry_point_size, AEP_geometry_point_size);8251symbolTable.setVariableExtensions("gl_in", "gl_PointSize", Num_AEP_geometry_point_size, AEP_geometry_point_size);8252} else if (language == EShLangTessEvaluation || language == EShLangTessControl) {8253// gl_in tessellation settings of gl_PointSize are in the context-dependent paths8254symbolTable.setVariableExtensions("gl_PointSize", Num_AEP_tessellation_point_size, AEP_tessellation_point_size);8255symbolTable.setVariableExtensions("gl_out", "gl_PointSize", Num_AEP_tessellation_point_size, AEP_tessellation_point_size);8256}8257}82588259if ((profile != EEsProfile && version >= 140) ||8260(profile == EEsProfile && version >= 310)) {8261symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);8262BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);8263symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);8264BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);8265}82668267if (profile != EEsProfile) {8268BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable);8269BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable);8270BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable);8271BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable);8272BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable);8273BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable);82748275if (spvVersion.vulkan > 0) {8276// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan8277SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);8278if (language == EShLangFragment)8279ModifyFlatDecoration("gl_SubGroupSizeARB", true, symbolTable);8280}8281else8282BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable);8283}82848285// GL_KHR_shader_subgroup8286if ((profile == EEsProfile && version >= 310) ||8287(profile != EEsProfile && version >= 140)) {8288symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);8289symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);8290symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);8291symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot);8292symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot);8293symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot);8294symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot);82958296BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable);8297BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable);8298BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable);8299BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable);8300BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable);8301BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable);8302BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable);83038304// GL_NV_shader_sm_builtins8305symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins);8306symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins);8307symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins);8308symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins);8309BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable);8310BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);8311BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);8312BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);83138314// GL_ARM_shader_core_builtins8315symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);8316symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);8317symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);8318symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);8319symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);83208321BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);8322BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);8323BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);8324BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);8325BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);8326}83278328if (language == EShLangGeometry || language == EShLangVertex) {8329if ((profile == EEsProfile && version >= 310) ||8330(profile != EEsProfile && version >= 450)) {8331symbolTable.setVariableExtensions("gl_PrimitiveShadingRateEXT", 1, &E_GL_EXT_fragment_shading_rate);8332BuiltInVariable("gl_PrimitiveShadingRateEXT", EbvPrimitiveShadingRateKHR, symbolTable);83338334symbolTable.setVariableExtensions("gl_ShadingRateFlag2VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);8335symbolTable.setVariableExtensions("gl_ShadingRateFlag4VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);8336symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);8337symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);8338}8339}8340break;83418342case EShLangFragment:8343SpecialQualifier("gl_FrontFacing", EvqFace, EbvFace, symbolTable);8344SpecialQualifier("gl_FragCoord", EvqFragCoord, EbvFragCoord, symbolTable);8345SpecialQualifier("gl_PointCoord", EvqPointCoord, EbvPointCoord, symbolTable);8346if (spvVersion.spv == 0)8347SpecialQualifier("gl_FragColor", EvqFragColor, EbvFragColor, symbolTable);8348else {8349TSymbol* symbol = symbolTable.find("gl_FragColor");8350if (symbol) {8351symbol->getWritableType().getQualifier().storage = EvqVaryingOut;8352symbol->getWritableType().getQualifier().layoutLocation = 0;8353}8354}8355SpecialQualifier("gl_FragDepth", EvqFragDepth, EbvFragDepth, symbolTable);8356SpecialQualifier("gl_FragDepthEXT", EvqFragDepth, EbvFragDepth, symbolTable);8357SpecialQualifier("gl_FragStencilRefARB", EvqFragStencil, EbvFragStencilRef, symbolTable);8358SpecialQualifier("gl_HelperInvocation", EvqVaryingIn, EbvHelperInvocation, symbolTable);83598360BuiltInVariable("gl_ClipDistance", EbvClipDistance, symbolTable);8361BuiltInVariable("gl_CullDistance", EbvCullDistance, symbolTable);8362BuiltInVariable("gl_PrimitiveID", EbvPrimitiveId, symbolTable);83638364if (profile != EEsProfile && version >= 140) {8365symbolTable.setVariableExtensions("gl_FragStencilRefARB", 1, &E_GL_ARB_shader_stencil_export);8366BuiltInVariable("gl_FragStencilRefARB", EbvFragStencilRef, symbolTable);8367}83688369if (profile != EEsProfile && version < 400) {8370symbolTable.setFunctionExtensions("textureQueryLOD", 1, &E_GL_ARB_texture_query_lod);8371}83728373if (profile != EEsProfile && version >= 460) {8374symbolTable.setFunctionExtensions("rayQueryInitializeEXT", 1, &E_GL_EXT_ray_query);8375symbolTable.setFunctionExtensions("rayQueryTerminateEXT", 1, &E_GL_EXT_ray_query);8376symbolTable.setFunctionExtensions("rayQueryGenerateIntersectionEXT", 1, &E_GL_EXT_ray_query);8377symbolTable.setFunctionExtensions("rayQueryConfirmIntersectionEXT", 1, &E_GL_EXT_ray_query);8378symbolTable.setFunctionExtensions("rayQueryProceedEXT", 1, &E_GL_EXT_ray_query);8379symbolTable.setFunctionExtensions("rayQueryGetIntersectionTypeEXT", 1, &E_GL_EXT_ray_query);8380symbolTable.setFunctionExtensions("rayQueryGetIntersectionTEXT", 1, &E_GL_EXT_ray_query);8381symbolTable.setFunctionExtensions("rayQueryGetRayFlagsEXT", 1, &E_GL_EXT_ray_query);8382symbolTable.setFunctionExtensions("rayQueryGetRayTMinEXT", 1, &E_GL_EXT_ray_query);8383symbolTable.setFunctionExtensions("rayQueryGetIntersectionInstanceCustomIndexEXT", 1, &E_GL_EXT_ray_query);8384symbolTable.setFunctionExtensions("rayQueryGetIntersectionInstanceIdEXT", 1, &E_GL_EXT_ray_query);8385symbolTable.setFunctionExtensions("rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT", 1, &E_GL_EXT_ray_query);8386symbolTable.setFunctionExtensions("rayQueryGetIntersectionGeometryIndexEXT", 1, &E_GL_EXT_ray_query);8387symbolTable.setFunctionExtensions("rayQueryGetIntersectionPrimitiveIndexEXT", 1, &E_GL_EXT_ray_query);8388symbolTable.setFunctionExtensions("rayQueryGetIntersectionBarycentricsEXT", 1, &E_GL_EXT_ray_query);8389symbolTable.setFunctionExtensions("rayQueryGetIntersectionFrontFaceEXT", 1, &E_GL_EXT_ray_query);8390symbolTable.setFunctionExtensions("rayQueryGetIntersectionCandidateAABBOpaqueEXT", 1, &E_GL_EXT_ray_query);8391symbolTable.setFunctionExtensions("rayQueryGetIntersectionObjectRayDirectionEXT", 1, &E_GL_EXT_ray_query);8392symbolTable.setFunctionExtensions("rayQueryGetIntersectionObjectRayOriginEXT", 1, &E_GL_EXT_ray_query);8393symbolTable.setFunctionExtensions("rayQueryGetIntersectionObjectToWorldEXT", 1, &E_GL_EXT_ray_query);8394symbolTable.setFunctionExtensions("rayQueryGetIntersectionWorldToObjectEXT", 1, &E_GL_EXT_ray_query);8395symbolTable.setFunctionExtensions("rayQueryGetWorldRayOriginEXT", 1, &E_GL_EXT_ray_query);8396symbolTable.setFunctionExtensions("rayQueryGetWorldRayDirectionEXT", 1, &E_GL_EXT_ray_query);8397symbolTable.setFunctionExtensions("rayQueryGetIntersectionTriangleVertexPositionsEXT", 1, &E_GL_EXT_ray_tracing_position_fetch);8398symbolTable.setVariableExtensions("gl_RayFlagsSkipAABBEXT", 1, &E_GL_EXT_ray_flags_primitive_culling);8399symbolTable.setVariableExtensions("gl_RayFlagsSkipTrianglesEXT", 1, &E_GL_EXT_ray_flags_primitive_culling);8400symbolTable.setVariableExtensions("gl_RayFlagsForceOpacityMicromap2StateEXT", 1, &E_GL_EXT_opacity_micromap);8401}84028403if ((profile != EEsProfile && version >= 130) ||8404(profile == EEsProfile && version >= 310)) {8405BuiltInVariable("gl_SampleID", EbvSampleId, symbolTable);8406BuiltInVariable("gl_SamplePosition", EbvSamplePosition, symbolTable);8407BuiltInVariable("gl_SampleMask", EbvSampleMask, symbolTable);84088409if (profile != EEsProfile && version < 400) {8410BuiltInVariable("gl_NumSamples", EbvSampleMask, symbolTable);84118412symbolTable.setVariableExtensions("gl_SampleMask", 1, &E_GL_ARB_sample_shading);8413symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_ARB_sample_shading);8414symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_ARB_sample_shading);8415symbolTable.setVariableExtensions("gl_NumSamples", 1, &E_GL_ARB_sample_shading);8416} else {8417BuiltInVariable("gl_SampleMaskIn", EbvSampleMask, symbolTable);84188419if (profile == EEsProfile && version < 320) {8420symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_OES_sample_variables);8421symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_OES_sample_variables);8422symbolTable.setVariableExtensions("gl_SampleMaskIn", 1, &E_GL_OES_sample_variables);8423symbolTable.setVariableExtensions("gl_SampleMask", 1, &E_GL_OES_sample_variables);8424symbolTable.setVariableExtensions("gl_NumSamples", 1, &E_GL_OES_sample_variables);8425}8426}8427}84288429BuiltInVariable("gl_Layer", EbvLayer, symbolTable);8430BuiltInVariable("gl_ViewportIndex", EbvViewportIndex, symbolTable);84318432// Compatibility variables84338434BuiltInVariable("gl_in", "gl_FogFragCoord", EbvFogFragCoord, symbolTable);8435BuiltInVariable("gl_in", "gl_TexCoord", EbvTexCoord, symbolTable);8436BuiltInVariable("gl_in", "gl_Color", EbvColor, symbolTable);8437BuiltInVariable("gl_in", "gl_SecondaryColor", EbvSecondaryColor, symbolTable);84388439BuiltInVariable("gl_FogFragCoord", EbvFogFragCoord, symbolTable);8440BuiltInVariable("gl_TexCoord", EbvTexCoord, symbolTable);8441BuiltInVariable("gl_Color", EbvColor, symbolTable);8442BuiltInVariable("gl_SecondaryColor", EbvSecondaryColor, symbolTable);84438444// built-in functions84458446if (profile == EEsProfile) {8447if (spvVersion.spv == 0) {8448symbolTable.setFunctionExtensions("texture2DLodEXT", 1, &E_GL_EXT_shader_texture_lod);8449symbolTable.setFunctionExtensions("texture2DProjLodEXT", 1, &E_GL_EXT_shader_texture_lod);8450symbolTable.setFunctionExtensions("textureCubeLodEXT", 1, &E_GL_EXT_shader_texture_lod);8451symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod);8452symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod);8453symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod);8454if (version < 320)8455symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5);8456}8457if (version == 100) {8458symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_OES_standard_derivatives);8459symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_OES_standard_derivatives);8460symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_OES_standard_derivatives);8461}8462if (version == 310) {8463symbolTable.setFunctionExtensions("fma", Num_AEP_gpu_shader5, AEP_gpu_shader5);8464symbolTable.setFunctionExtensions("interpolateAtCentroid", 1, &E_GL_OES_shader_multisample_interpolation);8465symbolTable.setFunctionExtensions("interpolateAtSample", 1, &E_GL_OES_shader_multisample_interpolation);8466symbolTable.setFunctionExtensions("interpolateAtOffset", 1, &E_GL_OES_shader_multisample_interpolation);8467}8468} else if (version < 130) {8469if (spvVersion.spv == 0) {8470symbolTable.setFunctionExtensions("texture1DLod", 1, &E_GL_ARB_shader_texture_lod);8471symbolTable.setFunctionExtensions("texture2DLod", 1, &E_GL_ARB_shader_texture_lod);8472symbolTable.setFunctionExtensions("texture3DLod", 1, &E_GL_ARB_shader_texture_lod);8473symbolTable.setFunctionExtensions("textureCubeLod", 1, &E_GL_ARB_shader_texture_lod);8474symbolTable.setFunctionExtensions("texture1DProjLod", 1, &E_GL_ARB_shader_texture_lod);8475symbolTable.setFunctionExtensions("texture2DProjLod", 1, &E_GL_ARB_shader_texture_lod);8476symbolTable.setFunctionExtensions("texture3DProjLod", 1, &E_GL_ARB_shader_texture_lod);8477symbolTable.setFunctionExtensions("shadow1DLod", 1, &E_GL_ARB_shader_texture_lod);8478symbolTable.setFunctionExtensions("shadow2DLod", 1, &E_GL_ARB_shader_texture_lod);8479symbolTable.setFunctionExtensions("shadow1DProjLod", 1, &E_GL_ARB_shader_texture_lod);8480symbolTable.setFunctionExtensions("shadow2DProjLod", 1, &E_GL_ARB_shader_texture_lod);8481}8482}84838484// E_GL_ARB_shader_texture_lod functions usable only with the extension enabled8485if (profile != EEsProfile && spvVersion.spv == 0) {8486symbolTable.setFunctionExtensions("texture1DGradARB", 1, &E_GL_ARB_shader_texture_lod);8487symbolTable.setFunctionExtensions("texture1DProjGradARB", 1, &E_GL_ARB_shader_texture_lod);8488symbolTable.setFunctionExtensions("texture2DGradARB", 1, &E_GL_ARB_shader_texture_lod);8489symbolTable.setFunctionExtensions("texture2DProjGradARB", 1, &E_GL_ARB_shader_texture_lod);8490symbolTable.setFunctionExtensions("texture3DGradARB", 1, &E_GL_ARB_shader_texture_lod);8491symbolTable.setFunctionExtensions("texture3DProjGradARB", 1, &E_GL_ARB_shader_texture_lod);8492symbolTable.setFunctionExtensions("textureCubeGradARB", 1, &E_GL_ARB_shader_texture_lod);8493symbolTable.setFunctionExtensions("shadow1DGradARB", 1, &E_GL_ARB_shader_texture_lod);8494symbolTable.setFunctionExtensions("shadow1DProjGradARB", 1, &E_GL_ARB_shader_texture_lod);8495symbolTable.setFunctionExtensions("shadow2DGradARB", 1, &E_GL_ARB_shader_texture_lod);8496symbolTable.setFunctionExtensions("shadow2DProjGradARB", 1, &E_GL_ARB_shader_texture_lod);8497symbolTable.setFunctionExtensions("texture2DRectGradARB", 1, &E_GL_ARB_shader_texture_lod);8498symbolTable.setFunctionExtensions("texture2DRectProjGradARB", 1, &E_GL_ARB_shader_texture_lod);8499symbolTable.setFunctionExtensions("shadow2DRectGradARB", 1, &E_GL_ARB_shader_texture_lod);8500symbolTable.setFunctionExtensions("shadow2DRectProjGradARB", 1, &E_GL_ARB_shader_texture_lod);8501}85028503// E_GL_ARB_shader_image_load_store8504if (profile != EEsProfile && version < 420)8505symbolTable.setFunctionExtensions("memoryBarrier", 1, &E_GL_ARB_shader_image_load_store);8506// All the image access functions are protected by checks on the type of the first argument.85078508// E_GL_ARB_shader_atomic_counters8509if (profile != EEsProfile && version < 420) {8510symbolTable.setFunctionExtensions("atomicCounterIncrement", 1, &E_GL_ARB_shader_atomic_counters);8511symbolTable.setFunctionExtensions("atomicCounterDecrement", 1, &E_GL_ARB_shader_atomic_counters);8512symbolTable.setFunctionExtensions("atomicCounter" , 1, &E_GL_ARB_shader_atomic_counters);8513}85148515// E_GL_ARB_shader_atomic_counter_ops8516if (profile != EEsProfile && version == 450) {8517symbolTable.setFunctionExtensions("atomicCounterAddARB" , 1, &E_GL_ARB_shader_atomic_counter_ops);8518symbolTable.setFunctionExtensions("atomicCounterSubtractARB", 1, &E_GL_ARB_shader_atomic_counter_ops);8519symbolTable.setFunctionExtensions("atomicCounterMinARB" , 1, &E_GL_ARB_shader_atomic_counter_ops);8520symbolTable.setFunctionExtensions("atomicCounterMaxARB" , 1, &E_GL_ARB_shader_atomic_counter_ops);8521symbolTable.setFunctionExtensions("atomicCounterAndARB" , 1, &E_GL_ARB_shader_atomic_counter_ops);8522symbolTable.setFunctionExtensions("atomicCounterOrARB" , 1, &E_GL_ARB_shader_atomic_counter_ops);8523symbolTable.setFunctionExtensions("atomicCounterXorARB" , 1, &E_GL_ARB_shader_atomic_counter_ops);8524symbolTable.setFunctionExtensions("atomicCounterExchangeARB", 1, &E_GL_ARB_shader_atomic_counter_ops);8525symbolTable.setFunctionExtensions("atomicCounterCompSwapARB", 1, &E_GL_ARB_shader_atomic_counter_ops);8526}85278528// E_GL_ARB_derivative_control8529if (profile != EEsProfile && version < 450) {8530symbolTable.setFunctionExtensions("dFdxFine", 1, &E_GL_ARB_derivative_control);8531symbolTable.setFunctionExtensions("dFdyFine", 1, &E_GL_ARB_derivative_control);8532symbolTable.setFunctionExtensions("fwidthFine", 1, &E_GL_ARB_derivative_control);8533symbolTable.setFunctionExtensions("dFdxCoarse", 1, &E_GL_ARB_derivative_control);8534symbolTable.setFunctionExtensions("dFdyCoarse", 1, &E_GL_ARB_derivative_control);8535symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_ARB_derivative_control);8536}85378538// E_GL_ARB_sparse_texture28539if (profile != EEsProfile)8540{8541symbolTable.setFunctionExtensions("sparseTextureARB", 1, &E_GL_ARB_sparse_texture2);8542symbolTable.setFunctionExtensions("sparseTextureLodARB", 1, &E_GL_ARB_sparse_texture2);8543symbolTable.setFunctionExtensions("sparseTextureOffsetARB", 1, &E_GL_ARB_sparse_texture2);8544symbolTable.setFunctionExtensions("sparseTexelFetchARB", 1, &E_GL_ARB_sparse_texture2);8545symbolTable.setFunctionExtensions("sparseTexelFetchOffsetARB", 1, &E_GL_ARB_sparse_texture2);8546symbolTable.setFunctionExtensions("sparseTextureLodOffsetARB", 1, &E_GL_ARB_sparse_texture2);8547symbolTable.setFunctionExtensions("sparseTextureGradARB", 1, &E_GL_ARB_sparse_texture2);8548symbolTable.setFunctionExtensions("sparseTextureGradOffsetARB", 1, &E_GL_ARB_sparse_texture2);8549symbolTable.setFunctionExtensions("sparseTextureGatherARB", 1, &E_GL_ARB_sparse_texture2);8550symbolTable.setFunctionExtensions("sparseTextureGatherOffsetARB", 1, &E_GL_ARB_sparse_texture2);8551symbolTable.setFunctionExtensions("sparseTextureGatherOffsetsARB", 1, &E_GL_ARB_sparse_texture2);8552symbolTable.setFunctionExtensions("sparseImageLoadARB", 1, &E_GL_ARB_sparse_texture2);8553symbolTable.setFunctionExtensions("sparseTexelsResident", 1, &E_GL_ARB_sparse_texture2);8554}85558556// E_GL_ARB_sparse_texture_clamp8557if (profile != EEsProfile)8558{8559symbolTable.setFunctionExtensions("sparseTextureClampARB", 1, &E_GL_ARB_sparse_texture_clamp);8560symbolTable.setFunctionExtensions("sparseTextureOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp);8561symbolTable.setFunctionExtensions("sparseTextureGradClampARB", 1, &E_GL_ARB_sparse_texture_clamp);8562symbolTable.setFunctionExtensions("sparseTextureGradOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp);8563symbolTable.setFunctionExtensions("textureClampARB", 1, &E_GL_ARB_sparse_texture_clamp);8564symbolTable.setFunctionExtensions("textureOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp);8565symbolTable.setFunctionExtensions("textureGradClampARB", 1, &E_GL_ARB_sparse_texture_clamp);8566symbolTable.setFunctionExtensions("textureGradOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp);8567}85688569// E_GL_AMD_shader_explicit_vertex_parameter8570if (profile != EEsProfile) {8571symbolTable.setVariableExtensions("gl_BaryCoordNoPerspAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);8572symbolTable.setVariableExtensions("gl_BaryCoordNoPerspCentroidAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);8573symbolTable.setVariableExtensions("gl_BaryCoordNoPerspSampleAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);8574symbolTable.setVariableExtensions("gl_BaryCoordSmoothAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);8575symbolTable.setVariableExtensions("gl_BaryCoordSmoothCentroidAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);8576symbolTable.setVariableExtensions("gl_BaryCoordSmoothSampleAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);8577symbolTable.setVariableExtensions("gl_BaryCoordPullModelAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);85788579symbolTable.setFunctionExtensions("interpolateAtVertexAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);85808581BuiltInVariable("gl_BaryCoordNoPerspAMD", EbvBaryCoordNoPersp, symbolTable);8582BuiltInVariable("gl_BaryCoordNoPerspCentroidAMD", EbvBaryCoordNoPerspCentroid, symbolTable);8583BuiltInVariable("gl_BaryCoordNoPerspSampleAMD", EbvBaryCoordNoPerspSample, symbolTable);8584BuiltInVariable("gl_BaryCoordSmoothAMD", EbvBaryCoordSmooth, symbolTable);8585BuiltInVariable("gl_BaryCoordSmoothCentroidAMD", EbvBaryCoordSmoothCentroid, symbolTable);8586BuiltInVariable("gl_BaryCoordSmoothSampleAMD", EbvBaryCoordSmoothSample, symbolTable);8587BuiltInVariable("gl_BaryCoordPullModelAMD", EbvBaryCoordPullModel, symbolTable);8588}85898590// E_GL_AMD_texture_gather_bias_lod8591if (profile != EEsProfile) {8592symbolTable.setFunctionExtensions("textureGatherLodAMD", 1, &E_GL_AMD_texture_gather_bias_lod);8593symbolTable.setFunctionExtensions("textureGatherLodOffsetAMD", 1, &E_GL_AMD_texture_gather_bias_lod);8594symbolTable.setFunctionExtensions("textureGatherLodOffsetsAMD", 1, &E_GL_AMD_texture_gather_bias_lod);8595symbolTable.setFunctionExtensions("sparseTextureGatherLodAMD", 1, &E_GL_AMD_texture_gather_bias_lod);8596symbolTable.setFunctionExtensions("sparseTextureGatherLodOffsetAMD", 1, &E_GL_AMD_texture_gather_bias_lod);8597symbolTable.setFunctionExtensions("sparseTextureGatherLodOffsetsAMD", 1, &E_GL_AMD_texture_gather_bias_lod);8598}85998600// E_GL_AMD_shader_image_load_store_lod8601if (profile != EEsProfile) {8602symbolTable.setFunctionExtensions("imageLoadLodAMD", 1, &E_GL_AMD_shader_image_load_store_lod);8603symbolTable.setFunctionExtensions("imageStoreLodAMD", 1, &E_GL_AMD_shader_image_load_store_lod);8604symbolTable.setFunctionExtensions("sparseImageLoadLodAMD", 1, &E_GL_AMD_shader_image_load_store_lod);8605}8606if (profile != EEsProfile && version >= 430) {8607symbolTable.setVariableExtensions("gl_FragFullyCoveredNV", 1, &E_GL_NV_conservative_raster_underestimation);8608BuiltInVariable("gl_FragFullyCoveredNV", EbvFragFullyCoveredNV, symbolTable);8609}8610if ((profile != EEsProfile && version >= 450) ||8611(profile == EEsProfile && version >= 320)) {8612symbolTable.setVariableExtensions("gl_FragmentSizeNV", 1, &E_GL_NV_shading_rate_image);8613symbolTable.setVariableExtensions("gl_InvocationsPerPixelNV", 1, &E_GL_NV_shading_rate_image);8614BuiltInVariable("gl_FragmentSizeNV", EbvFragmentSizeNV, symbolTable);8615BuiltInVariable("gl_InvocationsPerPixelNV", EbvInvocationsPerPixelNV, symbolTable);8616symbolTable.setVariableExtensions("gl_BaryCoordNV", 1, &E_GL_NV_fragment_shader_barycentric);8617symbolTable.setVariableExtensions("gl_BaryCoordNoPerspNV", 1, &E_GL_NV_fragment_shader_barycentric);8618BuiltInVariable("gl_BaryCoordNV", EbvBaryCoordNV, symbolTable);8619BuiltInVariable("gl_BaryCoordNoPerspNV", EbvBaryCoordNoPerspNV, symbolTable);8620symbolTable.setVariableExtensions("gl_BaryCoordEXT", 1, &E_GL_EXT_fragment_shader_barycentric);8621symbolTable.setVariableExtensions("gl_BaryCoordNoPerspEXT", 1, &E_GL_EXT_fragment_shader_barycentric);8622BuiltInVariable("gl_BaryCoordEXT", EbvBaryCoordEXT, symbolTable);8623BuiltInVariable("gl_BaryCoordNoPerspEXT", EbvBaryCoordNoPerspEXT, symbolTable);8624}86258626if ((profile != EEsProfile && version >= 450) ||8627(profile == EEsProfile && version >= 310)) {8628symbolTable.setVariableExtensions("gl_FragSizeEXT", 1, &E_GL_EXT_fragment_invocation_density);8629symbolTable.setVariableExtensions("gl_FragInvocationCountEXT", 1, &E_GL_EXT_fragment_invocation_density);8630BuiltInVariable("gl_FragSizeEXT", EbvFragSizeEXT, symbolTable);8631BuiltInVariable("gl_FragInvocationCountEXT", EbvFragInvocationCountEXT, symbolTable);8632}86338634symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &E_GL_EXT_frag_depth);86358636symbolTable.setFunctionExtensions("clockARB", 1, &E_GL_ARB_shader_clock);8637symbolTable.setFunctionExtensions("clock2x32ARB", 1, &E_GL_ARB_shader_clock);86388639symbolTable.setFunctionExtensions("clockRealtimeEXT", 1, &E_GL_EXT_shader_realtime_clock);8640symbolTable.setFunctionExtensions("clockRealtime2x32EXT", 1, &E_GL_EXT_shader_realtime_clock);86418642if (profile == EEsProfile && version < 320) {8643symbolTable.setVariableExtensions("gl_PrimitiveID", Num_AEP_geometry_shader, AEP_geometry_shader);8644symbolTable.setVariableExtensions("gl_Layer", Num_AEP_geometry_shader, AEP_geometry_shader);8645}86468647if (profile == EEsProfile && version < 320) {8648symbolTable.setFunctionExtensions("imageAtomicAdd", 1, &E_GL_OES_shader_image_atomic);8649symbolTable.setFunctionExtensions("imageAtomicMin", 1, &E_GL_OES_shader_image_atomic);8650symbolTable.setFunctionExtensions("imageAtomicMax", 1, &E_GL_OES_shader_image_atomic);8651symbolTable.setFunctionExtensions("imageAtomicAnd", 1, &E_GL_OES_shader_image_atomic);8652symbolTable.setFunctionExtensions("imageAtomicOr", 1, &E_GL_OES_shader_image_atomic);8653symbolTable.setFunctionExtensions("imageAtomicXor", 1, &E_GL_OES_shader_image_atomic);8654symbolTable.setFunctionExtensions("imageAtomicExchange", 1, &E_GL_OES_shader_image_atomic);8655symbolTable.setFunctionExtensions("imageAtomicCompSwap", 1, &E_GL_OES_shader_image_atomic);8656}86578658if (profile != EEsProfile && version < 330 ) {8659const char* bitsConvertExt[2] = {E_GL_ARB_shader_bit_encoding, E_GL_ARB_gpu_shader5};8660symbolTable.setFunctionExtensions("floatBitsToInt", 2, bitsConvertExt);8661symbolTable.setFunctionExtensions("floatBitsToUint", 2, bitsConvertExt);8662symbolTable.setFunctionExtensions("intBitsToFloat", 2, bitsConvertExt);8663symbolTable.setFunctionExtensions("uintBitsToFloat", 2, bitsConvertExt);8664}86658666if (profile != EEsProfile && version < 430 ) {8667symbolTable.setFunctionExtensions("imageSize", 1, &E_GL_ARB_shader_image_size);8668}86698670// GL_ARB_shader_storage_buffer_object8671if (profile != EEsProfile && version < 430 ) {8672symbolTable.setFunctionExtensions("atomicAdd", 1, &E_GL_ARB_shader_storage_buffer_object);8673symbolTable.setFunctionExtensions("atomicMin", 1, &E_GL_ARB_shader_storage_buffer_object);8674symbolTable.setFunctionExtensions("atomicMax", 1, &E_GL_ARB_shader_storage_buffer_object);8675symbolTable.setFunctionExtensions("atomicAnd", 1, &E_GL_ARB_shader_storage_buffer_object);8676symbolTable.setFunctionExtensions("atomicOr", 1, &E_GL_ARB_shader_storage_buffer_object);8677symbolTable.setFunctionExtensions("atomicXor", 1, &E_GL_ARB_shader_storage_buffer_object);8678symbolTable.setFunctionExtensions("atomicExchange", 1, &E_GL_ARB_shader_storage_buffer_object);8679symbolTable.setFunctionExtensions("atomicCompSwap", 1, &E_GL_ARB_shader_storage_buffer_object);8680}86818682// GL_ARB_shading_language_packing8683if (profile != EEsProfile && version < 400 ) {8684symbolTable.setFunctionExtensions("packUnorm2x16", 1, &E_GL_ARB_shading_language_packing);8685symbolTable.setFunctionExtensions("unpackUnorm2x16", 1, &E_GL_ARB_shading_language_packing);8686symbolTable.setFunctionExtensions("packSnorm4x8", 1, &E_GL_ARB_shading_language_packing);8687symbolTable.setFunctionExtensions("packUnorm4x8", 1, &E_GL_ARB_shading_language_packing);8688symbolTable.setFunctionExtensions("unpackSnorm4x8", 1, &E_GL_ARB_shading_language_packing);8689symbolTable.setFunctionExtensions("unpackUnorm4x8", 1, &E_GL_ARB_shading_language_packing);8690}8691if (profile != EEsProfile && version < 420 ) {8692symbolTable.setFunctionExtensions("packSnorm2x16", 1, &E_GL_ARB_shading_language_packing);8693symbolTable.setFunctionExtensions("unpackSnorm2x16", 1, &E_GL_ARB_shading_language_packing);8694symbolTable.setFunctionExtensions("unpackHalf2x16", 1, &E_GL_ARB_shading_language_packing);8695symbolTable.setFunctionExtensions("packHalf2x16", 1, &E_GL_ARB_shading_language_packing);8696}86978698symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);8699BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);8700symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);8701BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);8702if (version >= 300 /* both ES and non-ES */) {8703symbolTable.setVariableExtensions("gl_ViewID_OVR", Num_OVR_multiview_EXTs, OVR_multiview_EXTs);8704BuiltInVariable("gl_ViewID_OVR", EbvViewIndex, symbolTable);8705}87068707// GL_ARB_shader_ballot8708if (profile != EEsProfile) {8709symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);8710symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot);8711symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot);8712symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot);8713symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot);8714symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot);8715symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot);87168717BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable);8718BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable);8719BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable);8720BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable);8721BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable);8722BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable);87238724if (spvVersion.vulkan > 0) {8725// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan8726SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);8727if (language == EShLangFragment)8728ModifyFlatDecoration("gl_SubGroupSizeARB", true, symbolTable);8729}8730else8731BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable);8732}87338734// GL_EXT_expect_assume8735if ((profile == EEsProfile && version >= 310) ||8736(profile != EEsProfile && version >= 140)) {8737symbolTable.setFunctionExtensions("assumeEXT", 1, &E_GL_EXT_expect_assume);8738symbolTable.setFunctionExtensions("expectEXT", 1, &E_GL_EXT_expect_assume);8739}87408741// GL_KHR_shader_subgroup8742if ((profile == EEsProfile && version >= 310) ||8743(profile != EEsProfile && version >= 140)) {8744symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);8745symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);8746symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);8747symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot);8748symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot);8749symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot);8750symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot);87518752BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable);8753BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable);8754BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable);8755BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable);8756BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable);8757BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable);8758BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable);87598760symbolTable.setFunctionExtensions("subgroupBarrier", 1, &E_GL_KHR_shader_subgroup_basic);8761symbolTable.setFunctionExtensions("subgroupMemoryBarrier", 1, &E_GL_KHR_shader_subgroup_basic);8762symbolTable.setFunctionExtensions("subgroupMemoryBarrierBuffer", 1, &E_GL_KHR_shader_subgroup_basic);8763symbolTable.setFunctionExtensions("subgroupMemoryBarrierImage", 1, &E_GL_KHR_shader_subgroup_basic);8764symbolTable.setFunctionExtensions("subgroupElect", 1, &E_GL_KHR_shader_subgroup_basic);8765symbolTable.setFunctionExtensions("subgroupAll", 1, &E_GL_KHR_shader_subgroup_vote);8766symbolTable.setFunctionExtensions("subgroupAny", 1, &E_GL_KHR_shader_subgroup_vote);8767symbolTable.setFunctionExtensions("subgroupAllEqual", 1, &E_GL_KHR_shader_subgroup_vote);8768symbolTable.setFunctionExtensions("subgroupBroadcast", 1, &E_GL_KHR_shader_subgroup_ballot);8769symbolTable.setFunctionExtensions("subgroupBroadcastFirst", 1, &E_GL_KHR_shader_subgroup_ballot);8770symbolTable.setFunctionExtensions("subgroupBallot", 1, &E_GL_KHR_shader_subgroup_ballot);8771symbolTable.setFunctionExtensions("subgroupInverseBallot", 1, &E_GL_KHR_shader_subgroup_ballot);8772symbolTable.setFunctionExtensions("subgroupBallotBitExtract", 1, &E_GL_KHR_shader_subgroup_ballot);8773symbolTable.setFunctionExtensions("subgroupBallotBitCount", 1, &E_GL_KHR_shader_subgroup_ballot);8774symbolTable.setFunctionExtensions("subgroupBallotInclusiveBitCount", 1, &E_GL_KHR_shader_subgroup_ballot);8775symbolTable.setFunctionExtensions("subgroupBallotExclusiveBitCount", 1, &E_GL_KHR_shader_subgroup_ballot);8776symbolTable.setFunctionExtensions("subgroupBallotFindLSB", 1, &E_GL_KHR_shader_subgroup_ballot);8777symbolTable.setFunctionExtensions("subgroupBallotFindMSB", 1, &E_GL_KHR_shader_subgroup_ballot);8778symbolTable.setFunctionExtensions("subgroupShuffle", 1, &E_GL_KHR_shader_subgroup_shuffle);8779symbolTable.setFunctionExtensions("subgroupShuffleXor", 1, &E_GL_KHR_shader_subgroup_shuffle);8780symbolTable.setFunctionExtensions("subgroupShuffleUp", 1, &E_GL_KHR_shader_subgroup_shuffle_relative);8781symbolTable.setFunctionExtensions("subgroupShuffleDown", 1, &E_GL_KHR_shader_subgroup_shuffle_relative);8782symbolTable.setFunctionExtensions("subgroupRotate", 1, &E_GL_KHR_shader_subgroup_rotate);8783symbolTable.setFunctionExtensions("subgroupClusteredRotate", 1, &E_GL_KHR_shader_subgroup_rotate);8784symbolTable.setFunctionExtensions("subgroupAdd", 1, &E_GL_KHR_shader_subgroup_arithmetic);8785symbolTable.setFunctionExtensions("subgroupMul", 1, &E_GL_KHR_shader_subgroup_arithmetic);8786symbolTable.setFunctionExtensions("subgroupMin", 1, &E_GL_KHR_shader_subgroup_arithmetic);8787symbolTable.setFunctionExtensions("subgroupMax", 1, &E_GL_KHR_shader_subgroup_arithmetic);8788symbolTable.setFunctionExtensions("subgroupAnd", 1, &E_GL_KHR_shader_subgroup_arithmetic);8789symbolTable.setFunctionExtensions("subgroupOr", 1, &E_GL_KHR_shader_subgroup_arithmetic);8790symbolTable.setFunctionExtensions("subgroupXor", 1, &E_GL_KHR_shader_subgroup_arithmetic);8791symbolTable.setFunctionExtensions("subgroupInclusiveAdd", 1, &E_GL_KHR_shader_subgroup_arithmetic);8792symbolTable.setFunctionExtensions("subgroupInclusiveMul", 1, &E_GL_KHR_shader_subgroup_arithmetic);8793symbolTable.setFunctionExtensions("subgroupInclusiveMin", 1, &E_GL_KHR_shader_subgroup_arithmetic);8794symbolTable.setFunctionExtensions("subgroupInclusiveMax", 1, &E_GL_KHR_shader_subgroup_arithmetic);8795symbolTable.setFunctionExtensions("subgroupInclusiveAnd", 1, &E_GL_KHR_shader_subgroup_arithmetic);8796symbolTable.setFunctionExtensions("subgroupInclusiveOr", 1, &E_GL_KHR_shader_subgroup_arithmetic);8797symbolTable.setFunctionExtensions("subgroupInclusiveXor", 1, &E_GL_KHR_shader_subgroup_arithmetic);8798symbolTable.setFunctionExtensions("subgroupExclusiveAdd", 1, &E_GL_KHR_shader_subgroup_arithmetic);8799symbolTable.setFunctionExtensions("subgroupExclusiveMul", 1, &E_GL_KHR_shader_subgroup_arithmetic);8800symbolTable.setFunctionExtensions("subgroupExclusiveMin", 1, &E_GL_KHR_shader_subgroup_arithmetic);8801symbolTable.setFunctionExtensions("subgroupExclusiveMax", 1, &E_GL_KHR_shader_subgroup_arithmetic);8802symbolTable.setFunctionExtensions("subgroupExclusiveAnd", 1, &E_GL_KHR_shader_subgroup_arithmetic);8803symbolTable.setFunctionExtensions("subgroupExclusiveOr", 1, &E_GL_KHR_shader_subgroup_arithmetic);8804symbolTable.setFunctionExtensions("subgroupExclusiveXor", 1, &E_GL_KHR_shader_subgroup_arithmetic);8805symbolTable.setFunctionExtensions("subgroupClusteredAdd", 1, &E_GL_KHR_shader_subgroup_clustered);8806symbolTable.setFunctionExtensions("subgroupClusteredMul", 1, &E_GL_KHR_shader_subgroup_clustered);8807symbolTable.setFunctionExtensions("subgroupClusteredMin", 1, &E_GL_KHR_shader_subgroup_clustered);8808symbolTable.setFunctionExtensions("subgroupClusteredMax", 1, &E_GL_KHR_shader_subgroup_clustered);8809symbolTable.setFunctionExtensions("subgroupClusteredAnd", 1, &E_GL_KHR_shader_subgroup_clustered);8810symbolTable.setFunctionExtensions("subgroupClusteredOr", 1, &E_GL_KHR_shader_subgroup_clustered);8811symbolTable.setFunctionExtensions("subgroupClusteredXor", 1, &E_GL_KHR_shader_subgroup_clustered);8812symbolTable.setFunctionExtensions("subgroupQuadBroadcast", 1, &E_GL_KHR_shader_subgroup_quad);8813symbolTable.setFunctionExtensions("subgroupQuadSwapHorizontal", 1, &E_GL_KHR_shader_subgroup_quad);8814symbolTable.setFunctionExtensions("subgroupQuadSwapVertical", 1, &E_GL_KHR_shader_subgroup_quad);8815symbolTable.setFunctionExtensions("subgroupQuadSwapDiagonal", 1, &E_GL_KHR_shader_subgroup_quad);8816symbolTable.setFunctionExtensions("subgroupPartitionNV", 1, &E_GL_NV_shader_subgroup_partitioned);8817symbolTable.setFunctionExtensions("subgroupPartitionedAddNV", 1, &E_GL_NV_shader_subgroup_partitioned);8818symbolTable.setFunctionExtensions("subgroupPartitionedMulNV", 1, &E_GL_NV_shader_subgroup_partitioned);8819symbolTable.setFunctionExtensions("subgroupPartitionedMinNV", 1, &E_GL_NV_shader_subgroup_partitioned);8820symbolTable.setFunctionExtensions("subgroupPartitionedMaxNV", 1, &E_GL_NV_shader_subgroup_partitioned);8821symbolTable.setFunctionExtensions("subgroupPartitionedAndNV", 1, &E_GL_NV_shader_subgroup_partitioned);8822symbolTable.setFunctionExtensions("subgroupPartitionedOrNV", 1, &E_GL_NV_shader_subgroup_partitioned);8823symbolTable.setFunctionExtensions("subgroupPartitionedXorNV", 1, &E_GL_NV_shader_subgroup_partitioned);8824symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveAddNV", 1, &E_GL_NV_shader_subgroup_partitioned);8825symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveMulNV", 1, &E_GL_NV_shader_subgroup_partitioned);8826symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveMinNV", 1, &E_GL_NV_shader_subgroup_partitioned);8827symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveMaxNV", 1, &E_GL_NV_shader_subgroup_partitioned);8828symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveAndNV", 1, &E_GL_NV_shader_subgroup_partitioned);8829symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveOrNV", 1, &E_GL_NV_shader_subgroup_partitioned);8830symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveXorNV", 1, &E_GL_NV_shader_subgroup_partitioned);8831symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveAddNV", 1, &E_GL_NV_shader_subgroup_partitioned);8832symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveMulNV", 1, &E_GL_NV_shader_subgroup_partitioned);8833symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveMinNV", 1, &E_GL_NV_shader_subgroup_partitioned);8834symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveMaxNV", 1, &E_GL_NV_shader_subgroup_partitioned);8835symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveAndNV", 1, &E_GL_NV_shader_subgroup_partitioned);8836symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveOrNV", 1, &E_GL_NV_shader_subgroup_partitioned);8837symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveXorNV", 1, &E_GL_NV_shader_subgroup_partitioned);88388839// GL_NV_shader_sm_builtins8840symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins);8841symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins);8842symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins);8843symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins);8844BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable);8845BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);8846BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);8847BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);88488849// GL_ARM_shader_core_builtins8850symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);8851symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);8852symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);8853symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);8854symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);88558856BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);8857BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);8858BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);8859BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);8860BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);8861}88628863if (profile == EEsProfile) {8864symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers);8865symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers);8866}88678868if (spvVersion.vulkan > 0) {8869symbolTable.setVariableExtensions("gl_ScopeDevice", 1, &E_GL_KHR_memory_scope_semantics);8870symbolTable.setVariableExtensions("gl_ScopeWorkgroup", 1, &E_GL_KHR_memory_scope_semantics);8871symbolTable.setVariableExtensions("gl_ScopeSubgroup", 1, &E_GL_KHR_memory_scope_semantics);8872symbolTable.setVariableExtensions("gl_ScopeInvocation", 1, &E_GL_KHR_memory_scope_semantics);88738874symbolTable.setVariableExtensions("gl_SemanticsRelaxed", 1, &E_GL_KHR_memory_scope_semantics);8875symbolTable.setVariableExtensions("gl_SemanticsAcquire", 1, &E_GL_KHR_memory_scope_semantics);8876symbolTable.setVariableExtensions("gl_SemanticsRelease", 1, &E_GL_KHR_memory_scope_semantics);8877symbolTable.setVariableExtensions("gl_SemanticsAcquireRelease", 1, &E_GL_KHR_memory_scope_semantics);8878symbolTable.setVariableExtensions("gl_SemanticsMakeAvailable", 1, &E_GL_KHR_memory_scope_semantics);8879symbolTable.setVariableExtensions("gl_SemanticsMakeVisible", 1, &E_GL_KHR_memory_scope_semantics);8880symbolTable.setVariableExtensions("gl_SemanticsVolatile", 1, &E_GL_KHR_memory_scope_semantics);88818882symbolTable.setVariableExtensions("gl_StorageSemanticsNone", 1, &E_GL_KHR_memory_scope_semantics);8883symbolTable.setVariableExtensions("gl_StorageSemanticsBuffer", 1, &E_GL_KHR_memory_scope_semantics);8884symbolTable.setVariableExtensions("gl_StorageSemanticsShared", 1, &E_GL_KHR_memory_scope_semantics);8885symbolTable.setVariableExtensions("gl_StorageSemanticsImage", 1, &E_GL_KHR_memory_scope_semantics);8886symbolTable.setVariableExtensions("gl_StorageSemanticsOutput", 1, &E_GL_KHR_memory_scope_semantics);8887}88888889symbolTable.setFunctionExtensions("helperInvocationEXT", 1, &E_GL_EXT_demote_to_helper_invocation);88908891if ((profile == EEsProfile && version >= 310) ||8892(profile != EEsProfile && version >= 450)) {8893symbolTable.setVariableExtensions("gl_ShadingRateEXT", 1, &E_GL_EXT_fragment_shading_rate);8894BuiltInVariable("gl_ShadingRateEXT", EbvShadingRateKHR, symbolTable);88958896symbolTable.setVariableExtensions("gl_ShadingRateFlag2VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);8897symbolTable.setVariableExtensions("gl_ShadingRateFlag4VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);8898symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);8899symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);8900}89018902// GL_EXT_shader_quad_control8903if ((profile != EEsProfile && version >= 140) ||8904(profile == EEsProfile && version >= 310)) {8905symbolTable.setFunctionExtensions("subgroupQuadAll", 1, &E_GL_KHR_shader_subgroup_vote);8906symbolTable.setFunctionExtensions("subgroupQuadAny", 1, &E_GL_KHR_shader_subgroup_vote);8907}89088909// GL_EXT_shader_tile_image8910symbolTable.setFunctionExtensions("stencilAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);8911symbolTable.setFunctionExtensions("depthAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);8912symbolTable.setFunctionExtensions("colorAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);89138914if ((profile == EEsProfile && version >= 310) ||8915(profile != EEsProfile && version >= 140)) {89168917symbolTable.setFunctionExtensions("textureWeightedQCOM", 1, &E_GL_QCOM_image_processing);8918symbolTable.setFunctionExtensions("textureBoxFilterQCOM", 1, &E_GL_QCOM_image_processing);8919symbolTable.setFunctionExtensions("textureBlockMatchSADQCOM", 1, &E_GL_QCOM_image_processing);8920symbolTable.setFunctionExtensions("textureBlockMatchSSDQCOM", 1, &E_GL_QCOM_image_processing);89218922symbolTable.setFunctionExtensions("textureBlockMatchWindowSSDQCOM", 1, &E_GL_QCOM_image_processing2);8923symbolTable.setFunctionExtensions("textureBlockMatchWindowSADQCOM", 1, &E_GL_QCOM_image_processing2);8924symbolTable.setFunctionExtensions("textureBlockMatchGatherSSDQCOM", 1, &E_GL_QCOM_image_processing2);8925symbolTable.setFunctionExtensions("textureBlockMatchGatherSADQCOM", 1, &E_GL_QCOM_image_processing2);8926}8927break;89288929case EShLangCompute:8930BuiltInVariable("gl_NumWorkGroups", EbvNumWorkGroups, symbolTable);8931BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable);8932BuiltInVariable("gl_WorkGroupID", EbvWorkGroupId, symbolTable);8933BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable);8934BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable);8935BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable);8936BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);8937BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);89388939if ((profile != EEsProfile && version >= 140) ||8940(profile == EEsProfile && version >= 310)) {8941symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);8942symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);8943}89448945if (profile != EEsProfile && version < 430) {8946symbolTable.setVariableExtensions("gl_NumWorkGroups", 1, &E_GL_ARB_compute_shader);8947symbolTable.setVariableExtensions("gl_WorkGroupSize", 1, &E_GL_ARB_compute_shader);8948symbolTable.setVariableExtensions("gl_WorkGroupID", 1, &E_GL_ARB_compute_shader);8949symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_ARB_compute_shader);8950symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_ARB_compute_shader);8951symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_ARB_compute_shader);89528953symbolTable.setVariableExtensions("gl_MaxComputeWorkGroupCount", 1, &E_GL_ARB_compute_shader);8954symbolTable.setVariableExtensions("gl_MaxComputeWorkGroupSize", 1, &E_GL_ARB_compute_shader);8955symbolTable.setVariableExtensions("gl_MaxComputeUniformComponents", 1, &E_GL_ARB_compute_shader);8956symbolTable.setVariableExtensions("gl_MaxComputeTextureImageUnits", 1, &E_GL_ARB_compute_shader);8957symbolTable.setVariableExtensions("gl_MaxComputeImageUniforms", 1, &E_GL_ARB_compute_shader);8958symbolTable.setVariableExtensions("gl_MaxComputeAtomicCounters", 1, &E_GL_ARB_compute_shader);8959symbolTable.setVariableExtensions("gl_MaxComputeAtomicCounterBuffers", 1, &E_GL_ARB_compute_shader);89608961symbolTable.setFunctionExtensions("barrier", 1, &E_GL_ARB_compute_shader);8962symbolTable.setFunctionExtensions("memoryBarrierAtomicCounter", 1, &E_GL_ARB_compute_shader);8963symbolTable.setFunctionExtensions("memoryBarrierBuffer", 1, &E_GL_ARB_compute_shader);8964symbolTable.setFunctionExtensions("memoryBarrierImage", 1, &E_GL_ARB_compute_shader);8965symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_ARB_compute_shader);8966symbolTable.setFunctionExtensions("groupMemoryBarrier", 1, &E_GL_ARB_compute_shader);8967}896889698970symbolTable.setFunctionExtensions("controlBarrier", 1, &E_GL_KHR_memory_scope_semantics);8971symbolTable.setFunctionExtensions("debugPrintfEXT", 1, &E_GL_EXT_debug_printf);89728973// GL_ARB_shader_ballot8974if (profile != EEsProfile) {8975symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);8976symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot);8977symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot);8978symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot);8979symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot);8980symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot);8981symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot);89828983BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable);8984BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable);8985BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable);8986BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable);8987BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable);8988BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable);89898990if (spvVersion.vulkan > 0) {8991// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan8992SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);8993if (language == EShLangFragment)8994ModifyFlatDecoration("gl_SubGroupSizeARB", true, symbolTable);8995}8996else8997BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable);8998}89999000// GL_KHR_shader_subgroup9001if ((profile == EEsProfile && version >= 310) ||9002(profile != EEsProfile && version >= 140)) {9003symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);9004symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);9005symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);9006symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot);9007symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot);9008symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot);9009symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot);90109011BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable);9012BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable);9013BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable);9014BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable);9015BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable);9016BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable);9017BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable);90189019// GL_NV_shader_sm_builtins9020symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins);9021symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins);9022symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins);9023symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins);9024BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable);9025BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);9026BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);9027BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);90289029// GL_ARM_shader_core_builtins9030symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);9031symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);9032symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);9033symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);9034symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);90359036BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);9037BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);9038BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);9039BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);9040BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);9041}90429043// GL_KHR_shader_subgroup9044if ((profile == EEsProfile && version >= 310) ||9045(profile != EEsProfile && version >= 140)) {9046symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic);9047symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic);90489049BuiltInVariable("gl_NumSubgroups", EbvNumSubgroups, symbolTable);9050BuiltInVariable("gl_SubgroupID", EbvSubgroupID, symbolTable);90519052symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic);9053}90549055{9056const char *coopExt[2] = { E_GL_NV_cooperative_matrix, E_GL_NV_integer_cooperative_matrix };9057symbolTable.setFunctionExtensions("coopMatLoadNV", 2, coopExt);9058symbolTable.setFunctionExtensions("coopMatStoreNV", 2, coopExt);9059symbolTable.setFunctionExtensions("coopMatMulAddNV", 2, coopExt);9060}90619062{9063symbolTable.setFunctionExtensions("coopMatLoad", 1, &E_GL_KHR_cooperative_matrix);9064symbolTable.setFunctionExtensions("coopMatStore", 1, &E_GL_KHR_cooperative_matrix);9065symbolTable.setFunctionExtensions("coopMatMulAdd", 1, &E_GL_KHR_cooperative_matrix);9066}90679068if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {9069symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_NV_compute_shader_derivatives);9070symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_NV_compute_shader_derivatives);9071symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_NV_compute_shader_derivatives);9072symbolTable.setFunctionExtensions("dFdxFine", 1, &E_GL_NV_compute_shader_derivatives);9073symbolTable.setFunctionExtensions("dFdyFine", 1, &E_GL_NV_compute_shader_derivatives);9074symbolTable.setFunctionExtensions("fwidthFine", 1, &E_GL_NV_compute_shader_derivatives);9075symbolTable.setFunctionExtensions("dFdxCoarse", 1, &E_GL_NV_compute_shader_derivatives);9076symbolTable.setFunctionExtensions("dFdyCoarse", 1, &E_GL_NV_compute_shader_derivatives);9077symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_NV_compute_shader_derivatives);9078}90799080if ((profile == EEsProfile && version >= 310) ||9081(profile != EEsProfile && version >= 450)) {9082symbolTable.setVariableExtensions("gl_ShadingRateFlag2VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9083symbolTable.setVariableExtensions("gl_ShadingRateFlag4VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9084symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9085symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9086}90879088if ((profile != EEsProfile && version >= 460)) {9089symbolTable.setFunctionExtensions("fetchMicroTriangleVertexPositionNV", 1, &E_GL_NV_displacement_micromap);9090symbolTable.setFunctionExtensions("fetchMicroTriangleVertexBarycentricNV", 1, &E_GL_NV_displacement_micromap);9091}9092break;90939094case EShLangRayGen:9095case EShLangIntersect:9096case EShLangAnyHit:9097case EShLangClosestHit:9098case EShLangMiss:9099case EShLangCallable:9100if (profile != EEsProfile && version >= 460) {9101const char *rtexts[] = { E_GL_NV_ray_tracing, E_GL_EXT_ray_tracing };9102symbolTable.setVariableExtensions("gl_LaunchIDNV", 1, &E_GL_NV_ray_tracing);9103symbolTable.setVariableExtensions("gl_LaunchIDEXT", 1, &E_GL_EXT_ray_tracing);9104symbolTable.setVariableExtensions("gl_LaunchSizeNV", 1, &E_GL_NV_ray_tracing);9105symbolTable.setVariableExtensions("gl_LaunchSizeEXT", 1, &E_GL_EXT_ray_tracing);9106symbolTable.setVariableExtensions("gl_PrimitiveID", 2, rtexts);9107symbolTable.setVariableExtensions("gl_InstanceID", 2, rtexts);9108symbolTable.setVariableExtensions("gl_InstanceCustomIndexNV", 1, &E_GL_NV_ray_tracing);9109symbolTable.setVariableExtensions("gl_InstanceCustomIndexEXT", 1, &E_GL_EXT_ray_tracing);9110symbolTable.setVariableExtensions("gl_GeometryIndexEXT", 1, &E_GL_EXT_ray_tracing);9111symbolTable.setVariableExtensions("gl_WorldRayOriginNV", 1, &E_GL_NV_ray_tracing);9112symbolTable.setVariableExtensions("gl_WorldRayOriginEXT", 1, &E_GL_EXT_ray_tracing);9113symbolTable.setVariableExtensions("gl_WorldRayDirectionNV", 1, &E_GL_NV_ray_tracing);9114symbolTable.setVariableExtensions("gl_WorldRayDirectionEXT", 1, &E_GL_EXT_ray_tracing);9115symbolTable.setVariableExtensions("gl_ObjectRayOriginNV", 1, &E_GL_NV_ray_tracing);9116symbolTable.setVariableExtensions("gl_ObjectRayOriginEXT", 1, &E_GL_EXT_ray_tracing);9117symbolTable.setVariableExtensions("gl_ObjectRayDirectionNV", 1, &E_GL_NV_ray_tracing);9118symbolTable.setVariableExtensions("gl_ObjectRayDirectionEXT", 1, &E_GL_EXT_ray_tracing);9119symbolTable.setVariableExtensions("gl_RayTminNV", 1, &E_GL_NV_ray_tracing);9120symbolTable.setVariableExtensions("gl_RayTminEXT", 1, &E_GL_EXT_ray_tracing);9121symbolTable.setVariableExtensions("gl_RayTmaxNV", 1, &E_GL_NV_ray_tracing);9122symbolTable.setVariableExtensions("gl_RayTmaxEXT", 1, &E_GL_EXT_ray_tracing);9123symbolTable.setVariableExtensions("gl_CullMaskEXT", 1, &E_GL_EXT_ray_cull_mask);9124symbolTable.setVariableExtensions("gl_HitTNV", 1, &E_GL_NV_ray_tracing);9125symbolTable.setVariableExtensions("gl_HitTEXT", 1, &E_GL_EXT_ray_tracing);9126symbolTable.setVariableExtensions("gl_HitKindNV", 1, &E_GL_NV_ray_tracing);9127symbolTable.setVariableExtensions("gl_HitKindEXT", 1, &E_GL_EXT_ray_tracing);9128symbolTable.setVariableExtensions("gl_ObjectToWorldNV", 1, &E_GL_NV_ray_tracing);9129symbolTable.setVariableExtensions("gl_ObjectToWorldEXT", 1, &E_GL_EXT_ray_tracing);9130symbolTable.setVariableExtensions("gl_ObjectToWorld3x4EXT", 1, &E_GL_EXT_ray_tracing);9131symbolTable.setVariableExtensions("gl_WorldToObjectNV", 1, &E_GL_NV_ray_tracing);9132symbolTable.setVariableExtensions("gl_WorldToObjectEXT", 1, &E_GL_EXT_ray_tracing);9133symbolTable.setVariableExtensions("gl_WorldToObject3x4EXT", 1, &E_GL_EXT_ray_tracing);9134symbolTable.setVariableExtensions("gl_IncomingRayFlagsNV", 1, &E_GL_NV_ray_tracing);9135symbolTable.setVariableExtensions("gl_IncomingRayFlagsEXT", 1, &E_GL_EXT_ray_tracing);9136symbolTable.setVariableExtensions("gl_CurrentRayTimeNV", 1, &E_GL_NV_ray_tracing_motion_blur);9137symbolTable.setVariableExtensions("gl_HitTriangleVertexPositionsEXT", 1, &E_GL_EXT_ray_tracing_position_fetch);9138symbolTable.setVariableExtensions("gl_HitMicroTriangleVertexPositionsNV", 1, &E_GL_NV_displacement_micromap);9139symbolTable.setVariableExtensions("gl_HitMicroTriangleVertexBarycentricsNV", 1, &E_GL_NV_displacement_micromap);91409141symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);914291439144symbolTable.setFunctionExtensions("traceNV", 1, &E_GL_NV_ray_tracing);9145symbolTable.setFunctionExtensions("traceRayMotionNV", 1, &E_GL_NV_ray_tracing_motion_blur);9146symbolTable.setFunctionExtensions("traceRayEXT", 1, &E_GL_EXT_ray_tracing);9147symbolTable.setFunctionExtensions("reportIntersectionNV", 1, &E_GL_NV_ray_tracing);9148symbolTable.setFunctionExtensions("reportIntersectionEXT", 1, &E_GL_EXT_ray_tracing);9149symbolTable.setFunctionExtensions("ignoreIntersectionNV", 1, &E_GL_NV_ray_tracing);9150symbolTable.setFunctionExtensions("terminateRayNV", 1, &E_GL_NV_ray_tracing);9151symbolTable.setFunctionExtensions("executeCallableNV", 1, &E_GL_NV_ray_tracing);9152symbolTable.setFunctionExtensions("executeCallableEXT", 1, &E_GL_EXT_ray_tracing);91539154symbolTable.setFunctionExtensions("hitObjectTraceRayNV", 1, &E_GL_NV_shader_invocation_reorder);9155symbolTable.setFunctionExtensions("hitObjectTraceRayMotionNV", 1, &E_GL_NV_shader_invocation_reorder);9156symbolTable.setFunctionExtensions("hitObjectRecordHitNV", 1, &E_GL_NV_shader_invocation_reorder);9157symbolTable.setFunctionExtensions("hitObjectRecordHitMotionNV", 1, &E_GL_NV_shader_invocation_reorder);9158symbolTable.setFunctionExtensions("hitObjectRecordHitWithIndexNV", 1, &E_GL_NV_shader_invocation_reorder);9159symbolTable.setFunctionExtensions("hitObjectRecordHitWithIndexMotionNV", 1, &E_GL_NV_shader_invocation_reorder);9160symbolTable.setFunctionExtensions("hitObjectRecordMissNV", 1, &E_GL_NV_shader_invocation_reorder);9161symbolTable.setFunctionExtensions("hitObjectRecordMissMotionNV", 1, &E_GL_NV_shader_invocation_reorder);9162symbolTable.setFunctionExtensions("hitObjectRecordEmptyNV", 1, &E_GL_NV_shader_invocation_reorder);9163symbolTable.setFunctionExtensions("hitObjectExecuteShaderNV", 1, &E_GL_NV_shader_invocation_reorder);9164symbolTable.setFunctionExtensions("hitObjectIsEmptyNV", 1, &E_GL_NV_shader_invocation_reorder);9165symbolTable.setFunctionExtensions("hitObjectIsMissNV", 1, &E_GL_NV_shader_invocation_reorder);9166symbolTable.setFunctionExtensions("hitObjectIsHitNV", 1, &E_GL_NV_shader_invocation_reorder);9167symbolTable.setFunctionExtensions("hitObjectGetRayTMinNV", 1, &E_GL_NV_shader_invocation_reorder);9168symbolTable.setFunctionExtensions("hitObjectGetRayTMaxNV", 1, &E_GL_NV_shader_invocation_reorder);9169symbolTable.setFunctionExtensions("hitObjectGetObjectRayOriginNV", 1, &E_GL_NV_shader_invocation_reorder);9170symbolTable.setFunctionExtensions("hitObjectGetObjectRayDirectionNV", 1, &E_GL_NV_shader_invocation_reorder);9171symbolTable.setFunctionExtensions("hitObjectGetWorldRayOriginNV", 1, &E_GL_NV_shader_invocation_reorder);9172symbolTable.setFunctionExtensions("hitObjectGetWorldRayDirectionNV", 1, &E_GL_NV_shader_invocation_reorder);9173symbolTable.setFunctionExtensions("hitObjectGetWorldToObjectNV", 1, &E_GL_NV_shader_invocation_reorder);9174symbolTable.setFunctionExtensions("hitObjectGetbjectToWorldNV", 1, &E_GL_NV_shader_invocation_reorder);9175symbolTable.setFunctionExtensions("hitObjectGetInstanceCustomIndexNV", 1, &E_GL_NV_shader_invocation_reorder);9176symbolTable.setFunctionExtensions("hitObjectGetInstanceIdNV", 1, &E_GL_NV_shader_invocation_reorder);9177symbolTable.setFunctionExtensions("hitObjectGetGeometryIndexNV", 1, &E_GL_NV_shader_invocation_reorder);9178symbolTable.setFunctionExtensions("hitObjectGetPrimitiveIndexNV", 1, &E_GL_NV_shader_invocation_reorder);9179symbolTable.setFunctionExtensions("hitObjectGetHitKindNV", 1, &E_GL_NV_shader_invocation_reorder);9180symbolTable.setFunctionExtensions("hitObjectGetAttributesNV", 1, &E_GL_NV_shader_invocation_reorder);9181symbolTable.setFunctionExtensions("hitObjectGetCurrentTimeNV", 1, &E_GL_NV_shader_invocation_reorder);9182symbolTable.setFunctionExtensions("hitObjectGetShaderBindingTableRecordIndexNV", 1, &E_GL_NV_shader_invocation_reorder);9183symbolTable.setFunctionExtensions("hitObjectGetShaderRecordBufferHandleNV", 1, &E_GL_NV_shader_invocation_reorder);9184symbolTable.setFunctionExtensions("reorderThreadNV", 1, &E_GL_NV_shader_invocation_reorder);9185symbolTable.setFunctionExtensions("fetchMicroTriangleVertexPositionNV", 1, &E_GL_NV_displacement_micromap);9186symbolTable.setFunctionExtensions("fetchMicroTriangleVertexBarycentricNV", 1, &E_GL_NV_displacement_micromap);918791889189BuiltInVariable("gl_LaunchIDNV", EbvLaunchId, symbolTable);9190BuiltInVariable("gl_LaunchIDEXT", EbvLaunchId, symbolTable);9191BuiltInVariable("gl_LaunchSizeNV", EbvLaunchSize, symbolTable);9192BuiltInVariable("gl_LaunchSizeEXT", EbvLaunchSize, symbolTable);9193BuiltInVariable("gl_PrimitiveID", EbvPrimitiveId, symbolTable);9194BuiltInVariable("gl_InstanceID", EbvInstanceId, symbolTable);9195BuiltInVariable("gl_InstanceCustomIndexNV", EbvInstanceCustomIndex,symbolTable);9196BuiltInVariable("gl_InstanceCustomIndexEXT", EbvInstanceCustomIndex,symbolTable);9197BuiltInVariable("gl_GeometryIndexEXT", EbvGeometryIndex, symbolTable);9198BuiltInVariable("gl_WorldRayOriginNV", EbvWorldRayOrigin, symbolTable);9199BuiltInVariable("gl_WorldRayOriginEXT", EbvWorldRayOrigin, symbolTable);9200BuiltInVariable("gl_WorldRayDirectionNV", EbvWorldRayDirection, symbolTable);9201BuiltInVariable("gl_WorldRayDirectionEXT", EbvWorldRayDirection, symbolTable);9202BuiltInVariable("gl_ObjectRayOriginNV", EbvObjectRayOrigin, symbolTable);9203BuiltInVariable("gl_ObjectRayOriginEXT", EbvObjectRayOrigin, symbolTable);9204BuiltInVariable("gl_ObjectRayDirectionNV", EbvObjectRayDirection, symbolTable);9205BuiltInVariable("gl_ObjectRayDirectionEXT", EbvObjectRayDirection, symbolTable);9206BuiltInVariable("gl_RayTminNV", EbvRayTmin, symbolTable);9207BuiltInVariable("gl_RayTminEXT", EbvRayTmin, symbolTable);9208BuiltInVariable("gl_RayTmaxNV", EbvRayTmax, symbolTable);9209BuiltInVariable("gl_RayTmaxEXT", EbvRayTmax, symbolTable);9210BuiltInVariable("gl_CullMaskEXT", EbvCullMask, symbolTable);9211BuiltInVariable("gl_HitTNV", EbvHitT, symbolTable);9212BuiltInVariable("gl_HitTEXT", EbvHitT, symbolTable);9213BuiltInVariable("gl_HitKindNV", EbvHitKind, symbolTable);9214BuiltInVariable("gl_HitKindEXT", EbvHitKind, symbolTable);9215BuiltInVariable("gl_ObjectToWorldNV", EbvObjectToWorld, symbolTable);9216BuiltInVariable("gl_ObjectToWorldEXT", EbvObjectToWorld, symbolTable);9217BuiltInVariable("gl_ObjectToWorld3x4EXT", EbvObjectToWorld3x4, symbolTable);9218BuiltInVariable("gl_WorldToObjectNV", EbvWorldToObject, symbolTable);9219BuiltInVariable("gl_WorldToObjectEXT", EbvWorldToObject, symbolTable);9220BuiltInVariable("gl_WorldToObject3x4EXT", EbvWorldToObject3x4, symbolTable);9221BuiltInVariable("gl_IncomingRayFlagsNV", EbvIncomingRayFlags, symbolTable);9222BuiltInVariable("gl_IncomingRayFlagsEXT", EbvIncomingRayFlags, symbolTable);9223BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);9224BuiltInVariable("gl_CurrentRayTimeNV", EbvCurrentRayTimeNV, symbolTable);9225BuiltInVariable("gl_HitTriangleVertexPositionsEXT", EbvPositionFetch, symbolTable);9226BuiltInVariable("gl_HitMicroTriangleVertexPositionsNV", EbvMicroTrianglePositionNV, symbolTable);9227BuiltInVariable("gl_HitMicroTriangleVertexBarycentricsNV", EbvMicroTriangleBaryNV, symbolTable);9228BuiltInVariable("gl_HitKindFrontFacingMicroTriangleNV", EbvHitKindFrontFacingMicroTriangleNV, symbolTable);9229BuiltInVariable("gl_HitKindBackFacingMicroTriangleNV", EbvHitKindBackFacingMicroTriangleNV, symbolTable);92309231// GL_ARB_shader_ballot9232symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);9233symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot);9234symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot);9235symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot);9236symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot);9237symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot);9238symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot);92399240BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable);9241BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable);9242BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable);9243BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable);9244BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable);9245BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable);92469247if (spvVersion.vulkan > 0) {9248// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan9249SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);9250if (language == EShLangFragment)9251ModifyFlatDecoration("gl_SubGroupSizeARB", true, symbolTable);9252}9253else9254BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable);92559256// GL_KHR_shader_subgroup9257symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic);9258symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic);9259symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);9260symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);9261symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);9262symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot);9263symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot);9264symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot);9265symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot);92669267BuiltInVariable("gl_NumSubgroups", EbvNumSubgroups, symbolTable);9268BuiltInVariable("gl_SubgroupID", EbvSubgroupID, symbolTable);9269BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable);9270BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable);9271BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable);9272BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable);9273BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable);9274BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable);9275BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable);92769277// GL_NV_shader_sm_builtins9278symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins);9279symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins);9280symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins);9281symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins);9282BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable);9283BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);9284BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);9285BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);92869287// GL_ARM_shader_core_builtins9288symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);9289symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);9290symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);9291symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);9292symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);92939294BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);9295BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);9296BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);9297BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);9298BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);9299}9300if ((profile == EEsProfile && version >= 310) ||9301(profile != EEsProfile && version >= 450)) {9302symbolTable.setVariableExtensions("gl_ShadingRateFlag2VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9303symbolTable.setVariableExtensions("gl_ShadingRateFlag4VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9304symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9305symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9306}9307break;93089309case EShLangMesh:9310if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {9311// per-vertex builtins9312symbolTable.setVariableExtensions("gl_MeshVerticesNV", "gl_Position", 1, &E_GL_NV_mesh_shader);9313symbolTable.setVariableExtensions("gl_MeshVerticesNV", "gl_PointSize", 1, &E_GL_NV_mesh_shader);9314symbolTable.setVariableExtensions("gl_MeshVerticesNV", "gl_ClipDistance", 1, &E_GL_NV_mesh_shader);9315symbolTable.setVariableExtensions("gl_MeshVerticesNV", "gl_CullDistance", 1, &E_GL_NV_mesh_shader);93169317BuiltInVariable("gl_MeshVerticesNV", "gl_Position", EbvPosition, symbolTable);9318BuiltInVariable("gl_MeshVerticesNV", "gl_PointSize", EbvPointSize, symbolTable);9319BuiltInVariable("gl_MeshVerticesNV", "gl_ClipDistance", EbvClipDistance, symbolTable);9320BuiltInVariable("gl_MeshVerticesNV", "gl_CullDistance", EbvCullDistance, symbolTable);93219322symbolTable.setVariableExtensions("gl_MeshVerticesNV", "gl_PositionPerViewNV", 1, &E_GL_NV_mesh_shader);9323symbolTable.setVariableExtensions("gl_MeshVerticesNV", "gl_ClipDistancePerViewNV", 1, &E_GL_NV_mesh_shader);9324symbolTable.setVariableExtensions("gl_MeshVerticesNV", "gl_CullDistancePerViewNV", 1, &E_GL_NV_mesh_shader);93259326BuiltInVariable("gl_MeshVerticesNV", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable);9327BuiltInVariable("gl_MeshVerticesNV", "gl_ClipDistancePerViewNV", EbvClipDistancePerViewNV, symbolTable);9328BuiltInVariable("gl_MeshVerticesNV", "gl_CullDistancePerViewNV", EbvCullDistancePerViewNV, symbolTable);93299330// per-primitive builtins9331symbolTable.setVariableExtensions("gl_MeshPrimitivesNV", "gl_PrimitiveID", 1, &E_GL_NV_mesh_shader);9332symbolTable.setVariableExtensions("gl_MeshPrimitivesNV", "gl_Layer", 1, &E_GL_NV_mesh_shader);9333symbolTable.setVariableExtensions("gl_MeshPrimitivesNV", "gl_ViewportIndex", 1, &E_GL_NV_mesh_shader);9334symbolTable.setVariableExtensions("gl_MeshPrimitivesNV", "gl_ViewportMask", 1, &E_GL_NV_mesh_shader);93359336BuiltInVariable("gl_MeshPrimitivesNV", "gl_PrimitiveID", EbvPrimitiveId, symbolTable);9337BuiltInVariable("gl_MeshPrimitivesNV", "gl_Layer", EbvLayer, symbolTable);9338BuiltInVariable("gl_MeshPrimitivesNV", "gl_ViewportIndex", EbvViewportIndex, symbolTable);9339BuiltInVariable("gl_MeshPrimitivesNV", "gl_ViewportMask", EbvViewportMaskNV, symbolTable);93409341// per-view per-primitive builtins9342symbolTable.setVariableExtensions("gl_MeshPrimitivesNV", "gl_LayerPerViewNV", 1, &E_GL_NV_mesh_shader);9343symbolTable.setVariableExtensions("gl_MeshPrimitivesNV", "gl_ViewportMaskPerViewNV", 1, &E_GL_NV_mesh_shader);93449345BuiltInVariable("gl_MeshPrimitivesNV", "gl_LayerPerViewNV", EbvLayerPerViewNV, symbolTable);9346BuiltInVariable("gl_MeshPrimitivesNV", "gl_ViewportMaskPerViewNV", EbvViewportMaskPerViewNV, symbolTable);93479348// other builtins9349symbolTable.setVariableExtensions("gl_PrimitiveCountNV", 1, &E_GL_NV_mesh_shader);9350symbolTable.setVariableExtensions("gl_PrimitiveIndicesNV", 1, &E_GL_NV_mesh_shader);9351symbolTable.setVariableExtensions("gl_MeshViewCountNV", 1, &E_GL_NV_mesh_shader);9352symbolTable.setVariableExtensions("gl_MeshViewIndicesNV", 1, &E_GL_NV_mesh_shader);9353if (profile != EEsProfile) {9354symbolTable.setVariableExtensions("gl_WorkGroupSize", Num_AEP_mesh_shader, AEP_mesh_shader);9355symbolTable.setVariableExtensions("gl_WorkGroupID", Num_AEP_mesh_shader, AEP_mesh_shader);9356symbolTable.setVariableExtensions("gl_LocalInvocationID", Num_AEP_mesh_shader, AEP_mesh_shader);9357symbolTable.setVariableExtensions("gl_GlobalInvocationID", Num_AEP_mesh_shader, AEP_mesh_shader);9358symbolTable.setVariableExtensions("gl_LocalInvocationIndex", Num_AEP_mesh_shader, AEP_mesh_shader);9359} else {9360symbolTable.setVariableExtensions("gl_WorkGroupSize", 1, &E_GL_NV_mesh_shader);9361symbolTable.setVariableExtensions("gl_WorkGroupID", 1, &E_GL_NV_mesh_shader);9362symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_NV_mesh_shader);9363symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_NV_mesh_shader);9364symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_NV_mesh_shader);9365}9366BuiltInVariable("gl_PrimitiveCountNV", EbvPrimitiveCountNV, symbolTable);9367BuiltInVariable("gl_PrimitiveIndicesNV", EbvPrimitiveIndicesNV, symbolTable);9368BuiltInVariable("gl_MeshViewCountNV", EbvMeshViewCountNV, symbolTable);9369BuiltInVariable("gl_MeshViewIndicesNV", EbvMeshViewIndicesNV, symbolTable);9370BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable);9371BuiltInVariable("gl_WorkGroupID", EbvWorkGroupId, symbolTable);9372BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable);9373BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable);9374BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable);93759376// builtin constants9377symbolTable.setVariableExtensions("gl_MaxMeshOutputVerticesNV", 1, &E_GL_NV_mesh_shader);9378symbolTable.setVariableExtensions("gl_MaxMeshOutputPrimitivesNV", 1, &E_GL_NV_mesh_shader);9379symbolTable.setVariableExtensions("gl_MaxMeshWorkGroupSizeNV", 1, &E_GL_NV_mesh_shader);9380symbolTable.setVariableExtensions("gl_MaxMeshViewCountNV", 1, &E_GL_NV_mesh_shader);93819382// builtin functions9383if (profile != EEsProfile) {9384symbolTable.setFunctionExtensions("barrier", Num_AEP_mesh_shader, AEP_mesh_shader);9385symbolTable.setFunctionExtensions("memoryBarrierShared", Num_AEP_mesh_shader, AEP_mesh_shader);9386symbolTable.setFunctionExtensions("groupMemoryBarrier", Num_AEP_mesh_shader, AEP_mesh_shader);9387} else {9388symbolTable.setFunctionExtensions("barrier", 1, &E_GL_NV_mesh_shader);9389symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_NV_mesh_shader);9390symbolTable.setFunctionExtensions("groupMemoryBarrier", 1, &E_GL_NV_mesh_shader);9391}9392symbolTable.setFunctionExtensions("writePackedPrimitiveIndices4x8NV", 1, &E_GL_NV_mesh_shader);9393}93949395if (profile != EEsProfile && version >= 450) {9396// GL_EXT_Mesh_shader9397symbolTable.setVariableExtensions("gl_PrimitivePointIndicesEXT", 1, &E_GL_EXT_mesh_shader);9398symbolTable.setVariableExtensions("gl_PrimitiveLineIndicesEXT", 1, &E_GL_EXT_mesh_shader);9399symbolTable.setVariableExtensions("gl_PrimitiveTriangleIndicesEXT", 1, &E_GL_EXT_mesh_shader);9400symbolTable.setVariableExtensions("gl_NumWorkGroups", 1, &E_GL_EXT_mesh_shader);94019402BuiltInVariable("gl_PrimitivePointIndicesEXT", EbvPrimitivePointIndicesEXT, symbolTable);9403BuiltInVariable("gl_PrimitiveLineIndicesEXT", EbvPrimitiveLineIndicesEXT, symbolTable);9404BuiltInVariable("gl_PrimitiveTriangleIndicesEXT", EbvPrimitiveTriangleIndicesEXT, symbolTable);9405BuiltInVariable("gl_NumWorkGroups", EbvNumWorkGroups, symbolTable);94069407symbolTable.setVariableExtensions("gl_MeshVerticesEXT", "gl_Position", 1, &E_GL_EXT_mesh_shader);9408symbolTable.setVariableExtensions("gl_MeshVerticesEXT", "gl_PointSize", 1, &E_GL_EXT_mesh_shader);9409symbolTable.setVariableExtensions("gl_MeshVerticesEXT", "gl_ClipDistance", 1, &E_GL_EXT_mesh_shader);9410symbolTable.setVariableExtensions("gl_MeshVerticesEXT", "gl_CullDistance", 1, &E_GL_EXT_mesh_shader);94119412BuiltInVariable("gl_MeshVerticesEXT", "gl_Position", EbvPosition, symbolTable);9413BuiltInVariable("gl_MeshVerticesEXT", "gl_PointSize", EbvPointSize, symbolTable);9414BuiltInVariable("gl_MeshVerticesEXT", "gl_ClipDistance", EbvClipDistance, symbolTable);9415BuiltInVariable("gl_MeshVerticesEXT", "gl_CullDistance", EbvCullDistance, symbolTable);94169417symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_PrimitiveID", 1, &E_GL_EXT_mesh_shader);9418symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_Layer", 1, &E_GL_EXT_mesh_shader);9419symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_ViewportIndex", 1, &E_GL_EXT_mesh_shader);9420symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_CullPrimitiveEXT", 1, &E_GL_EXT_mesh_shader);94219422// note: technically this member requires both GL_EXT_mesh_shader and GL_EXT_fragment_shading_rate9423// since setVariableExtensions only needs *one of* the extensions to validate, it's more useful to specify EXT_fragment_shading_rate9424// GL_EXT_mesh_shader will be required in practice by use of other fields of gl_MeshPrimitivesEXT9425symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_PrimitiveShadingRateEXT", 1, &E_GL_EXT_fragment_shading_rate);94269427BuiltInVariable("gl_MeshPrimitivesEXT", "gl_PrimitiveID", EbvPrimitiveId, symbolTable);9428BuiltInVariable("gl_MeshPrimitivesEXT", "gl_Layer", EbvLayer, symbolTable);9429BuiltInVariable("gl_MeshPrimitivesEXT", "gl_ViewportIndex", EbvViewportIndex, symbolTable);9430BuiltInVariable("gl_MeshPrimitivesEXT", "gl_CullPrimitiveEXT", EbvCullPrimitiveEXT, symbolTable);9431BuiltInVariable("gl_MeshPrimitivesEXT", "gl_PrimitiveShadingRateEXT", EbvPrimitiveShadingRateKHR, symbolTable);94329433symbolTable.setFunctionExtensions("SetMeshOutputsEXT", 1, &E_GL_EXT_mesh_shader);94349435// GL_EXT_device_group9436symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);9437BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);94389439// GL_ARB_shader_draw_parameters9440symbolTable.setVariableExtensions("gl_DrawIDARB", 1, &E_GL_ARB_shader_draw_parameters);9441BuiltInVariable("gl_DrawIDARB", EbvDrawId, symbolTable);9442if (version >= 460) {9443BuiltInVariable("gl_DrawID", EbvDrawId, symbolTable);9444}9445// GL_EXT_multiview9446BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);9447symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);94489449// GL_ARB_shader_ballot9450symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);9451symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot);9452symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot);9453symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot);9454symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot);9455symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot);9456symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot);94579458BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable);9459BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable);9460BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable);9461BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable);9462BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable);9463BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable);94649465if (spvVersion.vulkan > 0) {9466// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan9467SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);9468if (language == EShLangFragment)9469ModifyFlatDecoration("gl_SubGroupSizeARB", true, symbolTable);9470}9471else9472BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable);9473}94749475// GL_KHR_shader_subgroup9476if ((profile == EEsProfile && version >= 310) ||9477(profile != EEsProfile && version >= 140)) {9478symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic);9479symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic);9480symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);9481symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);9482symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);9483symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot);9484symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot);9485symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot);9486symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot);94879488BuiltInVariable("gl_NumSubgroups", EbvNumSubgroups, symbolTable);9489BuiltInVariable("gl_SubgroupID", EbvSubgroupID, symbolTable);9490BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable);9491BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable);9492BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable);9493BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable);9494BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable);9495BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable);9496BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable);94979498symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic);94999500// GL_NV_shader_sm_builtins9501symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins);9502symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins);9503symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins);9504symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins);9505BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable);9506BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);9507BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);9508BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);95099510// GL_ARM_shader_core_builtins9511symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);9512symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);9513symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);9514symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);9515symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);95169517BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);9518BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);9519BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);9520BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);9521BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);9522}95239524if ((profile == EEsProfile && version >= 310) ||9525(profile != EEsProfile && version >= 450)) {9526symbolTable.setVariableExtensions("gl_ShadingRateFlag2VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9527symbolTable.setVariableExtensions("gl_ShadingRateFlag4VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9528symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9529symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9530}95319532// Builtins for GL_NV_displacment_micromap9533if ((profile != EEsProfile && version >= 460)) {9534symbolTable.setFunctionExtensions("fetchMicroTriangleVertexPositionNV", 1, &E_GL_NV_displacement_micromap);9535symbolTable.setFunctionExtensions("fetchMicroTriangleVertexBarycentricNV", 1, &E_GL_NV_displacement_micromap);9536}95379538break;95399540case EShLangTask:9541if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {9542symbolTable.setVariableExtensions("gl_TaskCountNV", 1, &E_GL_NV_mesh_shader);9543symbolTable.setVariableExtensions("gl_MeshViewCountNV", 1, &E_GL_NV_mesh_shader);9544symbolTable.setVariableExtensions("gl_MeshViewIndicesNV", 1, &E_GL_NV_mesh_shader);9545if (profile != EEsProfile) {9546symbolTable.setVariableExtensions("gl_WorkGroupSize", Num_AEP_mesh_shader, AEP_mesh_shader);9547symbolTable.setVariableExtensions("gl_WorkGroupID", Num_AEP_mesh_shader, AEP_mesh_shader);9548symbolTable.setVariableExtensions("gl_LocalInvocationID", Num_AEP_mesh_shader, AEP_mesh_shader);9549symbolTable.setVariableExtensions("gl_GlobalInvocationID", Num_AEP_mesh_shader, AEP_mesh_shader);9550symbolTable.setVariableExtensions("gl_LocalInvocationIndex", Num_AEP_mesh_shader, AEP_mesh_shader);9551} else {9552symbolTable.setVariableExtensions("gl_WorkGroupSize", 1, &E_GL_NV_mesh_shader);9553symbolTable.setVariableExtensions("gl_WorkGroupID", 1, &E_GL_NV_mesh_shader);9554symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_NV_mesh_shader);9555symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_NV_mesh_shader);9556symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_NV_mesh_shader);9557}95589559BuiltInVariable("gl_TaskCountNV", EbvTaskCountNV, symbolTable);9560BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable);9561BuiltInVariable("gl_WorkGroupID", EbvWorkGroupId, symbolTable);9562BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable);9563BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable);9564BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable);9565BuiltInVariable("gl_MeshViewCountNV", EbvMeshViewCountNV, symbolTable);9566BuiltInVariable("gl_MeshViewIndicesNV", EbvMeshViewIndicesNV, symbolTable);95679568symbolTable.setVariableExtensions("gl_MaxTaskWorkGroupSizeNV", 1, &E_GL_NV_mesh_shader);9569symbolTable.setVariableExtensions("gl_MaxMeshViewCountNV", 1, &E_GL_NV_mesh_shader);95709571if (profile != EEsProfile) {9572symbolTable.setFunctionExtensions("barrier", Num_AEP_mesh_shader, AEP_mesh_shader);9573symbolTable.setFunctionExtensions("memoryBarrierShared", Num_AEP_mesh_shader, AEP_mesh_shader);9574symbolTable.setFunctionExtensions("groupMemoryBarrier", Num_AEP_mesh_shader, AEP_mesh_shader);9575} else {9576symbolTable.setFunctionExtensions("barrier", 1, &E_GL_NV_mesh_shader);9577symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_NV_mesh_shader);9578symbolTable.setFunctionExtensions("groupMemoryBarrier", 1, &E_GL_NV_mesh_shader);9579}9580}95819582if (profile != EEsProfile && version >= 450) {9583// GL_EXT_mesh_shader9584symbolTable.setFunctionExtensions("EmitMeshTasksEXT", 1, &E_GL_EXT_mesh_shader);9585symbolTable.setVariableExtensions("gl_NumWorkGroups", 1, &E_GL_EXT_mesh_shader);9586BuiltInVariable("gl_NumWorkGroups", EbvNumWorkGroups, symbolTable);95879588// GL_EXT_device_group9589symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);9590BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);95919592// GL_ARB_shader_draw_parameters9593symbolTable.setVariableExtensions("gl_DrawIDARB", 1, &E_GL_ARB_shader_draw_parameters);9594BuiltInVariable("gl_DrawIDARB", EbvDrawId, symbolTable);9595if (version >= 460) {9596BuiltInVariable("gl_DrawID", EbvDrawId, symbolTable);9597}95989599// GL_ARB_shader_ballot9600symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);9601symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot);9602symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot);9603symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot);9604symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot);9605symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot);9606symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot);96079608BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable);9609BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable);9610BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable);9611BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable);9612BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable);9613BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable);96149615if (spvVersion.vulkan > 0) {9616// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan9617SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);9618if (language == EShLangFragment)9619ModifyFlatDecoration("gl_SubGroupSizeARB", true, symbolTable);9620}9621else9622BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable);9623}96249625// GL_KHR_shader_subgroup9626if ((profile == EEsProfile && version >= 310) ||9627(profile != EEsProfile && version >= 140)) {9628symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic);9629symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic);9630symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);9631symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);9632symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);9633symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot);9634symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot);9635symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot);9636symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot);96379638BuiltInVariable("gl_NumSubgroups", EbvNumSubgroups, symbolTable);9639BuiltInVariable("gl_SubgroupID", EbvSubgroupID, symbolTable);9640BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable);9641BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable);9642BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable);9643BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable);9644BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable);9645BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable);9646BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable);96479648symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic);96499650// GL_NV_shader_sm_builtins9651symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins);9652symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins);9653symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins);9654symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins);9655BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable);9656BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);9657BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);9658BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);96599660// GL_ARM_shader_core_builtins9661symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);9662symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);9663symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);9664symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);9665symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);96669667BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);9668BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);9669BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);9670BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);9671BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);9672}9673if ((profile == EEsProfile && version >= 310) ||9674(profile != EEsProfile && version >= 450)) {9675symbolTable.setVariableExtensions("gl_ShadingRateFlag2VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9676symbolTable.setVariableExtensions("gl_ShadingRateFlag4VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9677symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9678symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);9679}9680break;96819682default:9683assert(false && "Language not supported");9684break;9685}96869687//9688// Next, identify which built-ins have a mapping to an operator.9689// If PureOperatorBuiltins is false, those that are not identified as such are9690// expected to be resolved through a library of functions, versus as9691// operations.9692//96939694relateTabledBuiltins(version, profile, spvVersion, language, symbolTable);96959696symbolTable.relateToOperator("doubleBitsToInt64", EOpDoubleBitsToInt64);9697symbolTable.relateToOperator("doubleBitsToUint64", EOpDoubleBitsToUint64);9698symbolTable.relateToOperator("int64BitsToDouble", EOpInt64BitsToDouble);9699symbolTable.relateToOperator("uint64BitsToDouble", EOpUint64BitsToDouble);9700symbolTable.relateToOperator("halfBitsToInt16", EOpFloat16BitsToInt16);9701symbolTable.relateToOperator("halfBitsToUint16", EOpFloat16BitsToUint16);9702symbolTable.relateToOperator("float16BitsToInt16", EOpFloat16BitsToInt16);9703symbolTable.relateToOperator("float16BitsToUint16", EOpFloat16BitsToUint16);9704symbolTable.relateToOperator("int16BitsToFloat16", EOpInt16BitsToFloat16);9705symbolTable.relateToOperator("uint16BitsToFloat16", EOpUint16BitsToFloat16);97069707symbolTable.relateToOperator("int16BitsToHalf", EOpInt16BitsToFloat16);9708symbolTable.relateToOperator("uint16BitsToHalf", EOpUint16BitsToFloat16);97099710symbolTable.relateToOperator("packSnorm4x8", EOpPackSnorm4x8);9711symbolTable.relateToOperator("unpackSnorm4x8", EOpUnpackSnorm4x8);9712symbolTable.relateToOperator("packUnorm4x8", EOpPackUnorm4x8);9713symbolTable.relateToOperator("unpackUnorm4x8", EOpUnpackUnorm4x8);97149715symbolTable.relateToOperator("packDouble2x32", EOpPackDouble2x32);9716symbolTable.relateToOperator("unpackDouble2x32", EOpUnpackDouble2x32);97179718symbolTable.relateToOperator("packInt2x32", EOpPackInt2x32);9719symbolTable.relateToOperator("unpackInt2x32", EOpUnpackInt2x32);9720symbolTable.relateToOperator("packUint2x32", EOpPackUint2x32);9721symbolTable.relateToOperator("unpackUint2x32", EOpUnpackUint2x32);97229723symbolTable.relateToOperator("packInt2x16", EOpPackInt2x16);9724symbolTable.relateToOperator("unpackInt2x16", EOpUnpackInt2x16);9725symbolTable.relateToOperator("packUint2x16", EOpPackUint2x16);9726symbolTable.relateToOperator("unpackUint2x16", EOpUnpackUint2x16);97279728symbolTable.relateToOperator("packInt4x16", EOpPackInt4x16);9729symbolTable.relateToOperator("unpackInt4x16", EOpUnpackInt4x16);9730symbolTable.relateToOperator("packUint4x16", EOpPackUint4x16);9731symbolTable.relateToOperator("unpackUint4x16", EOpUnpackUint4x16);9732symbolTable.relateToOperator("packFloat2x16", EOpPackFloat2x16);9733symbolTable.relateToOperator("unpackFloat2x16", EOpUnpackFloat2x16);97349735symbolTable.relateToOperator("pack16", EOpPack16);9736symbolTable.relateToOperator("pack32", EOpPack32);9737symbolTable.relateToOperator("pack64", EOpPack64);97389739symbolTable.relateToOperator("unpack32", EOpUnpack32);9740symbolTable.relateToOperator("unpack16", EOpUnpack16);9741symbolTable.relateToOperator("unpack8", EOpUnpack8);97429743symbolTable.relateToOperator("controlBarrier", EOpBarrier);9744symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierAtomicCounter);9745symbolTable.relateToOperator("memoryBarrierImage", EOpMemoryBarrierImage);97469747if (spvVersion.vulkanRelaxed) {9748//9749// functions signature have been replaced to take uint operations on buffer variables9750// remap atomic counter functions to atomic operations9751//9752symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierBuffer);9753}97549755symbolTable.relateToOperator("atomicLoad", EOpAtomicLoad);9756symbolTable.relateToOperator("atomicStore", EOpAtomicStore);97579758symbolTable.relateToOperator("atomicCounterIncrement", EOpAtomicCounterIncrement);9759symbolTable.relateToOperator("atomicCounterDecrement", EOpAtomicCounterDecrement);9760symbolTable.relateToOperator("atomicCounter", EOpAtomicCounter);97619762if (spvVersion.vulkanRelaxed) {9763//9764// functions signature have been replaced to take uint operations9765// remap atomic counter functions to atomic operations9766//9767// these atomic counter functions do not match signatures of glsl9768// atomic functions, so they will be remapped to semantically9769// equivalent functions in the parser9770//9771symbolTable.relateToOperator("atomicCounterIncrement", EOpNull);9772symbolTable.relateToOperator("atomicCounterDecrement", EOpNull);9773symbolTable.relateToOperator("atomicCounter", EOpNull);9774}97759776symbolTable.relateToOperator("clockARB", EOpReadClockSubgroupKHR);9777symbolTable.relateToOperator("clock2x32ARB", EOpReadClockSubgroupKHR);97789779symbolTable.relateToOperator("clockRealtimeEXT", EOpReadClockDeviceKHR);9780symbolTable.relateToOperator("clockRealtime2x32EXT", EOpReadClockDeviceKHR);97819782if (profile != EEsProfile && version == 450) {9783symbolTable.relateToOperator("atomicCounterAddARB", EOpAtomicCounterAdd);9784symbolTable.relateToOperator("atomicCounterSubtractARB", EOpAtomicCounterSubtract);9785symbolTable.relateToOperator("atomicCounterMinARB", EOpAtomicCounterMin);9786symbolTable.relateToOperator("atomicCounterMaxARB", EOpAtomicCounterMax);9787symbolTable.relateToOperator("atomicCounterAndARB", EOpAtomicCounterAnd);9788symbolTable.relateToOperator("atomicCounterOrARB", EOpAtomicCounterOr);9789symbolTable.relateToOperator("atomicCounterXorARB", EOpAtomicCounterXor);9790symbolTable.relateToOperator("atomicCounterExchangeARB", EOpAtomicCounterExchange);9791symbolTable.relateToOperator("atomicCounterCompSwapARB", EOpAtomicCounterCompSwap);9792}97939794if (profile != EEsProfile && version >= 460) {9795symbolTable.relateToOperator("atomicCounterAdd", EOpAtomicCounterAdd);9796symbolTable.relateToOperator("atomicCounterSubtract", EOpAtomicCounterSubtract);9797symbolTable.relateToOperator("atomicCounterMin", EOpAtomicCounterMin);9798symbolTable.relateToOperator("atomicCounterMax", EOpAtomicCounterMax);9799symbolTable.relateToOperator("atomicCounterAnd", EOpAtomicCounterAnd);9800symbolTable.relateToOperator("atomicCounterOr", EOpAtomicCounterOr);9801symbolTable.relateToOperator("atomicCounterXor", EOpAtomicCounterXor);9802symbolTable.relateToOperator("atomicCounterExchange", EOpAtomicCounterExchange);9803symbolTable.relateToOperator("atomicCounterCompSwap", EOpAtomicCounterCompSwap);9804}98059806if (spvVersion.vulkanRelaxed) {9807//9808// functions signature have been replaced to take 'uint' instead of 'atomic_uint'9809// remap atomic counter functions to non-counter atomic ops so9810// functions act as aliases to non-counter atomic ops9811//9812symbolTable.relateToOperator("atomicCounterAdd", EOpAtomicAdd);9813symbolTable.relateToOperator("atomicCounterSubtract", EOpAtomicSubtract);9814symbolTable.relateToOperator("atomicCounterMin", EOpAtomicMin);9815symbolTable.relateToOperator("atomicCounterMax", EOpAtomicMax);9816symbolTable.relateToOperator("atomicCounterAnd", EOpAtomicAnd);9817symbolTable.relateToOperator("atomicCounterOr", EOpAtomicOr);9818symbolTable.relateToOperator("atomicCounterXor", EOpAtomicXor);9819symbolTable.relateToOperator("atomicCounterExchange", EOpAtomicExchange);9820symbolTable.relateToOperator("atomicCounterCompSwap", EOpAtomicCompSwap);9821}98229823symbolTable.relateToOperator("fma", EOpFma);9824symbolTable.relateToOperator("frexp", EOpFrexp);9825symbolTable.relateToOperator("ldexp", EOpLdexp);9826symbolTable.relateToOperator("uaddCarry", EOpAddCarry);9827symbolTable.relateToOperator("usubBorrow", EOpSubBorrow);9828symbolTable.relateToOperator("umulExtended", EOpUMulExtended);9829symbolTable.relateToOperator("imulExtended", EOpIMulExtended);9830symbolTable.relateToOperator("bitfieldExtract", EOpBitfieldExtract);9831symbolTable.relateToOperator("bitfieldInsert", EOpBitfieldInsert);9832symbolTable.relateToOperator("bitfieldReverse", EOpBitFieldReverse);9833symbolTable.relateToOperator("bitCount", EOpBitCount);9834symbolTable.relateToOperator("findLSB", EOpFindLSB);9835symbolTable.relateToOperator("findMSB", EOpFindMSB);98369837symbolTable.relateToOperator("helperInvocationEXT", EOpIsHelperInvocation);98389839symbolTable.relateToOperator("countLeadingZeros", EOpCountLeadingZeros);9840symbolTable.relateToOperator("countTrailingZeros", EOpCountTrailingZeros);9841symbolTable.relateToOperator("absoluteDifference", EOpAbsDifference);9842symbolTable.relateToOperator("addSaturate", EOpAddSaturate);9843symbolTable.relateToOperator("subtractSaturate", EOpSubSaturate);9844symbolTable.relateToOperator("average", EOpAverage);9845symbolTable.relateToOperator("averageRounded", EOpAverageRounded);9846symbolTable.relateToOperator("multiply32x16", EOpMul32x16);9847symbolTable.relateToOperator("debugPrintfEXT", EOpDebugPrintf);9848symbolTable.relateToOperator("assumeEXT", EOpAssumeEXT);9849symbolTable.relateToOperator("expectEXT", EOpExpectEXT);985098519852if (PureOperatorBuiltins) {9853symbolTable.relateToOperator("imageSize", EOpImageQuerySize);9854symbolTable.relateToOperator("imageSamples", EOpImageQuerySamples);9855symbolTable.relateToOperator("imageLoad", EOpImageLoad);9856symbolTable.relateToOperator("imageStore", EOpImageStore);9857symbolTable.relateToOperator("imageAtomicAdd", EOpImageAtomicAdd);9858symbolTable.relateToOperator("imageAtomicMin", EOpImageAtomicMin);9859symbolTable.relateToOperator("imageAtomicMax", EOpImageAtomicMax);9860symbolTable.relateToOperator("imageAtomicAnd", EOpImageAtomicAnd);9861symbolTable.relateToOperator("imageAtomicOr", EOpImageAtomicOr);9862symbolTable.relateToOperator("imageAtomicXor", EOpImageAtomicXor);9863symbolTable.relateToOperator("imageAtomicExchange", EOpImageAtomicExchange);9864symbolTable.relateToOperator("imageAtomicCompSwap", EOpImageAtomicCompSwap);9865symbolTable.relateToOperator("imageAtomicLoad", EOpImageAtomicLoad);9866symbolTable.relateToOperator("imageAtomicStore", EOpImageAtomicStore);98679868symbolTable.relateToOperator("subpassLoad", EOpSubpassLoad);9869symbolTable.relateToOperator("subpassLoadMS", EOpSubpassLoadMS);98709871symbolTable.relateToOperator("textureGather", EOpTextureGather);9872symbolTable.relateToOperator("textureGatherOffset", EOpTextureGatherOffset);9873symbolTable.relateToOperator("textureGatherOffsets", EOpTextureGatherOffsets);98749875symbolTable.relateToOperator("noise1", EOpNoise);9876symbolTable.relateToOperator("noise2", EOpNoise);9877symbolTable.relateToOperator("noise3", EOpNoise);9878symbolTable.relateToOperator("noise4", EOpNoise);98799880symbolTable.relateToOperator("textureFootprintNV", EOpImageSampleFootprintNV);9881symbolTable.relateToOperator("textureFootprintClampNV", EOpImageSampleFootprintClampNV);9882symbolTable.relateToOperator("textureFootprintLodNV", EOpImageSampleFootprintLodNV);9883symbolTable.relateToOperator("textureFootprintGradNV", EOpImageSampleFootprintGradNV);9884symbolTable.relateToOperator("textureFootprintGradClampNV", EOpImageSampleFootprintGradClampNV);98859886if (spvVersion.spv == 0 && IncludeLegacy(version, profile, spvVersion))9887symbolTable.relateToOperator("ftransform", EOpFtransform);98889889if (spvVersion.spv == 0 && (IncludeLegacy(version, profile, spvVersion) ||9890(profile == EEsProfile && version == 100))) {98919892symbolTable.relateToOperator("texture1D", EOpTexture);9893symbolTable.relateToOperator("texture1DGradARB", EOpTextureGrad);9894symbolTable.relateToOperator("texture1DProj", EOpTextureProj);9895symbolTable.relateToOperator("texture1DProjGradARB", EOpTextureProjGrad);9896symbolTable.relateToOperator("texture1DLod", EOpTextureLod);9897symbolTable.relateToOperator("texture1DProjLod", EOpTextureProjLod);98989899symbolTable.relateToOperator("texture2DRect", EOpTexture);9900symbolTable.relateToOperator("texture2DRectProj", EOpTextureProj);9901symbolTable.relateToOperator("texture2DRectGradARB", EOpTextureGrad);9902symbolTable.relateToOperator("texture2DRectProjGradARB", EOpTextureProjGrad);9903symbolTable.relateToOperator("shadow2DRect", EOpTexture);9904symbolTable.relateToOperator("shadow2DRectProj", EOpTextureProj);9905symbolTable.relateToOperator("shadow2DRectGradARB", EOpTextureGrad);9906symbolTable.relateToOperator("shadow2DRectProjGradARB", EOpTextureProjGrad);99079908symbolTable.relateToOperator("texture2D", EOpTexture);9909symbolTable.relateToOperator("texture2DProj", EOpTextureProj);9910symbolTable.relateToOperator("texture2DGradEXT", EOpTextureGrad);9911symbolTable.relateToOperator("texture2DGradARB", EOpTextureGrad);9912symbolTable.relateToOperator("texture2DProjGradEXT", EOpTextureProjGrad);9913symbolTable.relateToOperator("texture2DProjGradARB", EOpTextureProjGrad);9914symbolTable.relateToOperator("texture2DLod", EOpTextureLod);9915symbolTable.relateToOperator("texture2DLodEXT", EOpTextureLod);9916symbolTable.relateToOperator("texture2DProjLod", EOpTextureProjLod);9917symbolTable.relateToOperator("texture2DProjLodEXT", EOpTextureProjLod);99189919symbolTable.relateToOperator("texture3D", EOpTexture);9920symbolTable.relateToOperator("texture3DGradARB", EOpTextureGrad);9921symbolTable.relateToOperator("texture3DProj", EOpTextureProj);9922symbolTable.relateToOperator("texture3DProjGradARB", EOpTextureProjGrad);9923symbolTable.relateToOperator("texture3DLod", EOpTextureLod);9924symbolTable.relateToOperator("texture3DProjLod", EOpTextureProjLod);9925symbolTable.relateToOperator("textureCube", EOpTexture);9926symbolTable.relateToOperator("textureCubeGradEXT", EOpTextureGrad);9927symbolTable.relateToOperator("textureCubeGradARB", EOpTextureGrad);9928symbolTable.relateToOperator("textureCubeLod", EOpTextureLod);9929symbolTable.relateToOperator("textureCubeLodEXT", EOpTextureLod);9930symbolTable.relateToOperator("shadow1D", EOpTexture);9931symbolTable.relateToOperator("shadow1DGradARB", EOpTextureGrad);9932symbolTable.relateToOperator("shadow2D", EOpTexture);9933symbolTable.relateToOperator("shadow2DGradARB", EOpTextureGrad);9934symbolTable.relateToOperator("shadow1DProj", EOpTextureProj);9935symbolTable.relateToOperator("shadow2DProj", EOpTextureProj);9936symbolTable.relateToOperator("shadow1DProjGradARB", EOpTextureProjGrad);9937symbolTable.relateToOperator("shadow2DProjGradARB", EOpTextureProjGrad);9938symbolTable.relateToOperator("shadow1DLod", EOpTextureLod);9939symbolTable.relateToOperator("shadow2DLod", EOpTextureLod);9940symbolTable.relateToOperator("shadow1DProjLod", EOpTextureProjLod);9941symbolTable.relateToOperator("shadow2DProjLod", EOpTextureProjLod);9942}99439944if (profile != EEsProfile) {9945symbolTable.relateToOperator("sparseTextureARB", EOpSparseTexture);9946symbolTable.relateToOperator("sparseTextureLodARB", EOpSparseTextureLod);9947symbolTable.relateToOperator("sparseTextureOffsetARB", EOpSparseTextureOffset);9948symbolTable.relateToOperator("sparseTexelFetchARB", EOpSparseTextureFetch);9949symbolTable.relateToOperator("sparseTexelFetchOffsetARB", EOpSparseTextureFetchOffset);9950symbolTable.relateToOperator("sparseTextureLodOffsetARB", EOpSparseTextureLodOffset);9951symbolTable.relateToOperator("sparseTextureGradARB", EOpSparseTextureGrad);9952symbolTable.relateToOperator("sparseTextureGradOffsetARB", EOpSparseTextureGradOffset);9953symbolTable.relateToOperator("sparseTextureGatherARB", EOpSparseTextureGather);9954symbolTable.relateToOperator("sparseTextureGatherOffsetARB", EOpSparseTextureGatherOffset);9955symbolTable.relateToOperator("sparseTextureGatherOffsetsARB", EOpSparseTextureGatherOffsets);9956symbolTable.relateToOperator("sparseImageLoadARB", EOpSparseImageLoad);9957symbolTable.relateToOperator("sparseTexelsResidentARB", EOpSparseTexelsResident);99589959symbolTable.relateToOperator("sparseTextureClampARB", EOpSparseTextureClamp);9960symbolTable.relateToOperator("sparseTextureOffsetClampARB", EOpSparseTextureOffsetClamp);9961symbolTable.relateToOperator("sparseTextureGradClampARB", EOpSparseTextureGradClamp);9962symbolTable.relateToOperator("sparseTextureGradOffsetClampARB", EOpSparseTextureGradOffsetClamp);9963symbolTable.relateToOperator("textureClampARB", EOpTextureClamp);9964symbolTable.relateToOperator("textureOffsetClampARB", EOpTextureOffsetClamp);9965symbolTable.relateToOperator("textureGradClampARB", EOpTextureGradClamp);9966symbolTable.relateToOperator("textureGradOffsetClampARB", EOpTextureGradOffsetClamp);99679968symbolTable.relateToOperator("ballotARB", EOpBallot);9969symbolTable.relateToOperator("readInvocationARB", EOpReadInvocation);9970symbolTable.relateToOperator("readFirstInvocationARB", EOpReadFirstInvocation);99719972if (version >= 430) {9973symbolTable.relateToOperator("anyInvocationARB", EOpAnyInvocation);9974symbolTable.relateToOperator("allInvocationsARB", EOpAllInvocations);9975symbolTable.relateToOperator("allInvocationsEqualARB", EOpAllInvocationsEqual);9976}9977if (version >= 460) {9978symbolTable.relateToOperator("anyInvocation", EOpAnyInvocation);9979symbolTable.relateToOperator("allInvocations", EOpAllInvocations);9980symbolTable.relateToOperator("allInvocationsEqual", EOpAllInvocationsEqual);9981}9982symbolTable.relateToOperator("minInvocationsAMD", EOpMinInvocations);9983symbolTable.relateToOperator("maxInvocationsAMD", EOpMaxInvocations);9984symbolTable.relateToOperator("addInvocationsAMD", EOpAddInvocations);9985symbolTable.relateToOperator("minInvocationsNonUniformAMD", EOpMinInvocationsNonUniform);9986symbolTable.relateToOperator("maxInvocationsNonUniformAMD", EOpMaxInvocationsNonUniform);9987symbolTable.relateToOperator("addInvocationsNonUniformAMD", EOpAddInvocationsNonUniform);9988symbolTable.relateToOperator("minInvocationsInclusiveScanAMD", EOpMinInvocationsInclusiveScan);9989symbolTable.relateToOperator("maxInvocationsInclusiveScanAMD", EOpMaxInvocationsInclusiveScan);9990symbolTable.relateToOperator("addInvocationsInclusiveScanAMD", EOpAddInvocationsInclusiveScan);9991symbolTable.relateToOperator("minInvocationsInclusiveScanNonUniformAMD", EOpMinInvocationsInclusiveScanNonUniform);9992symbolTable.relateToOperator("maxInvocationsInclusiveScanNonUniformAMD", EOpMaxInvocationsInclusiveScanNonUniform);9993symbolTable.relateToOperator("addInvocationsInclusiveScanNonUniformAMD", EOpAddInvocationsInclusiveScanNonUniform);9994symbolTable.relateToOperator("minInvocationsExclusiveScanAMD", EOpMinInvocationsExclusiveScan);9995symbolTable.relateToOperator("maxInvocationsExclusiveScanAMD", EOpMaxInvocationsExclusiveScan);9996symbolTable.relateToOperator("addInvocationsExclusiveScanAMD", EOpAddInvocationsExclusiveScan);9997symbolTable.relateToOperator("minInvocationsExclusiveScanNonUniformAMD", EOpMinInvocationsExclusiveScanNonUniform);9998symbolTable.relateToOperator("maxInvocationsExclusiveScanNonUniformAMD", EOpMaxInvocationsExclusiveScanNonUniform);9999symbolTable.relateToOperator("addInvocationsExclusiveScanNonUniformAMD", EOpAddInvocationsExclusiveScanNonUniform);10000symbolTable.relateToOperator("swizzleInvocationsAMD", EOpSwizzleInvocations);10001symbolTable.relateToOperator("swizzleInvocationsMaskedAMD", EOpSwizzleInvocationsMasked);10002symbolTable.relateToOperator("writeInvocationAMD", EOpWriteInvocation);10003symbolTable.relateToOperator("mbcntAMD", EOpMbcnt);1000410005symbolTable.relateToOperator("min3", EOpMin3);10006symbolTable.relateToOperator("max3", EOpMax3);10007symbolTable.relateToOperator("mid3", EOpMid3);1000810009symbolTable.relateToOperator("cubeFaceIndexAMD", EOpCubeFaceIndex);10010symbolTable.relateToOperator("cubeFaceCoordAMD", EOpCubeFaceCoord);10011symbolTable.relateToOperator("timeAMD", EOpTime);1001210013symbolTable.relateToOperator("textureGatherLodAMD", EOpTextureGatherLod);10014symbolTable.relateToOperator("textureGatherLodOffsetAMD", EOpTextureGatherLodOffset);10015symbolTable.relateToOperator("textureGatherLodOffsetsAMD", EOpTextureGatherLodOffsets);10016symbolTable.relateToOperator("sparseTextureGatherLodAMD", EOpSparseTextureGatherLod);10017symbolTable.relateToOperator("sparseTextureGatherLodOffsetAMD", EOpSparseTextureGatherLodOffset);10018symbolTable.relateToOperator("sparseTextureGatherLodOffsetsAMD", EOpSparseTextureGatherLodOffsets);1001910020symbolTable.relateToOperator("imageLoadLodAMD", EOpImageLoadLod);10021symbolTable.relateToOperator("imageStoreLodAMD", EOpImageStoreLod);10022symbolTable.relateToOperator("sparseImageLoadLodAMD", EOpSparseImageLoadLod);1002310024symbolTable.relateToOperator("fragmentMaskFetchAMD", EOpFragmentMaskFetch);10025symbolTable.relateToOperator("fragmentFetchAMD", EOpFragmentFetch);10026}1002710028// GL_KHR_shader_subgroup10029if ((profile == EEsProfile && version >= 310) ||10030(profile != EEsProfile && version >= 140)) {10031symbolTable.relateToOperator("subgroupBarrier", EOpSubgroupBarrier);10032symbolTable.relateToOperator("subgroupMemoryBarrier", EOpSubgroupMemoryBarrier);10033symbolTable.relateToOperator("subgroupMemoryBarrierBuffer", EOpSubgroupMemoryBarrierBuffer);10034symbolTable.relateToOperator("subgroupMemoryBarrierImage", EOpSubgroupMemoryBarrierImage);10035symbolTable.relateToOperator("subgroupElect", EOpSubgroupElect);10036symbolTable.relateToOperator("subgroupAll", EOpSubgroupAll);10037symbolTable.relateToOperator("subgroupAny", EOpSubgroupAny);10038symbolTable.relateToOperator("subgroupAllEqual", EOpSubgroupAllEqual);10039symbolTable.relateToOperator("subgroupBroadcast", EOpSubgroupBroadcast);10040symbolTable.relateToOperator("subgroupBroadcastFirst", EOpSubgroupBroadcastFirst);10041symbolTable.relateToOperator("subgroupBallot", EOpSubgroupBallot);10042symbolTable.relateToOperator("subgroupInverseBallot", EOpSubgroupInverseBallot);10043symbolTable.relateToOperator("subgroupBallotBitExtract", EOpSubgroupBallotBitExtract);10044symbolTable.relateToOperator("subgroupBallotBitCount", EOpSubgroupBallotBitCount);10045symbolTable.relateToOperator("subgroupBallotInclusiveBitCount", EOpSubgroupBallotInclusiveBitCount);10046symbolTable.relateToOperator("subgroupBallotExclusiveBitCount", EOpSubgroupBallotExclusiveBitCount);10047symbolTable.relateToOperator("subgroupBallotFindLSB", EOpSubgroupBallotFindLSB);10048symbolTable.relateToOperator("subgroupBallotFindMSB", EOpSubgroupBallotFindMSB);10049symbolTable.relateToOperator("subgroupShuffle", EOpSubgroupShuffle);10050symbolTable.relateToOperator("subgroupShuffleXor", EOpSubgroupShuffleXor);10051symbolTable.relateToOperator("subgroupShuffleUp", EOpSubgroupShuffleUp);10052symbolTable.relateToOperator("subgroupShuffleDown", EOpSubgroupShuffleDown);10053symbolTable.relateToOperator("subgroupRotate", EOpSubgroupRotate);10054symbolTable.relateToOperator("subgroupClusteredRotate", EOpSubgroupClusteredRotate);10055symbolTable.relateToOperator("subgroupAdd", EOpSubgroupAdd);10056symbolTable.relateToOperator("subgroupMul", EOpSubgroupMul);10057symbolTable.relateToOperator("subgroupMin", EOpSubgroupMin);10058symbolTable.relateToOperator("subgroupMax", EOpSubgroupMax);10059symbolTable.relateToOperator("subgroupAnd", EOpSubgroupAnd);10060symbolTable.relateToOperator("subgroupOr", EOpSubgroupOr);10061symbolTable.relateToOperator("subgroupXor", EOpSubgroupXor);10062symbolTable.relateToOperator("subgroupInclusiveAdd", EOpSubgroupInclusiveAdd);10063symbolTable.relateToOperator("subgroupInclusiveMul", EOpSubgroupInclusiveMul);10064symbolTable.relateToOperator("subgroupInclusiveMin", EOpSubgroupInclusiveMin);10065symbolTable.relateToOperator("subgroupInclusiveMax", EOpSubgroupInclusiveMax);10066symbolTable.relateToOperator("subgroupInclusiveAnd", EOpSubgroupInclusiveAnd);10067symbolTable.relateToOperator("subgroupInclusiveOr", EOpSubgroupInclusiveOr);10068symbolTable.relateToOperator("subgroupInclusiveXor", EOpSubgroupInclusiveXor);10069symbolTable.relateToOperator("subgroupExclusiveAdd", EOpSubgroupExclusiveAdd);10070symbolTable.relateToOperator("subgroupExclusiveMul", EOpSubgroupExclusiveMul);10071symbolTable.relateToOperator("subgroupExclusiveMin", EOpSubgroupExclusiveMin);10072symbolTable.relateToOperator("subgroupExclusiveMax", EOpSubgroupExclusiveMax);10073symbolTable.relateToOperator("subgroupExclusiveAnd", EOpSubgroupExclusiveAnd);10074symbolTable.relateToOperator("subgroupExclusiveOr", EOpSubgroupExclusiveOr);10075symbolTable.relateToOperator("subgroupExclusiveXor", EOpSubgroupExclusiveXor);10076symbolTable.relateToOperator("subgroupClusteredAdd", EOpSubgroupClusteredAdd);10077symbolTable.relateToOperator("subgroupClusteredMul", EOpSubgroupClusteredMul);10078symbolTable.relateToOperator("subgroupClusteredMin", EOpSubgroupClusteredMin);10079symbolTable.relateToOperator("subgroupClusteredMax", EOpSubgroupClusteredMax);10080symbolTable.relateToOperator("subgroupClusteredAnd", EOpSubgroupClusteredAnd);10081symbolTable.relateToOperator("subgroupClusteredOr", EOpSubgroupClusteredOr);10082symbolTable.relateToOperator("subgroupClusteredXor", EOpSubgroupClusteredXor);10083symbolTable.relateToOperator("subgroupQuadBroadcast", EOpSubgroupQuadBroadcast);10084symbolTable.relateToOperator("subgroupQuadSwapHorizontal", EOpSubgroupQuadSwapHorizontal);10085symbolTable.relateToOperator("subgroupQuadSwapVertical", EOpSubgroupQuadSwapVertical);10086symbolTable.relateToOperator("subgroupQuadSwapDiagonal", EOpSubgroupQuadSwapDiagonal);1008710088symbolTable.relateToOperator("subgroupPartitionNV", EOpSubgroupPartition);10089symbolTable.relateToOperator("subgroupPartitionedAddNV", EOpSubgroupPartitionedAdd);10090symbolTable.relateToOperator("subgroupPartitionedMulNV", EOpSubgroupPartitionedMul);10091symbolTable.relateToOperator("subgroupPartitionedMinNV", EOpSubgroupPartitionedMin);10092symbolTable.relateToOperator("subgroupPartitionedMaxNV", EOpSubgroupPartitionedMax);10093symbolTable.relateToOperator("subgroupPartitionedAndNV", EOpSubgroupPartitionedAnd);10094symbolTable.relateToOperator("subgroupPartitionedOrNV", EOpSubgroupPartitionedOr);10095symbolTable.relateToOperator("subgroupPartitionedXorNV", EOpSubgroupPartitionedXor);10096symbolTable.relateToOperator("subgroupPartitionedInclusiveAddNV", EOpSubgroupPartitionedInclusiveAdd);10097symbolTable.relateToOperator("subgroupPartitionedInclusiveMulNV", EOpSubgroupPartitionedInclusiveMul);10098symbolTable.relateToOperator("subgroupPartitionedInclusiveMinNV", EOpSubgroupPartitionedInclusiveMin);10099symbolTable.relateToOperator("subgroupPartitionedInclusiveMaxNV", EOpSubgroupPartitionedInclusiveMax);10100symbolTable.relateToOperator("subgroupPartitionedInclusiveAndNV", EOpSubgroupPartitionedInclusiveAnd);10101symbolTable.relateToOperator("subgroupPartitionedInclusiveOrNV", EOpSubgroupPartitionedInclusiveOr);10102symbolTable.relateToOperator("subgroupPartitionedInclusiveXorNV", EOpSubgroupPartitionedInclusiveXor);10103symbolTable.relateToOperator("subgroupPartitionedExclusiveAddNV", EOpSubgroupPartitionedExclusiveAdd);10104symbolTable.relateToOperator("subgroupPartitionedExclusiveMulNV", EOpSubgroupPartitionedExclusiveMul);10105symbolTable.relateToOperator("subgroupPartitionedExclusiveMinNV", EOpSubgroupPartitionedExclusiveMin);10106symbolTable.relateToOperator("subgroupPartitionedExclusiveMaxNV", EOpSubgroupPartitionedExclusiveMax);10107symbolTable.relateToOperator("subgroupPartitionedExclusiveAndNV", EOpSubgroupPartitionedExclusiveAnd);10108symbolTable.relateToOperator("subgroupPartitionedExclusiveOrNV", EOpSubgroupPartitionedExclusiveOr);10109symbolTable.relateToOperator("subgroupPartitionedExclusiveXorNV", EOpSubgroupPartitionedExclusiveXor);10110}1011110112if (profile == EEsProfile) {10113symbolTable.relateToOperator("shadow2DEXT", EOpTexture);10114symbolTable.relateToOperator("shadow2DProjEXT", EOpTextureProj);10115}1011610117// GL_EXT_shader_quad_control10118if ((profile == EEsProfile && version >= 310) ||10119(profile != EEsProfile && version >= 140)) {10120symbolTable.relateToOperator("subgroupQuadAll", EOpSubgroupQuadAll);10121symbolTable.relateToOperator("subgroupQuadAny", EOpSubgroupQuadAny);10122}1012310124if ((profile == EEsProfile && version >= 310) ||10125(profile != EEsProfile && version >= 140)) {10126symbolTable.relateToOperator("textureWeightedQCOM", EOpImageSampleWeightedQCOM);10127symbolTable.relateToOperator("textureBoxFilterQCOM", EOpImageBoxFilterQCOM);10128symbolTable.relateToOperator("textureBlockMatchSADQCOM", EOpImageBlockMatchSADQCOM);10129symbolTable.relateToOperator("textureBlockMatchSSDQCOM", EOpImageBlockMatchSSDQCOM);1013010131symbolTable.relateToOperator("textureBlockMatchWindowSSDQCOM", EOpImageBlockMatchWindowSSDQCOM);10132symbolTable.relateToOperator("textureBlockMatchWindowSADQCOM", EOpImageBlockMatchWindowSADQCOM);10133symbolTable.relateToOperator("textureBlockMatchGatherSSDQCOM", EOpImageBlockMatchGatherSSDQCOM);10134symbolTable.relateToOperator("textureBlockMatchGatherSADQCOM", EOpImageBlockMatchGatherSADQCOM);10135}1013610137if (profile != EEsProfile && spvVersion.spv == 0) {10138symbolTable.relateToOperator("texture1DArray", EOpTexture);10139symbolTable.relateToOperator("texture2DArray", EOpTexture);10140symbolTable.relateToOperator("shadow1DArray", EOpTexture);10141symbolTable.relateToOperator("shadow2DArray", EOpTexture);1014210143symbolTable.relateToOperator("texture1DArrayLod", EOpTextureLod);10144symbolTable.relateToOperator("texture2DArrayLod", EOpTextureLod);10145symbolTable.relateToOperator("shadow1DArrayLod", EOpTextureLod);10146}10147}1014810149switch(language) {10150case EShLangVertex:10151break;1015210153case EShLangTessControl:10154case EShLangTessEvaluation:10155break;1015610157case EShLangGeometry:10158symbolTable.relateToOperator("EmitStreamVertex", EOpEmitStreamVertex);10159symbolTable.relateToOperator("EndStreamPrimitive", EOpEndStreamPrimitive);10160symbolTable.relateToOperator("EmitVertex", EOpEmitVertex);10161symbolTable.relateToOperator("EndPrimitive", EOpEndPrimitive);10162break;1016310164case EShLangFragment:10165if (profile != EEsProfile && version >= 400) {10166symbolTable.relateToOperator("dFdxFine", EOpDPdxFine);10167symbolTable.relateToOperator("dFdyFine", EOpDPdyFine);10168symbolTable.relateToOperator("fwidthFine", EOpFwidthFine);10169symbolTable.relateToOperator("dFdxCoarse", EOpDPdxCoarse);10170symbolTable.relateToOperator("dFdyCoarse", EOpDPdyCoarse);10171symbolTable.relateToOperator("fwidthCoarse", EOpFwidthCoarse);10172}1017310174if (profile != EEsProfile && version >= 460) {10175symbolTable.relateToOperator("rayQueryInitializeEXT", EOpRayQueryInitialize);10176symbolTable.relateToOperator("rayQueryTerminateEXT", EOpRayQueryTerminate);10177symbolTable.relateToOperator("rayQueryGenerateIntersectionEXT", EOpRayQueryGenerateIntersection);10178symbolTable.relateToOperator("rayQueryConfirmIntersectionEXT", EOpRayQueryConfirmIntersection);10179symbolTable.relateToOperator("rayQueryProceedEXT", EOpRayQueryProceed);10180symbolTable.relateToOperator("rayQueryGetIntersectionTypeEXT", EOpRayQueryGetIntersectionType);10181symbolTable.relateToOperator("rayQueryGetRayTMinEXT", EOpRayQueryGetRayTMin);10182symbolTable.relateToOperator("rayQueryGetRayFlagsEXT", EOpRayQueryGetRayFlags);10183symbolTable.relateToOperator("rayQueryGetIntersectionTEXT", EOpRayQueryGetIntersectionT);10184symbolTable.relateToOperator("rayQueryGetIntersectionInstanceCustomIndexEXT", EOpRayQueryGetIntersectionInstanceCustomIndex);10185symbolTable.relateToOperator("rayQueryGetIntersectionInstanceIdEXT", EOpRayQueryGetIntersectionInstanceId);10186symbolTable.relateToOperator("rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT", EOpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffset);10187symbolTable.relateToOperator("rayQueryGetIntersectionGeometryIndexEXT", EOpRayQueryGetIntersectionGeometryIndex);10188symbolTable.relateToOperator("rayQueryGetIntersectionPrimitiveIndexEXT", EOpRayQueryGetIntersectionPrimitiveIndex);10189symbolTable.relateToOperator("rayQueryGetIntersectionBarycentricsEXT", EOpRayQueryGetIntersectionBarycentrics);10190symbolTable.relateToOperator("rayQueryGetIntersectionFrontFaceEXT", EOpRayQueryGetIntersectionFrontFace);10191symbolTable.relateToOperator("rayQueryGetIntersectionCandidateAABBOpaqueEXT", EOpRayQueryGetIntersectionCandidateAABBOpaque);10192symbolTable.relateToOperator("rayQueryGetIntersectionObjectRayDirectionEXT", EOpRayQueryGetIntersectionObjectRayDirection);10193symbolTable.relateToOperator("rayQueryGetIntersectionObjectRayOriginEXT", EOpRayQueryGetIntersectionObjectRayOrigin);10194symbolTable.relateToOperator("rayQueryGetWorldRayDirectionEXT", EOpRayQueryGetWorldRayDirection);10195symbolTable.relateToOperator("rayQueryGetWorldRayOriginEXT", EOpRayQueryGetWorldRayOrigin);10196symbolTable.relateToOperator("rayQueryGetIntersectionObjectToWorldEXT", EOpRayQueryGetIntersectionObjectToWorld);10197symbolTable.relateToOperator("rayQueryGetIntersectionWorldToObjectEXT", EOpRayQueryGetIntersectionWorldToObject);10198symbolTable.relateToOperator("rayQueryGetIntersectionTriangleVertexPositionsEXT", EOpRayQueryGetIntersectionTriangleVertexPositionsEXT);10199}1020010201symbolTable.relateToOperator("interpolateAtCentroid", EOpInterpolateAtCentroid);10202symbolTable.relateToOperator("interpolateAtSample", EOpInterpolateAtSample);10203symbolTable.relateToOperator("interpolateAtOffset", EOpInterpolateAtOffset);1020410205if (profile != EEsProfile)10206symbolTable.relateToOperator("interpolateAtVertexAMD", EOpInterpolateAtVertex);1020710208symbolTable.relateToOperator("beginInvocationInterlockARB", EOpBeginInvocationInterlock);10209symbolTable.relateToOperator("endInvocationInterlockARB", EOpEndInvocationInterlock);1021010211symbolTable.relateToOperator("stencilAttachmentReadEXT", EOpStencilAttachmentReadEXT);10212symbolTable.relateToOperator("depthAttachmentReadEXT", EOpDepthAttachmentReadEXT);10213symbolTable.relateToOperator("colorAttachmentReadEXT", EOpColorAttachmentReadEXT);1021410215break;1021610217case EShLangCompute:10218symbolTable.relateToOperator("subgroupMemoryBarrierShared", EOpSubgroupMemoryBarrierShared);10219if ((profile != EEsProfile && version >= 450) ||10220(profile == EEsProfile && version >= 320)) {10221symbolTable.relateToOperator("dFdx", EOpDPdx);10222symbolTable.relateToOperator("dFdy", EOpDPdy);10223symbolTable.relateToOperator("fwidth", EOpFwidth);10224symbolTable.relateToOperator("dFdxFine", EOpDPdxFine);10225symbolTable.relateToOperator("dFdyFine", EOpDPdyFine);10226symbolTable.relateToOperator("fwidthFine", EOpFwidthFine);10227symbolTable.relateToOperator("dFdxCoarse", EOpDPdxCoarse);10228symbolTable.relateToOperator("dFdyCoarse", EOpDPdyCoarse);10229symbolTable.relateToOperator("fwidthCoarse",EOpFwidthCoarse);10230}10231symbolTable.relateToOperator("coopMatLoadNV", EOpCooperativeMatrixLoadNV);10232symbolTable.relateToOperator("coopMatStoreNV", EOpCooperativeMatrixStoreNV);10233symbolTable.relateToOperator("coopMatMulAddNV", EOpCooperativeMatrixMulAddNV);1023410235symbolTable.relateToOperator("coopMatLoad", EOpCooperativeMatrixLoad);10236symbolTable.relateToOperator("coopMatStore", EOpCooperativeMatrixStore);10237symbolTable.relateToOperator("coopMatMulAdd", EOpCooperativeMatrixMulAdd);1023810239if (profile != EEsProfile && version >= 460) {10240symbolTable.relateToOperator("fetchMicroTriangleVertexPositionNV", EOpFetchMicroTriangleVertexPositionNV);10241symbolTable.relateToOperator("fetchMicroTriangleVertexBarycentricNV", EOpFetchMicroTriangleVertexBarycentricNV);10242}10243break;1024410245case EShLangRayGen:10246if (profile != EEsProfile && version >= 460) {10247symbolTable.relateToOperator("fetchMicroTriangleVertexPositionNV", EOpFetchMicroTriangleVertexPositionNV);10248symbolTable.relateToOperator("fetchMicroTriangleVertexBarycentricNV", EOpFetchMicroTriangleVertexBarycentricNV);10249}10250[[fallthrough]];10251case EShLangClosestHit:10252case EShLangMiss:10253if (profile != EEsProfile && version >= 460) {10254symbolTable.relateToOperator("traceNV", EOpTraceNV);10255symbolTable.relateToOperator("traceRayMotionNV", EOpTraceRayMotionNV);10256symbolTable.relateToOperator("traceRayEXT", EOpTraceKHR);10257symbolTable.relateToOperator("executeCallableNV", EOpExecuteCallableNV);10258symbolTable.relateToOperator("executeCallableEXT", EOpExecuteCallableKHR);1025910260symbolTable.relateToOperator("hitObjectTraceRayNV", EOpHitObjectTraceRayNV);10261symbolTable.relateToOperator("hitObjectTraceRayMotionNV", EOpHitObjectTraceRayMotionNV);10262symbolTable.relateToOperator("hitObjectRecordHitNV", EOpHitObjectRecordHitNV);10263symbolTable.relateToOperator("hitObjectRecordHitMotionNV", EOpHitObjectRecordHitMotionNV);10264symbolTable.relateToOperator("hitObjectRecordHitWithIndexNV", EOpHitObjectRecordHitWithIndexNV);10265symbolTable.relateToOperator("hitObjectRecordHitWithIndexMotionNV", EOpHitObjectRecordHitWithIndexMotionNV);10266symbolTable.relateToOperator("hitObjectRecordMissNV", EOpHitObjectRecordMissNV);10267symbolTable.relateToOperator("hitObjectRecordMissMotionNV", EOpHitObjectRecordMissMotionNV);10268symbolTable.relateToOperator("hitObjectRecordEmptyNV", EOpHitObjectRecordEmptyNV);10269symbolTable.relateToOperator("hitObjectExecuteShaderNV", EOpHitObjectExecuteShaderNV);10270symbolTable.relateToOperator("hitObjectIsEmptyNV", EOpHitObjectIsEmptyNV);10271symbolTable.relateToOperator("hitObjectIsMissNV", EOpHitObjectIsMissNV);10272symbolTable.relateToOperator("hitObjectIsHitNV", EOpHitObjectIsHitNV);10273symbolTable.relateToOperator("hitObjectGetRayTMinNV", EOpHitObjectGetRayTMinNV);10274symbolTable.relateToOperator("hitObjectGetRayTMaxNV", EOpHitObjectGetRayTMaxNV);10275symbolTable.relateToOperator("hitObjectGetObjectRayOriginNV", EOpHitObjectGetObjectRayOriginNV);10276symbolTable.relateToOperator("hitObjectGetObjectRayDirectionNV", EOpHitObjectGetObjectRayDirectionNV);10277symbolTable.relateToOperator("hitObjectGetWorldRayOriginNV", EOpHitObjectGetWorldRayOriginNV);10278symbolTable.relateToOperator("hitObjectGetWorldRayDirectionNV", EOpHitObjectGetWorldRayDirectionNV);10279symbolTable.relateToOperator("hitObjectGetWorldToObjectNV", EOpHitObjectGetWorldToObjectNV);10280symbolTable.relateToOperator("hitObjectGetObjectToWorldNV", EOpHitObjectGetObjectToWorldNV);10281symbolTable.relateToOperator("hitObjectGetInstanceCustomIndexNV", EOpHitObjectGetInstanceCustomIndexNV);10282symbolTable.relateToOperator("hitObjectGetInstanceIdNV", EOpHitObjectGetInstanceIdNV);10283symbolTable.relateToOperator("hitObjectGetGeometryIndexNV", EOpHitObjectGetGeometryIndexNV);10284symbolTable.relateToOperator("hitObjectGetPrimitiveIndexNV", EOpHitObjectGetPrimitiveIndexNV);10285symbolTable.relateToOperator("hitObjectGetHitKindNV", EOpHitObjectGetHitKindNV);10286symbolTable.relateToOperator("hitObjectGetAttributesNV", EOpHitObjectGetAttributesNV);10287symbolTable.relateToOperator("hitObjectGetCurrentTimeNV", EOpHitObjectGetCurrentTimeNV);10288symbolTable.relateToOperator("hitObjectGetShaderBindingTableRecordIndexNV", EOpHitObjectGetShaderBindingTableRecordIndexNV);10289symbolTable.relateToOperator("hitObjectGetShaderRecordBufferHandleNV", EOpHitObjectGetShaderRecordBufferHandleNV);10290symbolTable.relateToOperator("reorderThreadNV", EOpReorderThreadNV);10291}10292break;10293case EShLangIntersect:10294if (profile != EEsProfile && version >= 460) {10295symbolTable.relateToOperator("reportIntersectionNV", EOpReportIntersection);10296symbolTable.relateToOperator("reportIntersectionEXT", EOpReportIntersection);10297}10298break;10299case EShLangAnyHit:10300if (profile != EEsProfile && version >= 460) {10301symbolTable.relateToOperator("ignoreIntersectionNV", EOpIgnoreIntersectionNV);10302symbolTable.relateToOperator("terminateRayNV", EOpTerminateRayNV);10303}10304break;10305case EShLangCallable:10306if (profile != EEsProfile && version >= 460) {10307symbolTable.relateToOperator("executeCallableNV", EOpExecuteCallableNV);10308symbolTable.relateToOperator("executeCallableEXT", EOpExecuteCallableKHR);10309}10310break;10311case EShLangMesh:10312if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {10313symbolTable.relateToOperator("writePackedPrimitiveIndices4x8NV", EOpWritePackedPrimitiveIndices4x8NV);10314symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared);10315symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier);10316symbolTable.relateToOperator("subgroupMemoryBarrierShared", EOpSubgroupMemoryBarrierShared);10317}1031810319if (profile != EEsProfile && version >= 450) {10320symbolTable.relateToOperator("SetMeshOutputsEXT", EOpSetMeshOutputsEXT);10321}1032210323if (profile != EEsProfile && version >= 460) {10324// Builtins for GL_NV_displacement_micromap.10325symbolTable.relateToOperator("fetchMicroTriangleVertexPositionNV", EOpFetchMicroTriangleVertexPositionNV);10326symbolTable.relateToOperator("fetchMicroTriangleVertexBarycentricNV", EOpFetchMicroTriangleVertexBarycentricNV);10327}10328break;10329case EShLangTask:10330if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {10331symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared);10332symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier);10333symbolTable.relateToOperator("subgroupMemoryBarrierShared", EOpSubgroupMemoryBarrierShared);10334}10335if (profile != EEsProfile && version >= 450) {10336symbolTable.relateToOperator("EmitMeshTasksEXT", EOpEmitMeshTasksEXT);10337}10338break;1033910340default:10341assert(false && "Language not supported");10342}10343}1034410345//10346// Add context-dependent (resource-specific) built-ins not handled by the above. These10347// would be ones that need to be programmatically added because they cannot10348// be added by simple text strings. For these, also10349// 1) Map built-in functions to operators, for those that will turn into an operation node10350// instead of remaining a function call.10351// 2) Tag extension-related symbols added to their base version with their extensions, so10352// that if an early version has the extension turned off, there is an error reported on use.10353//10354void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources)10355{10356if (profile != EEsProfile && version >= 430 && version < 440) {10357symbolTable.setVariableExtensions("gl_MaxTransformFeedbackBuffers", 1, &E_GL_ARB_enhanced_layouts);10358symbolTable.setVariableExtensions("gl_MaxTransformFeedbackInterleavedComponents", 1, &E_GL_ARB_enhanced_layouts);10359}10360if (profile != EEsProfile && version >= 130 && version < 420) {10361symbolTable.setVariableExtensions("gl_MinProgramTexelOffset", 1, &E_GL_ARB_shading_language_420pack);10362symbolTable.setVariableExtensions("gl_MaxProgramTexelOffset", 1, &E_GL_ARB_shading_language_420pack);10363}10364if (profile != EEsProfile && version >= 150 && version < 410)10365symbolTable.setVariableExtensions("gl_MaxViewports", 1, &E_GL_ARB_viewport_array);1036610367switch(language) {10368case EShLangFragment:10369// Set up gl_FragData based on current array size.10370if (version == 100 || IncludeLegacy(version, profile, spvVersion) || (! ForwardCompatibility && profile != EEsProfile && version < 420)) {10371TPrecisionQualifier pq = profile == EEsProfile ? EpqMedium : EpqNone;10372TType fragData(EbtFloat, EvqFragColor, pq, 4);10373TArraySizes* arraySizes = new TArraySizes;10374arraySizes->addInnerSize(resources.maxDrawBuffers);10375fragData.transferArraySizes(arraySizes);10376symbolTable.insert(*new TVariable(NewPoolTString("gl_FragData"), fragData));10377SpecialQualifier("gl_FragData", EvqFragColor, EbvFragData, symbolTable);10378}1037910380// GL_EXT_blend_func_extended10381if (profile == EEsProfile && version >= 100) {10382symbolTable.setVariableExtensions("gl_MaxDualSourceDrawBuffersEXT", 1, &E_GL_EXT_blend_func_extended);10383symbolTable.setVariableExtensions("gl_SecondaryFragColorEXT", 1, &E_GL_EXT_blend_func_extended);10384symbolTable.setVariableExtensions("gl_SecondaryFragDataEXT", 1, &E_GL_EXT_blend_func_extended);10385SpecialQualifier("gl_SecondaryFragColorEXT", EvqVaryingOut, EbvSecondaryFragColorEXT, symbolTable);10386SpecialQualifier("gl_SecondaryFragDataEXT", EvqVaryingOut, EbvSecondaryFragDataEXT, symbolTable);10387}1038810389break;1039010391case EShLangTessControl:10392case EShLangTessEvaluation:10393// Because of the context-dependent array size (gl_MaxPatchVertices),10394// these variables were added later than the others and need to be mapped now.1039510396// standard members10397BuiltInVariable("gl_in", "gl_Position", EbvPosition, symbolTable);10398BuiltInVariable("gl_in", "gl_PointSize", EbvPointSize, symbolTable);10399BuiltInVariable("gl_in", "gl_ClipDistance", EbvClipDistance, symbolTable);10400BuiltInVariable("gl_in", "gl_CullDistance", EbvCullDistance, symbolTable);1040110402// compatibility members10403BuiltInVariable("gl_in", "gl_ClipVertex", EbvClipVertex, symbolTable);10404BuiltInVariable("gl_in", "gl_FrontColor", EbvFrontColor, symbolTable);10405BuiltInVariable("gl_in", "gl_BackColor", EbvBackColor, symbolTable);10406BuiltInVariable("gl_in", "gl_FrontSecondaryColor", EbvFrontSecondaryColor, symbolTable);10407BuiltInVariable("gl_in", "gl_BackSecondaryColor", EbvBackSecondaryColor, symbolTable);10408BuiltInVariable("gl_in", "gl_TexCoord", EbvTexCoord, symbolTable);10409BuiltInVariable("gl_in", "gl_FogFragCoord", EbvFogFragCoord, symbolTable);1041010411symbolTable.setVariableExtensions("gl_in", "gl_SecondaryPositionNV", 1, &E_GL_NV_stereo_view_rendering);10412symbolTable.setVariableExtensions("gl_in", "gl_PositionPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes);1041310414BuiltInVariable("gl_in", "gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable);10415BuiltInVariable("gl_in", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable);1041610417// extension requirements10418if (profile == EEsProfile) {10419symbolTable.setVariableExtensions("gl_in", "gl_PointSize", Num_AEP_tessellation_point_size, AEP_tessellation_point_size);10420}1042110422break;1042310424default:10425break;10426}10427}1042810429} // end namespace glslang104301043110432