mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-09 12:48:32 +09:00
[Misc] (3rdparty): Update glslang to 15.4.0
This commit is contained in:
@@ -49,6 +49,9 @@ enum TBasicType {
|
||||
EbtFloat,
|
||||
EbtDouble,
|
||||
EbtFloat16,
|
||||
EbtBFloat16,
|
||||
EbtFloatE5M2,
|
||||
EbtFloatE4M3,
|
||||
EbtInt8,
|
||||
EbtUint8,
|
||||
EbtInt16,
|
||||
@@ -70,6 +73,8 @@ enum TBasicType {
|
||||
EbtFunction,
|
||||
EbtTensorLayoutNV,
|
||||
EbtTensorViewNV,
|
||||
EbtCoopvecNV,
|
||||
EbtTensorARM,
|
||||
// SPIR-V type defined by spirv_type
|
||||
EbtSpirvType,
|
||||
|
||||
@@ -278,6 +283,7 @@ enum TBuiltInVariable {
|
||||
EbvWorldToObject3x4,
|
||||
EbvIncomingRayFlags,
|
||||
EbvCurrentRayTimeNV,
|
||||
EbvClusterIDNV,
|
||||
// barycentrics
|
||||
EbvBaryCoordNV,
|
||||
EbvBaryCoordNoPerspNV,
|
||||
@@ -298,6 +304,13 @@ enum TBuiltInVariable {
|
||||
EbvHitKindFrontFacingMicroTriangleNV,
|
||||
EbvHitKindBackFacingMicroTriangleNV,
|
||||
|
||||
EbvHitIsSphereNV,
|
||||
EbvHitIsLSSNV,
|
||||
EbvHitSpherePositionNV,
|
||||
EbvHitSphereRadiusNV,
|
||||
EbvHitLSSPositionsNV,
|
||||
EbvHitLSSRadiiNV,
|
||||
|
||||
//GL_EXT_mesh_shader
|
||||
EbvPrimitivePointIndicesEXT,
|
||||
EbvPrimitiveLineIndicesEXT,
|
||||
@@ -334,6 +347,11 @@ enum TBuiltInVariable {
|
||||
|
||||
EbvPositionFetch,
|
||||
|
||||
// SPV_QCOM_tile_shading
|
||||
EbvTileOffsetQCOM,
|
||||
EbvTileDimensionQCOM,
|
||||
EbvTileApronSizeQCOM,
|
||||
|
||||
EbvLast
|
||||
};
|
||||
|
||||
@@ -502,6 +520,7 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
||||
case EbvObjectToWorld: return "ObjectToWorldNV";
|
||||
case EbvWorldToObject: return "WorldToObjectNV";
|
||||
case EbvCurrentRayTimeNV: return "CurrentRayTimeNV";
|
||||
case EbvClusterIDNV: return "ClusterIDNV";
|
||||
|
||||
case EbvBaryCoordEXT:
|
||||
case EbvBaryCoordNV: return "BaryCoordKHR";
|
||||
@@ -533,6 +552,13 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
||||
case EbvHitKindFrontFacingMicroTriangleNV: return "HitKindFrontFacingMicroTriangleNV";
|
||||
case EbvHitKindBackFacingMicroTriangleNV: return "HitKindBackFacingMicroTriangleNV";
|
||||
|
||||
case EbvHitIsSphereNV: return "HitIsSphereNV";
|
||||
case EbvHitIsLSSNV: return "HitIsLSSNV";
|
||||
case EbvHitSpherePositionNV: return "HitSpherePositionNV";
|
||||
case EbvHitSphereRadiusNV: return "HitSphereRadiusNV";
|
||||
case EbvHitLSSPositionsNV: return "HitSpherePositionsNV";
|
||||
case EbvHitLSSRadiiNV: return "HitLSSRadiiNV";
|
||||
|
||||
default: return "unknown built-in variable";
|
||||
}
|
||||
}
|
||||
@@ -585,6 +611,9 @@ __inline bool isTypeFloat(TBasicType type)
|
||||
case EbtFloat:
|
||||
case EbtDouble:
|
||||
case EbtFloat16:
|
||||
case EbtBFloat16:
|
||||
case EbtFloatE5M2:
|
||||
case EbtFloatE4M3:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -596,7 +625,10 @@ __inline uint32_t GetNumBits(TBasicType type)
|
||||
switch (type) {
|
||||
case EbtInt8:
|
||||
case EbtUint8:
|
||||
case EbtFloatE5M2:
|
||||
case EbtFloatE4M3:
|
||||
return 8;
|
||||
case EbtBFloat16:
|
||||
case EbtFloat16:
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
|
||||
@@ -899,6 +899,17 @@ public:
|
||||
unionArray = new TConstUnionVector(size, val);
|
||||
}
|
||||
|
||||
TConstUnionArray* clone() const
|
||||
{
|
||||
TConstUnionArray *copy = new TConstUnionArray(size());
|
||||
if (unionArray) {
|
||||
for (const auto i : *unionArray) {
|
||||
copy->unionArray->push_back(i);
|
||||
}
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
int size() const { return unionArray ? (int)unionArray->size() : 0; }
|
||||
TConstUnion& operator[](size_t index) { return (*unionArray)[index]; }
|
||||
const TConstUnion& operator[](size_t index) const { return (*unionArray)[index]; }
|
||||
|
||||
@@ -61,6 +61,8 @@
|
||||
// class as the allocator (second) template argument.
|
||||
//
|
||||
|
||||
#include "visibility.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
@@ -179,6 +181,7 @@ public:
|
||||
// Call allocate() to actually acquire memory. Returns nullptr if no memory
|
||||
// available, otherwise a properly aligned pointer to 'numBytes' of memory.
|
||||
//
|
||||
GLSLANG_EXPORT_FOR_TESTS
|
||||
void* allocate(size_t numBytes);
|
||||
|
||||
//
|
||||
@@ -255,6 +258,7 @@ private:
|
||||
// different times. But a simple use is to have a global pop
|
||||
// with everyone using the same global allocator.
|
||||
//
|
||||
GLSLANG_EXPORT_FOR_TESTS
|
||||
extern TPoolAllocator& GetThreadPoolAllocator();
|
||||
void SetThreadPoolAllocator(TPoolAllocator* poolAllocator);
|
||||
|
||||
@@ -289,6 +293,7 @@ public:
|
||||
template<class Other>
|
||||
pool_allocator(const pool_allocator<Other>& p) : allocator(p.getAllocator()) { }
|
||||
|
||||
GLSLANG_EXPORT_FOR_TESTS
|
||||
pointer allocate(size_type n) {
|
||||
return reinterpret_cast<pointer>(getAllocator().allocate(n * sizeof(T))); }
|
||||
pointer allocate(size_type n, const void*) {
|
||||
|
||||
+169
-25
@@ -85,6 +85,7 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
||||
bool image : 1; // image, combined should be false
|
||||
bool combined : 1; // true means texture is combined with a sampler, false means texture with no sampler
|
||||
bool sampler : 1; // true means a pure sampler, other fields should be clear()
|
||||
bool tileQCOM : 1; // is tile shading attachment
|
||||
|
||||
unsigned int vectorSize : 3; // vector return type size.
|
||||
// Some languages support structures as sample results. Storing the whole structure in the
|
||||
@@ -127,6 +128,8 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
||||
bool isShadow() const { return shadow; }
|
||||
bool isArrayed() const { return arrayed; }
|
||||
|
||||
bool isTileAttachmentQCOM() const { return tileQCOM; }
|
||||
|
||||
void clear()
|
||||
{
|
||||
type = EbtVoid;
|
||||
@@ -139,6 +142,7 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
||||
sampler = false;
|
||||
external = false;
|
||||
yuv = false;
|
||||
tileQCOM = false;
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
clearReturnStruct();
|
||||
@@ -220,7 +224,8 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
||||
isCombined() == right.isCombined() &&
|
||||
isPureSampler() == right.isPureSampler() &&
|
||||
isExternal() == right.isExternal() &&
|
||||
isYuv() == right.isYuv()
|
||||
isYuv() == right.isYuv() &&
|
||||
isTileAttachmentQCOM() == right.isTileAttachmentQCOM()
|
||||
#ifdef ENABLE_HLSL
|
||||
&& getVectorSize() == right.getVectorSize() &&
|
||||
getStructReturnIndex() == right.getStructReturnIndex()
|
||||
@@ -246,6 +251,9 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
||||
case EbtInt: s.append("i"); break;
|
||||
case EbtUint: s.append("u"); break;
|
||||
case EbtFloat16: s.append("f16"); break;
|
||||
case EbtBFloat16: s.append("bf16"); break;
|
||||
case EbtFloatE5M2: s.append("fe5m2"); break;
|
||||
case EbtFloatE4M3: s.append("fe4m3"); break;
|
||||
case EbtInt8: s.append("i8"); break;
|
||||
case EbtUint16: s.append("u8"); break;
|
||||
case EbtInt16: s.append("i16"); break;
|
||||
@@ -259,6 +267,8 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
||||
s.append("attachmentEXT");
|
||||
else if (isSubpass())
|
||||
s.append("subpass");
|
||||
else if (isTileAttachmentQCOM())
|
||||
s.append("attachmentQCOM");
|
||||
else
|
||||
s.append("image");
|
||||
} else if (isCombined()) {
|
||||
@@ -552,6 +562,7 @@ public:
|
||||
shadercallcoherent = false;
|
||||
nonprivate = false;
|
||||
volatil = false;
|
||||
nontemporal = false;
|
||||
restrict = false;
|
||||
readonly = false;
|
||||
writeonly = false;
|
||||
@@ -589,6 +600,7 @@ public:
|
||||
bool writeonly : 1;
|
||||
bool coherent : 1;
|
||||
bool volatil : 1;
|
||||
bool nontemporal : 1;
|
||||
bool devicecoherent : 1;
|
||||
bool queuefamilycoherent : 1;
|
||||
bool workgroupcoherent : 1;
|
||||
@@ -603,14 +615,15 @@ public:
|
||||
bool isRestrict() const { return restrict; }
|
||||
bool isCoherent() const { return coherent; }
|
||||
bool isVolatile() const { return volatil; }
|
||||
bool isNonTemporal() const { return nontemporal; }
|
||||
bool isSample() const { return sample; }
|
||||
bool isMemory() const
|
||||
{
|
||||
return shadercallcoherent || subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly || nonprivate;
|
||||
return shadercallcoherent || subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || nontemporal || restrict || readonly || writeonly || nonprivate;
|
||||
}
|
||||
bool isMemoryQualifierImageAndSSBOOnly() const
|
||||
{
|
||||
return shadercallcoherent || subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly;
|
||||
return shadercallcoherent || subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || nontemporal || restrict || readonly || writeonly;
|
||||
}
|
||||
bool bufferReferenceNeedsVulkanMemoryModel() const
|
||||
{
|
||||
@@ -846,6 +859,8 @@ public:
|
||||
layoutBufferReferenceAlign = layoutBufferReferenceAlignEnd;
|
||||
layoutFormat = ElfNone;
|
||||
|
||||
layoutTileAttachmentQCOM = false;
|
||||
|
||||
clearInterstageLayout();
|
||||
|
||||
layoutSpecConstantId = layoutSpecConstantIdEnd;
|
||||
@@ -947,6 +962,8 @@ public:
|
||||
bool layoutBindlessSampler;
|
||||
bool layoutBindlessImage;
|
||||
|
||||
bool layoutTileAttachmentQCOM;
|
||||
|
||||
bool hasUniformLayout() const
|
||||
{
|
||||
return hasMatrix() ||
|
||||
@@ -1065,6 +1082,10 @@ public:
|
||||
{
|
||||
return layoutBindlessImage;
|
||||
}
|
||||
bool isTileAttachmentQCOM() const
|
||||
{
|
||||
return layoutTileAttachmentQCOM;
|
||||
}
|
||||
|
||||
// GL_EXT_spirv_intrinsics
|
||||
bool hasSpirvDecorate() const { return spirvDecorate != nullptr; }
|
||||
@@ -1278,7 +1299,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// Qualifiers that don't need to be keep per object. They have shader scope, not object scope.
|
||||
// Qualifiers that don't need to be kept per object. They have shader scope, not object scope.
|
||||
// So, they will not be part of TType, TQualifier, etc.
|
||||
struct TShaderQualifiers {
|
||||
TLayoutGeometry geometry; // geometry/tessellation shader in/out primitives
|
||||
@@ -1308,6 +1329,9 @@ struct TShaderQualifiers {
|
||||
bool layoutDerivativeGroupLinear; // true if layout derivative_group_linearNV set
|
||||
int primitives; // mesh shader "max_primitives"DerivativeGroupLinear; // true if layout derivative_group_linearNV set
|
||||
bool layoutPrimitiveCulling; // true if layout primitive_culling set
|
||||
bool layoutNonCoherentTileAttachmentReadQCOM; // fragment shaders -- per object
|
||||
int layoutTileShadingRateQCOM[3]; // compute shader
|
||||
bool layoutTileShadingRateQCOMNotDefault[3]; // compute shader
|
||||
TLayoutDepth getDepth() const { return layoutDepth; }
|
||||
TLayoutStencil getStencil() const { return layoutStencil; }
|
||||
|
||||
@@ -1344,6 +1368,13 @@ struct TShaderQualifiers {
|
||||
layoutDerivativeGroupQuads = false;
|
||||
layoutDerivativeGroupLinear = false;
|
||||
layoutPrimitiveCulling = false;
|
||||
layoutNonCoherentTileAttachmentReadQCOM = false;
|
||||
layoutTileShadingRateQCOM[0] = 0;
|
||||
layoutTileShadingRateQCOM[1] = 0;
|
||||
layoutTileShadingRateQCOM[2] = 0;
|
||||
layoutTileShadingRateQCOMNotDefault[0] = false;
|
||||
layoutTileShadingRateQCOMNotDefault[1] = false;
|
||||
layoutTileShadingRateQCOMNotDefault[2] = false;
|
||||
primitives = TQualifier::layoutNotSet;
|
||||
interlockOrdering = EioNone;
|
||||
}
|
||||
@@ -1413,6 +1444,15 @@ struct TShaderQualifiers {
|
||||
interlockOrdering = src.interlockOrdering;
|
||||
if (src.layoutPrimitiveCulling)
|
||||
layoutPrimitiveCulling = src.layoutPrimitiveCulling;
|
||||
if (src.layoutNonCoherentTileAttachmentReadQCOM)
|
||||
layoutNonCoherentTileAttachmentReadQCOM = src.layoutNonCoherentTileAttachmentReadQCOM;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (src.layoutTileShadingRateQCOM[i] > 1)
|
||||
layoutTileShadingRateQCOM[i] = src.layoutTileShadingRateQCOM[i];
|
||||
}
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
layoutTileShadingRateQCOMNotDefault[i] = src.layoutTileShadingRateQCOMNotDefault[i] || layoutTileShadingRateQCOMNotDefault[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1460,6 +1500,9 @@ public:
|
||||
uint32_t matrixRows : 4;
|
||||
bool coopmatNV : 1;
|
||||
bool coopmatKHR : 1;
|
||||
bool coopvecNV : 1;
|
||||
bool tileAttachmentQCOM: 1;
|
||||
uint32_t tensorRankARM : 4;
|
||||
TArraySizes* arraySizes;
|
||||
const TType* userDef;
|
||||
TSourceLoc loc;
|
||||
@@ -1470,6 +1513,9 @@ public:
|
||||
bool isCoopmat() const { return coopmatNV || coopmatKHR; }
|
||||
bool isCoopmatNV() const { return coopmatNV; }
|
||||
bool isCoopmatKHR() const { return coopmatKHR; }
|
||||
bool isCoopvecNV() const { return coopvecNV; }
|
||||
bool isTensorARM() const { return tensorRankARM; }
|
||||
bool hasTypeParameter() const { return isCoopmat() || isCoopvecNV() || isTensorARM(); }
|
||||
|
||||
bool isTensorLayoutNV() const { return basicType == EbtTensorLayoutNV; }
|
||||
bool isTensorViewNV() const { return basicType == EbtTensorViewNV; }
|
||||
@@ -1486,6 +1532,9 @@ public:
|
||||
typeParameters = nullptr;
|
||||
coopmatNV = false;
|
||||
coopmatKHR = false;
|
||||
coopvecNV = false;
|
||||
tileAttachmentQCOM = false;
|
||||
tensorRankARM = 0;
|
||||
spirvType = nullptr;
|
||||
}
|
||||
|
||||
@@ -1545,8 +1594,8 @@ public:
|
||||
// for "empty" type (no args) or simple scalar/vector/matrix
|
||||
explicit TType(TBasicType t = EbtVoid, TStorageQualifier q = EvqTemporary, int vs = 1, int mc = 0, int mr = 0,
|
||||
bool isVector = false) :
|
||||
basicType(t), vectorSize(static_cast<uint32_t>(vs) & 0b1111), matrixCols(static_cast<uint32_t>(mc) & 0b1111), matrixRows(static_cast<uint32_t>(mr) & 0b1111), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false),
|
||||
arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr),
|
||||
basicType(t), vectorSize(static_cast<uint32_t>(vs) & 0b1111), matrixCols(static_cast<uint32_t>(mc) & 0b1111), matrixRows(static_cast<uint32_t>(mr) & 0b1111), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false),
|
||||
tileAttachmentQCOM(false), tensorRankARM(0), arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr),
|
||||
spirvType(nullptr)
|
||||
{
|
||||
assert(vs >= 0);
|
||||
@@ -1561,8 +1610,8 @@ public:
|
||||
// for explicit precision qualifier
|
||||
TType(TBasicType t, TStorageQualifier q, TPrecisionQualifier p, int vs = 1, int mc = 0, int mr = 0,
|
||||
bool isVector = false) :
|
||||
basicType(t), vectorSize(static_cast<uint32_t>(vs) & 0b1111), matrixCols(static_cast<uint32_t>(mc) & 0b1111), matrixRows(static_cast<uint32_t>(mr) & 0b1111), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false),
|
||||
arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr),
|
||||
basicType(t), vectorSize(static_cast<uint32_t>(vs) & 0b1111), matrixCols(static_cast<uint32_t>(mc) & 0b1111), matrixRows(static_cast<uint32_t>(mr) & 0b1111), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false),
|
||||
tileAttachmentQCOM(false), tensorRankARM(0), arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr),
|
||||
spirvType(nullptr)
|
||||
{
|
||||
assert(vs >= 0);
|
||||
@@ -1579,8 +1628,8 @@ public:
|
||||
// for turning a TPublicType into a TType, using a shallow copy
|
||||
explicit TType(const TPublicType& p) :
|
||||
basicType(p.basicType),
|
||||
vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), vector1(false), coopmatNV(p.coopmatNV), coopmatKHR(p.coopmatKHR), coopmatKHRuse(0), coopmatKHRUseValid(false),
|
||||
arraySizes(p.arraySizes), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(p.typeParameters),
|
||||
vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), vector1(false), coopmatNV(p.coopmatNV), coopmatKHR(p.coopmatKHR), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(p.coopvecNV),
|
||||
tileAttachmentQCOM(p.tileAttachmentQCOM), tensorRankARM(p.tensorRankARM), arraySizes(p.arraySizes), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(p.typeParameters),
|
||||
spirvType(p.spirvType)
|
||||
{
|
||||
if (basicType == EbtSampler)
|
||||
@@ -1630,11 +1679,20 @@ public:
|
||||
coopmatKHRUseValid = true;
|
||||
}
|
||||
}
|
||||
if (p.isCoopvecNV() && p.typeParameters) {
|
||||
basicType = p.typeParameters->basicType;
|
||||
}
|
||||
if (p.isTensorARM() && p.typeParameters) {
|
||||
basicType = p.typeParameters->basicType;
|
||||
if (p.typeParameters->arraySizes->getNumDims() > 0) {
|
||||
tensorRankARM = static_cast<uint32_t>(p.typeParameters->arraySizes->getDimSize(0)) & 0b1111;
|
||||
}
|
||||
}
|
||||
}
|
||||
// for construction of sampler types
|
||||
TType(const TSampler& sampler, TStorageQualifier q = EvqUniform, TArraySizes* as = nullptr) :
|
||||
basicType(EbtSampler), vectorSize(1u), matrixCols(0u), matrixRows(0u), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false),
|
||||
arraySizes(as), structure(nullptr), fieldName(nullptr), typeName(nullptr),
|
||||
basicType(EbtSampler), vectorSize(1u), matrixCols(0u), matrixRows(0u), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false),
|
||||
tileAttachmentQCOM(false), tensorRankARM(0), arraySizes(as), structure(nullptr), fieldName(nullptr), typeName(nullptr),
|
||||
sampler(sampler), typeParameters(nullptr), spirvType(nullptr)
|
||||
{
|
||||
qualifier.clear();
|
||||
@@ -1676,19 +1734,23 @@ public:
|
||||
// dereference from vector to scalar
|
||||
vectorSize = 1;
|
||||
vector1 = false;
|
||||
} else if (isCoopMat()) {
|
||||
} else if (isCoopMat() || isCoopVecNV()) {
|
||||
coopmatNV = false;
|
||||
coopmatKHR = false;
|
||||
coopmatKHRuse = 0;
|
||||
coopmatKHRUseValid = false;
|
||||
coopvecNV = false;
|
||||
typeParameters = nullptr;
|
||||
} else if (isTileAttachmentQCOM()) {
|
||||
tileAttachmentQCOM = false;
|
||||
typeParameters = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
// for making structures, ...
|
||||
TType(TTypeList* userDef, const TString& n) :
|
||||
basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false),
|
||||
arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr),
|
||||
basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false),
|
||||
tileAttachmentQCOM(false), tensorRankARM(0), arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr),
|
||||
spirvType(nullptr)
|
||||
{
|
||||
sampler.clear();
|
||||
@@ -1697,8 +1759,8 @@ public:
|
||||
}
|
||||
// For interface blocks
|
||||
TType(TTypeList* userDef, const TString& n, const TQualifier& q) :
|
||||
basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false),
|
||||
qualifier(q), arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr),
|
||||
basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false), coopvecNV(false),
|
||||
tileAttachmentQCOM(false), tensorRankARM(0), qualifier(q), arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr),
|
||||
spirvType(nullptr)
|
||||
{
|
||||
sampler.clear();
|
||||
@@ -1707,7 +1769,7 @@ public:
|
||||
// for block reference (first parameter must be EbtReference)
|
||||
explicit TType(TBasicType t, const TType &p, const TString& n) :
|
||||
basicType(t), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(0), coopmatKHRUseValid(false),
|
||||
arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr),
|
||||
tileAttachmentQCOM(false), tensorRankARM(0), arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr),
|
||||
spirvType(nullptr)
|
||||
{
|
||||
assert(t == EbtReference);
|
||||
@@ -1745,6 +1807,9 @@ public:
|
||||
coopmatKHR = copyOf.isCoopMatKHR();
|
||||
coopmatKHRuse = copyOf.coopmatKHRuse;
|
||||
coopmatKHRUseValid = copyOf.coopmatKHRUseValid;
|
||||
coopvecNV = copyOf.isCoopVecNV();
|
||||
tileAttachmentQCOM = copyOf.tileAttachmentQCOM;
|
||||
tensorRankARM = copyOf.tensorRankARM;
|
||||
}
|
||||
|
||||
// Make complete copy of the whole type graph rooted at 'copyOf'.
|
||||
@@ -1828,7 +1893,7 @@ public:
|
||||
virtual const TTypeParameters* getTypeParameters() const { return typeParameters; }
|
||||
virtual TTypeParameters* getTypeParameters() { return typeParameters; }
|
||||
|
||||
virtual bool isScalar() const { return ! isVector() && ! isMatrix() && ! isStruct() && ! isArray(); }
|
||||
virtual bool isScalar() const { return ! isVector() && ! isMatrix() && ! isStruct() && ! isArray() && ! isCoopVecNV(); }
|
||||
virtual bool isScalarOrVec1() const { return isScalar() || vector1; }
|
||||
virtual bool isScalarOrVector() const { return !isMatrix() && !isStruct() && !isArray(); }
|
||||
virtual bool isVector() const { return vectorSize > 1u || vector1; }
|
||||
@@ -1842,7 +1907,8 @@ public:
|
||||
virtual void updateImplicitArraySize(int size) { assert(isArray()); arraySizes->updateImplicitSize(size); }
|
||||
virtual void setImplicitlySized(bool isImplicitSized) { arraySizes->setImplicitlySized(isImplicitSized); }
|
||||
virtual bool isStruct() const { return basicType == EbtStruct || basicType == EbtBlock; }
|
||||
virtual bool isFloatingDomain() const { return basicType == EbtFloat || basicType == EbtDouble || basicType == EbtFloat16; }
|
||||
virtual bool isFloatingDomain() const { return basicType == EbtFloat || basicType == EbtDouble || basicType == EbtFloat16 ||
|
||||
basicType == EbtBFloat16 || basicType == EbtFloatE5M2 || basicType == EbtFloatE4M3; }
|
||||
virtual bool isIntegerDomain() const
|
||||
{
|
||||
switch (basicType) {
|
||||
@@ -1863,7 +1929,9 @@ public:
|
||||
}
|
||||
virtual bool isOpaque() const { return basicType == EbtSampler
|
||||
|| basicType == EbtAtomicUint || basicType == EbtAccStruct || basicType == EbtRayQuery
|
||||
|| basicType == EbtHitObjectNV; }
|
||||
|| basicType == EbtHitObjectNV || isTileAttachmentQCOM()
|
||||
|| isTensorARM();
|
||||
}
|
||||
virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; }
|
||||
|
||||
virtual bool isAttachmentEXT() const { return basicType == EbtSampler && getSampler().isAttachmentEXT(); }
|
||||
@@ -1879,6 +1947,11 @@ public:
|
||||
bool isCoopMat() const { return coopmatNV || coopmatKHR; }
|
||||
bool isCoopMatNV() const { return coopmatNV; }
|
||||
bool isCoopMatKHR() const { return coopmatKHR; }
|
||||
bool isCoopVecNV() const { return coopvecNV; }
|
||||
bool isTileAttachmentQCOM() const { return tileAttachmentQCOM; }
|
||||
bool isTensorARM() const { return tensorRankARM; }
|
||||
bool hasTypeParameter() const { return isCoopMat() || isCoopVecNV() || isTensorARM(); }
|
||||
int getTensorRankARM() const { return static_cast<int>(tensorRankARM); }
|
||||
bool isReference() const { return getBasicType() == EbtReference; }
|
||||
bool isSpirvType() const { return getBasicType() == EbtSpirvType; }
|
||||
int getCoopMatKHRuse() const { return static_cast<int>(coopmatKHRuse); }
|
||||
@@ -1940,12 +2013,20 @@ public:
|
||||
|
||||
virtual bool containsNonOpaque() const
|
||||
{
|
||||
if (isTensorARM()) {
|
||||
// Tensors have a numerical basicType even though it is Opaque
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto nonOpaque = [](const TType* t) {
|
||||
switch (t->basicType) {
|
||||
case EbtVoid:
|
||||
case EbtFloat:
|
||||
case EbtDouble:
|
||||
case EbtFloat16:
|
||||
case EbtBFloat16:
|
||||
case EbtFloatE5M2:
|
||||
case EbtFloatE4M3:
|
||||
case EbtInt8:
|
||||
case EbtUint8:
|
||||
case EbtInt16:
|
||||
@@ -1978,6 +2059,10 @@ public:
|
||||
{
|
||||
return containsBasicType(EbtFloat16);
|
||||
}
|
||||
bool containsBFloat16() const
|
||||
{
|
||||
return containsBasicType(EbtBFloat16);
|
||||
}
|
||||
bool contains64BitInt() const
|
||||
{
|
||||
return containsBasicType(EbtInt64) || containsBasicType(EbtUint64);
|
||||
@@ -1994,6 +2079,10 @@ public:
|
||||
{
|
||||
return contains([](const TType* t) { return t->coopmatNV || t->coopmatKHR; } );
|
||||
}
|
||||
bool containsCoopVec() const
|
||||
{
|
||||
return contains([](const TType* t) { return t->coopvecNV; } );
|
||||
}
|
||||
bool containsReference() const
|
||||
{
|
||||
return containsBasicType(EbtReference);
|
||||
@@ -2095,6 +2184,9 @@ public:
|
||||
case EbtVoid: return "void";
|
||||
case EbtDouble: return "double";
|
||||
case EbtFloat16: return "float16_t";
|
||||
case EbtBFloat16: return "bfloat16_t";
|
||||
case EbtFloatE5M2: return "floate5m2_t";
|
||||
case EbtFloatE4M3: return "floate4m3_t";
|
||||
case EbtInt8: return "int8_t";
|
||||
case EbtUint8: return "uint8_t";
|
||||
case EbtInt16: return "int16_t";
|
||||
@@ -2113,6 +2205,8 @@ public:
|
||||
case EbtCoopmat: return "coopmat";
|
||||
case EbtTensorLayoutNV: return "tensorLayoutNV";
|
||||
case EbtTensorViewNV: return "tensorViewNV";
|
||||
case EbtCoopvecNV: return "coopvecNV";
|
||||
case EbtTensorARM: return "tensorARM";
|
||||
default: return "unknown type";
|
||||
}
|
||||
}
|
||||
@@ -2218,7 +2312,7 @@ public:
|
||||
appendStr(" layoutSecondaryViewportRelativeOffset=");
|
||||
appendInt(qualifier.layoutSecondaryViewportRelativeOffset);
|
||||
}
|
||||
|
||||
|
||||
if (qualifier.layoutShaderRecord)
|
||||
appendStr(" shaderRecordNV");
|
||||
if (qualifier.layoutFullQuads)
|
||||
@@ -2281,6 +2375,8 @@ public:
|
||||
appendStr(" nonprivate");
|
||||
if (qualifier.volatil)
|
||||
appendStr(" volatile");
|
||||
if (qualifier.nontemporal)
|
||||
appendStr(" nontemporal");
|
||||
if (qualifier.restrict)
|
||||
appendStr(" restrict");
|
||||
if (qualifier.readonly)
|
||||
@@ -2431,6 +2527,10 @@ public:
|
||||
appendStr(" ");
|
||||
appendStr("tensorViewNV");
|
||||
}
|
||||
if (isCoopVecNV()) {
|
||||
appendStr(" ");
|
||||
appendStr("coopvecNV");
|
||||
}
|
||||
|
||||
appendStr("<");
|
||||
for (int i = 0; i < (int)typeParameters->arraySizes->getNumDims(); ++i) {
|
||||
@@ -2512,7 +2612,9 @@ public:
|
||||
{
|
||||
uint32_t components = 0;
|
||||
|
||||
if (getBasicType() == EbtStruct || getBasicType() == EbtBlock) {
|
||||
if (isCoopVecNV()) {
|
||||
components = typeParameters->arraySizes->getDimSize(0);
|
||||
} else if (getBasicType() == EbtStruct || getBasicType() == EbtBlock) {
|
||||
for (TTypeList::const_iterator tl = getStruct()->begin(); tl != getStruct()->end(); tl++)
|
||||
components += ((*tl).type)->computeNumComponents();
|
||||
} else if (matrixCols)
|
||||
@@ -2716,6 +2818,8 @@ public:
|
||||
vector1 == right.vector1 &&
|
||||
isCoopMatNV() == right.isCoopMatNV() &&
|
||||
isCoopMatKHR() == right.isCoopMatKHR() &&
|
||||
isCoopVecNV() == right.isCoopVecNV() &&
|
||||
isTensorARM() == right.isTensorARM() &&
|
||||
sameStructType(right, lpidx, rpidx) &&
|
||||
sameReferenceType(right);
|
||||
}
|
||||
@@ -2737,6 +2841,18 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
// See if a cooperative vector type parameter with unspecified parameters is
|
||||
// an OK function parameter
|
||||
bool coopVecParameterOK(const TType& right) const
|
||||
{
|
||||
if (isCoopVecNV() && right.isCoopVecNV()) {
|
||||
return ((getBasicType() == right.getBasicType()) || (getBasicType() == EbtCoopvecNV) ||
|
||||
(right.getBasicType() == EbtCoopvecNV)) &&
|
||||
typeParameters == nullptr && right.typeParameters != nullptr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool sameCoopMatBaseType(const TType &right) const {
|
||||
bool rv = false;
|
||||
|
||||
@@ -2751,8 +2867,8 @@ public:
|
||||
else
|
||||
rv = false;
|
||||
} else if (isCoopMatKHR() && right.isCoopMatKHR()) {
|
||||
if (getBasicType() == EbtFloat || getBasicType() == EbtFloat16)
|
||||
rv = right.getBasicType() == EbtFloat || right.getBasicType() == EbtFloat16 || right.getBasicType() == EbtCoopmat;
|
||||
if (isFloatingDomain())
|
||||
rv = right.isFloatingDomain() || right.getBasicType() == EbtCoopmat;
|
||||
else if (getBasicType() == EbtUint || getBasicType() == EbtUint8 || getBasicType() == EbtUint16)
|
||||
rv = right.getBasicType() == EbtUint || right.getBasicType() == EbtUint8 || right.getBasicType() == EbtUint16 || right.getBasicType() == EbtCoopmat;
|
||||
else if (getBasicType() == EbtInt || getBasicType() == EbtInt8 || getBasicType() == EbtInt16)
|
||||
@@ -2771,9 +2887,34 @@ public:
|
||||
if (isTensorViewNV()) {
|
||||
return right.isTensorViewNV() && right.typeParameters == nullptr && typeParameters != nullptr;
|
||||
}
|
||||
if (isTensorARM()) {
|
||||
return right.isTensorARM() && right.typeParameters == nullptr && typeParameters != nullptr;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool sameTensorBaseTypeARM(const TType &right) const {
|
||||
return (typeParameters == nullptr || right.typeParameters == nullptr ||
|
||||
(tensorRankARM == right.tensorRankARM && getBasicType() == right.getBasicType()));
|
||||
}
|
||||
|
||||
bool sameCoopVecBaseType(const TType &right) const {
|
||||
bool rv = false;
|
||||
|
||||
if (isCoopVecNV() && right.isCoopVecNV()) {
|
||||
if (getBasicType() == EbtFloat || getBasicType() == EbtFloat16)
|
||||
rv = right.getBasicType() == EbtFloat || right.getBasicType() == EbtFloat16 || right.getBasicType() == EbtCoopvecNV;
|
||||
else if (getBasicType() == EbtUint || getBasicType() == EbtUint8 || getBasicType() == EbtUint16)
|
||||
rv = right.getBasicType() == EbtUint || right.getBasicType() == EbtUint8 || right.getBasicType() == EbtUint16 || right.getBasicType() == EbtCoopvecNV;
|
||||
else if (getBasicType() == EbtInt || getBasicType() == EbtInt8 || getBasicType() == EbtInt16)
|
||||
rv = right.getBasicType() == EbtInt || right.getBasicType() == EbtInt8 || right.getBasicType() == EbtInt16 || right.getBasicType() == EbtCoopvecNV;
|
||||
else
|
||||
rv = false;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool sameCoopMatUse(const TType &right) const {
|
||||
return coopmatKHRuse == right.coopmatKHRuse;
|
||||
}
|
||||
@@ -2903,6 +3044,9 @@ protected:
|
||||
bool coopmatKHR : 1;
|
||||
uint32_t coopmatKHRuse : 3; // Accepts one of three values: 0, 1, 2 (gl_MatrixUseA, gl_MatrixUseB, gl_MatrixUseAccumulator)
|
||||
bool coopmatKHRUseValid : 1; // True if coopmatKHRuse has been set
|
||||
bool coopvecNV : 1;
|
||||
bool tileAttachmentQCOM : 1;
|
||||
uint32_t tensorRankARM : 4; // 0 means not a tensor; non-zero indicates the tensor rank.
|
||||
TQualifier qualifier;
|
||||
|
||||
TArraySizes* arraySizes; // nullptr unless an array; can be shared across types
|
||||
|
||||
@@ -284,7 +284,7 @@ GLSLANG_EXPORT const char* glslang_program_SPIRV_get_messages(glslang_program_t*
|
||||
GLSLANG_EXPORT const char* glslang_program_get_info_log(glslang_program_t* program);
|
||||
GLSLANG_EXPORT const char* glslang_program_get_info_debug_log(glslang_program_t* program);
|
||||
|
||||
GLSLANG_EXPORT glslang_mapper_t* glslang_glsl_mapper_create();
|
||||
GLSLANG_EXPORT glslang_mapper_t* glslang_glsl_mapper_create(void);
|
||||
GLSLANG_EXPORT void glslang_glsl_mapper_delete(glslang_mapper_t* mapper);
|
||||
|
||||
GLSLANG_EXPORT glslang_resolver_t* glslang_glsl_resolver_create(glslang_program_t* program, glslang_stage_t stage);
|
||||
|
||||
@@ -118,8 +118,9 @@ typedef enum {
|
||||
GLSLANG_TARGET_VULKAN_1_1 = (1 << 22) | (1 << 12),
|
||||
GLSLANG_TARGET_VULKAN_1_2 = (1 << 22) | (2 << 12),
|
||||
GLSLANG_TARGET_VULKAN_1_3 = (1 << 22) | (3 << 12),
|
||||
GLSLANG_TARGET_VULKAN_1_4 = (1 << 22) | (4 << 12),
|
||||
GLSLANG_TARGET_OPENGL_450 = 450,
|
||||
LAST_ELEMENT_MARKER(GLSLANG_TARGET_CLIENT_VERSION_COUNT = 5),
|
||||
LAST_ELEMENT_MARKER(GLSLANG_TARGET_CLIENT_VERSION_COUNT = 6),
|
||||
} glslang_target_client_version_t;
|
||||
|
||||
/* SH_TARGET_LanguageVersion counterpart */
|
||||
@@ -177,6 +178,7 @@ typedef enum {
|
||||
GLSLANG_MSG_ABSOLUTE_PATH = (1 << 16),
|
||||
GLSLANG_MSG_DISPLAY_ERROR_COLUMN = (1 << 17),
|
||||
GLSLANG_MSG_LINK_TIME_OPTIMIZATION_BIT = (1 << 18),
|
||||
GLSLANG_MSG_VALIDATE_CROSS_STAGE_IO_BIT = (1 << 19),
|
||||
LAST_ELEMENT_MARKER(GLSLANG_MSG_COUNT),
|
||||
} glslang_messages_t;
|
||||
|
||||
|
||||
@@ -387,6 +387,11 @@ enum TOperator {
|
||||
EOpSubgroupPartitionedExclusiveXor,
|
||||
|
||||
EOpSubgroupGuardStop,
|
||||
|
||||
// Integer dot product
|
||||
EOpDotPackedEXT,
|
||||
EOpDotAccSatEXT,
|
||||
EOpDotPackedAccSatEXT,
|
||||
|
||||
EOpMinInvocations,
|
||||
EOpMaxInvocations,
|
||||
@@ -467,6 +472,17 @@ enum TOperator {
|
||||
EOpTensorViewSetStrideNV,
|
||||
EOpTensorViewSetClipNV,
|
||||
|
||||
EOpCooperativeVectorMatMulNV,
|
||||
EOpCooperativeVectorMatMulAddNV,
|
||||
EOpCooperativeVectorLoadNV,
|
||||
EOpCooperativeVectorStoreNV,
|
||||
EOpCooperativeVectorOuterProductAccumulateNV,
|
||||
EOpCooperativeVectorReduceSumAccumulateNV,
|
||||
|
||||
EOpTensorReadARM,
|
||||
EOpTensorWriteARM,
|
||||
EOpTensorSizeARM,
|
||||
|
||||
EOpBeginInvocationInterlock, // Fragment only
|
||||
EOpEndInvocationInterlock, // Fragment only
|
||||
|
||||
@@ -599,13 +615,27 @@ enum TOperator {
|
||||
EOpConstructF16Mat4x2,
|
||||
EOpConstructF16Mat4x3,
|
||||
EOpConstructF16Mat4x4,
|
||||
EOpConstructBFloat16,
|
||||
EOpConstructBF16Vec2,
|
||||
EOpConstructBF16Vec3,
|
||||
EOpConstructBF16Vec4,
|
||||
EOpConstructFloatE5M2,
|
||||
EOpConstructFloatE5M2Vec2,
|
||||
EOpConstructFloatE5M2Vec3,
|
||||
EOpConstructFloatE5M2Vec4,
|
||||
EOpConstructFloatE4M3,
|
||||
EOpConstructFloatE4M3Vec2,
|
||||
EOpConstructFloatE4M3Vec3,
|
||||
EOpConstructFloatE4M3Vec4,
|
||||
EOpConstructStruct,
|
||||
EOpConstructTextureSampler,
|
||||
EOpConstructNonuniform, // expected to be transformed away, not present in final AST
|
||||
EOpConstructReference,
|
||||
EOpConstructCooperativeMatrixNV,
|
||||
EOpConstructCooperativeMatrixKHR,
|
||||
EOpConstructCooperativeVectorNV,
|
||||
EOpConstructAccStruct,
|
||||
EOpConstructSaturated,
|
||||
EOpConstructGuardEnd,
|
||||
|
||||
//
|
||||
@@ -954,6 +984,25 @@ enum TOperator {
|
||||
EOpImageBlockMatchWindowSADQCOM,
|
||||
EOpImageBlockMatchGatherSSDQCOM,
|
||||
EOpImageBlockMatchGatherSADQCOM,
|
||||
|
||||
// GL_NV_cluster_acceleration_structure
|
||||
EOpRayQueryGetIntersectionClusterIdNV,
|
||||
EOpHitObjectGetClusterIdNV,
|
||||
|
||||
// GL_NV_linear_swept_spheres
|
||||
EOpRayQueryGetIntersectionSpherePositionNV,
|
||||
EOpRayQueryGetIntersectionSphereRadiusNV,
|
||||
EOpRayQueryGetIntersectionLSSHitValueNV,
|
||||
EOpRayQueryGetIntersectionLSSPositionsNV,
|
||||
EOpRayQueryGetIntersectionLSSRadiiNV,
|
||||
EOpRayQueryIsSphereHitNV,
|
||||
EOpRayQueryIsLSSHitNV,
|
||||
EOpHitObjectGetSpherePositionNV,
|
||||
EOpHitObjectGetSphereRadiusNV,
|
||||
EOpHitObjectGetLSSPositionsNV,
|
||||
EOpHitObjectGetLSSRadiiNV,
|
||||
EOpHitObjectIsSphereHitNV,
|
||||
EOpHitObjectIsLSSHitNV,
|
||||
};
|
||||
|
||||
inline bool IsOpNumericConv(const TOperator op) {
|
||||
@@ -1059,6 +1108,7 @@ public:
|
||||
virtual int getVectorSize() const { return type.getVectorSize(); }
|
||||
virtual int getMatrixCols() const { return type.getMatrixCols(); }
|
||||
virtual int getMatrixRows() const { return type.getMatrixRows(); }
|
||||
virtual int getTensorRankARM() const { return type.getTensorRankARM(); }
|
||||
virtual bool isMatrix() const { return type.isMatrix(); }
|
||||
virtual bool isArray() const { return type.isArray(); }
|
||||
virtual bool isVector() const { return type.isVector(); }
|
||||
|
||||
Reference in New Issue
Block a user