Commit 387657e4 by Jeff Bolz

GL_NV_integer_cooperative_matrix support

parent a3bc04b2
......@@ -3485,6 +3485,10 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
builder.addExtension(spv::E_SPV_NV_cooperative_matrix);
if (type.getBasicType() == glslang::EbtFloat16)
builder.addCapability(spv::CapabilityFloat16);
if (type.getBasicType() == glslang::EbtUint8 ||
type.getBasicType() == glslang::EbtInt8) {
builder.addCapability(spv::CapabilityInt8);
}
spv::Id scope = makeArraySizeId(*type.getTypeParameters(), 1);
spv::Id rows = makeArraySizeId(*type.getTypeParameters(), 2);
......
#version 450 core
#extension GL_KHR_memory_scope_semantics : enable
#extension GL_NV_cooperative_matrix : enable
#extension GL_NV_integer_cooperative_matrix : enable
#extension GL_EXT_shader_explicit_arithmetic_types : enable
#extension GL_EXT_buffer_reference : enable
layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
const int X = 8;
layout(constant_id = 0) const int Y = 2;
const int Z = X*Y;
icoopmatNV<8, gl_ScopeSubgroup, Z, 8> miC;
icoopmatNV<8, gl_ScopeSubgroup, Z, 8> miC2[3];
ucoopmatNV<8, gl_ScopeSubgroup, Z, 8> muC;
ucoopmatNV<8, gl_ScopeSubgroup, Z, 8> muC2[3];
int iarr[miC.length()];
int iarr2[miC2[1].length()];
int uarr[muC.length()];
int uarr2[muC2[1].length()];
const icoopmatNV<32, gl_ScopeSubgroup, Z, 8> mD = icoopmatNV<32, gl_ScopeSubgroup, Z, 8>(1);
const ucoopmatNV<8, gl_ScopeSubgroup, 8, 8> mD2 = ucoopmatNV<8, gl_ScopeSubgroup, 8, 8>(1);
struct S { int a; int b; int c; };
const S s = S(12, 23, 34);
layout(set = 0, binding = 0, buffer_reference) coherent buffer Block {
uint y[1024*1024];
uint x[];
} block;
layout(set = 0, binding = 0) coherent buffer Block16 {
int8_t y[1024*1024];
int8_t x[];
Block b;
} block8;
icoopmatNV<8, gl_ScopeSubgroup, 8, 8> ineg(icoopmatNV<8, gl_ScopeSubgroup, 8, 8> m) { return -m; }
ucoopmatNV<8, gl_ScopeSubgroup, 8, 8> umul(ucoopmatNV<8, gl_ScopeSubgroup, 8, 8> m) { return m * uint8_t(2); }
layout(constant_id = 2) const int SC = 1;
ucoopmatNV<32, gl_ScopeSubgroup, SC, SC> scm[SC][SC];
// sized for icoopmatNV<8, gl_ScopeSubgroup, 16, 16>
shared uvec4 shmatrix[16*16*2/16];
void main()
{
ucoopmatNV<8, gl_ScopeSubgroup, 16, (2>1?8:4)> mu = ucoopmatNV<8, gl_ScopeSubgroup, 16, (2>1?8:4)>(2);
icoopmatNV<8, gl_ScopeSubgroup, 16, (2>1?8:4)> mi = icoopmatNV<8, gl_ScopeSubgroup, 16, (2>1?8:4)>(2);
mu = mu + mu;
mu = mu - mu;
mi = -mi;
mi = mi * int8_t(2);
fcoopmatNV<16, gl_ScopeSubgroup, 16, 8> mf16_0 = fcoopmatNV<16, gl_ScopeSubgroup, 16, 8>(mu);
fcoopmatNV<32, gl_ScopeSubgroup, 16, 8> mf32_0 = fcoopmatNV<32, gl_ScopeSubgroup, 16, 8>(mu);
fcoopmatNV<16, gl_ScopeSubgroup, 16, 8> mf16_1 = fcoopmatNV<16, gl_ScopeSubgroup, 16, 8>(mi);
fcoopmatNV<32, gl_ScopeSubgroup, 16, 8> mf32_1 = fcoopmatNV<32, gl_ScopeSubgroup, 16, 8>(mi);
uint8_t x = mu[1];
mi[0] = int8_t(x);
coopMatLoadNV(mi, block.x, 16, 128, false);
coopMatStoreNV(mi, block.x, 16, 128, false);
coopMatLoadNV(mu, block8.x, 16, 128, false);
coopMatStoreNV(mu, block8.x, 16, 128, false);
coopMatLoadNV(mi, block8.b.x, 16, 128, false);
coopMatStoreNV(mi, block8.b.x, 16, 128, false);
ucoopmatNV<8, gl_ScopeSubgroup, 16, 8> A;
ucoopmatNV<8, gl_ScopeSubgroup, 8, 8> B;
ucoopmatNV<8, gl_ScopeSubgroup, 16, 8> C;
ucoopmatNV<8, gl_ScopeSubgroup, 16, 8> D;
D = coopMatMulAddNV(A, B, C);
int l = D.length();
icoopmatNV<8, gl_ScopeSubgroup, 16, (2>1?8:4)> a[5];
a[3][0] = int8_t(1);
int md1 = mD[1];
md1 += (mi += mi)[1234];
muC2[0] = muC2[1];
muC2[1][0] = (miC2[2][0]);
coopMatLoadNV(mi, block.y, 16, 128, false);
coopMatStoreNV(mi, block.y, 16, 128, false);
coopMatLoadNV(mu, block8.y, 16, 128, false);
coopMatStoreNV(mu, block8.y, 16, 128, false);
icoopmatNV<8, gl_ScopeSubgroup, 8, 8> p1;
ucoopmatNV<8, gl_ScopeSubgroup, 8, 8> p2;
p1 = ineg(p1);
p2 = umul(p2);
p1 /= p1;
p2 /= p2;
p1 *= int8_t(2);
p2 *= uint8_t(4);
icoopmatNV<8, gl_ScopeSubgroup, 16, 8> ms;
coopMatLoadNV(ms, shmatrix, 1, 2, false);
coopMatStoreNV(ms, shmatrix, 1, 2, false);
}
......@@ -1433,11 +1433,18 @@ public:
}
typeName = NewPoolTString(p.userDef->getTypeName().c_str());
}
if (p.isCoopmat() && p.basicType == EbtFloat &&
p.typeParameters && p.typeParameters->getNumDims() > 0 &&
p.typeParameters->getDimSize(0) == 16) {
basicType = EbtFloat16;
qualifier.precision = EpqNone;
if (p.isCoopmat() && p.typeParameters && p.typeParameters->getNumDims() > 0) {
int numBits = p.typeParameters->getDimSize(0);
if (p.basicType == EbtFloat && numBits == 16) {
basicType = EbtFloat16;
qualifier.precision = EpqNone;
} else if (p.basicType == EbtUint && numBits == 8) {
basicType = EbtUint8;
qualifier.precision = EpqNone;
} else if (p.basicType == EbtInt && numBits == 8) {
basicType = EbtInt8;
qualifier.precision = EpqNone;
}
}
}
// for construction of sampler types
......@@ -2301,10 +2308,24 @@ public:
// an OK function parameter
bool coopMatParameterOK(const TType& right) const
{
return isCoopMat() && right.isCoopMat() &&
return isCoopMat() && right.isCoopMat() && (getBasicType() == right.getBasicType()) &&
typeParameters == nullptr && right.typeParameters != nullptr;
}
bool sameCoopMatBaseType(const TType &right) const {
bool rv = coopmat && right.coopmat;
if (getBasicType() == EbtFloat || getBasicType() == EbtFloat16)
rv = right.getBasicType() == EbtFloat || right.getBasicType() == EbtFloat16;
else if (getBasicType() == EbtUint || getBasicType() == EbtUint8)
rv = right.getBasicType() == EbtUint || right.getBasicType() == EbtUint8;
else if (getBasicType() == EbtInt || getBasicType() == EbtInt8)
rv = right.getBasicType() == EbtInt || right.getBasicType() == EbtInt8;
else
rv = false;
return rv;
}
// See if two types match in all ways (just the actual type, not qualification)
bool operator==(const TType& right) const
{
......
......@@ -4797,6 +4797,60 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"void coopMatStoreNV(fcoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
"fcoopmatNV coopMatMulAddNV(fcoopmatNV A, fcoopmatNV B, fcoopmatNV C);\n"
"void coopMatLoadNV(out icoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out icoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out icoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out icoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out icoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out icoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out icoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out icoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out icoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out icoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out icoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out icoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(icoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(icoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(icoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(icoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(icoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(icoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(icoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(icoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(icoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(icoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(icoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(icoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(ucoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(ucoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(ucoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(ucoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(ucoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(ucoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(ucoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(ucoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(ucoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(ucoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(ucoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"
"void coopMatStoreNV(ucoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
"icoopmatNV coopMatMulAddNV(icoopmatNV A, icoopmatNV B, icoopmatNV C);\n"
"ucoopmatNV coopMatMulAddNV(ucoopmatNV A, ucoopmatNV B, ucoopmatNV C);\n"
);
}
......@@ -8527,9 +8581,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic);
}
symbolTable.setFunctionExtensions("coopMatLoadNV", 1, &E_GL_NV_cooperative_matrix);
symbolTable.setFunctionExtensions("coopMatStoreNV", 1, &E_GL_NV_cooperative_matrix);
symbolTable.setFunctionExtensions("coopMatMulAddNV", 1, &E_GL_NV_cooperative_matrix);
{
const char *coopExt[2] = { E_GL_NV_cooperative_matrix, E_GL_NV_integer_cooperative_matrix };
symbolTable.setFunctionExtensions("coopMatLoadNV", 2, coopExt);
symbolTable.setFunctionExtensions("coopMatStoreNV", 2, coopExt);
symbolTable.setFunctionExtensions("coopMatMulAddNV", 2, coopExt);
}
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_NV_compute_shader_derivatives);
......
......@@ -6192,6 +6192,8 @@ const TFunction* TParseContext::findFunction400(const TSourceLoc& loc, const TFu
}
if (from.isArray() || to.isArray() || ! from.sameElementShape(to))
return false;
if (from.isCoopMat() && to.isCoopMat())
return from.sameCoopMatBaseType(to);
return intermediate.canImplicitlyPromote(from.getBasicType(), to.getBasicType());
};
......@@ -6266,6 +6268,8 @@ const TFunction* TParseContext::findFunctionExplicitTypes(const TSourceLoc& loc,
}
if (from.isArray() || to.isArray() || ! from.sameElementShape(to))
return false;
if (from.isCoopMat() && to.isCoopMat())
return from.sameCoopMatBaseType(to);
return intermediate.canImplicitlyPromote(from.getBasicType(), to.getBasicType());
};
......@@ -6365,12 +6369,20 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden
if (!publicType.typeParameters || publicType.typeParameters->getNumDims() != 4) {
error(loc, "expected four type parameters", identifier.c_str(), "");
}
if (publicType.typeParameters &&
publicType.typeParameters->getDimSize(0) != 16 &&
publicType.typeParameters->getDimSize(0) != 32 &&
publicType.typeParameters->getDimSize(0) != 64) {
error(loc, "expected 16, 32, or 64 bits for first type parameter", identifier.c_str(), "");
if (publicType.typeParameters) {
if (isTypeFloat(publicType.basicType) &&
publicType.typeParameters->getDimSize(0) != 16 &&
publicType.typeParameters->getDimSize(0) != 32 &&
publicType.typeParameters->getDimSize(0) != 64) {
error(loc, "expected 16, 32, or 64 bits for first type parameter", identifier.c_str(), "");
}
if (isTypeInt(publicType.basicType) &&
publicType.typeParameters->getDimSize(0) != 8 &&
publicType.typeParameters->getDimSize(0) != 32) {
error(loc, "expected 8 or 32 bits for first type parameter", identifier.c_str(), "");
}
}
} else {
if (publicType.typeParameters && publicType.typeParameters->getNumDims() != 0) {
error(loc, "unexpected type parameters", identifier.c_str(), "");
......@@ -7065,19 +7077,90 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
}
node = intermediate.setAggregateOperator(node, EOpConstructCooperativeMatrix, type, node->getLoc());
} else {
TOperator op;
switch (type.getBasicType()) {
default:
assert(0);
break;
case EbtInt:
{
switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToInt; break;
case EbtFloat16: op = EOpConvFloat16ToInt; break;
case EbtUint8: op = EOpConvUint8ToInt; break;
case EbtInt8: op = EOpConvInt8ToInt; break;
case EbtUint: op = EOpConvUintToInt; break;
default: assert(0);
}
}
break;
case EbtUint:
{
switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToUint; break;
case EbtFloat16: op = EOpConvFloat16ToUint; break;
case EbtUint8: op = EOpConvUint8ToUint; break;
case EbtInt8: op = EOpConvInt8ToUint; break;
case EbtInt: op = EOpConvIntToUint; break;
case EbtUint: op = EOpConvUintToInt8; break;
default: assert(0);
}
}
break;
case EbtInt8:
{
switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToInt8; break;
case EbtFloat16: op = EOpConvFloat16ToInt8; break;
case EbtUint8: op = EOpConvUint8ToInt8; break;
case EbtInt: op = EOpConvIntToInt8; break;
case EbtUint: op = EOpConvUintToInt8; break;
default: assert(0);
}
}
break;
case EbtUint8: {
switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToUint8; break;
case EbtFloat16: op = EOpConvFloat16ToUint8; break;
case EbtInt8: op = EOpConvInt8ToUint8; break;
case EbtInt: op = EOpConvIntToUint8; break;
case EbtUint: op = EOpConvUintToUint8; break;
default: assert(0);
}
}
break;
case EbtFloat:
assert(node->getType().getBasicType() == EbtFloat16);
node = intermediate.addUnaryNode(EOpConvFloat16ToFloat, node, node->getLoc(), type);
{
switch (node->getType().getBasicType()) {
case EbtFloat16: op = EOpConvFloat16ToFloat; break;
case EbtInt8: op = EOpConvInt8ToFloat; break;
case EbtUint8: op = EOpConvUint8ToFloat; break;
case EbtInt: op = EOpConvIntToFloat; break;
case EbtUint: op = EOpConvUintToFloat; break;
default: assert(0);
}
}
break;
case EbtFloat16:
assert(node->getType().getBasicType() == EbtFloat);
node = intermediate.addUnaryNode(EOpConvFloatToFloat16, node, node->getLoc(), type);
{
switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToFloat16; break;
case EbtInt8: op = EOpConvInt8ToFloat16; break;
case EbtUint8: op = EOpConvUint8ToFloat16; break;
case EbtInt: op = EOpConvIntToFloat16; break;
case EbtUint: op = EOpConvUintToFloat16; break;
default: assert(0);
}
}
break;
}
node = intermediate.addUnaryNode(op, node, node->getLoc(), type);
// If it's a (non-specialization) constant, it must be folded.
if (node->getAsUnaryNode()->getOperand()->getAsConstantUnion())
return node->getAsUnaryNode()->getOperand()->getAsConstantUnion()->fold(op, node->getType());
......
......@@ -713,6 +713,8 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["taskNV"] = PERTASKNV;
(*KeywordMap)["fcoopmatNV"] = FCOOPMATNV;
(*KeywordMap)["icoopmatNV"] = ICOOPMATNV;
(*KeywordMap)["ucoopmatNV"] = UCOOPMATNV;
ReservedSet = new std::unordered_set<const char*, str_hash, str_eq>;
......@@ -1599,6 +1601,14 @@ int TScanContext::tokenizeIdentifier()
return keyword;
return identifierOrType();
case UCOOPMATNV:
case ICOOPMATNV:
afterType = true;
if (parseContext.symbolTable.atBuiltInLevel() ||
parseContext.extensionTurnedOn(E_GL_NV_integer_cooperative_matrix))
return keyword;
return identifierOrType();
case DEMOTE:
if (parseContext.extensionTurnedOn(E_GL_EXT_demote_to_helper_invocation))
return keyword;
......
......@@ -252,6 +252,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_NV_cooperative_matrix] = EBhDisable;
extensionBehavior[E_GL_NV_shader_sm_builtins] = EBhDisable;
extensionBehavior[E_GL_NV_integer_cooperative_matrix] = EBhDisable;
// AEP
extensionBehavior[E_GL_ANDROID_extension_pack_es31a] = EBhDisable;
......@@ -436,6 +437,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_NV_shader_texture_footprint 1\n"
"#define GL_NV_mesh_shader 1\n"
"#define GL_NV_cooperative_matrix 1\n"
"#define GL_NV_integer_cooperative_matrix 1\n"
"#define GL_EXT_shader_explicit_arithmetic_types 1\n"
"#define GL_EXT_shader_explicit_arithmetic_types_int8 1\n"
......@@ -822,6 +824,8 @@ void TParseVersions::updateExtensionBehavior(int line, const char* extension, co
updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString);
else if (strcmp(extension, "GL_EXT_buffer_reference2") == 0)
updateExtensionBehavior(line, "GL_EXT_buffer_reference", behaviorString);
else if (strcmp(extension, "GL_NV_integer_cooperative_matrix") == 0)
updateExtensionBehavior(line, "GL_NV_cooperative_matrix", behaviorString);
}
void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBehavior behavior)
......@@ -1088,8 +1092,15 @@ void TParseVersions::fcoopmatCheck(const TSourceLoc& loc, const char* op, bool b
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
}
}
#endif // GLSLANG_WEB
void TParseVersions::intcoopmatCheck(const TSourceLoc& loc, const char* op, bool builtIn)
{
if (!builtIn) {
const char* const extensions[] = {E_GL_NV_integer_cooperative_matrix};
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
}
}
#endif // GLSLANG_WEB
// Call for any operation removed because SPIR-V is in use.
void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op)
{
......
......@@ -227,6 +227,7 @@ const int Num_viewportEXTs = sizeof(viewportEXTs) / sizeof(viewportEXTs[0]);
const char* const E_GL_NV_cooperative_matrix = "GL_NV_cooperative_matrix";
const char* const E_GL_NV_shader_sm_builtins = "GL_NV_shader_sm_builtins";
const char* const E_GL_NV_integer_cooperative_matrix = "GL_NV_integer_cooperative_matrix";
// AEP
const char* const E_GL_ANDROID_extension_pack_es31a = "GL_ANDROID_extension_pack_es31a";
......
......@@ -200,7 +200,7 @@ GLSLANG_WEB_EXCLUDE_ON
%token <lex> F64MAT4X2 F64MAT4X3 F64MAT4X4
%token <lex> ATOMIC_UINT
%token <lex> ACCSTRUCTNV
%token <lex> FCOOPMATNV
%token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV
// combined image/sampler
%token <lex> SAMPLER1D SAMPLER1DARRAY SAMPLER1DARRAYSHADOW ISAMPLER1D SAMPLER1DSHADOW
......@@ -3183,6 +3183,18 @@ GLSLANG_WEB_EXCLUDE_ON
$$.basicType = EbtFloat;
$$.coopmat = true;
}
| ICOOPMATNV {
parseContext.intcoopmatCheck($1.loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtInt;
$$.coopmat = true;
}
| UCOOPMATNV {
parseContext.intcoopmatCheck($1.loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtUint;
$$.coopmat = true;
}
GLSLANG_WEB_EXCLUDE_OFF
| struct_specifier {
$$ = $1;
......
......@@ -200,7 +200,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> F64MAT4X2 F64MAT4X3 F64MAT4X4
%token <lex> ATOMIC_UINT
%token <lex> ACCSTRUCTNV
%token <lex> FCOOPMATNV
%token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV
// combined image/sampler
%token <lex> SAMPLER1D SAMPLER1DARRAY SAMPLER1DARRAYSHADOW ISAMPLER1D SAMPLER1DSHADOW
......@@ -3183,6 +3183,18 @@ type_specifier_nonarray
$$.basicType = EbtFloat;
$$.coopmat = true;
}
| ICOOPMATNV {
parseContext.intcoopmatCheck($1.loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtInt;
$$.coopmat = true;
}
| UCOOPMATNV {
parseContext.intcoopmatCheck($1.loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtUint;
$$.coopmat = true;
}
| struct_specifier {
$$ = $1;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -161,6 +161,7 @@ public:
virtual void explicitFloat32Check(const TSourceLoc&, const char* op, bool builtIn = false);
virtual void explicitFloat64Check(const TSourceLoc&, const char* op, bool builtIn = false);
virtual void fcoopmatCheck(const TSourceLoc&, const char* op, bool builtIn = false);
virtual void intcoopmatCheck(const TSourceLoc&, const char *op, bool builtIn = false);
bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; }
bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; }
bool isForwardCompatible() const { return forwardCompatible; }
......
......@@ -325,6 +325,7 @@ INSTANTIATE_TEST_CASE_P(
"spv.GeometryShaderPassthrough.geom",
"spv.interpOps.frag",
"spv.int64.frag",
"spv.intcoopmat.comp",
"spv.intOps.vert",
"spv.layoutNested.vert",
"spv.length.frag",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment