Lines Matching full:glslang

38 // Visit the nodes in the glslang intermediate tree representation to
57 // Glslang includes
58 #include "../glslang/MachineIndependent/localintermediate.h"
59 #include "../glslang/MachineIndependent/SymbolTable.h"
60 #include "../glslang/Include/Common.h"
61 #include "../glslang/Include/revision.h"
102 // The main holder of information for translating glslang to SPIR-V.
106 class TGlslangToSpvTraverser : public glslang::TIntermTraverser {
108 …TGlslangToSpvTraverser(unsigned int spvVersion, const glslang::TIntermediate*, spv::SpvBuildLogger…
109 glslang::SpvOptions& options);
112 bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate*);
113 bool visitBinary(glslang::TVisit, glslang::TIntermBinary*);
114 void visitConstantUnion(glslang::TIntermConstantUnion*);
115 bool visitSelection(glslang::TVisit, glslang::TIntermSelection*);
116 bool visitSwitch(glslang::TVisit, glslang::TIntermSwitch*);
117 void visitSymbol(glslang::TIntermSymbol* symbol);
118 bool visitUnary(glslang::TVisit, glslang::TIntermUnary*);
119 bool visitLoop(glslang::TVisit, glslang::TIntermLoop*);
120 bool visitBranch(glslang::TVisit visit, glslang::TIntermBranch*);
129 spv::Decoration TranslateInterpolationDecoration(const glslang::TQualifier& qualifier);
130 spv::Decoration TranslateAuxiliaryStorageDecoration(const glslang::TQualifier& qualifier);
131 spv::Decoration TranslateNonUniformDecoration(const glslang::TQualifier& qualifier);
132 spv::Builder::AccessChain::CoherentFlags TranslateCoherent(const glslang::TType& type);
136 spv::BuiltIn TranslateBuiltInDecoration(glslang::TBuiltInVariable, bool memberDeclaration);
137 spv::ImageFormat TranslateImageFormat(const glslang::TType& type);
138 spv::SelectionControlMask TranslateSelectionControl(const glslang::TIntermSelection&) const;
139 spv::SelectionControlMask TranslateSwitchControl(const glslang::TIntermSwitch&) const;
140 …spv::LoopControlMask TranslateLoopControl(const glslang::TIntermLoop&, unsigned int& dependencyLen…
141 spv::StorageClass TranslateStorageClass(const glslang::TType&);
142 …void addIndirectionIndexCapabilities(const glslang::TType& baseType, const glslang::TType& indexTy…
143 spv::Id createSpvVariable(const glslang::TIntermSymbol*);
144 spv::Id getSampledType(const glslang::TSampler&);
145 spv::Id getInvertedSwizzleType(const glslang::TIntermTyped&);
146 …spv::Id createInvertedSwizzle(spv::Decoration precision, const glslang::TIntermTyped&, spv::Id par…
147 void convertSwizzle(const glslang::TIntermAggregate&, std::vector<unsigned>& swizzle);
148 spv::Id convertGlslangToSpvType(const glslang::TType& type, bool forwardReferenceOnly = false);
149 …spv::Id convertGlslangToSpvType(const glslang::TType& type, glslang::TLayoutPacking, const glslang
151 bool filterMember(const glslang::TType& member);
152 …spv::Id convertGlslangStructToSpvType(const glslang::TType&, const glslang::TTypeList* glslangStru…
153 glslang::TLayoutPacking, const glslang::TQualifier&);
154 …void decorateStructType(const glslang::TType&, const glslang::TTypeList* glslangStruct, glslang::T…
155 const glslang::TQualifier&, spv::Id);
156 spv::Id makeArraySizeId(const glslang::TArraySizes&, int dim);
157 spv::Id accessChainLoad(const glslang::TType& type);
158 void accessChainStore(const glslang::TType& type, spv::Id rvalue);
159 void multiTypeStore(const glslang::TType&, spv::Id rValue);
160 glslang::TLayoutPacking getExplicitLayout(const glslang::TType& type) const;
161 …int getArrayStride(const glslang::TType& arrayType, glslang::TLayoutPacking, glslang::TLayoutMatri…
162 …int getMatrixStride(const glslang::TType& matrixType, glslang::TLayoutPacking, glslang::TLayoutMat…
163 …void updateMemberOffset(const glslang::TType& structType, const glslang::TType& memberType, int& c…
164 int& nextOffset, glslang::TLayoutPacking, glslang::TLayoutMatrix);
165 void declareUseOfStructMember(const glslang::TTypeList& members, int glslangMember);
167 bool isShaderEntryPoint(const glslang::TIntermAggregate* node);
168 bool writableParam(glslang::TStorageQualifier) const;
169 bool originalParam(glslang::TStorageQualifier, const glslang::TType&, bool implicitThisParam);
170 void makeFunctions(const glslang::TIntermSequence&);
171 void makeGlobalInitializers(const glslang::TIntermSequence&);
172 void visitFunctions(const glslang::TIntermSequence&);
173 void handleFunctionEntry(const glslang::TIntermAggregate* node);
174 void translateArguments(const glslang::TIntermAggregate& node, std::vector<spv::Id>& arguments);
175 void translateArguments(glslang::TIntermUnary& node, std::vector<spv::Id>& arguments);
176 spv::Id createImageTextureFunctionCall(glslang::TIntermOperator* node);
177 spv::Id handleUserFunctionCall(const glslang::TIntermAggregate*);
179 …spv::Id createBinaryOperation(glslang::TOperator op, OpDecorations&, spv::Id typeId, spv::Id left,…
180 glslang::TBasicType typeProxy, bool reduceComparison = true);
182 …spv::Id createUnaryOperation(glslang::TOperator op, OpDecorations&, spv::Id typeId, spv::Id operan…
183 glslang::TBasicType typeProxy);
185 glslang::TBasicType typeProxy);
186 …spv::Id createConversion(glslang::TOperator op, OpDecorations&, spv::Id destTypeId, spv::Id operan…
187 glslang::TBasicType typeProxy);
188 spv::Id createIntWidthConversion(glslang::TOperator op, spv::Id operand, int vectorSize);
190 …d createAtomicOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vec…
191 …spv::Id createInvocationsOperation(glslang::TOperator op, spv::Id typeId, std::vector<spv::Id>& op…
193 …spv::Id createSubgroupOperation(glslang::TOperator op, spv::Id typeId, std::vector<spv::Id>& opera…
194 …:Id createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vec…
195 spv::Id createNoArgOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId);
196 spv::Id getSymbolId(const glslang::TIntermSymbol* node);
198 void addMeshNVDecoration(spv::Id id, int member, const glslang::TQualifier & qualifier);
200 spv::Id createSpvConstant(const glslang::TIntermTyped&);
201 …spv::Id createSpvConstantFromConstUnionArray(const glslang::TType& type, const glslang::TConstUnio…
202 bool isTrivialLeaf(const glslang::TIntermTyped* node);
203 bool isTrivial(const glslang::TIntermTyped* node);
204 …spv::Id createShortCircuit(glslang::TOperator, glslang::TIntermTyped& left, glslang::TIntermTyped&…
210 if (builder.getSpvVersion() < glslang::EShTargetSpv_1_3) in addPre13Extension()
214 unsigned int getBufferReferenceAlignment(const glslang::TType &type) const { in getBufferReferenceAlignment()
215 if (type.getBasicType() == glslang::EbtReference) { in getBufferReferenceAlignment()
223 glslang::SpvOptions& options;
237 const glslang::TIntermediate* glslangIntermediate;
244 …std::unordered_map<const glslang::TTypeList*, spv::Id> structMap[glslang::ElpCount][glslang::ElmCo…
245 // for mapping glslang block indices to spv indices (e.g., due to hidden members):
246 std::unordered_map<const glslang::TTypeList*, std::vector<int> > memberRemapper;
248 std::unordered_map<std::string, const glslang::TIntermSymbol*> counterOriginator;
250 std::map<const glslang::TType *, spv::Id> forwardPointers;
254 // Helper functions for translating glslang representations to SPIR-V enumerants.
257 // Translate glslang profile to SPIR-V source language.
258 spv::SourceLanguage TranslateSourceLanguage(glslang::EShSource source, EProfile profile) in TranslateSourceLanguage()
261 case glslang::EShSourceGlsl: in TranslateSourceLanguage()
272 case glslang::EShSourceHlsl: in TranslateSourceLanguage()
279 // Translate glslang language (stage) to SPIR-V execution model.
305 // Translate glslang sampler type to SPIR-V dimensionality.
306 spv::Dim TranslateDimensionality(const glslang::TSampler& sampler) in TranslateDimensionality()
309 case glslang::Esd1D: return spv::Dim1D; in TranslateDimensionality()
310 case glslang::Esd2D: return spv::Dim2D; in TranslateDimensionality()
311 case glslang::Esd3D: return spv::Dim3D; in TranslateDimensionality()
312 case glslang::EsdCube: return spv::DimCube; in TranslateDimensionality()
313 case glslang::EsdRect: return spv::DimRect; in TranslateDimensionality()
314 case glslang::EsdBuffer: return spv::DimBuffer; in TranslateDimensionality()
315 case glslang::EsdSubpass: return spv::DimSubpassData; in TranslateDimensionality()
322 // Translate glslang precision to SPIR-V precision decorations.
323 spv::Decoration TranslatePrecisionDecoration(glslang::TPrecisionQualifier glslangPrecision) in TranslatePrecisionDecoration()
326 case glslang::EpqLow: return spv::DecorationRelaxedPrecision; in TranslatePrecisionDecoration()
327 case glslang::EpqMedium: return spv::DecorationRelaxedPrecision; in TranslatePrecisionDecoration()
333 // Translate glslang type to SPIR-V precision decorations.
334 spv::Decoration TranslatePrecisionDecoration(const glslang::TType& type) in TranslatePrecisionDecoration()
339 // Translate glslang type to SPIR-V block decorations.
340 spv::Decoration TranslateBlockDecoration(const glslang::TType& type, bool useStorageBuffer) in TranslateBlockDecoration()
342 if (type.getBasicType() == glslang::EbtBlock) { in TranslateBlockDecoration()
344 case glslang::EvqUniform: return spv::DecorationBlock; in TranslateBlockDecoration()
345 …case glslang::EvqBuffer: return useStorageBuffer ? spv::DecorationBlock : spv::DecorationBuf… in TranslateBlockDecoration()
346 case glslang::EvqVaryingIn: return spv::DecorationBlock; in TranslateBlockDecoration()
347 case glslang::EvqVaryingOut: return spv::DecorationBlock; in TranslateBlockDecoration()
349 case glslang::EvqPayloadNV: return spv::DecorationBlock; in TranslateBlockDecoration()
350 case glslang::EvqPayloadInNV: return spv::DecorationBlock; in TranslateBlockDecoration()
351 case glslang::EvqHitAttrNV: return spv::DecorationBlock; in TranslateBlockDecoration()
352 case glslang::EvqCallableDataNV: return spv::DecorationBlock; in TranslateBlockDecoration()
353 case glslang::EvqCallableDataInNV: return spv::DecorationBlock; in TranslateBlockDecoration()
364 // Translate glslang type to SPIR-V memory decorations.
365 void TranslateMemoryDecoration(const glslang::TQualifier& qualifier, std::vector<spv::Decoration>& … in TranslateMemoryDecoration()
383 // Translate glslang type to SPIR-V layout decorations.
384 spv::Decoration TranslateLayoutDecoration(const glslang::TType& type, glslang::TLayoutMatrix matrix… in TranslateLayoutDecoration()
388 case glslang::ElmRowMajor: in TranslateLayoutDecoration()
390 case glslang::ElmColumnMajor: in TranslateLayoutDecoration()
401 case glslang::EbtBlock: in TranslateLayoutDecoration()
403 case glslang::EvqUniform: in TranslateLayoutDecoration()
404 case glslang::EvqBuffer: in TranslateLayoutDecoration()
406 case glslang::ElpShared: return spv::DecorationGLSLShared; in TranslateLayoutDecoration()
407 case glslang::ElpPacked: return spv::DecorationGLSLPacked; in TranslateLayoutDecoration()
411 case glslang::EvqVaryingIn: in TranslateLayoutDecoration()
412 case glslang::EvqVaryingOut: in TranslateLayoutDecoration()
415 case glslang::ElpShared: return spv::DecorationGLSLShared; in TranslateLayoutDecoration()
416 case glslang::ElpPacked: return spv::DecorationGLSLPacked; in TranslateLayoutDecoration()
420 assert(type.getQualifier().layoutPacking == glslang::ElpNone); in TranslateLayoutDecoration()
424 case glslang::EvqPayloadNV: in TranslateLayoutDecoration()
425 case glslang::EvqPayloadInNV: in TranslateLayoutDecoration()
426 case glslang::EvqHitAttrNV: in TranslateLayoutDecoration()
427 case glslang::EvqCallableDataNV: in TranslateLayoutDecoration()
428 case glslang::EvqCallableDataInNV: in TranslateLayoutDecoration()
439 // Translate glslang type to SPIR-V interpolation decorations.
442 spv::Decoration TGlslangToSpvTraverser::TranslateInterpolationDecoration(const glslang::TQualifier&… in TranslateInterpolationDecoration()
461 // Translate glslang type to SPIR-V auxiliary storage decorations.
464 spv::Decoration TGlslangToSpvTraverser::TranslateAuxiliaryStorageDecoration(const glslang::TQualifi… in TranslateAuxiliaryStorageDecoration()
477 // If glslang type is invariant, return SPIR-V invariant decoration.
478 spv::Decoration TranslateInvariantDecoration(const glslang::TQualifier& qualifier) in TranslateInvariantDecoration()
486 // If glslang type is noContraction, return SPIR-V NoContraction decoration.
487 spv::Decoration TranslateNoContractionDecoration(const glslang::TQualifier& qualifier) in TranslateNoContractionDecoration()
495 // If glslang type is nonUniform, return SPIR-V NonUniform decoration.
496 spv::Decoration TGlslangToSpvTraverser::TranslateNonUniformDecoration(const glslang::TQualifier& qu… in TranslateNonUniformDecoration()
560 spv::Builder::AccessChain::CoherentFlags TGlslangToSpvTraverser::TranslateCoherent(const glslang::T… in TranslateCoherent()
568 type.getQualifier().storage == glslang::EvqShared; in TranslateCoherent()
578 flags.isImage = type.getBasicType() == glslang::EbtSampler; in TranslateCoherent()
605 // Translate a glslang built-in variable to a SPIR-V built in decoration. Also generate
610 spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltInVariable builtIn, … in TranslateBuiltInDecoration()
613 case glslang::EbvPointSize: in TranslateBuiltInDecoration()
636 case glslang::EbvClipDistance: in TranslateBuiltInDecoration()
641 case glslang::EbvCullDistance: in TranslateBuiltInDecoration()
646 case glslang::EbvViewportIndex: in TranslateBuiltInDecoration()
657 case glslang::EbvSampleId: in TranslateBuiltInDecoration()
661 case glslang::EbvSamplePosition: in TranslateBuiltInDecoration()
665 case glslang::EbvSampleMask: in TranslateBuiltInDecoration()
668 case glslang::EbvLayer: in TranslateBuiltInDecoration()
684 case glslang::EbvPosition: return spv::BuiltInPosition; in TranslateBuiltInDecoration()
685 case glslang::EbvVertexId: return spv::BuiltInVertexId; in TranslateBuiltInDecoration()
686 case glslang::EbvInstanceId: return spv::BuiltInInstanceId; in TranslateBuiltInDecoration()
687 case glslang::EbvVertexIndex: return spv::BuiltInVertexIndex; in TranslateBuiltInDecoration()
688 case glslang::EbvInstanceIndex: return spv::BuiltInInstanceIndex; in TranslateBuiltInDecoration()
690 case glslang::EbvBaseVertex: in TranslateBuiltInDecoration()
695 case glslang::EbvBaseInstance: in TranslateBuiltInDecoration()
700 case glslang::EbvDrawId: in TranslateBuiltInDecoration()
705 case glslang::EbvPrimitiveId: in TranslateBuiltInDecoration()
710 case glslang::EbvFragStencilRef: in TranslateBuiltInDecoration()
715 case glslang::EbvInvocationId: return spv::BuiltInInvocationId; in TranslateBuiltInDecoration()
716 case glslang::EbvTessLevelInner: return spv::BuiltInTessLevelInner; in TranslateBuiltInDecoration()
717 case glslang::EbvTessLevelOuter: return spv::BuiltInTessLevelOuter; in TranslateBuiltInDecoration()
718 case glslang::EbvTessCoord: return spv::BuiltInTessCoord; in TranslateBuiltInDecoration()
719 case glslang::EbvPatchVertices: return spv::BuiltInPatchVertices; in TranslateBuiltInDecoration()
720 case glslang::EbvFragCoord: return spv::BuiltInFragCoord; in TranslateBuiltInDecoration()
721 case glslang::EbvPointCoord: return spv::BuiltInPointCoord; in TranslateBuiltInDecoration()
722 case glslang::EbvFace: return spv::BuiltInFrontFacing; in TranslateBuiltInDecoration()
723 case glslang::EbvFragDepth: return spv::BuiltInFragDepth; in TranslateBuiltInDecoration()
724 case glslang::EbvHelperInvocation: return spv::BuiltInHelperInvocation; in TranslateBuiltInDecoration()
725 case glslang::EbvNumWorkGroups: return spv::BuiltInNumWorkgroups; in TranslateBuiltInDecoration()
726 case glslang::EbvWorkGroupSize: return spv::BuiltInWorkgroupSize; in TranslateBuiltInDecoration()
727 case glslang::EbvWorkGroupId: return spv::BuiltInWorkgroupId; in TranslateBuiltInDecoration()
728 case glslang::EbvLocalInvocationId: return spv::BuiltInLocalInvocationId; in TranslateBuiltInDecoration()
729 case glslang::EbvLocalInvocationIndex: return spv::BuiltInLocalInvocationIndex; in TranslateBuiltInDecoration()
730 case glslang::EbvGlobalInvocationId: return spv::BuiltInGlobalInvocationId; in TranslateBuiltInDecoration()
732 case glslang::EbvSubGroupSize: in TranslateBuiltInDecoration()
737 case glslang::EbvSubGroupInvocation: in TranslateBuiltInDecoration()
742 case glslang::EbvSubGroupEqMask: in TranslateBuiltInDecoration()
747 case glslang::EbvSubGroupGeMask: in TranslateBuiltInDecoration()
752 case glslang::EbvSubGroupGtMask: in TranslateBuiltInDecoration()
757 case glslang::EbvSubGroupLeMask: in TranslateBuiltInDecoration()
762 case glslang::EbvSubGroupLtMask: in TranslateBuiltInDecoration()
767 case glslang::EbvNumSubgroups: in TranslateBuiltInDecoration()
771 case glslang::EbvSubgroupID: in TranslateBuiltInDecoration()
775 case glslang::EbvSubgroupSize2: in TranslateBuiltInDecoration()
779 case glslang::EbvSubgroupInvocation2: in TranslateBuiltInDecoration()
783 case glslang::EbvSubgroupEqMask2: in TranslateBuiltInDecoration()
788 case glslang::EbvSubgroupGeMask2: in TranslateBuiltInDecoration()
793 case glslang::EbvSubgroupGtMask2: in TranslateBuiltInDecoration()
798 case glslang::EbvSubgroupLeMask2: in TranslateBuiltInDecoration()
803 case glslang::EbvSubgroupLtMask2: in TranslateBuiltInDecoration()
808 case glslang::EbvBaryCoordNoPersp: in TranslateBuiltInDecoration()
812 case glslang::EbvBaryCoordNoPerspCentroid: in TranslateBuiltInDecoration()
816 case glslang::EbvBaryCoordNoPerspSample: in TranslateBuiltInDecoration()
820 case glslang::EbvBaryCoordSmooth: in TranslateBuiltInDecoration()
824 case glslang::EbvBaryCoordSmoothCentroid: in TranslateBuiltInDecoration()
828 case glslang::EbvBaryCoordSmoothSample: in TranslateBuiltInDecoration()
832 case glslang::EbvBaryCoordPullModel: in TranslateBuiltInDecoration()
837 case glslang::EbvDeviceIndex: in TranslateBuiltInDecoration()
842 case glslang::EbvViewIndex: in TranslateBuiltInDecoration()
847 case glslang::EbvFragSizeEXT: in TranslateBuiltInDecoration()
852 case glslang::EbvFragInvocationCountEXT: in TranslateBuiltInDecoration()
858 case glslang::EbvViewportMaskNV: in TranslateBuiltInDecoration()
864 case glslang::EbvSecondaryPositionNV: in TranslateBuiltInDecoration()
870 case glslang::EbvSecondaryViewportMaskNV: in TranslateBuiltInDecoration()
876 case glslang::EbvPositionPerViewNV: in TranslateBuiltInDecoration()
882 case glslang::EbvViewportMaskPerViewNV: in TranslateBuiltInDecoration()
888 case glslang::EbvFragFullyCoveredNV: in TranslateBuiltInDecoration()
892 case glslang::EbvFragmentSizeNV: in TranslateBuiltInDecoration()
896 case glslang::EbvInvocationsPerPixelNV: in TranslateBuiltInDecoration()
902 case glslang::EbvLaunchIdNV: in TranslateBuiltInDecoration()
904 case glslang::EbvLaunchSizeNV: in TranslateBuiltInDecoration()
906 case glslang::EbvWorldRayOriginNV: in TranslateBuiltInDecoration()
908 case glslang::EbvWorldRayDirectionNV: in TranslateBuiltInDecoration()
910 case glslang::EbvObjectRayOriginNV: in TranslateBuiltInDecoration()
912 case glslang::EbvObjectRayDirectionNV: in TranslateBuiltInDecoration()
914 case glslang::EbvRayTminNV: in TranslateBuiltInDecoration()
916 case glslang::EbvRayTmaxNV: in TranslateBuiltInDecoration()
918 case glslang::EbvInstanceCustomIndexNV: in TranslateBuiltInDecoration()
920 case glslang::EbvHitTNV: in TranslateBuiltInDecoration()
922 case glslang::EbvHitKindNV: in TranslateBuiltInDecoration()
924 case glslang::EbvObjectToWorldNV: in TranslateBuiltInDecoration()
926 case glslang::EbvWorldToObjectNV: in TranslateBuiltInDecoration()
928 case glslang::EbvIncomingRayFlagsNV: in TranslateBuiltInDecoration()
930 case glslang::EbvBaryCoordNV: in TranslateBuiltInDecoration()
934 case glslang::EbvBaryCoordNoPerspNV: in TranslateBuiltInDecoration()
938 case glslang::EbvTaskCountNV: in TranslateBuiltInDecoration()
940 case glslang::EbvPrimitiveCountNV: in TranslateBuiltInDecoration()
942 case glslang::EbvPrimitiveIndicesNV: in TranslateBuiltInDecoration()
944 case glslang::EbvClipDistancePerViewNV: in TranslateBuiltInDecoration()
946 case glslang::EbvCullDistancePerViewNV: in TranslateBuiltInDecoration()
948 case glslang::EbvLayerPerViewNV: in TranslateBuiltInDecoration()
950 case glslang::EbvMeshViewCountNV: in TranslateBuiltInDecoration()
952 case glslang::EbvMeshViewIndicesNV: in TranslateBuiltInDecoration()
960 // Translate glslang image layout format to SPIR-V image format.
961 spv::ImageFormat TGlslangToSpvTraverser::TranslateImageFormat(const glslang::TType& type) in TranslateImageFormat()
963 assert(type.getBasicType() == glslang::EbtSampler); in TranslateImageFormat()
967 case glslang::ElfRg32f: in TranslateImageFormat()
968 case glslang::ElfRg16f: in TranslateImageFormat()
969 case glslang::ElfR11fG11fB10f: in TranslateImageFormat()
970 case glslang::ElfR16f: in TranslateImageFormat()
971 case glslang::ElfRgba16: in TranslateImageFormat()
972 case glslang::ElfRgb10A2: in TranslateImageFormat()
973 case glslang::ElfRg16: in TranslateImageFormat()
974 case glslang::ElfRg8: in TranslateImageFormat()
975 case glslang::ElfR16: in TranslateImageFormat()
976 case glslang::ElfR8: in TranslateImageFormat()
977 case glslang::ElfRgba16Snorm: in TranslateImageFormat()
978 case glslang::ElfRg16Snorm: in TranslateImageFormat()
979 case glslang::ElfRg8Snorm: in TranslateImageFormat()
980 case glslang::ElfR16Snorm: in TranslateImageFormat()
981 case glslang::ElfR8Snorm: in TranslateImageFormat()
983 case glslang::ElfRg32i: in TranslateImageFormat()
984 case glslang::ElfRg16i: in TranslateImageFormat()
985 case glslang::ElfRg8i: in TranslateImageFormat()
986 case glslang::ElfR16i: in TranslateImageFormat()
987 case glslang::ElfR8i: in TranslateImageFormat()
989 case glslang::ElfRgb10a2ui: in TranslateImageFormat()
990 case glslang::ElfRg32ui: in TranslateImageFormat()
991 case glslang::ElfRg16ui: in TranslateImageFormat()
992 case glslang::ElfRg8ui: in TranslateImageFormat()
993 case glslang::ElfR16ui: in TranslateImageFormat()
994 case glslang::ElfR8ui: in TranslateImageFormat()
1004 case glslang::ElfNone: return spv::ImageFormatUnknown; in TranslateImageFormat()
1005 case glslang::ElfRgba32f: return spv::ImageFormatRgba32f; in TranslateImageFormat()
1006 case glslang::ElfRgba16f: return spv::ImageFormatRgba16f; in TranslateImageFormat()
1007 case glslang::ElfR32f: return spv::ImageFormatR32f; in TranslateImageFormat()
1008 case glslang::ElfRgba8: return spv::ImageFormatRgba8; in TranslateImageFormat()
1009 case glslang::ElfRgba8Snorm: return spv::ImageFormatRgba8Snorm; in TranslateImageFormat()
1010 case glslang::ElfRg32f: return spv::ImageFormatRg32f; in TranslateImageFormat()
1011 case glslang::ElfRg16f: return spv::ImageFormatRg16f; in TranslateImageFormat()
1012 case glslang::ElfR11fG11fB10f: return spv::ImageFormatR11fG11fB10f; in TranslateImageFormat()
1013 case glslang::ElfR16f: return spv::ImageFormatR16f; in TranslateImageFormat()
1014 case glslang::ElfRgba16: return spv::ImageFormatRgba16; in TranslateImageFormat()
1015 case glslang::ElfRgb10A2: return spv::ImageFormatRgb10A2; in TranslateImageFormat()
1016 case glslang::ElfRg16: return spv::ImageFormatRg16; in TranslateImageFormat()
1017 case glslang::ElfRg8: return spv::ImageFormatRg8; in TranslateImageFormat()
1018 case glslang::ElfR16: return spv::ImageFormatR16; in TranslateImageFormat()
1019 case glslang::ElfR8: return spv::ImageFormatR8; in TranslateImageFormat()
1020 case glslang::ElfRgba16Snorm: return spv::ImageFormatRgba16Snorm; in TranslateImageFormat()
1021 case glslang::ElfRg16Snorm: return spv::ImageFormatRg16Snorm; in TranslateImageFormat()
1022 case glslang::ElfRg8Snorm: return spv::ImageFormatRg8Snorm; in TranslateImageFormat()
1023 case glslang::ElfR16Snorm: return spv::ImageFormatR16Snorm; in TranslateImageFormat()
1024 case glslang::ElfR8Snorm: return spv::ImageFormatR8Snorm; in TranslateImageFormat()
1025 case glslang::ElfRgba32i: return spv::ImageFormatRgba32i; in TranslateImageFormat()
1026 case glslang::ElfRgba16i: return spv::ImageFormatRgba16i; in TranslateImageFormat()
1027 case glslang::ElfRgba8i: return spv::ImageFormatRgba8i; in TranslateImageFormat()
1028 case glslang::ElfR32i: return spv::ImageFormatR32i; in TranslateImageFormat()
1029 case glslang::ElfRg32i: return spv::ImageFormatRg32i; in TranslateImageFormat()
1030 case glslang::ElfRg16i: return spv::ImageFormatRg16i; in TranslateImageFormat()
1031 case glslang::ElfRg8i: return spv::ImageFormatRg8i; in TranslateImageFormat()
1032 case glslang::ElfR16i: return spv::ImageFormatR16i; in TranslateImageFormat()
1033 case glslang::ElfR8i: return spv::ImageFormatR8i; in TranslateImageFormat()
1034 case glslang::ElfRgba32ui: return spv::ImageFormatRgba32ui; in TranslateImageFormat()
1035 case glslang::ElfRgba16ui: return spv::ImageFormatRgba16ui; in TranslateImageFormat()
1036 case glslang::ElfRgba8ui: return spv::ImageFormatRgba8ui; in TranslateImageFormat()
1037 case glslang::ElfR32ui: return spv::ImageFormatR32ui; in TranslateImageFormat()
1038 case glslang::ElfRg32ui: return spv::ImageFormatRg32ui; in TranslateImageFormat()
1039 case glslang::ElfRg16ui: return spv::ImageFormatRg16ui; in TranslateImageFormat()
1040 case glslang::ElfRgb10a2ui: return spv::ImageFormatRgb10a2ui; in TranslateImageFormat()
1041 case glslang::ElfRg8ui: return spv::ImageFormatRg8ui; in TranslateImageFormat()
1042 case glslang::ElfR16ui: return spv::ImageFormatR16ui; in TranslateImageFormat()
1043 case glslang::ElfR8ui: return spv::ImageFormatR8ui; in TranslateImageFormat()
1048 spv::SelectionControlMask TGlslangToSpvTraverser::TranslateSelectionControl(const glslang::TIntermS… in TranslateSelectionControl()
1057 spv::SelectionControlMask TGlslangToSpvTraverser::TranslateSwitchControl(const glslang::TIntermSwit… in TranslateSwitchControl()
1067 spv::LoopControlMask TGlslangToSpvTraverser::TranslateLoopControl(const glslang::TIntermLoop& loopN… in TranslateLoopControl()
1076 if (unsigned(loopNode.getLoopDependency()) == glslang::TIntermLoop::dependencyInfinite) in TranslateLoopControl()
1086 // Translate glslang type to SPIR-V storage class.
1087 spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::TType& type) in TranslateStorageClass()
1094 if (glslangIntermediate->getSource() != glslang::EShSourceHlsl || in TranslateStorageClass()
1095 type.getQualifier().storage == glslang::EvqUniform) { in TranslateStorageClass()
1096 if (type.getBasicType() == glslang::EbtAtomicUint) in TranslateStorageClass()
1109 …if (glslangIntermediate->usingStorageBuffer() && type.getQualifier().storage == glslang::EvqBuffer… in TranslateStorageClass()
1117 if (type.getBasicType() == glslang::EbtBlock) in TranslateStorageClass()
1123 case glslang::EvqShared: return spv::StorageClassWorkgroup; in TranslateStorageClass()
1124 case glslang::EvqGlobal: return spv::StorageClassPrivate; in TranslateStorageClass()
1125 case glslang::EvqConstReadOnly: return spv::StorageClassFunction; in TranslateStorageClass()
1126 case glslang::EvqTemporary: return spv::StorageClassFunction; in TranslateStorageClass()
1128 case glslang::EvqPayloadNV: return spv::StorageClassRayPayloadNV; in TranslateStorageClass()
1129 case glslang::EvqPayloadInNV: return spv::StorageClassIncomingRayPayloadNV; in TranslateStorageClass()
1130 case glslang::EvqHitAttrNV: return spv::StorageClassHitAttributeNV; in TranslateStorageClass()
1131 case glslang::EvqCallableDataNV: return spv::StorageClassCallableDataNV; in TranslateStorageClass()
1132 case glslang::EvqCallableDataInNV: return spv::StorageClassIncomingCallableDataNV; in TranslateStorageClass()
1143 void TGlslangToSpvTraverser::addIndirectionIndexCapabilities(const glslang::TType& baseType, in addIndirectionIndexCapabilities()
1144 const glslang::TType& indexType) in addIndirectionIndexCapabilities()
1149 if (baseType.getBasicType() == glslang::EbtSampler) { in addIndirectionIndexCapabilities()
1152 else if (baseType.isImage() && baseType.getSampler().dim == glslang::EsdBuffer) in addIndirectionIndexCapabilities()
1154 else if (baseType.isTexture() && baseType.getSampler().dim == glslang::EsdBuffer) in addIndirectionIndexCapabilities()
1160 } else if (baseType.getBasicType() == glslang::EbtBlock) { in addIndirectionIndexCapabilities()
1161 if (baseType.getQualifier().storage == glslang::EvqBuffer) in addIndirectionIndexCapabilities()
1163 else if (baseType.getQualifier().storage == glslang::EvqUniform) in addIndirectionIndexCapabilities()
1168 if (baseType.getBasicType() == glslang::EbtSampler) { in addIndirectionIndexCapabilities()
1172 } else if (baseType.isImage() && baseType.getSampler().dim == glslang::EsdBuffer) { in addIndirectionIndexCapabilities()
1175 } else if (baseType.isTexture() && baseType.getSampler().dim == glslang::EsdBuffer) { in addIndirectionIndexCapabilities()
1185 bool IsDescriptorResource(const glslang::TType& type) in IsDescriptorResource()
1188 if (type.getBasicType() == glslang::EbtBlock) in IsDescriptorResource()
1199 if (type.getBasicType() == glslang::EbtSampler) in IsDescriptorResource()
1206 void InheritQualifiers(glslang::TQualifier& child, const glslang::TQualifier& parent) in InheritQualifiers()
1208 if (child.layoutMatrix == glslang::ElmNone) in InheritQualifiers()
1257 bool HasNonLayoutQualifiers(const glslang::TType& type, const glslang::TQualifier& qualifier) in HasNonLayoutQualifiers()
1267 …return qualifier.invariant || (qualifier.hasLocation() && type.getBasicType() == glslang::EbtBlock… in HasNonLayoutQualifiers()
1274 TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const glslang::TIntermediat… in TGlslangToSpvTraverser()
1275 … spv::SpvBuildLogger* buildLogger, glslang::SpvOptions& options) in TGlslangToSpvTraverser()
1280 …builder(spvVersion, (glslang::GetKhronosToolId() << 16) | glslang::GetSpirvGeneratorVersion(), log… in TGlslangToSpvTraverser()
1300 if (glslangIntermediate->getSpv().spv < glslang::EShTargetSpv_1_1) { in TGlslangToSpvTraverser()
1307 … if (glslangIntermediate->getSpv().spv < glslang::EShTargetSpv_1_1 && (int)processes.size() > 0) in TGlslangToSpvTraverser()
1358 glslang::TLayoutGeometry primitive; in TGlslangToSpvTraverser()
1368 case glslang::ElgTriangles: mode = spv::ExecutionModeTriangles; break; in TGlslangToSpvTraverser()
1369 case glslang::ElgQuads: mode = spv::ExecutionModeQuads; break; in TGlslangToSpvTraverser()
1370 case glslang::ElgIsolines: mode = spv::ExecutionModeIsolines; break; in TGlslangToSpvTraverser()
1377 case glslang::EvsEqual: mode = spv::ExecutionModeSpacingEqual; break; in TGlslangToSpvTraverser()
1378 case glslang::EvsFractionalEven: mode = spv::ExecutionModeSpacingFractionalEven; break; in TGlslangToSpvTraverser()
1379 case glslang::EvsFractionalOdd: mode = spv::ExecutionModeSpacingFractionalOdd; break; in TGlslangToSpvTraverser()
1386 case glslang::EvoCw: mode = spv::ExecutionModeVertexOrderCw; break; in TGlslangToSpvTraverser()
1387 case glslang::EvoCcw: mode = spv::ExecutionModeVertexOrderCcw; break; in TGlslangToSpvTraverser()
1400 … case glslang::ElgPoints: mode = spv::ExecutionModeInputPoints; break; in TGlslangToSpvTraverser()
1401 … case glslang::ElgLines: mode = spv::ExecutionModeInputLines; break; in TGlslangToSpvTraverser()
1402 … case glslang::ElgLinesAdjacency: mode = spv::ExecutionModeInputLinesAdjacency; break; in TGlslangToSpvTraverser()
1403 … case glslang::ElgTriangles: mode = spv::ExecutionModeTriangles; break; in TGlslangToSpvTraverser()
1404 … case glslang::ElgTrianglesAdjacency: mode = spv::ExecutionModeInputTrianglesAdjacency; break; in TGlslangToSpvTraverser()
1413 … case glslang::ElgPoints: mode = spv::ExecutionModeOutputPoints; break; in TGlslangToSpvTraverser()
1414 … case glslang::ElgLineStrip: mode = spv::ExecutionModeOutputLineStrip; break; in TGlslangToSpvTraverser()
1415 … case glslang::ElgTriangleStrip: mode = spv::ExecutionModeOutputTriangleStrip; break; in TGlslangToSpvTraverser()
1443 case glslang::EldGreater: mode = spv::ExecutionModeDepthGreater; break; in TGlslangToSpvTraverser()
1444 case glslang::EldLess: mode = spv::ExecutionModeDepthLess; break; in TGlslangToSpvTraverser()
1450 …if (glslangIntermediate->getDepth() != glslang::EldUnchanged && glslangIntermediate->isDepthReplac… in TGlslangToSpvTraverser()
1460 … if (glslangIntermediate->getLayoutDerivativeModeNone() == glslang::LayoutDerivativeGroupQuads) { in TGlslangToSpvTraverser()
1464 …} else if (glslangIntermediate->getLayoutDerivativeModeNone() == glslang::LayoutDerivativeGroupLin… in TGlslangToSpvTraverser()
1494 case glslang::ElgPoints: mode = spv::ExecutionModeOutputPoints; break; in TGlslangToSpvTraverser()
1495 case glslang::ElgLines: mode = spv::ExecutionModeOutputLinesNV; break; in TGlslangToSpvTraverser()
1496 case glslang::ElgTriangles: mode = spv::ExecutionModeOutputTrianglesNV; break; in TGlslangToSpvTraverser()
1549 void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) in visitSymbol()
1583 glslang::TQualifier qualifier = symbol->getQualifier(); in visitSymbol()
1623 bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::TIntermBinary* node) in visitBinary()
1633 case glslang::EOpAssign: in visitBinary()
1634 case glslang::EOpAddAssign: in visitBinary()
1635 case glslang::EOpSubAssign: in visitBinary()
1636 case glslang::EOpMulAssign: in visitBinary()
1637 case glslang::EOpVectorTimesMatrixAssign: in visitBinary()
1638 case glslang::EOpVectorTimesScalarAssign: in visitBinary()
1639 case glslang::EOpMatrixTimesScalarAssign: in visitBinary()
1640 case glslang::EOpMatrixTimesMatrixAssign: in visitBinary()
1641 case glslang::EOpDivAssign: in visitBinary()
1642 case glslang::EOpModAssign: in visitBinary()
1643 case glslang::EOpAndAssign: in visitBinary()
1644 case glslang::EOpInclusiveOrAssign: in visitBinary()
1645 case glslang::EOpExclusiveOrAssign: in visitBinary()
1646 case glslang::EOpLeftShiftAssign: in visitBinary()
1647 case glslang::EOpRightShiftAssign: in visitBinary()
1663 if (node->getOp() != glslang::EOpAssign) { in visitBinary()
1689 case glslang::EOpIndexDirect: in visitBinary()
1690 case glslang::EOpIndexDirectStruct: in visitBinary()
1700 node->getOp() == glslang::EOpIndexDirect) { in visitBinary()
1714 if (node->getLeft()->getBasicType() == glslang::EbtReference && in visitBinary()
1716 node->getOp() == glslang::EOpIndexDirectStruct) in visitBinary()
1724 if (node->getLeft()->getBasicType() == glslang::EbtBlock && in visitBinary()
1725 node->getOp() == glslang::EOpIndexDirectStruct) in visitBinary()
1744 case glslang::EOpIndexIndirect: in visitBinary()
1777 case glslang::EOpVectorSwizzle: in visitBinary()
1788 case glslang::EOpMatrixSwizzle: in visitBinary()
1791 case glslang::EOpLogicalOr: in visitBinary()
1792 case glslang::EOpLogicalAnd: in visitBinary()
1832 logger->missingFunctionality("unknown glslang binary operation"); in visitBinary()
1840 bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TIntermUnary* node) in visitUnary()
1861 if (node->getOp() == glslang::EOpArrayLength) { in visitUnary()
1873 glslang::TIntermTyped* block = node->getOperand()->getAsBinaryNode()->getLeft(); in visitUnary()
1881 if (glslangIntermediate->getSource() == glslang::EShSourceGlsl) in visitUnary()
1896 if (node->getOp() == glslang::EOpInterpolateAtCentroid) in visitUnary()
1907 if (node->getOp() == glslang::EOpAtomicCounterIncrement || in visitUnary()
1908 node->getOp() == glslang::EOpAtomicCounterDecrement || in visitUnary()
1909 node->getOp() == glslang::EOpAtomicCounter || in visitUnary()
1910 node->getOp() == glslang::EOpInterpolateAtCentroid) in visitUnary()
1941 case glslang::EOpPostIncrement: in visitUnary()
1942 case glslang::EOpPostDecrement: in visitUnary()
1943 case glslang::EOpPreIncrement: in visitUnary()
1944 case glslang::EOpPreDecrement: in visitUnary()
1948 if (node->getBasicType() == glslang::EbtFloat) in visitUnary()
1950 else if (node->getBasicType() == glslang::EbtDouble) in visitUnary()
1952 else if (node->getBasicType() == glslang::EbtFloat16) in visitUnary()
1954 … else if (node->getBasicType() == glslang::EbtInt8 || node->getBasicType() == glslang::EbtUint8) in visitUnary()
1956 … else if (node->getBasicType() == glslang::EbtInt16 || node->getBasicType() == glslang::EbtUint16) in visitUnary()
1958 … else if (node->getBasicType() == glslang::EbtInt64 || node->getBasicType() == glslang::EbtUint64) in visitUnary()
1962 glslang::TOperator op; in visitUnary()
1963 if (node->getOp() == glslang::EOpPreIncrement || in visitUnary()
1964 node->getOp() == glslang::EOpPostIncrement) in visitUnary()
1965 op = glslang::EOpAdd; in visitUnary()
1967 op = glslang::EOpSub; in visitUnary()
1978 if (node->getOp() == glslang::EOpPreIncrement || in visitUnary()
1979 node->getOp() == glslang::EOpPreDecrement) in visitUnary()
1987 case glslang::EOpEmitStreamVertex: in visitUnary()
1990 case glslang::EOpEndStreamPrimitive: in visitUnary()
1995 logger->missingFunctionality("unknown glslang unary"); in visitUnary()
2000 bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TIntermAggregate* node) in visitAggregate()
2017 } else if (node->getOp() == glslang::EOpImageStore || in visitAggregate()
2019 node->getOp() == glslang::EOpImageStoreLod || in visitAggregate()
2021 node->getOp() == glslang::EOpImageAtomicStore) { in visitAggregate()
2026 glslang::TOperator binOp = glslang::EOpNull; in visitAggregate()
2037 case glslang::EOpSequence: in visitAggregate()
2063 case glslang::EOpLinkerObjects: in visitAggregate()
2065 if (visit == glslang::EvPreVisit) in visitAggregate()
2072 case glslang::EOpComma: in visitAggregate()
2076 glslang::TIntermSequence& glslangOperands = node->getSequence(); in visitAggregate()
2082 case glslang::EOpFunction: in visitAggregate()
2083 if (visit == glslang::EvPreVisit) { in visitAggregate()
2099 case glslang::EOpParameters: in visitAggregate()
2104 case glslang::EOpFunctionCall: in visitAggregate()
2118 case glslang::EOpConstructMat2x2: in visitAggregate()
2119 case glslang::EOpConstructMat2x3: in visitAggregate()
2120 case glslang::EOpConstructMat2x4: in visitAggregate()
2121 case glslang::EOpConstructMat3x2: in visitAggregate()
2122 case glslang::EOpConstructMat3x3: in visitAggregate()
2123 case glslang::EOpConstructMat3x4: in visitAggregate()
2124 case glslang::EOpConstructMat4x2: in visitAggregate()
2125 case glslang::EOpConstructMat4x3: in visitAggregate()
2126 case glslang::EOpConstructMat4x4: in visitAggregate()
2127 case glslang::EOpConstructDMat2x2: in visitAggregate()
2128 case glslang::EOpConstructDMat2x3: in visitAggregate()
2129 case glslang::EOpConstructDMat2x4: in visitAggregate()
2130 case glslang::EOpConstructDMat3x2: in visitAggregate()
2131 case glslang::EOpConstructDMat3x3: in visitAggregate()
2132 case glslang::EOpConstructDMat3x4: in visitAggregate()
2133 case glslang::EOpConstructDMat4x2: in visitAggregate()
2134 case glslang::EOpConstructDMat4x3: in visitAggregate()
2135 case glslang::EOpConstructDMat4x4: in visitAggregate()
2136 case glslang::EOpConstructIMat2x2: in visitAggregate()
2137 case glslang::EOpConstructIMat2x3: in visitAggregate()
2138 case glslang::EOpConstructIMat2x4: in visitAggregate()
2139 case glslang::EOpConstructIMat3x2: in visitAggregate()
2140 case glslang::EOpConstructIMat3x3: in visitAggregate()
2141 case glslang::EOpConstructIMat3x4: in visitAggregate()
2142 case glslang::EOpConstructIMat4x2: in visitAggregate()
2143 case glslang::EOpConstructIMat4x3: in visitAggregate()
2144 case glslang::EOpConstructIMat4x4: in visitAggregate()
2145 case glslang::EOpConstructUMat2x2: in visitAggregate()
2146 case glslang::EOpConstructUMat2x3: in visitAggregate()
2147 case glslang::EOpConstructUMat2x4: in visitAggregate()
2148 case glslang::EOpConstructUMat3x2: in visitAggregate()
2149 case glslang::EOpConstructUMat3x3: in visitAggregate()
2150 case glslang::EOpConstructUMat3x4: in visitAggregate()
2151 case glslang::EOpConstructUMat4x2: in visitAggregate()
2152 case glslang::EOpConstructUMat4x3: in visitAggregate()
2153 case glslang::EOpConstructUMat4x4: in visitAggregate()
2154 case glslang::EOpConstructBMat2x2: in visitAggregate()
2155 case glslang::EOpConstructBMat2x3: in visitAggregate()
2156 case glslang::EOpConstructBMat2x4: in visitAggregate()
2157 case glslang::EOpConstructBMat3x2: in visitAggregate()
2158 case glslang::EOpConstructBMat3x3: in visitAggregate()
2159 case glslang::EOpConstructBMat3x4: in visitAggregate()
2160 case glslang::EOpConstructBMat4x2: in visitAggregate()
2161 case glslang::EOpConstructBMat4x3: in visitAggregate()
2162 case glslang::EOpConstructBMat4x4: in visitAggregate()
2163 case glslang::EOpConstructF16Mat2x2: in visitAggregate()
2164 case glslang::EOpConstructF16Mat2x3: in visitAggregate()
2165 case glslang::EOpConstructF16Mat2x4: in visitAggregate()
2166 case glslang::EOpConstructF16Mat3x2: in visitAggregate()
2167 case glslang::EOpConstructF16Mat3x3: in visitAggregate()
2168 case glslang::EOpConstructF16Mat3x4: in visitAggregate()
2169 case glslang::EOpConstructF16Mat4x2: in visitAggregate()
2170 case glslang::EOpConstructF16Mat4x3: in visitAggregate()
2171 case glslang::EOpConstructF16Mat4x4: in visitAggregate()
2174 case glslang::EOpConstructFloat: in visitAggregate()
2175 case glslang::EOpConstructVec2: in visitAggregate()
2176 case glslang::EOpConstructVec3: in visitAggregate()
2177 case glslang::EOpConstructVec4: in visitAggregate()
2178 case glslang::EOpConstructDouble: in visitAggregate()
2179 case glslang::EOpConstructDVec2: in visitAggregate()
2180 case glslang::EOpConstructDVec3: in visitAggregate()
2181 case glslang::EOpConstructDVec4: in visitAggregate()
2182 case glslang::EOpConstructFloat16: in visitAggregate()
2183 case glslang::EOpConstructF16Vec2: in visitAggregate()
2184 case glslang::EOpConstructF16Vec3: in visitAggregate()
2185 case glslang::EOpConstructF16Vec4: in visitAggregate()
2186 case glslang::EOpConstructBool: in visitAggregate()
2187 case glslang::EOpConstructBVec2: in visitAggregate()
2188 case glslang::EOpConstructBVec3: in visitAggregate()
2189 case glslang::EOpConstructBVec4: in visitAggregate()
2190 case glslang::EOpConstructInt8: in visitAggregate()
2191 case glslang::EOpConstructI8Vec2: in visitAggregate()
2192 case glslang::EOpConstructI8Vec3: in visitAggregate()
2193 case glslang::EOpConstructI8Vec4: in visitAggregate()
2194 case glslang::EOpConstructUint8: in visitAggregate()
2195 case glslang::EOpConstructU8Vec2: in visitAggregate()
2196 case glslang::EOpConstructU8Vec3: in visitAggregate()
2197 case glslang::EOpConstructU8Vec4: in visitAggregate()
2198 case glslang::EOpConstructInt16: in visitAggregate()
2199 case glslang::EOpConstructI16Vec2: in visitAggregate()
2200 case glslang::EOpConstructI16Vec3: in visitAggregate()
2201 case glslang::EOpConstructI16Vec4: in visitAggregate()
2202 case glslang::EOpConstructUint16: in visitAggregate()
2203 case glslang::EOpConstructU16Vec2: in visitAggregate()
2204 case glslang::EOpConstructU16Vec3: in visitAggregate()
2205 case glslang::EOpConstructU16Vec4: in visitAggregate()
2206 case glslang::EOpConstructInt: in visitAggregate()
2207 case glslang::EOpConstructIVec2: in visitAggregate()
2208 case glslang::EOpConstructIVec3: in visitAggregate()
2209 case glslang::EOpConstructIVec4: in visitAggregate()
2210 case glslang::EOpConstructUint: in visitAggregate()
2211 case glslang::EOpConstructUVec2: in visitAggregate()
2212 case glslang::EOpConstructUVec3: in visitAggregate()
2213 case glslang::EOpConstructUVec4: in visitAggregate()
2214 case glslang::EOpConstructInt64: in visitAggregate()
2215 case glslang::EOpConstructI64Vec2: in visitAggregate()
2216 case glslang::EOpConstructI64Vec3: in visitAggregate()
2217 case glslang::EOpConstructI64Vec4: in visitAggregate()
2218 case glslang::EOpConstructUint64: in visitAggregate()
2219 case glslang::EOpConstructU64Vec2: in visitAggregate()
2220 case glslang::EOpConstructU64Vec3: in visitAggregate()
2221 case glslang::EOpConstructU64Vec4: in visitAggregate()
2222 case glslang::EOpConstructStruct: in visitAggregate()
2223 case glslang::EOpConstructTextureSampler: in visitAggregate()
2224 case glslang::EOpConstructReference: in visitAggregate()
2230 if (node->getOp() == glslang::EOpConstructTextureSampler) in visitAggregate()
2232 else if (node->getOp() == glslang::EOpConstructStruct || node->getType().isArray()) { in visitAggregate()
2250 case glslang::EOpLessThan: in visitAggregate()
2251 case glslang::EOpGreaterThan: in visitAggregate()
2252 case glslang::EOpLessThanEqual: in visitAggregate()
2253 case glslang::EOpGreaterThanEqual: in visitAggregate()
2254 case glslang::EOpVectorEqual: in visitAggregate()
2255 case glslang::EOpVectorNotEqual: in visitAggregate()
2261 case glslang::EOpVectorEqual: binOp = glslang::EOpVectorEqual; break; in visitAggregate()
2262 case glslang::EOpVectorNotEqual: binOp = glslang::EOpVectorNotEqual; break; in visitAggregate()
2268 case glslang::EOpMul: in visitAggregate()
2270 binOp = glslang::EOpMul; in visitAggregate()
2272 case glslang::EOpOuterProduct: in visitAggregate()
2274 binOp = glslang::EOpOuterProduct; in visitAggregate()
2276 case glslang::EOpDot: in visitAggregate()
2279 glslang::TIntermSequence& glslangOperands = node->getSequence(); in visitAggregate()
2281 binOp = glslang::EOpMul; in visitAggregate()
2284 case glslang::EOpMod: in visitAggregate()
2287 binOp = glslang::EOpMod; in visitAggregate()
2289 case glslang::EOpEmitVertex: in visitAggregate()
2290 case glslang::EOpEndPrimitive: in visitAggregate()
2291 case glslang::EOpBarrier: in visitAggregate()
2292 case glslang::EOpMemoryBarrier: in visitAggregate()
2293 case glslang::EOpMemoryBarrierAtomicCounter: in visitAggregate()
2294 case glslang::EOpMemoryBarrierBuffer: in visitAggregate()
2295 case glslang::EOpMemoryBarrierImage: in visitAggregate()
2296 case glslang::EOpMemoryBarrierShared: in visitAggregate()
2297 case glslang::EOpGroupMemoryBarrier: in visitAggregate()
2298 case glslang::EOpDeviceMemoryBarrier: in visitAggregate()
2299 case glslang::EOpAllMemoryBarrierWithGroupSync: in visitAggregate()
2300 case glslang::EOpDeviceMemoryBarrierWithGroupSync: in visitAggregate()
2301 case glslang::EOpWorkgroupMemoryBarrier: in visitAggregate()
2302 case glslang::EOpWorkgroupMemoryBarrierWithGroupSync: in visitAggregate()
2303 case glslang::EOpSubgroupBarrier: in visitAggregate()
2304 case glslang::EOpSubgroupMemoryBarrier: in visitAggregate()
2305 case glslang::EOpSubgroupMemoryBarrierBuffer: in visitAggregate()
2306 case glslang::EOpSubgroupMemoryBarrierImage: in visitAggregate()
2307 case glslang::EOpSubgroupMemoryBarrierShared: in visitAggregate()
2312 case glslang::EOpAtomicStore: in visitAggregate()
2315 case glslang::EOpAtomicLoad: in visitAggregate()
2316 case glslang::EOpAtomicAdd: in visitAggregate()
2317 case glslang::EOpAtomicMin: in visitAggregate()
2318 case glslang::EOpAtomicMax: in visitAggregate()
2319 case glslang::EOpAtomicAnd: in visitAggregate()
2320 case glslang::EOpAtomicOr: in visitAggregate()
2321 case glslang::EOpAtomicXor: in visitAggregate()
2322 case glslang::EOpAtomicExchange: in visitAggregate()
2323 case glslang::EOpAtomicCompSwap: in visitAggregate()
2327 case glslang::EOpAtomicCounterAdd: in visitAggregate()
2328 case glslang::EOpAtomicCounterSubtract: in visitAggregate()
2329 case glslang::EOpAtomicCounterMin: in visitAggregate()
2330 case glslang::EOpAtomicCounterMax: in visitAggregate()
2331 case glslang::EOpAtomicCounterAnd: in visitAggregate()
2332 case glslang::EOpAtomicCounterOr: in visitAggregate()
2333 case glslang::EOpAtomicCounterXor: in visitAggregate()
2334 case glslang::EOpAtomicCounterExchange: in visitAggregate()
2335 case glslang::EOpAtomicCounterCompSwap: in visitAggregate()
2342 case glslang::EOpIgnoreIntersectionNV: in visitAggregate()
2343 case glslang::EOpTerminateRayNV: in visitAggregate()
2344 case glslang::EOpTraceNV: in visitAggregate()
2345 case glslang::EOpExecuteCallableNV: in visitAggregate()
2346 case glslang::EOpWritePackedPrimitiveIndices4x8NV: in visitAggregate()
2358 if (binOp != glslang::EOpNull) { in visitAggregate()
2359 glslang::TIntermTyped* left = node->getSequence()[0]->getAsTyped(); in visitAggregate()
2360 glslang::TIntermTyped* right = node->getSequence()[1]->getAsTyped(); in visitAggregate()
2390 glslang::TIntermSequence& glslangOperands = node->getSequence(); in visitAggregate()
2396 case glslang::EOpFrexp: in visitAggregate()
2397 case glslang::EOpModf: in visitAggregate()
2401 case glslang::EOpInterpolateAtSample: in visitAggregate()
2402 case glslang::EOpInterpolateAtOffset: in visitAggregate()
2404 case glslang::EOpInterpolateAtVertex: in visitAggregate()
2412 glslangOperands[0]->getAsOperator()->getOp() == glslang::EOpVectorSwizzle) in visitAggregate()
2416 case glslang::EOpAtomicAdd: in visitAggregate()
2417 case glslang::EOpAtomicMin: in visitAggregate()
2418 case glslang::EOpAtomicMax: in visitAggregate()
2419 case glslang::EOpAtomicAnd: in visitAggregate()
2420 case glslang::EOpAtomicOr: in visitAggregate()
2421 case glslang::EOpAtomicXor: in visitAggregate()
2422 case glslang::EOpAtomicExchange: in visitAggregate()
2423 case glslang::EOpAtomicCompSwap: in visitAggregate()
2424 case glslang::EOpAtomicLoad: in visitAggregate()
2425 case glslang::EOpAtomicStore: in visitAggregate()
2426 case glslang::EOpAtomicCounterAdd: in visitAggregate()
2427 case glslang::EOpAtomicCounterSubtract: in visitAggregate()
2428 case glslang::EOpAtomicCounterMin: in visitAggregate()
2429 case glslang::EOpAtomicCounterMax: in visitAggregate()
2430 case glslang::EOpAtomicCounterAnd: in visitAggregate()
2431 case glslang::EOpAtomicCounterOr: in visitAggregate()
2432 case glslang::EOpAtomicCounterXor: in visitAggregate()
2433 case glslang::EOpAtomicCounterExchange: in visitAggregate()
2434 case glslang::EOpAtomicCounterCompSwap: in visitAggregate()
2438 case glslang::EOpAddCarry: in visitAggregate()
2439 case glslang::EOpSubBorrow: in visitAggregate()
2443 case glslang::EOpUMulExtended: in visitAggregate()
2444 case glslang::EOpIMulExtended: in visitAggregate()
2497 logger->missingFunctionality("unknown glslang aggregate"); in visitAggregate()
2515 bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang::TIntermSelection*… in visitSelection()
2537 node->getBasicType() == glslang::EbtVoid) in visitSelection()
2544 const auto operandOkay = [](glslang::TIntermTyped* node) { in visitSelection()
2568 if (node->getBasicType() == glslang::EbtVoid) in visitSelection()
2618 if (node->getBasicType() != glslang::EbtVoid) in visitSelection()
2663 bool TGlslangToSpvTraverser::visitSwitch(glslang::TVisit /* visit */, glslang::TIntermSwitch* node) in visitSwitch()
2675 glslang::TIntermSequence& sequence = node->getBody()->getSequence(); in visitSwitch()
2678 for (glslang::TIntermSequence::iterator c = sequence.begin(); c != sequence.end(); ++c) { in visitSwitch()
2680 … if (child->getAsBranchNode() && child->getAsBranchNode()->getFlowOp() == glslang::EOpDefault) in visitSwitch()
2682 … else if (child->getAsBranchNode() && child->getAsBranchNode()->getFlowOp() == glslang::EOpCase) { in visitSwitch()
2715 void TGlslangToSpvTraverser::visitConstantUnion(glslang::TIntermConstantUnion* node) in visitConstantUnion()
2724 bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIntermLoop* node) in visitLoop()
2730 unsigned int dependencyLength = glslang::TIntermLoop::dependencyInfinite; in visitLoop()
2793 bool TGlslangToSpvTraverser::visitBranch(glslang::TVisit /* visit */, glslang::TIntermBranch* node) in visitBranch()
2801 case glslang::EOpKill: in visitBranch()
2804 case glslang::EOpBreak: in visitBranch()
2810 case glslang::EOpContinue: in visitBranch()
2813 case glslang::EOpReturn: in visitBranch()
2815 const glslang::TType& glslangReturnType = node->getExpression()->getType(); in visitBranch()
2839 spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* node) in createSpvVariable()
2854 const bool contains16BitType = node->getType().containsBasicType(glslang::EbtFloat16) || in createSpvVariable()
2855 node->getType().containsBasicType(glslang::EbtInt16) || in createSpvVariable()
2856 node->getType().containsBasicType(glslang::EbtUint16); in createSpvVariable()
2870 if (node->getType().getQualifier().storage == glslang::EvqBuffer) in createSpvVariable()
2885 const bool contains8BitType = node->getType().containsBasicType(glslang::EbtInt8) || in createSpvVariable()
2886 node->getType().containsBasicType(glslang::EbtUint8); in createSpvVariable()
2901 if (glslang::IsAnonymous(name)) in createSpvVariable()
2908 spv::Id TGlslangToSpvTraverser::getSampledType(const glslang::TSampler& sampler) in getSampledType()
2911 case glslang::EbtFloat: return builder.makeFloatType(32); in getSampledType()
2913 case glslang::EbtFloat16: in getSampledType()
2918 case glslang::EbtInt: return builder.makeIntType(32); in getSampledType()
2919 case glslang::EbtUint: return builder.makeUintType(32); in getSampledType()
2929 spv::Id TGlslangToSpvTraverser::getInvertedSwizzleType(const glslang::TIntermTyped& node) in getInvertedSwizzleType()
2932 node.getAsOperator()->getOp() == glslang::EOpVectorSwizzle) in getInvertedSwizzleType()
2940 spv::Id TGlslangToSpvTraverser::createInvertedSwizzle(spv::Decoration precision, const glslang::TIn… in createInvertedSwizzle()
2947 // Convert a glslang AST swizzle node to a swizzle vector for building SPIR-V.
2948 void TGlslangToSpvTraverser::convertSwizzle(const glslang::TIntermAggregate& node, std::vector<unsi… in convertSwizzle()
2950 const glslang::TIntermSequence& swizzleSequence = node.getSequence(); in convertSwizzle()
2955 // Convert from a glslang type to an SPV type, by calling into a
2958 spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& type, bool forwardRef… in convertGlslangToSpvType()
2963 // Do full recursive conversion of an arbitrary glslang type to a SPIR-V Id.
2966 spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& type, in convertGlslangToSpvType()
2967 glslang::TLayoutPacking explicitLayout, const glslang::TQualifier& qualifier, in convertGlslangToSpvType()
2973 case glslang::EbtVoid: in convertGlslangToSpvType()
2977 case glslang::EbtFloat: in convertGlslangToSpvType()
2980 case glslang::EbtDouble: in convertGlslangToSpvType()
2983 case glslang::EbtFloat16: in convertGlslangToSpvType()
2986 case glslang::EbtBool: in convertGlslangToSpvType()
2989 if (explicitLayout != glslang::ElpNone) in convertGlslangToSpvType()
2994 case glslang::EbtInt8: in convertGlslangToSpvType()
2997 case glslang::EbtUint8: in convertGlslangToSpvType()
3000 case glslang::EbtInt16: in convertGlslangToSpvType()
3003 case glslang::EbtUint16: in convertGlslangToSpvType()
3006 case glslang::EbtInt: in convertGlslangToSpvType()
3009 case glslang::EbtUint: in convertGlslangToSpvType()
3012 case glslang::EbtInt64: in convertGlslangToSpvType()
3015 case glslang::EbtUint64: in convertGlslangToSpvType()
3018 case glslang::EbtAtomicUint: in convertGlslangToSpvType()
3023 case glslang::EbtAccStructNV: in convertGlslangToSpvType()
3027 case glslang::EbtSampler: in convertGlslangToSpvType()
3029 const glslang::TSampler& sampler = type.getSampler(); in convertGlslangToSpvType()
3044 case glslang::EbtStruct: in convertGlslangToSpvType()
3045 case glslang::EbtBlock: in convertGlslangToSpvType()
3048 const glslang::TTypeList* glslangMembers = type.getStruct(); in convertGlslangToSpvType()
3058 if (type.getBasicType() == glslang::EbtBlock) in convertGlslangToSpvType()
3063 case glslang::EbtReference: in convertGlslangToSpvType()
3099 if (explicitLayout != glslang::ElpNone && type.getBasicType() != glslang::EbtBlock) { in convertGlslangToSpvType()
3100 // Use a dummy glslang type for querying internal strides of in convertGlslangToSpvType()
3102 glslang::TType simpleArrayType(type, 0); // deference type of the array in convertGlslangToSpvType()
3122 if (explicitLayout != glslang::ElpNone && type.getBasicType() != glslang::EbtBlock) in convertGlslangToSpvType()
3148 bool TGlslangToSpvTraverser::filterMember(const glslang::TType& member) in filterMember()
3176 // Do full recursive conversion of a glslang structure (or block) type to a SPIR-V Id.
3179 spv::Id TGlslangToSpvTraverser::convertGlslangStructToSpvType(const glslang::TType& type, in convertGlslangStructToSpvType()
3180 … const glslang::TTypeList* glslangMembers, in convertGlslangStructToSpvType()
3181glslang::TLayoutPacking explicitLayout, in convertGlslangStructToSpvType()
3182 const glslang::TQualifier& qualifier) in convertGlslangStructToSpvType()
3186 …int memberDelta = 0; // how much the member's index changes from glslang to SPIR-V, normally 0, e… in convertGlslangStructToSpvType()
3187 std::vector<std::pair<glslang::TType*, glslang::TQualifier> > deferredForwardPointers; in convertGlslangStructToSpvType()
3189 glslang::TType& glslangMember = *(*glslangMembers)[i].type; in convertGlslangStructToSpvType()
3192 if (type.getBasicType() == glslang::EbtBlock) in convertGlslangStructToSpvType()
3195 if (type.getBasicType() == glslang::EbtBlock) { in convertGlslangStructToSpvType()
3201 glslang::TQualifier memberQualifier = glslangMember.getQualifier(); in convertGlslangStructToSpvType()
3209 bool lastBufferBlockMember = qualifier.storage == glslang::EvqBuffer && in convertGlslangStructToSpvType()
3214 if (glslangMember.getBasicType() == glslang::EbtReference) { in convertGlslangStructToSpvType()
3243 void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, in decorateStructType()
3244 const glslang::TTypeList* glslangMembers, in decorateStructType()
3245 glslang::TLayoutPacking explicitLayout, in decorateStructType()
3246 const glslang::TQualifier& qualifier, in decorateStructType()
3253 glslang::TType& glslangMember = *(*glslangMembers)[i].type; in decorateStructType()
3255 if (type.getBasicType() == glslang::EbtBlock) { in decorateStructType()
3262 glslang::TQualifier memberQualifier = glslangMember.getQualifier(); in decorateStructType()
3275 if (type.getQualifier().storage == glslang::EvqVaryingIn || in decorateStructType()
3276 type.getQualifier().storage == glslang::EvqVaryingOut) { in decorateStructType()
3277 if (type.getBasicType() == glslang::EbtBlock || in decorateStructType()
3278 glslangIntermediate->getSource() == glslang::EShSourceHlsl) { in decorateStructType()
3288 if (type.getBasicType() == glslang::EbtBlock && in decorateStructType()
3289 qualifier.storage == glslang::EvqBuffer) { in decorateStructType()
3315 else if (explicitLayout != glslang::ElpNone) { in decorateStructType()
3324 if (glslangMember.isMatrix() && explicitLayout != glslang::ElpNone) in decorateStructType()
3375 spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arraySizes, int dim) in makeArraySizeId()
3378 glslang::TIntermTyped* specNode = arraySizes.getDimNode(dim); in makeArraySizeId()
3393 // - use the SPIR-V inferred type instead of another conversion of the glslang type
3396 spv::Id TGlslangToSpvTraverser::accessChainLoad(const glslang::TType& type) in accessChainLoad()
3414 if (type.getBasicType() == glslang::EbtBool) { in accessChainLoad()
3436 void TGlslangToSpvTraverser::accessChainStore(const glslang::TType& type, spv::Id rvalue) in accessChainStore()
3439 if (type.getBasicType() == glslang::EbtBool) { in accessChainStore()
3478 // For storing when types match at the glslang level, but not might match at the
3481 // This especially happens when a single glslang type expands to multiple
3489 void TGlslangToSpvTraverser::multiTypeStore(const glslang::TType& type, spv::Id rValue) in multiTypeStore()
3512 glslang::TType glslangElementType(type, 0); in multiTypeStore()
3530 const glslang::TTypeList& members = *type.getStruct(); in multiTypeStore()
3532 const glslang::TType& glslangMemberType = *members[m].type; in multiTypeStore()
3552 glslang::TLayoutPacking TGlslangToSpvTraverser::getExplicitLayout(const glslang::TType& type) const in getExplicitLayout()
3555 if (type.getBasicType() != glslang::EbtBlock) in getExplicitLayout()
3556 return glslang::ElpNone; in getExplicitLayout()
3559 if (type.getQualifier().storage != glslang::EvqUniform && in getExplicitLayout()
3560 type.getQualifier().storage != glslang::EvqBuffer && in getExplicitLayout()
3562 return glslang::ElpNone; in getExplicitLayout()
3566 case glslang::ElpStd140: in getExplicitLayout()
3567 case glslang::ElpStd430: in getExplicitLayout()
3568 case glslang::ElpScalar: in getExplicitLayout()
3571 return glslang::ElpNone; in getExplicitLayout()
3576 …ngToSpvTraverser::getArrayStride(const glslang::TType& arrayType, glslang::TLayoutPacking explicit… in getArrayStride()
3580 …>getMemberAlignment(arrayType, size, stride, explicitLayout, matrixLayout == glslang::ElmRowMajor); in getArrayStride()
3587 …gToSpvTraverser::getMatrixStride(const glslang::TType& matrixType, glslang::TLayoutPacking explici… in getMatrixStride()
3589 glslang::TType elementType; in getMatrixStride()
3595 …etMemberAlignment(elementType, size, stride, explicitLayout, matrixLayout == glslang::ElmRowMajor); in getMatrixStride()
3606 void TGlslangToSpvTraverser::updateMemberOffset(const glslang::TType& structType, const glslang::TT… in updateMemberOffset()
3607glslang::TLayoutPacking explicitLayout, glslang::TLayoutMatrix matrixLayout) in updateMemberOffset()
3616 // It could be that current linker usage in glslang updated all the layoutOffset, in updateMemberOffset()
3621 if (explicitLayout == glslang::ElpNone) { in updateMemberOffset()
3637 …ignment(memberType, memberSize, dummyStride, explicitLayout, matrixLayout == glslang::ElmRowMajor); in updateMemberOffset()
3653 glslang::RoundToPow2(currentOffset, memberAlignment); in updateMemberOffset()
3656 …if (explicitLayout != glslang::ElpScalar && glslangIntermediate->improperStraddle(memberType, memb… in updateMemberOffset()
3657 glslang::RoundToPow2(currentOffset, 16); in updateMemberOffset()
3662 void TGlslangToSpvTraverser::declareUseOfStructMember(const glslang::TTypeList& members, int glslan… in declareUseOfStructMember()
3664 …const glslang::TBuiltInVariable glslangBuiltIn = members[glslangMember].type->getQualifier().built… in declareUseOfStructMember()
3667 case glslang::EbvClipDistance: in declareUseOfStructMember()
3668 case glslang::EbvCullDistance: in declareUseOfStructMember()
3669 case glslang::EbvPointSize: in declareUseOfStructMember()
3671 case glslang::EbvViewportMaskNV: in declareUseOfStructMember()
3672 case glslang::EbvSecondaryPositionNV: in declareUseOfStructMember()
3673 case glslang::EbvSecondaryViewportMaskNV: in declareUseOfStructMember()
3674 case glslang::EbvPositionPerViewNV: in declareUseOfStructMember()
3675 case glslang::EbvViewportMaskPerViewNV: in declareUseOfStructMember()
3676 case glslang::EbvTaskCountNV: in declareUseOfStructMember()
3677 case glslang::EbvPrimitiveCountNV: in declareUseOfStructMember()
3678 case glslang::EbvPrimitiveIndicesNV: in declareUseOfStructMember()
3679 case glslang::EbvClipDistancePerViewNV: in declareUseOfStructMember()
3680 case glslang::EbvCullDistancePerViewNV: in declareUseOfStructMember()
3681 case glslang::EbvLayerPerViewNV: in declareUseOfStructMember()
3682 case glslang::EbvMeshViewCountNV: in declareUseOfStructMember()
3683 case glslang::EbvMeshViewIndicesNV: in declareUseOfStructMember()
3686 // Alternately, we could just call this for any glslang built-in, since the in declareUseOfStructMember()
3696 bool TGlslangToSpvTraverser::isShaderEntryPoint(const glslang::TIntermAggregate* node) in isShaderEntryPoint()
3704 bool TGlslangToSpvTraverser::writableParam(glslang::TStorageQualifier qualifier) const in writableParam()
3706 assert(qualifier == glslang::EvqIn || in writableParam()
3707 qualifier == glslang::EvqOut || in writableParam()
3708 qualifier == glslang::EvqInOut || in writableParam()
3709 qualifier == glslang::EvqConstReadOnly); in writableParam()
3710 return qualifier != glslang::EvqConstReadOnly; in writableParam()
3714 bool TGlslangToSpvTraverser::originalParam(glslang::TStorageQualifier qualifier, const glslang::TTy… in originalParam()
3719 if (glslangIntermediate->getSource() == glslang::EShSourceHlsl) in originalParam()
3720 return paramType.getBasicType() == glslang::EbtBlock; in originalParam()
3722 … (paramType.getBasicType() == glslang::EbtBlock && qualifier == glslang::EvqBuffer); // SSBO in originalParam()
3726 void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslFunctions) in makeFunctions()
3728 …const auto getParamDecorations = [&](std::vector<spv::Decoration>& decorations, const glslang::TTy… in makeFunctions()
3733 if (type.getBasicType() == glslang::EbtReference) { in makeFunctions()
3747 glslang::TIntermAggregate* glslFunction = glslFunctions[f]->getAsAggregate(); in makeFunctions()
3748 …if (! glslFunction || glslFunction->getOp() != glslang::EOpFunction || isShaderEntryPoint(glslFunc… in makeFunctions()
3767glslang::TIntermSequence& parameters = glslFunction->getSequence()[0]->getAsAggregate()->getSequen… in makeFunctions()
3774 const glslang::TType& paramType = parameters[p]->getAsTyped()->getType(); in makeFunctions()
3807 void TGlslangToSpvTraverser::makeGlobalInitializers(const glslang::TIntermSequence& initializers) in makeGlobalInitializers()
3811 glslang::TIntermAggregate* initializer = initializers[i]->getAsAggregate(); in makeGlobalInitializers()
3812 …if (initializer && initializer->getOp() != glslang::EOpFunction && initializer->getOp() != glslang in makeGlobalInitializers()
3822 void TGlslangToSpvTraverser::visitFunctions(const glslang::TIntermSequence& glslFunctions) in visitFunctions()
3825 glslang::TIntermAggregate* node = glslFunctions[f]->getAsAggregate(); in visitFunctions()
3826 … if (node && (node->getOp() == glslang::EOpFunction || node->getOp() == glslang::EOpLinkerObjects)) in visitFunctions()
3831 void TGlslangToSpvTraverser::handleFunctionEntry(const glslang::TIntermAggregate* node) in handleFunctionEntry()
3840 void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& node, std::vector<… in translateArguments()
3842 const glslang::TIntermSequence& glslangArguments = node.getSequence(); in translateArguments()
3844 glslang::TSampler sampler = {}; in translateArguments()
3851 cubeCompare = sampler.dim == glslang::EsdCube && sampler.arrayed && sampler.shadow; in translateArguments()
3853 …mpler.shadow && glslangArguments[1]->getAsTyped()->getType().getBasicType() == glslang::EbtFloat16; in translateArguments()
3864 case glslang::EOpImageAtomicAdd: in translateArguments()
3865 case glslang::EOpImageAtomicMin: in translateArguments()
3866 case glslang::EOpImageAtomicMax: in translateArguments()
3867 case glslang::EOpImageAtomicAnd: in translateArguments()
3868 case glslang::EOpImageAtomicOr: in translateArguments()
3869 case glslang::EOpImageAtomicXor: in translateArguments()
3870 case glslang::EOpImageAtomicExchange: in translateArguments()
3871 case glslang::EOpImageAtomicCompSwap: in translateArguments()
3872 case glslang::EOpImageAtomicLoad: in translateArguments()
3873 case glslang::EOpImageAtomicStore: in translateArguments()
3877 case glslang::EOpSparseImageLoad: in translateArguments()
3882 case glslang::EOpSparseTexture: in translateArguments()
3886 case glslang::EOpSparseTextureClamp: in translateArguments()
3890 case glslang::EOpSparseTextureLod: in translateArguments()
3891 case glslang::EOpSparseTextureOffset: in translateArguments()
3896 case glslang::EOpSparseTexture: in translateArguments()
3900 case glslang::EOpSparseTextureClamp: in translateArguments()
3904 case glslang::EOpSparseTextureLod: in translateArguments()
3905 case glslang::EOpSparseTextureOffset: in translateArguments()
3910 case glslang::EOpSparseTextureFetch: in translateArguments()
3911 … if ((sampler.dim != glslang::EsdRect && i == 3) || (sampler.dim == glslang::EsdRect && i == 2)) in translateArguments()
3914 case glslang::EOpSparseTextureFetchOffset: in translateArguments()
3915 … if ((sampler.dim != glslang::EsdRect && i == 4) || (sampler.dim == glslang::EsdRect && i == 3)) in translateArguments()
3919 case glslang::EOpSparseTextureLodOffset: in translateArguments()
3920 case glslang::EOpSparseTextureGrad: in translateArguments()
3921 case glslang::EOpSparseTextureOffsetClamp: in translateArguments()
3925 case glslang::EOpSparseTextureGradOffset: in translateArguments()
3926 case glslang::EOpSparseTextureGradClamp: in translateArguments()
3930 case glslang::EOpSparseTextureGradOffsetClamp: in translateArguments()
3935 case glslang::EOpSparseTextureLodOffset: in translateArguments()
3936 case glslang::EOpSparseTextureGrad: in translateArguments()
3937 case glslang::EOpSparseTextureOffsetClamp: in translateArguments()
3941 case glslang::EOpSparseTextureGradOffset: in translateArguments()
3942 case glslang::EOpSparseTextureGradClamp: in translateArguments()
3946 case glslang::EOpSparseTextureGradOffsetClamp: in translateArguments()
3951 case glslang::EOpSparseTextureGather: in translateArguments()
3955 case glslang::EOpSparseTextureGatherOffset: in translateArguments()
3956 case glslang::EOpSparseTextureGatherOffsets: in translateArguments()
3961 case glslang::EOpSparseTextureGatherLod: in translateArguments()
3965 case glslang::EOpSparseTextureGatherLodOffset: in translateArguments()
3966 case glslang::EOpSparseTextureGatherLodOffsets: in translateArguments()
3970 case glslang::EOpSparseImageLoadLod: in translateArguments()
3976 case glslang::EOpImageSampleFootprintNV: in translateArguments()
3980 case glslang::EOpImageSampleFootprintClampNV: in translateArguments()
3981 case glslang::EOpImageSampleFootprintLodNV: in translateArguments()
3985 case glslang::EOpImageSampleFootprintGradNV: in translateArguments()
3989 case glslang::EOpImageSampleFootprintGradClampNV: in translateArguments()
4005 void TGlslangToSpvTraverser::translateArguments(glslang::TIntermUnary& node, std::vector<spv::Id>& … in translateArguments()
4012 spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermOperator* node)
4021 …const glslang::TType &imageType = node->getAsAggregate() ? node->getAsAggregate()->getSequence()[0…
4023 const glslang::TSampler sampler = imageType.getSampler();
4026 …->getAsAggregate()->getSequence()[1]->getAsTyped()->getType().getBasicType() == glslang::EbtFloat16
4040 glslang::TCrackedTextureOp cracked;
4043 const bool isUnsignedResult = node->getType().getBasicType() == glslang::EbtUint;
4048 if (node->getOp() != glslang::EOpTextureQueryLod && builder.isSampledImage(params.sampler))
4052 case glslang::EOpImageQuerySize:
4053 case glslang::EOpTextureQuerySize:
4059 case glslang::EOpImageQuerySamples:
4060 case glslang::EOpTextureQuerySamples:
4062 case glslang::EOpTextureQueryLod:
4065 case glslang::EOpTextureQueryLevels:
4067 case glslang::EOpSparseTexelsResident:
4077 if (node->getOp() == glslang::EOpTextureFetch) {
4085 glslang::TType returnType(node->getType().getBasicType(), glslang::EvqTemporary, components);
4122 if (node->getOp() == glslang::EOpImageLoad || node->getOp() == glslang::EOpImageLoadLod) {
4124 if (node->getOp() == glslang::EOpImageLoad) {
4170 …} else if (node->getOp() == glslang::EOpImageStore || node->getOp() == glslang::EOpImageStoreLod) {
4172 } else if (node->getOp() == glslang::EOpImageStore) {
4225 …} else if (node->getOp() == glslang::EOpSparseImageLoad || node->getOp() == glslang::EOpSparseImag…
4227 } else if (node->getOp() == glslang::EOpSparseImageLoad) {
4289 if (node->getOp() == glslang::EOpImageAtomicStore) {
4333 if (node->getOp() == glslang::EOpFragmentMaskFetch)
4335 else if (node->getOp() == glslang::EOpFragmentFetch)
4350 bool cubeCompare = sampler.dim == glslang::EsdCube && sampler.arrayed && sampler.shadow;
4400 … sourceExtensions.find(glslang::E_GL_AMD_texture_gather_bias_lod) != sourceExtensions.end()) {
4443 … (glslangIntermediate->getLayoutDerivativeModeNone() != glslang::LayoutDerivativeNone))
4576 case glslang::Esd1D: projTargetComp = 1; break;
4577 case glslang::Esd2D: projTargetComp = 2; break;
4578 case glslang::EsdRect: projTargetComp = 2; break;
4611 spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAggregate* node)
4618 const glslang::TIntermSequence& glslangArgs = node->getSequence();
4619 const glslang::TQualifierList& qualifiers = node->getQualifierList();
4632 std::vector<const glslang::TType*> argTypes;
4665 if (qualifiers[a] == glslang::EvqIn || qualifiers[a] == glslang::EvqInOut) {
4699 if (qualifiers[a] == glslang::EvqOut || qualifiers[a] == glslang::EvqInOut) {
4712 spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, OpDecorations& decorat…
4714glslang::TBasicType typeProxy, bool reduceComparison)
4718 bool isBool = typeProxy == glslang::EbtBool;
4725 case glslang::EOpAdd:
4726 case glslang::EOpAddAssign:
4732 case glslang::EOpSub:
4733 case glslang::EOpSubAssign:
4739 case glslang::EOpMul:
4740 case glslang::EOpMulAssign:
4746 case glslang::EOpVectorTimesScalar:
4747 case glslang::EOpVectorTimesScalarAssign:
4759 case glslang::EOpVectorTimesMatrix:
4760 case glslang::EOpVectorTimesMatrixAssign:
4763 case glslang::EOpMatrixTimesVector:
4766 case glslang::EOpMatrixTimesScalar:
4767 case glslang::EOpMatrixTimesScalarAssign:
4770 case glslang::EOpMatrixTimesMatrix:
4771 case glslang::EOpMatrixTimesMatrixAssign:
4774 case glslang::EOpOuterProduct:
4779 case glslang::EOpDiv:
4780 case glslang::EOpDivAssign:
4788 case glslang::EOpMod:
4789 case glslang::EOpModAssign:
4797 case glslang::EOpRightShift:
4798 case glslang::EOpRightShiftAssign:
4804 case glslang::EOpLeftShift:
4805 case glslang::EOpLeftShiftAssign:
4808 case glslang::EOpAnd:
4809 case glslang::EOpAndAssign:
4812 case glslang::EOpLogicalAnd:
4816 case glslang::EOpInclusiveOr:
4817 case glslang::EOpInclusiveOrAssign:
4820 case glslang::EOpLogicalOr:
4824 case glslang::EOpExclusiveOr:
4825 case glslang::EOpExclusiveOrAssign:
4828 case glslang::EOpLogicalXor:
4833 case glslang::EOpLessThan:
4834 case glslang::EOpGreaterThan:
4835 case glslang::EOpLessThanEqual:
4836 case glslang::EOpGreaterThanEqual:
4837 case glslang::EOpEqual:
4838 case glslang::EOpNotEqual:
4839 case glslang::EOpVectorEqual:
4840 case glslang::EOpVectorNotEqual:
4868 if (reduceComparison && (op == glslang::EOpEqual || op == glslang::EOpNotEqual)
4870 …sult = builder.createCompositeCompare(decorations.precision, left, right, op == glslang::EOpEqual);
4876 case glslang::EOpLessThan:
4884 case glslang::EOpGreaterThan:
4892 case glslang::EOpLessThanEqual:
4900 case glslang::EOpGreaterThanEqual:
4908 case glslang::EOpEqual:
4909 case glslang::EOpVectorEqual:
4917 case glslang::EOpNotEqual:
4918 case glslang::EOpVectorNotEqual:
5050 spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDecorations& decorati…
5051 spv::Id operand, glslang::TBasicType typeProxy)
5060 case glslang::EOpNegative:
5069 case glslang::EOpLogicalNot:
5070 case glslang::EOpVectorLogicalNot:
5073 case glslang::EOpBitwiseNot:
5077 case glslang::EOpDeterminant:
5080 case glslang::EOpMatrixInverse:
5083 case glslang::EOpTranspose:
5087 case glslang::EOpRadians:
5090 case glslang::EOpDegrees:
5093 case glslang::EOpSin:
5096 case glslang::EOpCos:
5099 case glslang::EOpTan:
5102 case glslang::EOpAcos:
5105 case glslang::EOpAsin:
5108 case glslang::EOpAtan:
5112 case glslang::EOpAcosh:
5115 case glslang::EOpAsinh:
5118 case glslang::EOpAtanh:
5121 case glslang::EOpTanh:
5124 case glslang::EOpCosh:
5127 case glslang::EOpSinh:
5131 case glslang::EOpLength:
5134 case glslang::EOpNormalize:
5138 case glslang::EOpExp:
5141 case glslang::EOpLog:
5144 case glslang::EOpExp2:
5147 case glslang::EOpLog2:
5150 case glslang::EOpSqrt:
5153 case glslang::EOpInverseSqrt:
5157 case glslang::EOpFloor:
5160 case glslang::EOpTrunc:
5163 case glslang::EOpRound:
5166 case glslang::EOpRoundEven:
5169 case glslang::EOpCeil:
5172 case glslang::EOpFract:
5176 case glslang::EOpIsNan:
5179 case glslang::EOpIsInf:
5182 case glslang::EOpIsFinite:
5186 case glslang::EOpFloatBitsToInt:
5187 case glslang::EOpFloatBitsToUint:
5188 case glslang::EOpIntBitsToFloat:
5189 case glslang::EOpUintBitsToFloat:
5190 case glslang::EOpDoubleBitsToInt64:
5191 case glslang::EOpDoubleBitsToUint64:
5192 case glslang::EOpInt64BitsToDouble:
5193 case glslang::EOpUint64BitsToDouble:
5194 case glslang::EOpFloat16BitsToInt16:
5195 case glslang::EOpFloat16BitsToUint16:
5196 case glslang::EOpInt16BitsToFloat16:
5197 case glslang::EOpUint16BitsToFloat16:
5201 case glslang::EOpPackSnorm2x16:
5204 case glslang::EOpUnpackSnorm2x16:
5207 case glslang::EOpPackUnorm2x16:
5210 case glslang::EOpUnpackUnorm2x16:
5213 case glslang::EOpPackHalf2x16:
5216 case glslang::EOpUnpackHalf2x16:
5219 case glslang::EOpPackSnorm4x8:
5222 case glslang::EOpUnpackSnorm4x8:
5225 case glslang::EOpPackUnorm4x8:
5228 case glslang::EOpUnpackUnorm4x8:
5231 case glslang::EOpPackDouble2x32:
5234 case glslang::EOpUnpackDouble2x32:
5238 case glslang::EOpPackInt2x32:
5239 case glslang::EOpUnpackInt2x32:
5240 case glslang::EOpPackUint2x32:
5241 case glslang::EOpUnpackUint2x32:
5242 case glslang::EOpPack16:
5243 case glslang::EOpPack32:
5244 case glslang::EOpPack64:
5245 case glslang::EOpUnpack32:
5246 case glslang::EOpUnpack16:
5247 case glslang::EOpUnpack8:
5248 case glslang::EOpPackInt2x16:
5249 case glslang::EOpUnpackInt2x16:
5250 case glslang::EOpPackUint2x16:
5251 case glslang::EOpUnpackUint2x16:
5252 case glslang::EOpPackInt4x16:
5253 case glslang::EOpUnpackInt4x16:
5254 case glslang::EOpPackUint4x16:
5255 case glslang::EOpUnpackUint4x16:
5256 case glslang::EOpPackFloat2x16:
5257 case glslang::EOpUnpackFloat2x16:
5261 case glslang::EOpDPdx:
5264 case glslang::EOpDPdy:
5267 case glslang::EOpFwidth:
5270 case glslang::EOpDPdxFine:
5273 case glslang::EOpDPdyFine:
5276 case glslang::EOpFwidthFine:
5279 case glslang::EOpDPdxCoarse:
5282 case glslang::EOpDPdyCoarse:
5285 case glslang::EOpFwidthCoarse:
5288 case glslang::EOpInterpolateAtCentroid:
5290 if (typeProxy == glslang::EbtFloat16)
5295 case glslang::EOpAny:
5298 case glslang::EOpAll:
5302 case glslang::EOpAbs:
5308 case glslang::EOpSign:
5315 case glslang::EOpAtomicCounterIncrement:
5316 case glslang::EOpAtomicCounterDecrement:
5317 case glslang::EOpAtomicCounter:
5325 case glslang::EOpBitFieldReverse:
5328 case glslang::EOpBitCount:
5331 case glslang::EOpFindLSB:
5334 case glslang::EOpFindMSB:
5341 case glslang::EOpBallot:
5342 case glslang::EOpReadFirstInvocation:
5343 case glslang::EOpAnyInvocation:
5344 case glslang::EOpAllInvocations:
5345 case glslang::EOpAllInvocationsEqual:
5347 case glslang::EOpMinInvocations:
5348 case glslang::EOpMaxInvocations:
5349 case glslang::EOpAddInvocations:
5350 case glslang::EOpMinInvocationsNonUniform:
5351 case glslang::EOpMaxInvocationsNonUniform:
5352 case glslang::EOpAddInvocationsNonUniform:
5353 case glslang::EOpMinInvocationsInclusiveScan:
5354 case glslang::EOpMaxInvocationsInclusiveScan:
5355 case glslang::EOpAddInvocationsInclusiveScan:
5356 case glslang::EOpMinInvocationsInclusiveScanNonUniform:
5357 case glslang::EOpMaxInvocationsInclusiveScanNonUniform:
5358 case glslang::EOpAddInvocationsInclusiveScanNonUniform:
5359 case glslang::EOpMinInvocationsExclusiveScan:
5360 case glslang::EOpMaxInvocationsExclusiveScan:
5361 case glslang::EOpAddInvocationsExclusiveScan:
5362 case glslang::EOpMinInvocationsExclusiveScanNonUniform:
5363 case glslang::EOpMaxInvocationsExclusiveScanNonUniform:
5364 case glslang::EOpAddInvocationsExclusiveScanNonUniform:
5371 case glslang::EOpSubgroupAll:
5372 case glslang::EOpSubgroupAny:
5373 case glslang::EOpSubgroupAllEqual:
5374 case glslang::EOpSubgroupBroadcastFirst:
5375 case glslang::EOpSubgroupBallot:
5376 case glslang::EOpSubgroupInverseBallot:
5377 case glslang::EOpSubgroupBallotBitCount:
5378 case glslang::EOpSubgroupBallotInclusiveBitCount:
5379 case glslang::EOpSubgroupBallotExclusiveBitCount:
5380 case glslang::EOpSubgroupBallotFindLSB:
5381 case glslang::EOpSubgroupBallotFindMSB:
5382 case glslang::EOpSubgroupAdd:
5383 case glslang::EOpSubgroupMul:
5384 case glslang::EOpSubgroupMin:
5385 case glslang::EOpSubgroupMax:
5386 case glslang::EOpSubgroupAnd:
5387 case glslang::EOpSubgroupOr:
5388 case glslang::EOpSubgroupXor:
5389 case glslang::EOpSubgroupInclusiveAdd:
5390 case glslang::EOpSubgroupInclusiveMul:
5391 case glslang::EOpSubgroupInclusiveMin:
5392 case glslang::EOpSubgroupInclusiveMax:
5393 case glslang::EOpSubgroupInclusiveAnd:
5394 case glslang::EOpSubgroupInclusiveOr:
5395 case glslang::EOpSubgroupInclusiveXor:
5396 case glslang::EOpSubgroupExclusiveAdd:
5397 case glslang::EOpSubgroupExclusiveMul:
5398 case glslang::EOpSubgroupExclusiveMin:
5399 case glslang::EOpSubgroupExclusiveMax:
5400 case glslang::EOpSubgroupExclusiveAnd:
5401 case glslang::EOpSubgroupExclusiveOr:
5402 case glslang::EOpSubgroupExclusiveXor:
5403 case glslang::EOpSubgroupQuadSwapHorizontal:
5404 case glslang::EOpSubgroupQuadSwapVertical:
5405 case glslang::EOpSubgroupQuadSwapDiagonal: {
5411 case glslang::EOpMbcnt:
5416 case glslang::EOpCubeFaceIndex:
5421 case glslang::EOpCubeFaceCoord:
5427 case glslang::EOpSubgroupPartition:
5431 case glslang::EOpConstructReference:
5454 … spv::Id operand, glslang::TBasicType /* typeProxy */)
5490 spv::Id TGlslangToSpvTraverser::createIntWidthConversion(glslang::TOperator op, spv::Id operand, in…
5495 case glslang::EOpConvInt16ToUint8:
5496 case glslang::EOpConvIntToUint8:
5497 case glslang::EOpConvInt64ToUint8:
5498 case glslang::EOpConvUint16ToInt8:
5499 case glslang::EOpConvUintToInt8:
5500 case glslang::EOpConvUint64ToInt8:
5503 case glslang::EOpConvInt8ToUint16:
5504 case glslang::EOpConvIntToUint16:
5505 case glslang::EOpConvInt64ToUint16:
5506 case glslang::EOpConvUint8ToInt16:
5507 case glslang::EOpConvUintToInt16:
5508 case glslang::EOpConvUint64ToInt16:
5511 case glslang::EOpConvInt8ToUint:
5512 case glslang::EOpConvInt16ToUint:
5513 case glslang::EOpConvInt64ToUint:
5514 case glslang::EOpConvUint8ToInt:
5515 case glslang::EOpConvUint16ToInt:
5516 case glslang::EOpConvUint64ToInt:
5519 case glslang::EOpConvInt8ToUint64:
5520 case glslang::EOpConvInt16ToUint64:
5521 case glslang::EOpConvIntToUint64:
5522 case glslang::EOpConvUint8ToInt64:
5523 case glslang::EOpConvUint16ToInt64:
5524 case glslang::EOpConvUintToInt64:
5538 case glslang::EOpConvInt8ToUint16:
5539 case glslang::EOpConvInt8ToUint:
5540 case glslang::EOpConvInt8ToUint64:
5541 case glslang::EOpConvInt16ToUint8:
5542 case glslang::EOpConvInt16ToUint:
5543 case glslang::EOpConvInt16ToUint64:
5544 case glslang::EOpConvIntToUint8:
5545 case glslang::EOpConvIntToUint16:
5546 case glslang::EOpConvIntToUint64:
5547 case glslang::EOpConvInt64ToUint8:
5548 case glslang::EOpConvInt64ToUint16:
5549 case glslang::EOpConvInt64ToUint:
5565 spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecorations& decorations,…
5566 spv::Id operand, glslang::TBasicType typeProxy)
5575 case glslang::EOpConvInt8ToBool:
5576 case glslang::EOpConvUint8ToBool:
5580 case glslang::EOpConvInt16ToBool:
5581 case glslang::EOpConvUint16ToBool:
5585 case glslang::EOpConvIntToBool:
5586 case glslang::EOpConvUintToBool:
5590 case glslang::EOpConvInt64ToBool:
5591 case glslang::EOpConvUint64ToBool:
5596 case glslang::EOpConvFloatToBool:
5601 case glslang::EOpConvDoubleToBool:
5606 case glslang::EOpConvFloat16ToBool:
5611 case glslang::EOpConvBoolToFloat:
5617 case glslang::EOpConvBoolToDouble:
5623 case glslang::EOpConvBoolToFloat16:
5629 case glslang::EOpConvBoolToInt8:
5635 case glslang::EOpConvBoolToUint8:
5641 case glslang::EOpConvBoolToInt16:
5647 case glslang::EOpConvBoolToUint16:
5653 case glslang::EOpConvBoolToInt:
5654 case glslang::EOpConvBoolToInt64:
5655 if (op == glslang::EOpConvBoolToInt64)
5660 if (op == glslang::EOpConvBoolToInt64)
5668 case glslang::EOpConvBoolToUint:
5669 case glslang::EOpConvBoolToUint64:
5670 if (op == glslang::EOpConvBoolToUint64)
5675 if (op == glslang::EOpConvBoolToUint64)
5683 case glslang::EOpConvInt8ToFloat16:
5684 case glslang::EOpConvInt8ToFloat:
5685 case glslang::EOpConvInt8ToDouble:
5686 case glslang::EOpConvInt16ToFloat16:
5687 case glslang::EOpConvInt16ToFloat:
5688 case glslang::EOpConvInt16ToDouble:
5689 case glslang::EOpConvIntToFloat16:
5690 case glslang::EOpConvIntToFloat:
5691 case glslang::EOpConvIntToDouble:
5692 case glslang::EOpConvInt64ToFloat:
5693 case glslang::EOpConvInt64ToDouble:
5694 case glslang::EOpConvInt64ToFloat16:
5698 case glslang::EOpConvUint8ToFloat16:
5699 case glslang::EOpConvUint8ToFloat:
5700 case glslang::EOpConvUint8ToDouble:
5701 case glslang::EOpConvUint16ToFloat16:
5702 case glslang::EOpConvUint16ToFloat:
5703 case glslang::EOpConvUint16ToDouble:
5704 case glslang::EOpConvUintToFloat16:
5705 case glslang::EOpConvUintToFloat:
5706 case glslang::EOpConvUintToDouble:
5707 case glslang::EOpConvUint64ToFloat:
5708 case glslang::EOpConvUint64ToDouble:
5709 case glslang::EOpConvUint64ToFloat16:
5713 case glslang::EOpConvDoubleToFloat:
5714 case glslang::EOpConvFloatToDouble:
5715 case glslang::EOpConvDoubleToFloat16:
5716 case glslang::EOpConvFloat16ToDouble:
5717 case glslang::EOpConvFloatToFloat16:
5718 case glslang::EOpConvFloat16ToFloat:
5724 case glslang::EOpConvFloat16ToInt8:
5725 case glslang::EOpConvFloatToInt8:
5726 case glslang::EOpConvDoubleToInt8:
5727 case glslang::EOpConvFloat16ToInt16:
5728 case glslang::EOpConvFloatToInt16:
5729 case glslang::EOpConvDoubleToInt16:
5730 case glslang::EOpConvFloat16ToInt:
5731 case glslang::EOpConvFloatToInt:
5732 case glslang::EOpConvDoubleToInt:
5733 case glslang::EOpConvFloat16ToInt64:
5734 case glslang::EOpConvFloatToInt64:
5735 case glslang::EOpConvDoubleToInt64:
5739 case glslang::EOpConvUint8ToInt8:
5740 case glslang::EOpConvInt8ToUint8:
5741 case glslang::EOpConvUint16ToInt16:
5742 case glslang::EOpConvInt16ToUint16:
5743 case glslang::EOpConvUintToInt:
5744 case glslang::EOpConvIntToUint:
5745 case glslang::EOpConvUint64ToInt64:
5746 case glslang::EOpConvInt64ToUint64:
5749 if(op == glslang::EOpConvUint8ToInt8 || op == glslang::EOpConvInt8ToUint8) {
5751 } else if (op == glslang::EOpConvUint16ToInt16 || op == glslang::EOpConvInt16ToUint16) {
5753 } else if (op == glslang::EOpConvUint64ToInt64 || op == glslang::EOpConvInt64ToUint64) {
5767 case glslang::EOpConvFloat16ToUint8:
5768 case glslang::EOpConvFloatToUint8:
5769 case glslang::EOpConvDoubleToUint8:
5770 case glslang::EOpConvFloat16ToUint16:
5771 case glslang::EOpConvFloatToUint16:
5772 case glslang::EOpConvDoubleToUint16:
5773 case glslang::EOpConvFloat16ToUint:
5774 case glslang::EOpConvFloatToUint:
5775 case glslang::EOpConvDoubleToUint:
5776 case glslang::EOpConvFloatToUint64:
5777 case glslang::EOpConvDoubleToUint64:
5778 case glslang::EOpConvFloat16ToUint64:
5782 case glslang::EOpConvInt8ToInt16:
5783 case glslang::EOpConvInt8ToInt:
5784 case glslang::EOpConvInt8ToInt64:
5785 case glslang::EOpConvInt16ToInt8:
5786 case glslang::EOpConvInt16ToInt:
5787 case glslang::EOpConvInt16ToInt64:
5788 case glslang::EOpConvIntToInt8:
5789 case glslang::EOpConvIntToInt16:
5790 case glslang::EOpConvIntToInt64:
5791 case glslang::EOpConvInt64ToInt8:
5792 case glslang::EOpConvInt64ToInt16:
5793 case glslang::EOpConvInt64ToInt:
5797 case glslang::EOpConvUint8ToUint16:
5798 case glslang::EOpConvUint8ToUint:
5799 case glslang::EOpConvUint8ToUint64:
5800 case glslang::EOpConvUint16ToUint8:
5801 case glslang::EOpConvUint16ToUint:
5802 case glslang::EOpConvUint16ToUint64:
5803 case glslang::EOpConvUintToUint8:
5804 case glslang::EOpConvUintToUint16:
5805 case glslang::EOpConvUintToUint64:
5806 case glslang::EOpConvUint64ToUint8:
5807 case glslang::EOpConvUint64ToUint16:
5808 case glslang::EOpConvUint64ToUint:
5812 case glslang::EOpConvInt8ToUint16:
5813 case glslang::EOpConvInt8ToUint:
5814 case glslang::EOpConvInt8ToUint64:
5815 case glslang::EOpConvInt16ToUint8:
5816 case glslang::EOpConvInt16ToUint:
5817 case glslang::EOpConvInt16ToUint64:
5818 case glslang::EOpConvIntToUint8:
5819 case glslang::EOpConvIntToUint16:
5820 case glslang::EOpConvIntToUint64:
5821 case glslang::EOpConvInt64ToUint8:
5822 case glslang::EOpConvInt64ToUint16:
5823 case glslang::EOpConvInt64ToUint:
5824 case glslang::EOpConvUint8ToInt16:
5825 case glslang::EOpConvUint8ToInt:
5826 case glslang::EOpConvUint8ToInt64:
5827 case glslang::EOpConvUint16ToInt8:
5828 case glslang::EOpConvUint16ToInt:
5829 case glslang::EOpConvUint16ToInt64:
5830 case glslang::EOpConvUintToInt8:
5831 case glslang::EOpConvUintToInt16:
5832 case glslang::EOpConvUintToInt64:
5833 case glslang::EOpConvUint64ToInt8:
5834 case glslang::EOpConvUint64ToInt16:
5835 case glslang::EOpConvUint64ToInt:
5842 case glslang::EOpConvInt16ToUint8:
5843 case glslang::EOpConvIntToUint8:
5844 case glslang::EOpConvInt64ToUint8:
5845 case glslang::EOpConvUint16ToInt8:
5846 case glslang::EOpConvUintToInt8:
5847 case glslang::EOpConvUint64ToInt8:
5850 case glslang::EOpConvInt8ToUint16:
5851 case glslang::EOpConvIntToUint16:
5852 case glslang::EOpConvInt64ToUint16:
5853 case glslang::EOpConvUint8ToInt16:
5854 case glslang::EOpConvUintToInt16:
5855 case glslang::EOpConvUint64ToInt16:
5858 case glslang::EOpConvInt8ToUint:
5859 case glslang::EOpConvInt16ToUint:
5860 case glslang::EOpConvInt64ToUint:
5861 case glslang::EOpConvUint8ToInt:
5862 case glslang::EOpConvUint16ToInt:
5863 case glslang::EOpConvUint64ToInt:
5866 case glslang::EOpConvInt8ToUint64:
5867 case glslang::EOpConvInt16ToUint64:
5868 case glslang::EOpConvIntToUint64:
5869 case glslang::EOpConvUint8ToInt64:
5870 case glslang::EOpConvUint16ToInt64:
5871 case glslang::EOpConvUintToInt64:
5886 case glslang::EOpConvUint64ToPtr:
5889 case glslang::EOpConvPtrToUint64:
5924 // For glslang ops that map to SPV atomic opCodes
5925 …createAtomicOperation(glslang::TOperator op, spv::Decoration /*precision*/, spv::Id typeId, std::v…
5930 case glslang::EOpAtomicAdd:
5931 case glslang::EOpImageAtomicAdd:
5932 case glslang::EOpAtomicCounterAdd:
5935 case glslang::EOpAtomicCounterSubtract:
5938 case glslang::EOpAtomicMin:
5939 case glslang::EOpImageAtomicMin:
5940 case glslang::EOpAtomicCounterMin:
5941 …opCode = (typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64) ? spv::OpAtomicUMin : …
5943 case glslang::EOpAtomicMax:
5944 case glslang::EOpImageAtomicMax:
5945 case glslang::EOpAtomicCounterMax:
5946 …opCode = (typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64) ? spv::OpAtomicUMax : …
5948 case glslang::EOpAtomicAnd:
5949 case glslang::EOpImageAtomicAnd:
5950 case glslang::EOpAtomicCounterAnd:
5953 case glslang::EOpAtomicOr:
5954 case glslang::EOpImageAtomicOr:
5955 case glslang::EOpAtomicCounterOr:
5958 case glslang::EOpAtomicXor:
5959 case glslang::EOpImageAtomicXor:
5960 case glslang::EOpAtomicCounterXor:
5963 case glslang::EOpAtomicExchange:
5964 case glslang::EOpImageAtomicExchange:
5965 case glslang::EOpAtomicCounterExchange:
5968 case glslang::EOpAtomicCompSwap:
5969 case glslang::EOpImageAtomicCompSwap:
5970 case glslang::EOpAtomicCounterCompSwap:
5973 case glslang::EOpAtomicCounterIncrement:
5976 case glslang::EOpAtomicCounterDecrement:
5979 case glslang::EOpAtomicCounter:
5980 case glslang::EOpImageAtomicLoad:
5981 case glslang::EOpAtomicLoad:
5984 case glslang::EOpAtomicStore:
5985 case glslang::EOpImageAtomicStore:
5993 if (typeProxy == glslang::EbtInt64 || typeProxy == glslang::EbtUint64)
5997 // - mapping from glslang -> SPV
5998 // - there are extra SPV operands that are optional in glslang
6069 if (op == glslang::EOpAtomicCounterDecrement)
6077 …raverser::createInvocationsOperation(glslang::TOperator op, spv::Id typeId, std::vector<spv::Id>& …
6088 if (op == glslang::EOpBallot || op == glslang::EOpReadFirstInvocation ||
6089 op == glslang::EOpReadInvocation) {
6092 } else if (op == glslang::EOpAnyInvocation ||
6093 op == glslang::EOpAllInvocations ||
6094 op == glslang::EOpAllInvocationsEqual) {
6100 if (op == glslang::EOpMinInvocationsNonUniform ||
6101 op == glslang::EOpMaxInvocationsNonUniform ||
6102 op == glslang::EOpAddInvocationsNonUniform ||
6103 op == glslang::EOpMinInvocationsInclusiveScanNonUniform ||
6104 op == glslang::EOpMaxInvocationsInclusiveScanNonUniform ||
6105 op == glslang::EOpAddInvocationsInclusiveScanNonUniform ||
6106 op == glslang::EOpMinInvocationsExclusiveScanNonUniform ||
6107 op == glslang::EOpMaxInvocationsExclusiveScanNonUniform ||
6108 op == glslang::EOpAddInvocationsExclusiveScanNonUniform)
6114 case glslang::EOpMinInvocations:
6115 case glslang::EOpMaxInvocations:
6116 case glslang::EOpAddInvocations:
6117 case glslang::EOpMinInvocationsNonUniform:
6118 case glslang::EOpMaxInvocationsNonUniform:
6119 case glslang::EOpAddInvocationsNonUniform:
6122 case glslang::EOpMinInvocationsInclusiveScan:
6123 case glslang::EOpMaxInvocationsInclusiveScan:
6124 case glslang::EOpAddInvocationsInclusiveScan:
6125 case glslang::EOpMinInvocationsInclusiveScanNonUniform:
6126 case glslang::EOpMaxInvocationsInclusiveScanNonUniform:
6127 case glslang::EOpAddInvocationsInclusiveScanNonUniform:
6130 case glslang::EOpMinInvocationsExclusiveScan:
6131 case glslang::EOpMaxInvocationsExclusiveScan:
6132 case glslang::EOpAddInvocationsExclusiveScan:
6133 case glslang::EOpMinInvocationsExclusiveScanNonUniform:
6134 case glslang::EOpMaxInvocationsExclusiveScanNonUniform:
6135 case glslang::EOpAddInvocationsExclusiveScanNonUniform:
6156 case glslang::EOpAnyInvocation:
6159 case glslang::EOpAllInvocations:
6162 case glslang::EOpAllInvocationsEqual:
6165 case glslang::EOpReadInvocation:
6170 case glslang::EOpReadFirstInvocation:
6173 case glslang::EOpBallot:
6195 case glslang::EOpMinInvocations:
6196 case glslang::EOpMaxInvocations:
6197 case glslang::EOpAddInvocations:
6198 case glslang::EOpMinInvocationsInclusiveScan:
6199 case glslang::EOpMaxInvocationsInclusiveScan:
6200 case glslang::EOpAddInvocationsInclusiveScan:
6201 case glslang::EOpMinInvocationsExclusiveScan:
6202 case glslang::EOpMaxInvocationsExclusiveScan:
6203 case glslang::EOpAddInvocationsExclusiveScan:
6204 if (op == glslang::EOpMinInvocations ||
6205 op == glslang::EOpMinInvocationsInclusiveScan ||
6206 op == glslang::EOpMinInvocationsExclusiveScan) {
6215 } else if (op == glslang::EOpMaxInvocations ||
6216 op == glslang::EOpMaxInvocationsInclusiveScan ||
6217 op == glslang::EOpMaxInvocationsExclusiveScan) {
6237 case glslang::EOpMinInvocationsNonUniform:
6238 case glslang::EOpMaxInvocationsNonUniform:
6239 case glslang::EOpAddInvocationsNonUniform:
6240 case glslang::EOpMinInvocationsInclusiveScanNonUniform:
6241 case glslang::EOpMaxInvocationsInclusiveScanNonUniform:
6242 case glslang::EOpAddInvocationsInclusiveScanNonUniform:
6243 case glslang::EOpMinInvocationsExclusiveScanNonUniform:
6244 case glslang::EOpMaxInvocationsExclusiveScanNonUniform:
6245 case glslang::EOpAddInvocationsExclusiveScanNonUniform:
6246 if (op == glslang::EOpMinInvocationsNonUniform ||
6247 op == glslang::EOpMinInvocationsInclusiveScanNonUniform ||
6248 op == glslang::EOpMinInvocationsExclusiveScanNonUniform) {
6258 else if (op == glslang::EOpMaxInvocationsNonUniform ||
6259 op == glslang::EOpMaxInvocationsInclusiveScanNonUniform ||
6260 op == glslang::EOpMaxInvocationsExclusiveScanNonUniform) {
6354 spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, spv::Id typeId,
6355 std::vector<spv::Id>& operands, glslang::TBasicType typeProxy)
6359 case glslang::EOpSubgroupElect:
6362 case glslang::EOpSubgroupAll:
6363 case glslang::EOpSubgroupAny:
6364 case glslang::EOpSubgroupAllEqual:
6368 case glslang::EOpSubgroupBroadcast:
6369 case glslang::EOpSubgroupBroadcastFirst:
6370 case glslang::EOpSubgroupBallot:
6371 case glslang::EOpSubgroupInverseBallot:
6372 case glslang::EOpSubgroupBallotBitExtract:
6373 case glslang::EOpSubgroupBallotBitCount:
6374 case glslang::EOpSubgroupBallotInclusiveBitCount:
6375 case glslang::EOpSubgroupBallotExclusiveBitCount:
6376 case glslang::EOpSubgroupBallotFindLSB:
6377 case glslang::EOpSubgroupBallotFindMSB:
6381 case glslang::EOpSubgroupShuffle:
6382 case glslang::EOpSubgroupShuffleXor:
6386 case glslang::EOpSubgroupShuffleUp:
6387 case glslang::EOpSubgroupShuffleDown:
6391 case glslang::EOpSubgroupAdd:
6392 case glslang::EOpSubgroupMul:
6393 case glslang::EOpSubgroupMin:
6394 case glslang::EOpSubgroupMax:
6395 case glslang::EOpSubgroupAnd:
6396 case glslang::EOpSubgroupOr:
6397 case glslang::EOpSubgroupXor:
6398 case glslang::EOpSubgroupInclusiveAdd:
6399 case glslang::EOpSubgroupInclusiveMul:
6400 case glslang::EOpSubgroupInclusiveMin:
6401 case glslang::EOpSubgroupInclusiveMax:
6402 case glslang::EOpSubgroupInclusiveAnd:
6403 case glslang::EOpSubgroupInclusiveOr:
6404 case glslang::EOpSubgroupInclusiveXor:
6405 case glslang::EOpSubgroupExclusiveAdd:
6406 case glslang::EOpSubgroupExclusiveMul:
6407 case glslang::EOpSubgroupExclusiveMin:
6408 case glslang::EOpSubgroupExclusiveMax:
6409 case glslang::EOpSubgroupExclusiveAnd:
6410 case glslang::EOpSubgroupExclusiveOr:
6411 case glslang::EOpSubgroupExclusiveXor:
6415 case glslang::EOpSubgroupClusteredAdd:
6416 case glslang::EOpSubgroupClusteredMul:
6417 case glslang::EOpSubgroupClusteredMin:
6418 case glslang::EOpSubgroupClusteredMax:
6419 case glslang::EOpSubgroupClusteredAnd:
6420 case glslang::EOpSubgroupClusteredOr:
6421 case glslang::EOpSubgroupClusteredXor:
6425 case glslang::EOpSubgroupQuadBroadcast:
6426 case glslang::EOpSubgroupQuadSwapHorizontal:
6427 case glslang::EOpSubgroupQuadSwapVertical:
6428 case glslang::EOpSubgroupQuadSwapDiagonal:
6433 case glslang::EOpSubgroupPartitionedAdd:
6434 case glslang::EOpSubgroupPartitionedMul:
6435 case glslang::EOpSubgroupPartitionedMin:
6436 case glslang::EOpSubgroupPartitionedMax:
6437 case glslang::EOpSubgroupPartitionedAnd:
6438 case glslang::EOpSubgroupPartitionedOr:
6439 case glslang::EOpSubgroupPartitionedXor:
6440 case glslang::EOpSubgroupPartitionedInclusiveAdd:
6441 case glslang::EOpSubgroupPartitionedInclusiveMul:
6442 case glslang::EOpSubgroupPartitionedInclusiveMin:
6443 case glslang::EOpSubgroupPartitionedInclusiveMax:
6444 case glslang::EOpSubgroupPartitionedInclusiveAnd:
6445 case glslang::EOpSubgroupPartitionedInclusiveOr:
6446 case glslang::EOpSubgroupPartitionedInclusiveXor:
6447 case glslang::EOpSubgroupPartitionedExclusiveAdd:
6448 case glslang::EOpSubgroupPartitionedExclusiveMul:
6449 case glslang::EOpSubgroupPartitionedExclusiveMin:
6450 case glslang::EOpSubgroupPartitionedExclusiveMax:
6451 case glslang::EOpSubgroupPartitionedExclusiveAnd:
6452 case glslang::EOpSubgroupPartitionedExclusiveOr:
6453 case glslang::EOpSubgroupPartitionedExclusiveXor:
6461 const bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
6462 const bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
6463 const bool isBool = typeProxy == glslang::EbtBool;
6469 case glslang::EOpSubgroupElect: opCode = spv::OpGroupNonUniformElect; break;
6470 case glslang::EOpSubgroupAll: opCode = spv::OpGroupNonUniformAll; break;
6471 case glslang::EOpSubgroupAny: opCode = spv::OpGroupNonUniformAny; break;
6472 … case glslang::EOpSubgroupAllEqual: opCode = spv::OpGroupNonUniformAllEqual; break;
6473 … case glslang::EOpSubgroupBroadcast: opCode = spv::OpGroupNonUniformBroadcast; break;
6474 …case glslang::EOpSubgroupBroadcastFirst: opCode = spv::OpGroupNonUniformBroadcastFirst; b…
6475 case glslang::EOpSubgroupBallot: opCode = spv::OpGroupNonUniformBallot; break;
6476 …case glslang::EOpSubgroupInverseBallot: opCode = spv::OpGroupNonUniformInverseBallot; br…
6477 …case glslang::EOpSubgroupBallotBitExtract: opCode = spv::OpGroupNonUniformBallotBitExtract;…
6478 case glslang::EOpSubgroupBallotBitCount:
6479 case glslang::EOpSubgroupBallotInclusiveBitCount:
6480 …case glslang::EOpSubgroupBallotExclusiveBitCount: opCode = spv::OpGroupNonUniformBallotBitCount; b…
6481 …case glslang::EOpSubgroupBallotFindLSB: opCode = spv::OpGroupNonUniformBallotFindLSB; br…
6482 …case glslang::EOpSubgroupBallotFindMSB: opCode = spv::OpGroupNonUniformBallotFindMSB; br…
6483 case glslang::EOpSubgroupShuffle: opCode = spv::OpGroupNonUniformShuffle; break;
6484 …case glslang::EOpSubgroupShuffleXor: opCode = spv::OpGroupNonUniformShuffleXor; break;
6485 … case glslang::EOpSubgroupShuffleUp: opCode = spv::OpGroupNonUniformShuffleUp; break;
6486 …case glslang::EOpSubgroupShuffleDown: opCode = spv::OpGroupNonUniformShuffleDown; brea…
6487 case glslang::EOpSubgroupAdd:
6488 case glslang::EOpSubgroupInclusiveAdd:
6489 case glslang::EOpSubgroupExclusiveAdd:
6490 case glslang::EOpSubgroupClusteredAdd:
6492 case glslang::EOpSubgroupPartitionedAdd:
6493 case glslang::EOpSubgroupPartitionedInclusiveAdd:
6494 case glslang::EOpSubgroupPartitionedExclusiveAdd:
6502 case glslang::EOpSubgroupMul:
6503 case glslang::EOpSubgroupInclusiveMul:
6504 case glslang::EOpSubgroupExclusiveMul:
6505 case glslang::EOpSubgroupClusteredMul:
6507 case glslang::EOpSubgroupPartitionedMul:
6508 case glslang::EOpSubgroupPartitionedInclusiveMul:
6509 case glslang::EOpSubgroupPartitionedExclusiveMul:
6517 case glslang::EOpSubgroupMin:
6518 case glslang::EOpSubgroupInclusiveMin:
6519 case glslang::EOpSubgroupExclusiveMin:
6520 case glslang::EOpSubgroupClusteredMin:
6522 case glslang::EOpSubgroupPartitionedMin:
6523 case glslang::EOpSubgroupPartitionedInclusiveMin:
6524 case glslang::EOpSubgroupPartitionedExclusiveMin:
6534 case glslang::EOpSubgroupMax:
6535 case glslang::EOpSubgroupInclusiveMax:
6536 case glslang::EOpSubgroupExclusiveMax:
6537 case glslang::EOpSubgroupClusteredMax:
6539 case glslang::EOpSubgroupPartitionedMax:
6540 case glslang::EOpSubgroupPartitionedInclusiveMax:
6541 case glslang::EOpSubgroupPartitionedExclusiveMax:
6551 case glslang::EOpSubgroupAnd:
6552 case glslang::EOpSubgroupInclusiveAnd:
6553 case glslang::EOpSubgroupExclusiveAnd:
6554 case glslang::EOpSubgroupClusteredAnd:
6556 case glslang::EOpSubgroupPartitionedAnd:
6557 case glslang::EOpSubgroupPartitionedInclusiveAnd:
6558 case glslang::EOpSubgroupPartitionedExclusiveAnd:
6566 case glslang::EOpSubgroupOr:
6567 case glslang::EOpSubgroupInclusiveOr:
6568 case glslang::EOpSubgroupExclusiveOr:
6569 case glslang::EOpSubgroupClusteredOr:
6571 case glslang::EOpSubgroupPartitionedOr:
6572 case glslang::EOpSubgroupPartitionedInclusiveOr:
6573 case glslang::EOpSubgroupPartitionedExclusiveOr:
6581 case glslang::EOpSubgroupXor:
6582 case glslang::EOpSubgroupInclusiveXor:
6583 case glslang::EOpSubgroupExclusiveXor:
6584 case glslang::EOpSubgroupClusteredXor:
6586 case glslang::EOpSubgroupPartitionedXor:
6587 case glslang::EOpSubgroupPartitionedInclusiveXor:
6588 case glslang::EOpSubgroupPartitionedExclusiveXor:
6596 … case glslang::EOpSubgroupQuadBroadcast: opCode = spv::OpGroupNonUniformQuadBroadcast; break;
6597 case glslang::EOpSubgroupQuadSwapHorizontal:
6598 case glslang::EOpSubgroupQuadSwapVertical:
6599 case glslang::EOpSubgroupQuadSwapDiagonal: opCode = spv::OpGroupNonUniformQuadSwap; break;
6608 case glslang::EOpSubgroupBallotBitCount:
6609 case glslang::EOpSubgroupAdd:
6610 case glslang::EOpSubgroupMul:
6611 case glslang::EOpSubgroupMin:
6612 case glslang::EOpSubgroupMax:
6613 case glslang::EOpSubgroupAnd:
6614 case glslang::EOpSubgroupOr:
6615 case glslang::EOpSubgroupXor:
6618 case glslang::EOpSubgroupBallotInclusiveBitCount:
6619 case glslang::EOpSubgroupInclusiveAdd:
6620 case glslang::EOpSubgroupInclusiveMul:
6621 case glslang::EOpSubgroupInclusiveMin:
6622 case glslang::EOpSubgroupInclusiveMax:
6623 case glslang::EOpSubgroupInclusiveAnd:
6624 case glslang::EOpSubgroupInclusiveOr:
6625 case glslang::EOpSubgroupInclusiveXor:
6628 case glslang::EOpSubgroupBallotExclusiveBitCount:
6629 case glslang::EOpSubgroupExclusiveAdd:
6630 case glslang::EOpSubgroupExclusiveMul:
6631 case glslang::EOpSubgroupExclusiveMin:
6632 case glslang::EOpSubgroupExclusiveMax:
6633 case glslang::EOpSubgroupExclusiveAnd:
6634 case glslang::EOpSubgroupExclusiveOr:
6635 case glslang::EOpSubgroupExclusiveXor:
6638 case glslang::EOpSubgroupClusteredAdd:
6639 case glslang::EOpSubgroupClusteredMul:
6640 case glslang::EOpSubgroupClusteredMin:
6641 case glslang::EOpSubgroupClusteredMax:
6642 case glslang::EOpSubgroupClusteredAnd:
6643 case glslang::EOpSubgroupClusteredOr:
6644 case glslang::EOpSubgroupClusteredXor:
6648 case glslang::EOpSubgroupPartitionedAdd:
6649 case glslang::EOpSubgroupPartitionedMul:
6650 case glslang::EOpSubgroupPartitionedMin:
6651 case glslang::EOpSubgroupPartitionedMax:
6652 case glslang::EOpSubgroupPartitionedAnd:
6653 case glslang::EOpSubgroupPartitionedOr:
6654 case glslang::EOpSubgroupPartitionedXor:
6657 case glslang::EOpSubgroupPartitionedInclusiveAdd:
6658 case glslang::EOpSubgroupPartitionedInclusiveMul:
6659 case glslang::EOpSubgroupPartitionedInclusiveMin:
6660 case glslang::EOpSubgroupPartitionedInclusiveMax:
6661 case glslang::EOpSubgroupPartitionedInclusiveAnd:
6662 case glslang::EOpSubgroupPartitionedInclusiveOr:
6663 case glslang::EOpSubgroupPartitionedInclusiveXor:
6666 case glslang::EOpSubgroupPartitionedExclusiveAdd:
6667 case glslang::EOpSubgroupPartitionedExclusiveMul:
6668 case glslang::EOpSubgroupPartitionedExclusiveMin:
6669 case glslang::EOpSubgroupPartitionedExclusiveMax:
6670 case glslang::EOpSubgroupPartitionedExclusiveAnd:
6671 case glslang::EOpSubgroupPartitionedExclusiveOr:
6672 case glslang::EOpSubgroupPartitionedExclusiveXor:
6701 case glslang::EOpSubgroupQuadSwapHorizontal: directionId = builder.makeUintConstant(0); break;
6702 case glslang::EOpSubgroupQuadSwapVertical: directionId = builder.makeUintConstant(1); break;
6703 case glslang::EOpSubgroupQuadSwapDiagonal: directionId = builder.makeUintConstant(2); break;
6713 …er::createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vec…
6731 case glslang::EOpMin:
6740 case glslang::EOpModf:
6743 case glslang::EOpMax:
6752 case glslang::EOpPow:
6755 case glslang::EOpDot:
6758 case glslang::EOpAtan:
6762 case glslang::EOpClamp:
6772 case glslang::EOpMix:
6782 case glslang::EOpStep:
6786 case glslang::EOpSmoothStep:
6792 case glslang::EOpDistance:
6795 case glslang::EOpCross:
6798 case glslang::EOpFaceForward:
6801 case glslang::EOpReflect:
6804 case glslang::EOpRefract:
6807 case glslang::EOpInterpolateAtSample:
6809 if (typeProxy == glslang::EbtFloat16)
6814 case glslang::EOpInterpolateAtOffset:
6816 if (typeProxy == glslang::EbtFloat16)
6821 case glslang::EOpAddCarry:
6826 case glslang::EOpSubBorrow:
6831 case glslang::EOpUMulExtended:
6836 case glslang::EOpIMulExtended:
6841 case glslang::EOpBitfieldExtract:
6847 case glslang::EOpBitfieldInsert:
6851 case glslang::EOpFma:
6854 case glslang::EOpFrexp:
6873 case glslang::EOpLdexp:
6877 case glslang::EOpReadInvocation:
6880 case glslang::EOpSubgroupBroadcast:
6881 case glslang::EOpSubgroupBallotBitExtract:
6882 case glslang::EOpSubgroupShuffle:
6883 case glslang::EOpSubgroupShuffleXor:
6884 case glslang::EOpSubgroupShuffleUp:
6885 case glslang::EOpSubgroupShuffleDown:
6886 case glslang::EOpSubgroupClusteredAdd:
6887 case glslang::EOpSubgroupClusteredMul:
6888 case glslang::EOpSubgroupClusteredMin:
6889 case glslang::EOpSubgroupClusteredMax:
6890 case glslang::EOpSubgroupClusteredAnd:
6891 case glslang::EOpSubgroupClusteredOr:
6892 case glslang::EOpSubgroupClusteredXor:
6893 case glslang::EOpSubgroupQuadBroadcast:
6895 case glslang::EOpSubgroupPartitionedAdd:
6896 case glslang::EOpSubgroupPartitionedMul:
6897 case glslang::EOpSubgroupPartitionedMin:
6898 case glslang::EOpSubgroupPartitionedMax:
6899 case glslang::EOpSubgroupPartitionedAnd:
6900 case glslang::EOpSubgroupPartitionedOr:
6901 case glslang::EOpSubgroupPartitionedXor:
6902 case glslang::EOpSubgroupPartitionedInclusiveAdd:
6903 case glslang::EOpSubgroupPartitionedInclusiveMul:
6904 case glslang::EOpSubgroupPartitionedInclusiveMin:
6905 case glslang::EOpSubgroupPartitionedInclusiveMax:
6906 case glslang::EOpSubgroupPartitionedInclusiveAnd:
6907 case glslang::EOpSubgroupPartitionedInclusiveOr:
6908 case glslang::EOpSubgroupPartitionedInclusiveXor:
6909 case glslang::EOpSubgroupPartitionedExclusiveAdd:
6910 case glslang::EOpSubgroupPartitionedExclusiveMul:
6911 case glslang::EOpSubgroupPartitionedExclusiveMin:
6912 case glslang::EOpSubgroupPartitionedExclusiveMax:
6913 case glslang::EOpSubgroupPartitionedExclusiveAnd:
6914 case glslang::EOpSubgroupPartitionedExclusiveOr:
6915 case glslang::EOpSubgroupPartitionedExclusiveXor:
6920 case glslang::EOpSwizzleInvocations:
6924 case glslang::EOpSwizzleInvocationsMasked:
6928 case glslang::EOpWriteInvocation:
6933 case glslang::EOpMin3:
6944 case glslang::EOpMax3:
6955 case glslang::EOpMid3:
6967 case glslang::EOpInterpolateAtVertex:
6968 if (typeProxy == glslang::EbtFloat16)
6974 case glslang::EOpBarrier:
6992 case glslang::EOpMemoryBarrier:
7011 case glslang::EOpReportIntersectionNV:
7017 case glslang::EOpTraceNV:
7023 case glslang::EOpExecuteCallableNV:
7029 case glslang::EOpWritePackedPrimitiveIndices4x8NV:
7078 case glslang::EOpAddCarry:
7079 case glslang::EOpSubBorrow:
7083 case glslang::EOpUMulExtended:
7084 case glslang::EOpIMulExtended:
7088 case glslang::EOpFrexp:
7110 spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv::Decoration precisi…
7116 case glslang::EOpEmitVertex:
7119 case glslang::EOpEndPrimitive:
7122 case glslang::EOpBarrier:
7138 case glslang::EOpMemoryBarrier:
7142 case glslang::EOpMemoryBarrierAtomicCounter:
7146 case glslang::EOpMemoryBarrierBuffer:
7150 case glslang::EOpMemoryBarrierImage:
7154 case glslang::EOpMemoryBarrierShared:
7158 case glslang::EOpGroupMemoryBarrier:
7162 case glslang::EOpAllMemoryBarrierWithGroupSync:
7167 case glslang::EOpDeviceMemoryBarrier:
7172 case glslang::EOpDeviceMemoryBarrierWithGroupSync:
7177 case glslang::EOpWorkgroupMemoryBarrier:
7181 case glslang::EOpWorkgroupMemoryBarrierWithGroupSync:
7186 case glslang::EOpSubgroupBarrier:
7190 case glslang::EOpSubgroupMemoryBarrier:
7194 case glslang::EOpSubgroupMemoryBarrierBuffer:
7198 case glslang::EOpSubgroupMemoryBarrierImage:
7202 case glslang::EOpSubgroupMemoryBarrierShared:
7206 case glslang::EOpSubgroupElect: {
7208 return createSubgroupOperation(op, typeId, operands, glslang::EbtVoid);
7211 case glslang::EOpTime:
7219 case glslang::EOpIgnoreIntersectionNV:
7222 case glslang::EOpTerminateRayNV:
7232 spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol)
7245 if (symbol->getBasicType() != glslang::EbtBlock) {
7289 if (stride != glslang::TQualifier::layoutXfbStrideEnd)
7357 if (symbol->getBasicType() == glslang::EbtReference) {
7366 void TGlslangToSpvTraverser::addMeshNVDecoration(spv::Id id, int member, const glslang::TQualifier&…
7410 spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& node)
7427 if (node.getType().getQualifier().builtIn == glslang::EbvWorkGroupSize) {
7430 …bool specConst = (glslangIntermediate->getLocalSizeSpecId(dim) != glslang::TQualifier::layoutNotSe…
7467 // Use 'consts' as the flattened glslang source of scalar constants to recursively
7473 …vTraverser::createSpvConstantFromConstUnionArray(const glslang::TType& glslangType, const glslang:…
7482 glslang::TType elementType(glslangType, 0);
7486 glslang::TType vectorType(glslangType, 0);
7490 glslang::TVector<glslang::TTypeLoc>::const_iterator iter;
7497 case glslang::EbtInt8:
7500 case glslang::EbtUint8:
7503 case glslang::EbtInt16:
7506 case glslang::EbtUint16:
7509 case glslang::EbtInt:
7512 case glslang::EbtUint:
7515 case glslang::EbtInt64:
7518 case glslang::EbtUint64:
7521 case glslang::EbtFloat:
7524 case glslang::EbtDouble:
7527 case glslang::EbtFloat16:
7530 case glslang::EbtBool:
7544 case glslang::EbtInt8:
7547 case glslang::EbtUint8:
7550 case glslang::EbtInt16:
7553 case glslang::EbtUint16:
7556 case glslang::EbtInt:
7559 case glslang::EbtUint:
7562 case glslang::EbtInt64:
7565 case glslang::EbtUint64:
7568 case glslang::EbtFloat:
7571 case glslang::EbtDouble:
7574 case glslang::EbtFloat16:
7577 case glslang::EbtBool:
7593 bool TGlslangToSpvTraverser::isTrivialLeaf(const glslang::TIntermTyped* node)
7609 case glslang::EvqTemporary:
7610 case glslang::EvqGlobal:
7611 case glslang::EvqIn:
7612 case glslang::EvqInOut:
7613 case glslang::EvqConst:
7614 case glslang::EvqConstReadOnly:
7615 case glslang::EvqUniform:
7626 bool TGlslangToSpvTraverser::isTrivial(const glslang::TIntermTyped* node)
7632 …if (! node->getType().isScalarOrVec1() || glslangIntermediate->getSource() == glslang::EShSourceHl…
7642 const glslang::TIntermBinary* binaryNode = node->getAsBinaryNode();
7643 const glslang::TIntermUnary* unaryNode = node->getAsUnaryNode();
7656 case glslang::EOpLogicalNot:
7657 case glslang::EOpConvIntToBool:
7658 case glslang::EOpConvUintToBool:
7659 case glslang::EOpConvFloatToBool:
7660 case glslang::EOpConvDoubleToBool:
7661 case glslang::EOpEqual:
7662 case glslang::EOpNotEqual:
7663 case glslang::EOpLessThan:
7664 case glslang::EOpGreaterThan:
7665 case glslang::EOpLessThanEqual:
7666 case glslang::EOpGreaterThanEqual:
7667 case glslang::EOpIndexDirect:
7668 case glslang::EOpIndexDirectStruct:
7669 case glslang::EOpLogicalXor:
7670 case glslang::EOpAny:
7671 case glslang::EOpAll:
7680 …:Id TGlslangToSpvTraverser::createShortCircuit(glslang::TOperator op, glslang::TIntermTyped& left,…
7701 if (op == glslang::EOpLogicalOr)
7741 namespace glslang { namespace
7813 // Set up the glslang traversal
7857 }; // end namespace glslang