GLSL/SPV: Implement SPV_EXT_descriptor_indexing and GL_EXT_nonuniform_qualifier

This commit is contained in:
John Kessenich 2018-04-05 11:25:02 -06:00
parent 0b5e5da7e7
commit 5611c6d27b
31 changed files with 5887 additions and 4668 deletions

View File

@ -102,6 +102,7 @@ private:
struct OpDecorations {
spv::Decoration precision;
spv::Decoration noContraction;
spv::Decoration nonUniform;
};
} // namespace
@ -136,12 +137,14 @@ protected:
spv::Decoration TranslateInterpolationDecoration(const glslang::TQualifier& qualifier);
spv::Decoration TranslateAuxiliaryStorageDecoration(const glslang::TQualifier& qualifier);
spv::Decoration TranslateNonUniformDecoration(const glslang::TQualifier& qualifier);
spv::BuiltIn TranslateBuiltInDecoration(glslang::TBuiltInVariable, bool memberDeclaration);
spv::ImageFormat TranslateImageFormat(const glslang::TType& type);
spv::SelectionControlMask TranslateSelectionControl(const glslang::TIntermSelection&) const;
spv::SelectionControlMask TranslateSwitchControl(const glslang::TIntermSwitch&) const;
spv::LoopControlMask TranslateLoopControl(const glslang::TIntermLoop&, unsigned int& dependencyLength) const;
spv::StorageClass TranslateStorageClass(const glslang::TType&);
void addIndirectionIndexCapabilities(const glslang::TType& baseType, const glslang::TType& indexType);
spv::Id createSpvVariable(const glslang::TIntermSymbol*);
spv::Id getSampledType(const glslang::TSampler&);
spv::Id getInvertedSwizzleType(const glslang::TIntermTyped&);
@ -443,6 +446,17 @@ spv::Decoration TranslateNoContractionDecoration(const glslang::TQualifier& qual
return spv::DecorationMax;
}
// If glslang type is nonUniform, return SPIR-V NonUniform decoration.
spv::Decoration TGlslangToSpvTraverser::TranslateNonUniformDecoration(const glslang::TQualifier& qualifier)
{
if (qualifier.isNonUniform()) {
builder.addExtension("SPV_EXT_descriptor_indexing");
builder.addCapability(spv::CapabilityShaderNonUniformEXT);
return spv::DecorationNonUniformEXT;
} else
return spv::DecorationMax;
}
// Translate a glslang built-in variable to a SPIR-V built in decoration. Also generate
// associated capabilities when required. For some built-in variables, a capability
// is generated only when using the variable in an executable instruction, but not when
@ -889,6 +903,42 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T
return spv::StorageClassFunction;
}
// Add capabilities pertaining to how an array is indexed.
void TGlslangToSpvTraverser::addIndirectionIndexCapabilities(const glslang::TType& baseType,
const glslang::TType& indexType)
{
if (indexType.getQualifier().isNonUniform()) {
// deal with an asserted non-uniform index
if (baseType.getBasicType() == glslang::EbtSampler) {
if (baseType.getQualifier().hasAttachment())
builder.addCapability(spv::CapabilityInputAttachmentArrayNonUniformIndexingEXT);
else if (baseType.isImage() && baseType.getSampler().dim == glslang::EsdBuffer)
builder.addCapability(spv::CapabilityStorageTexelBufferArrayNonUniformIndexingEXT);
else if (baseType.isTexture() && baseType.getSampler().dim == glslang::EsdBuffer)
builder.addCapability(spv::CapabilityUniformTexelBufferArrayNonUniformIndexingEXT);
else if (baseType.isImage())
builder.addCapability(spv::CapabilityStorageImageArrayNonUniformIndexingEXT);
else if (baseType.isTexture())
builder.addCapability(spv::CapabilitySampledImageArrayNonUniformIndexingEXT);
} else if (baseType.getBasicType() == glslang::EbtBlock) {
if (baseType.getQualifier().storage == glslang::EvqBuffer)
builder.addCapability(spv::CapabilityStorageBufferArrayNonUniformIndexingEXT);
else if (baseType.getQualifier().storage == glslang::EvqUniform)
builder.addCapability(spv::CapabilityUniformBufferArrayNonUniformIndexingEXT);
}
} else {
// assume a dynamically uniform index
if (baseType.getBasicType() == glslang::EbtSampler) {
if (baseType.getQualifier().hasAttachment())
builder.addCapability(spv::CapabilityInputAttachmentArrayDynamicIndexingEXT);
else if (baseType.isImage() && baseType.getSampler().dim == glslang::EsdBuffer)
builder.addCapability(spv::CapabilityStorageTexelBufferArrayDynamicIndexingEXT);
else if (baseType.isTexture() && baseType.getSampler().dim == glslang::EsdBuffer)
builder.addCapability(spv::CapabilityUniformTexelBufferArrayDynamicIndexingEXT);
}
}
}
// Return whether or not the given type is something that should be tied to a
// descriptor set.
bool IsDescriptorResource(const glslang::TType& type)
@ -1286,7 +1336,8 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T
// do the operation
OpDecorations decorations = { TranslatePrecisionDecoration(node->getOperationPrecision()),
TranslateNoContractionDecoration(node->getType().getQualifier()) };
TranslateNoContractionDecoration(node->getType().getQualifier()),
TranslateNonUniformDecoration(node->getType().getQualifier()) };
rValue = createBinaryOperation(node->getOp(), decorations,
convertGlslangToSpvType(node->getType()), leftRValue, rValue,
node->getType().getBasicType());
@ -1362,6 +1413,8 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T
node->getRight()->traverse(this);
spv::Id index = accessChainLoad(node->getRight()->getType());
addIndirectionIndexCapabilities(node->getLeft()->getType(), node->getRight()->getType());
// restore the saved access chain
builder.setAccessChain(partial);
@ -1415,7 +1468,8 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T
// get result
OpDecorations decorations = { TranslatePrecisionDecoration(node->getOperationPrecision()),
TranslateNoContractionDecoration(node->getType().getQualifier()) };
TranslateNoContractionDecoration(node->getType().getQualifier()),
TranslateNonUniformDecoration(node->getType().getQualifier()) };
spv::Id result = createBinaryOperation(node->getOp(), decorations,
convertGlslangToSpvType(node->getType()), left, right,
node->getLeft()->getType().getBasicType());
@ -1454,6 +1508,11 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
if (node->getOp() == glslang::EOpArrayLength) {
// Quite special; won't want to evaluate the operand.
// Currently, the front-end does not allow .length() on an array until it is sized,
// except for the last block membeor of an SSBO.
// TODO: If this changes, link-time sized arrays might show up here, and need their
// size extracted.
// Normal .length() would have been constant folded by the front-end.
// So, this has to be block.lastMember.length().
// SPV wants "block" and member number as the operands, go get them.
@ -1495,7 +1554,8 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
operand = accessChainLoad(node->getOperand()->getType());
OpDecorations decorations = { TranslatePrecisionDecoration(node->getOperationPrecision()),
TranslateNoContractionDecoration(node->getType().getQualifier()) };
TranslateNoContractionDecoration(node->getType().getQualifier()),
TranslateNonUniformDecoration(node->getType().getQualifier()) };
// it could be a conversion
if (! result)
@ -1506,8 +1566,10 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
result = createUnaryOperation(node->getOp(), decorations, resultType(), operand, node->getOperand()->getBasicType());
if (result) {
if (invertedType)
if (invertedType) {
result = createInvertedSwizzle(decorations.precision, *node->getOperand(), result);
builder.addDecoration(result, decorations.nonUniform);
}
builder.clearAccessChain();
builder.setAccessChainRValue(result);
@ -1934,7 +1996,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
builder.setLine(node->getLoc().line);
OpDecorations decorations = { precision,
TranslateNoContractionDecoration(node->getType().getQualifier()) };
TranslateNoContractionDecoration(node->getType().getQualifier()),
TranslateNonUniformDecoration(node->getType().getQualifier()) };
result = createBinaryOperation(binOp, decorations,
resultType(), leftId, rightId,
left->getType().getBasicType(), reduceComparison);
@ -2035,7 +2098,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
case 1:
{
OpDecorations decorations = { precision,
TranslateNoContractionDecoration(node->getType().getQualifier()) };
TranslateNoContractionDecoration(node->getType().getQualifier()),
TranslateNonUniformDecoration(node->getType().getQualifier()) };
result = createUnaryOperation(
node->getOp(), decorations,
resultType(), operands.front(),
@ -2651,8 +2715,13 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
// (Unsized arrays that survive through linking will be runtime-sized arrays)
if (type.isSizedArray())
spvType = builder.makeArrayType(spvType, makeArraySizeId(*type.getArraySizes(), 0), stride);
else
else {
if (!lastBufferBlockMember) {
builder.addExtension("SPV_EXT_descriptor_indexing");
builder.addCapability(spv::CapabilityRuntimeDescriptorArrayEXT);
}
spvType = builder.makeRuntimeArray(spvType);
}
if (stride > 0)
builder.addDecoration(spvType, spv::DecorationArrayStride, stride);
}
@ -2824,6 +2893,9 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type,
if (builtIn != spv::BuiltInMax)
builder.addMemberDecoration(spvType, member, spv::DecorationBuiltIn, (int)builtIn);
// nonuniform
builder.addMemberDecoration(spvType, member, TranslateNonUniformDecoration(glslangMember.getQualifier()));
if (glslangIntermediate->getHlslFunctionality1() && memberQualifier.semanticName != nullptr) {
builder.addExtension("SPV_GOOGLE_hlsl_functionality1");
builder.addMemberDecoration(spvType, member, (spv::Decoration)spv::DecorationHlslSemanticGOOGLE,
@ -2891,7 +2963,8 @@ spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arra
spv::Id TGlslangToSpvTraverser::accessChainLoad(const glslang::TType& type)
{
spv::Id nominalTypeId = builder.accessChainGetInferredType();
spv::Id loadedId = builder.accessChainLoad(TranslatePrecisionDecoration(type), nominalTypeId);
spv::Id loadedId = builder.accessChainLoad(TranslatePrecisionDecoration(type),
TranslateNonUniformDecoration(type.getQualifier()), nominalTypeId);
// Need to convert to abstract types when necessary
if (type.getBasicType() == glslang::EbtBool) {
@ -4102,6 +4175,7 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, OpD
spv::Id result = builder.createBinOp(binOp, typeId, left, right);
builder.addDecoration(result, decorations.noContraction);
builder.addDecoration(result, decorations.nonUniform);
return builder.setPrecision(result, decorations.precision);
}
@ -4113,6 +4187,7 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, OpD
if (reduceComparison && (op == glslang::EOpEqual || op == glslang::EOpNotEqual)
&& (builder.isVector(left) || builder.isMatrix(left) || builder.isAggregate(left))) {
spv::Id result = builder.createCompositeCompare(decorations.precision, left, right, op == glslang::EOpEqual);
builder.addDecoration(result, decorations.nonUniform);
return result;
}
@ -4174,6 +4249,7 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, OpD
if (binOp != spv::OpNop) {
spv::Id result = builder.createBinOp(binOp, typeId, left, right);
builder.addDecoration(result, decorations.noContraction);
builder.addDecoration(result, decorations.nonUniform);
return builder.setPrecision(result, decorations.precision);
}
@ -4235,6 +4311,7 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, OpDecora
if (firstClass) {
spv::Id result = builder.createBinOp(op, typeId, left, right);
builder.addDecoration(result, decorations.noContraction);
builder.addDecoration(result, decorations.nonUniform);
return builder.setPrecision(result, decorations.precision);
}
@ -4274,11 +4351,13 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, OpDecora
spv::Id rightVec = rightMat ? builder.createCompositeExtract(right, vecType, indexes) : smearVec;
spv::Id result = builder.createBinOp(op, vecType, leftVec, rightVec);
builder.addDecoration(result, decorations.noContraction);
builder.addDecoration(result, decorations.nonUniform);
results.push_back(builder.setPrecision(result, decorations.precision));
}
// put the pieces together
spv::Id result = builder.setPrecision(builder.createCompositeConstruct(typeId, results), decorations.precision);
builder.addDecoration(result, decorations.nonUniform);
return result;
}
default:
@ -4687,6 +4766,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe
}
builder.addDecoration(id, decorations.noContraction);
builder.addDecoration(id, decorations.nonUniform);
return builder.setPrecision(id, decorations.precision);
}
@ -4715,11 +4795,13 @@ spv::Id TGlslangToSpvTraverser::createUnaryMatrixOperation(spv::Op op, OpDecorat
spv::Id srcVec = builder.createCompositeExtract(operand, srcVecType, indexes);
spv::Id destVec = builder.createUnaryOp(op, destVecType, srcVec);
builder.addDecoration(destVec, decorations.noContraction);
builder.addDecoration(destVec, decorations.nonUniform);
results.push_back(builder.setPrecision(destVec, decorations.precision));
}
// put the pieces together
spv::Id result = builder.setPrecision(builder.createCompositeConstruct(typeId, results), decorations.precision);
builder.addDecoration(result, decorations.nonUniform);
return result;
}
@ -5177,6 +5259,7 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora
result = builder.createUnaryOp(convOp, destType, operand);
result = builder.setPrecision(result, decorations.precision);
builder.addDecoration(result, decorations.nonUniform);
return result;
}
@ -6396,6 +6479,9 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
if (builtIn != spv::BuiltInMax)
builder.addDecoration(id, spv::DecorationBuiltIn, (int)builtIn);
// nonuniform
builder.addDecoration(id, TranslateNonUniformDecoration(symbol->getType().getQualifier()));
#ifdef NV_EXTENSIONS
if (builtIn == spv::BuiltInSampleMask) {
spv::Decoration decoration;

View File

@ -2331,7 +2331,7 @@ void Builder::accessChainStore(Id rvalue)
}
// Comments in header
Id Builder::accessChainLoad(Decoration precision, Id resultType)
Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resultType)
{
Id id;
@ -2377,6 +2377,7 @@ Id Builder::accessChainLoad(Decoration precision, Id resultType)
// load through the access chain
id = createLoad(collapseAccessChain());
setPrecision(id, precision);
addDecoration(id, nonUniform);
}
// Done, unless there are swizzles to do
@ -2397,6 +2398,7 @@ Id Builder::accessChainLoad(Decoration precision, Id resultType)
if (accessChain.component != NoResult)
id = setPrecision(createVectorExtractDynamic(id, resultType, accessChain.component), precision);
addDecoration(id, nonUniform);
return id;
}

View File

@ -554,7 +554,7 @@ public:
void accessChainStore(Id rvalue);
// use accessChain and swizzle to load an r-value
Id accessChainLoad(Decoration precision, Id ResultType);
Id accessChainLoad(Decoration precision, Decoration nonUniform, Id ResultType);
// get the direct pointer for an l-value
Id accessChainGetLValue();

View File

@ -255,6 +255,7 @@ const char* DecorationString(int decoration)
case DecorationSecondaryViewportRelativeNV: return "SecondaryViewportRelativeNV";
#endif
case DecorationNonUniformEXT: return "DecorationNonUniformEXT";
case DecorationHlslCounterBufferGOOGLE: return "DecorationHlslCounterBufferGOOGLE";
case DecorationHlslSemanticGOOGLE: return "DecorationHlslSemanticGOOGLE";
}
@ -815,6 +816,19 @@ const char* CapabilityString(int info)
case CapabilityFragmentFullyCoveredEXT: return "FragmentFullyCoveredEXT";
case CapabilityShaderNonUniformEXT: return "CapabilityShaderNonUniformEXT";
case CapabilityRuntimeDescriptorArrayEXT: return "CapabilityRuntimeDescriptorArrayEXT";
case CapabilityInputAttachmentArrayDynamicIndexingEXT: return "CapabilityInputAttachmentArrayDynamicIndexingEXT";
case CapabilityUniformTexelBufferArrayDynamicIndexingEXT: return "CapabilityUniformTexelBufferArrayDynamicIndexingEXT";
case CapabilityStorageTexelBufferArrayDynamicIndexingEXT: return "CapabilityStorageTexelBufferArrayDynamicIndexingEXT";
case CapabilityUniformBufferArrayNonUniformIndexingEXT: return "CapabilityUniformBufferArrayNonUniformIndexingEXT";
case CapabilitySampledImageArrayNonUniformIndexingEXT: return "CapabilitySampledImageArrayNonUniformIndexingEXT";
case CapabilityStorageBufferArrayNonUniformIndexingEXT: return "CapabilityStorageBufferArrayNonUniformIndexingEXT";
case CapabilityStorageImageArrayNonUniformIndexingEXT: return "CapabilityStorageImageArrayNonUniformIndexingEXT";
case CapabilityInputAttachmentArrayNonUniformIndexingEXT: return "CapabilityInputAttachmentArrayNonUniformIndexingEXT";
case CapabilityUniformTexelBufferArrayNonUniformIndexingEXT: return "CapabilityUniformTexelBufferArrayNonUniformIndexingEXT";
case CapabilityStorageTexelBufferArrayNonUniformIndexingEXT: return "CapabilityStorageTexelBufferArrayNonUniformIndexingEXT";
default: return "Bad";
}
}

13
SPIRV/spirv.hpp Executable file → Normal file
View File

@ -393,6 +393,7 @@ enum Decoration {
DecorationPassthroughNV = 5250,
DecorationViewportRelativeNV = 5252,
DecorationSecondaryViewportRelativeNV = 5256,
DecorationNonUniformEXT = 5300,
DecorationHlslCounterBufferGOOGLE = 5634,
DecorationHlslSemanticGOOGLE = 5635,
DecorationMax = 0x7fffffff,
@ -692,6 +693,18 @@ enum Capability {
CapabilityPerViewAttributesNV = 5260,
CapabilityFragmentFullyCoveredEXT = 5265,
CapabilityGroupNonUniformPartitionedNV = 5297,
CapabilityShaderNonUniformEXT = 5301,
CapabilityRuntimeDescriptorArrayEXT = 5302,
CapabilityInputAttachmentArrayDynamicIndexingEXT = 5303,
CapabilityUniformTexelBufferArrayDynamicIndexingEXT = 5304,
CapabilityStorageTexelBufferArrayDynamicIndexingEXT = 5305,
CapabilityUniformBufferArrayNonUniformIndexingEXT = 5306,
CapabilitySampledImageArrayNonUniformIndexingEXT = 5307,
CapabilityStorageBufferArrayNonUniformIndexingEXT = 5308,
CapabilityStorageImageArrayNonUniformIndexingEXT = 5309,
CapabilityInputAttachmentArrayNonUniformIndexingEXT = 5310,
CapabilityUniformTexelBufferArrayNonUniformIndexingEXT = 5311,
CapabilityStorageTexelBufferArrayNonUniformIndexingEXT = 5312,
CapabilitySubgroupShuffleINTEL = 5568,
CapabilitySubgroupBufferBlockIOINTEL = 5569,
CapabilitySubgroupImageBlockIOINTEL = 5570,

18
Test/310runtimeArray.vert Normal file
View File

@ -0,0 +1,18 @@
#version 310 es
precision highp float;
layout(location=0) out float o;
struct S { float f; };
buffer b1 { S s[]; };
buffer b2 { S s[]; } b2name;
buffer b3 { S s[]; } b3name[];
buffer b4 { S s[]; } b4name[4];
void main()
{
o = s[5].f;
o += b2name.s[6].f;
o += b3name[3].s[7].f;
o += b4name[2].s[8].f;
}

View File

@ -0,0 +1,145 @@
310runtimeArray.vert
ERROR: 0:9: '' : array size required
ERROR: 1 compilation errors. No code generated.
Shader version: 310
ERROR: node is still EOpNull!
0:12 Function Definition: main( ( global void)
0:12 Function Parameters:
0:14 Sequence
0:14 move second child to first child ( temp highp float)
0:14 'o' (layout( location=0) smooth out highp float)
0:14 f: direct index for structure ( global highp float)
0:14 direct index (layout( column_major shared) temp structure{ global highp float f})
0:14 s: direct index for structure (layout( column_major shared) buffer unsized 6-element array of structure{ global highp float f})
0:14 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 6-element array of structure{ global highp float f} s})
0:14 Constant:
0:14 0 (const uint)
0:14 Constant:
0:14 5 (const int)
0:14 Constant:
0:14 0 (const int)
0:15 add second child into first child ( temp highp float)
0:15 'o' (layout( location=0) smooth out highp float)
0:15 f: direct index for structure ( global highp float)
0:15 direct index (layout( column_major shared) temp structure{ global highp float f})
0:15 s: direct index for structure (layout( column_major shared) buffer unsized 7-element array of structure{ global highp float f})
0:15 'b2name' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 7-element array of structure{ global highp float f} s})
0:15 Constant:
0:15 0 (const int)
0:15 Constant:
0:15 6 (const int)
0:15 Constant:
0:15 0 (const int)
0:16 add second child into first child ( temp highp float)
0:16 'o' (layout( location=0) smooth out highp float)
0:16 f: direct index for structure ( global highp float)
0:16 direct index (layout( column_major shared) temp structure{ global highp float f})
0:16 s: direct index for structure (layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f})
0:16 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f} s})
0:16 'b3name' (layout( column_major shared) buffer unsized 4-element array of block{layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f} s})
0:16 Constant:
0:16 3 (const int)
0:16 Constant:
0:16 0 (const int)
0:16 Constant:
0:16 7 (const int)
0:16 Constant:
0:16 0 (const int)
0:17 add second child into first child ( temp highp float)
0:17 'o' (layout( location=0) smooth out highp float)
0:17 f: direct index for structure ( global highp float)
0:17 direct index (layout( column_major shared) temp structure{ global highp float f})
0:17 s: direct index for structure (layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f})
0:17 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f} s})
0:17 'b4name' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f} s})
0:17 Constant:
0:17 2 (const int)
0:17 Constant:
0:17 0 (const int)
0:17 Constant:
0:17 8 (const int)
0:17 Constant:
0:17 0 (const int)
0:? Linker Objects
0:? 'o' (layout( location=0) smooth out highp float)
0:? 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 6-element array of structure{ global highp float f} s})
0:? 'b2name' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 7-element array of structure{ global highp float f} s})
0:? 'b3name' (layout( column_major shared) buffer unsized 4-element array of block{layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f} s})
0:? 'b4name' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f} s})
0:? 'gl_VertexID' ( gl_VertexId highp int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId highp int InstanceId)
Linked vertex stage:
Shader version: 310
ERROR: node is still EOpNull!
0:12 Function Definition: main( ( global void)
0:12 Function Parameters:
0:14 Sequence
0:14 move second child to first child ( temp highp float)
0:14 'o' (layout( location=0) smooth out highp float)
0:14 f: direct index for structure ( global highp float)
0:14 direct index (layout( column_major shared) temp structure{ global highp float f})
0:14 s: direct index for structure (layout( column_major shared) buffer unsized 6-element array of structure{ global highp float f})
0:14 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 6-element array of structure{ global highp float f} s})
0:14 Constant:
0:14 0 (const uint)
0:14 Constant:
0:14 5 (const int)
0:14 Constant:
0:14 0 (const int)
0:15 add second child into first child ( temp highp float)
0:15 'o' (layout( location=0) smooth out highp float)
0:15 f: direct index for structure ( global highp float)
0:15 direct index (layout( column_major shared) temp structure{ global highp float f})
0:15 s: direct index for structure (layout( column_major shared) buffer unsized 7-element array of structure{ global highp float f})
0:15 'b2name' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 7-element array of structure{ global highp float f} s})
0:15 Constant:
0:15 0 (const int)
0:15 Constant:
0:15 6 (const int)
0:15 Constant:
0:15 0 (const int)
0:16 add second child into first child ( temp highp float)
0:16 'o' (layout( location=0) smooth out highp float)
0:16 f: direct index for structure ( global highp float)
0:16 direct index (layout( column_major shared) temp structure{ global highp float f})
0:16 s: direct index for structure (layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f})
0:16 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f} s})
0:16 'b3name' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f} s})
0:16 Constant:
0:16 3 (const int)
0:16 Constant:
0:16 0 (const int)
0:16 Constant:
0:16 7 (const int)
0:16 Constant:
0:16 0 (const int)
0:17 add second child into first child ( temp highp float)
0:17 'o' (layout( location=0) smooth out highp float)
0:17 f: direct index for structure ( global highp float)
0:17 direct index (layout( column_major shared) temp structure{ global highp float f})
0:17 s: direct index for structure (layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f})
0:17 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f} s})
0:17 'b4name' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f} s})
0:17 Constant:
0:17 2 (const int)
0:17 Constant:
0:17 0 (const int)
0:17 Constant:
0:17 8 (const int)
0:17 Constant:
0:17 0 (const int)
0:? Linker Objects
0:? 'o' (layout( location=0) smooth out highp float)
0:? 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 6-element array of structure{ global highp float f} s})
0:? 'b2name' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 7-element array of structure{ global highp float f} s})
0:? 'b3name' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f} s})
0:? 'b4name' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f} s})
0:? 'gl_VertexID' ( gl_VertexId highp int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId highp int InstanceId)

View File

@ -51,7 +51,7 @@ ERROR: 0:157: 'textureQueryLevels' : no matching overloaded function found
ERROR: 0:157: 'assign' : cannot convert from ' const float' to ' temp int'
ERROR: 0:158: 'textureQueryLevels' : no matching overloaded function found
ERROR: 0:158: 'assign' : cannot convert from ' const float' to ' temp int'
WARNING: 0:161: '[]' : assuming array size of one for compile-time checking of binding numbers for unsized array
WARNING: 0:161: '[]' : assuming binding count of one for compile-time checking of binding numbers for unsized array
ERROR: 51 compilation errors. No code generated.

View File

@ -25,7 +25,7 @@ ERROR: 0:101: '[' : array index out of range '5'
ERROR: 0:104: 'constructor' : array constructor must have at least one argument
ERROR: 0:104: '=' : cannot convert from ' const float' to ' global unsized 1-element array of int'
ERROR: 0:106: 'constructor' : array argument must be sized
ERROR: 0:111: '[' : array must be redeclared with a size before being indexed with a variable
ERROR: 0:111: 'variable index' : required extension not requested: GL_EXT_nonuniform_qualifier
ERROR: 0:111: 'variable indexing sampler array' : not supported with this profile: none
ERROR: 28 compilation errors. No code generated.

View File

@ -0,0 +1,92 @@
nonuniform.frag
ERROR: 0:10: 'nonuniformEXT' : for non-parameter, can only apply to 'in' or no storage qualifier
ERROR: 0:11: 'nonuniformEXT' : for non-parameter, can only apply to 'in' or no storage qualifier
ERROR: 0:12: 'nonuniformEXT' : for non-parameter, can only apply to 'in' or no storage qualifier
ERROR: 0:22: 'nonuniformEXT' : for non-parameter, can only apply to 'in' or no storage qualifier
ERROR: 0:28: 'constructor' : too many arguments
ERROR: 0:28: 'assign' : cannot convert from ' const float' to ' nonuniform temp int'
ERROR: 0:29: 'constructor' : not enough data provided for construction
ERROR: 0:29: 'assign' : cannot convert from ' const float' to ' nonuniform temp int'
ERROR: 0:32: 'nonuniformEXT' : not allowed on block or structure members
ERROR: 0:33: 'nonuniformEXT' : not allowed on block or structure members
ERROR: 10 compilation errors. No code generated.
Shader version: 450
Requested GL_EXT_nonuniform_qualifier
ERROR: node is still EOpNull!
0:14 Function Definition: foo(i1;i1; ( nonuniform temp int)
0:14 Function Parameters:
0:14 'nupi' ( nonuniform in int)
0:14 'f' ( nonuniform out int)
0:16 Sequence
0:16 Branch: Return with expression
0:16 'nupi' ( nonuniform in int)
0:19 Function Definition: main( ( global void)
0:19 Function Parameters:
0:? Sequence
0:24 Function Call: foo(i1;i1; ( nonuniform temp int)
0:24 'nu_li' ( nonuniform temp int)
0:24 'nu_li' ( nonuniform temp int)
0:27 move second child to first child ( temp int)
0:27 'nu_li' ( nonuniform temp int)
0:27 add ( nonuniform temp int)
0:27 'a' ( nonuniform temp int)
0:27 component-wise multiply ( nonuniform temp int)
0:27 'a' ( temp int)
0:27 Constant:
0:27 2 (const int)
0:28 'nu_li' ( nonuniform temp int)
0:29 'nu_li' ( nonuniform temp int)
0:? Linker Objects
0:? 'nonuniformEXT' ( global int)
0:? 'nu_inv4' ( smooth nonuniform in 4-component vector of float)
0:? 'nu_gf' ( nonuniform temp float)
0:? 'nu_outv4' ( nonuniform out 4-component vector of float)
0:? 'nu_uv4' ( nonuniform uniform 4-component vector of float)
0:? 'nu_constf' ( nonuniform const float)
0:? 1.000000
0:? 'ins' (layout( location=1) smooth in structure{ global float a, temp float b})
0:? 'inb' (layout( location=3) in block{ in float a, in float b})
Linked fragment stage:
Shader version: 450
Requested GL_EXT_nonuniform_qualifier
ERROR: node is still EOpNull!
0:14 Function Definition: foo(i1;i1; ( nonuniform temp int)
0:14 Function Parameters:
0:14 'nupi' ( nonuniform in int)
0:14 'f' ( nonuniform out int)
0:16 Sequence
0:16 Branch: Return with expression
0:16 'nupi' ( nonuniform in int)
0:19 Function Definition: main( ( global void)
0:19 Function Parameters:
0:? Sequence
0:24 Function Call: foo(i1;i1; ( nonuniform temp int)
0:24 'nu_li' ( nonuniform temp int)
0:24 'nu_li' ( nonuniform temp int)
0:27 move second child to first child ( temp int)
0:27 'nu_li' ( nonuniform temp int)
0:27 add ( nonuniform temp int)
0:27 'a' ( nonuniform temp int)
0:27 component-wise multiply ( nonuniform temp int)
0:27 'a' ( temp int)
0:27 Constant:
0:27 2 (const int)
0:28 'nu_li' ( nonuniform temp int)
0:29 'nu_li' ( nonuniform temp int)
0:? Linker Objects
0:? 'nonuniformEXT' ( global int)
0:? 'nu_inv4' ( smooth nonuniform in 4-component vector of float)
0:? 'nu_gf' ( nonuniform temp float)
0:? 'nu_outv4' ( nonuniform out 4-component vector of float)
0:? 'nu_uv4' ( nonuniform uniform 4-component vector of float)
0:? 'nu_constf' ( nonuniform const float)
0:? 1.000000
0:? 'ins' (layout( location=1) smooth in structure{ global float a, temp float b})
0:? 'inb' (layout( location=3) in block{ in float a, in float b})

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,359 @@
spv.nonuniform.frag
// Module Version 10000
// Generated by (magic number): 80006
// Id's are bound by 210
Capability Shader
Capability InputAttachment
Capability SampledBuffer
Capability ImageBuffer
Capability CapabilityShaderNonUniformEXT
Capability CapabilityRuntimeDescriptorArrayEXT
Capability CapabilityInputAttachmentArrayDynamicIndexingEXT
Capability CapabilityUniformTexelBufferArrayDynamicIndexingEXT
Capability CapabilityStorageTexelBufferArrayDynamicIndexingEXT
Capability CapabilityUniformBufferArrayNonUniformIndexingEXT
Capability CapabilitySampledImageArrayNonUniformIndexingEXT
Capability CapabilityStorageBufferArrayNonUniformIndexingEXT
Capability CapabilityStorageImageArrayNonUniformIndexingEXT
Capability CapabilityInputAttachmentArrayNonUniformIndexingEXT
Capability CapabilityUniformTexelBufferArrayNonUniformIndexingEXT
Capability CapabilityStorageTexelBufferArrayNonUniformIndexingEXT
Extension "SPV_EXT_descriptor_indexing"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 33 90
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_nonuniform_qualifier"
Name 4 "main"
Name 11 "foo(i1;i1;"
Name 9 "nupi"
Name 10 "f"
Name 16 "a"
Name 17 "nu_li"
Name 18 "param"
Name 20 "param"
Name 30 "b"
Name 33 "nu_inv4"
Name 39 "nu_gf"
Name 45 "inputAttachmentDyn"
Name 46 "dyn_i"
Name 62 "uniformTexelBufferDyn"
Name 76 "storageTexelBufferDyn"
Name 85 "uname"
MemberName 85(uname) 0 "a"
Name 88 "uniformBuffer"
Name 90 "nu_ii"
Name 97 "bname"
MemberName 97(bname) 0 "b"
Name 100 "storageBuffer"
Name 110 "sampledImage"
Name 125 "storageImage"
Name 137 "inputAttachment"
Name 147 "uniformTexelBuffer"
Name 158 "storageTexelBuffer"
Name 168 "v"
Name 183 "uv"
Name 193 "m"
Name 201 "S"
MemberName 201(S) 0 "a"
Name 203 "s"
Decorate 13 DecorationNonUniformEXT
Decorate 17(nu_li) DecorationNonUniformEXT
Decorate 19 DecorationNonUniformEXT
Decorate 23 DecorationNonUniformEXT
Decorate 26 DecorationNonUniformEXT
Decorate 27 DecorationNonUniformEXT
Decorate 33(nu_inv4) Location 0
Decorate 33(nu_inv4) DecorationNonUniformEXT
Decorate 38 DecorationNonUniformEXT
Decorate 39(nu_gf) DecorationNonUniformEXT
Decorate 40 DecorationNonUniformEXT
Decorate 41 DecorationNonUniformEXT
Decorate 45(inputAttachmentDyn) DescriptorSet 0
Decorate 45(inputAttachmentDyn) Binding 0
Decorate 45(inputAttachmentDyn) InputAttachmentIndex 0
Decorate 62(uniformTexelBufferDyn) DescriptorSet 0
Decorate 62(uniformTexelBufferDyn) Binding 1
Decorate 76(storageTexelBufferDyn) DescriptorSet 0
Decorate 76(storageTexelBufferDyn) Binding 2
MemberDecorate 85(uname) 0 Offset 0
Decorate 85(uname) Block
Decorate 88(uniformBuffer) DescriptorSet 0
Decorate 88(uniformBuffer) Binding 3
Decorate 90(nu_ii) Flat
Decorate 90(nu_ii) Location 1
Decorate 90(nu_ii) DecorationNonUniformEXT
Decorate 91 DecorationNonUniformEXT
Decorate 94 DecorationNonUniformEXT
MemberDecorate 97(bname) 0 Offset 0
Decorate 97(bname) BufferBlock
Decorate 100(storageBuffer) DescriptorSet 0
Decorate 100(storageBuffer) Binding 4
Decorate 101 DecorationNonUniformEXT
Decorate 103 DecorationNonUniformEXT
Decorate 110(sampledImage) DescriptorSet 0
Decorate 110(sampledImage) Binding 5
Decorate 111 DecorationNonUniformEXT
Decorate 114 DecorationNonUniformEXT
Decorate 125(storageImage) DescriptorSet 0
Decorate 125(storageImage) Binding 6
Decorate 126 DecorationNonUniformEXT
Decorate 129 DecorationNonUniformEXT
Decorate 137(inputAttachment) DescriptorSet 0
Decorate 137(inputAttachment) Binding 7
Decorate 137(inputAttachment) InputAttachmentIndex 1
Decorate 138 DecorationNonUniformEXT
Decorate 140 DecorationNonUniformEXT
Decorate 147(uniformTexelBuffer) DescriptorSet 0
Decorate 147(uniformTexelBuffer) Binding 8
Decorate 148 DecorationNonUniformEXT
Decorate 150 DecorationNonUniformEXT
Decorate 158(storageTexelBuffer) DescriptorSet 0
Decorate 158(storageTexelBuffer) Binding 9
Decorate 159 DecorationNonUniformEXT
Decorate 161 DecorationNonUniformEXT
Decorate 168(v) DecorationNonUniformEXT
Decorate 171 DecorationNonUniformEXT
Decorate 173 DecorationNonUniformEXT
Decorate 178 DecorationNonUniformEXT
Decorate 180 DecorationNonUniformEXT
Decorate 184 DecorationNonUniformEXT
Decorate 186 DecorationNonUniformEXT
Decorate 188 DecorationNonUniformEXT
Decorate 193(m) DecorationNonUniformEXT
Decorate 195 DecorationNonUniformEXT
Decorate 203(s) DecorationNonUniformEXT
Decorate 205 DecorationNonUniformEXT
Decorate 207 DecorationNonUniformEXT
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
8: TypeFunction 6(int) 7(ptr) 7(ptr)
25: 6(int) Constant 2
28: TypeFloat 32
29: TypePointer Function 28(float)
31: TypeVector 28(float) 4
32: TypePointer Input 31(fvec4)
33(nu_inv4): 32(ptr) Variable Input
34: TypeInt 32 0
35: 34(int) Constant 0
36: TypePointer Input 28(float)
42: TypeImage 28(float) SubpassData nonsampled format:Unknown
43: TypeRuntimeArray 42
44: TypePointer UniformConstant 43
45(inputAttachmentDyn): 44(ptr) Variable UniformConstant
48: TypePointer UniformConstant 42
51: 6(int) Constant 0
52: TypeVector 6(int) 2
53: 52(ivec2) ConstantComposite 51 51
58: TypeImage 28(float) Buffer sampled format:Unknown
59: TypeSampledImage 58
60: TypeRuntimeArray 59
61: TypePointer UniformConstant 60
62(uniformTexelBufferDyn): 61(ptr) Variable UniformConstant
64: TypePointer UniformConstant 59
67: 6(int) Constant 1
73: TypeImage 28(float) Buffer nonsampled format:R32f
74: TypeRuntimeArray 73
75: TypePointer UniformConstant 74
76(storageTexelBufferDyn): 75(ptr) Variable UniformConstant
78: TypePointer UniformConstant 73
85(uname): TypeStruct 28(float)
86: TypeRuntimeArray 85(uname)
87: TypePointer Uniform 86
88(uniformBuffer): 87(ptr) Variable Uniform
89: TypePointer Input 6(int)
90(nu_ii): 89(ptr) Variable Input
92: TypePointer Uniform 28(float)
97(bname): TypeStruct 28(float)
98: TypeRuntimeArray 97(bname)
99: TypePointer Uniform 98
100(storageBuffer): 99(ptr) Variable Uniform
106: TypeImage 28(float) 2D sampled format:Unknown
107: TypeSampledImage 106
108: TypeRuntimeArray 107
109: TypePointer UniformConstant 108
110(sampledImage): 109(ptr) Variable UniformConstant
112: TypePointer UniformConstant 107
115: TypeVector 28(float) 2
116: 28(float) Constant 1056964608
117: 115(fvec2) ConstantComposite 116 116
122: TypeImage 28(float) 2D nonsampled format:R32f
123: TypeRuntimeArray 122
124: TypePointer UniformConstant 123
125(storageImage): 124(ptr) Variable UniformConstant
127: TypePointer UniformConstant 122
130: 52(ivec2) ConstantComposite 67 67
135: TypeRuntimeArray 42
136: TypePointer UniformConstant 135
137(inputAttachment): 136(ptr) Variable UniformConstant
145: TypeRuntimeArray 59
146: TypePointer UniformConstant 145
147(uniformTexelBuffer): 146(ptr) Variable UniformConstant
156: TypeRuntimeArray 73
157: TypePointer UniformConstant 156
158(storageTexelBuffer): 157(ptr) Variable UniformConstant
166: TypeVector 6(int) 4
167: TypePointer Function 166(ivec4)
169: 34(int) Constant 1
176: 34(int) Constant 2
191: TypeMatrix 31(fvec4) 4
192: TypePointer Function 191
201(S): TypeStruct 6(int)
202: TypePointer Function 201(S)
4(main): 2 Function None 3
5: Label
16(a): 7(ptr) Variable Function
17(nu_li): 7(ptr) Variable Function
18(param): 7(ptr) Variable Function
20(param): 7(ptr) Variable Function
30(b): 29(ptr) Variable Function
39(nu_gf): 29(ptr) Variable Function
46(dyn_i): 7(ptr) Variable Function
168(v): 167(ptr) Variable Function
183(uv): 167(ptr) Variable Function
193(m): 192(ptr) Variable Function
203(s): 202(ptr) Variable Function
19: 6(int) Load 17(nu_li)
Store 18(param) 19
21: 6(int) FunctionCall 11(foo(i1;i1;) 18(param) 20(param)
22: 6(int) Load 20(param)
Store 17(nu_li) 22
Store 16(a) 21
23: 6(int) Load 16(a)
24: 6(int) Load 16(a)
26: 6(int) IMul 24 25
27: 6(int) IAdd 23 26
Store 17(nu_li) 27
37: 36(ptr) AccessChain 33(nu_inv4) 35
38: 28(float) Load 37
40: 28(float) Load 39(nu_gf)
41: 28(float) FMul 38 40
Store 30(b) 41
47: 6(int) Load 46(dyn_i)
49: 48(ptr) AccessChain 45(inputAttachmentDyn) 47
50: 42 Load 49
54: 31(fvec4) ImageRead 50 53
55: 28(float) CompositeExtract 54 0
56: 28(float) Load 30(b)
57: 28(float) FAdd 56 55
Store 30(b) 57
63: 6(int) Load 46(dyn_i)
65: 64(ptr) AccessChain 62(uniformTexelBufferDyn) 63
66: 59 Load 65
68: 58 Image 66
69: 31(fvec4) ImageFetch 68 67
70: 28(float) CompositeExtract 69 0
71: 28(float) Load 30(b)
72: 28(float) FAdd 71 70
Store 30(b) 72
77: 6(int) Load 46(dyn_i)
79: 78(ptr) AccessChain 76(storageTexelBufferDyn) 77
80: 73 Load 79
81: 31(fvec4) ImageRead 80 67
82: 28(float) CompositeExtract 81 0
83: 28(float) Load 30(b)
84: 28(float) FAdd 83 82
Store 30(b) 84
91: 6(int) Load 90(nu_ii)
93: 92(ptr) AccessChain 88(uniformBuffer) 91 51
94: 28(float) Load 93
95: 28(float) Load 30(b)
96: 28(float) FAdd 95 94
Store 30(b) 96
101: 6(int) Load 90(nu_ii)
102: 92(ptr) AccessChain 100(storageBuffer) 101 51
103: 28(float) Load 102
104: 28(float) Load 30(b)
105: 28(float) FAdd 104 103
Store 30(b) 105
111: 6(int) Load 90(nu_ii)
113: 112(ptr) AccessChain 110(sampledImage) 111
114: 107 Load 113
118: 31(fvec4) ImageSampleImplicitLod 114 117
119: 28(float) CompositeExtract 118 0
120: 28(float) Load 30(b)
121: 28(float) FAdd 120 119
Store 30(b) 121
126: 6(int) Load 90(nu_ii)
128: 127(ptr) AccessChain 125(storageImage) 126
129: 122 Load 128
131: 31(fvec4) ImageRead 129 130
132: 28(float) CompositeExtract 131 0
133: 28(float) Load 30(b)
134: 28(float) FAdd 133 132
Store 30(b) 134
138: 6(int) Load 90(nu_ii)
139: 48(ptr) AccessChain 137(inputAttachment) 138
140: 42 Load 139
141: 31(fvec4) ImageRead 140 53
142: 28(float) CompositeExtract 141 0
143: 28(float) Load 30(b)
144: 28(float) FAdd 143 142
Store 30(b) 144
148: 6(int) Load 90(nu_ii)
149: 64(ptr) AccessChain 147(uniformTexelBuffer) 148
150: 59 Load 149
151: 58 Image 150
152: 31(fvec4) ImageFetch 151 67
153: 28(float) CompositeExtract 152 0
154: 28(float) Load 30(b)
155: 28(float) FAdd 154 153
Store 30(b) 155
159: 6(int) Load 90(nu_ii)
160: 78(ptr) AccessChain 158(storageTexelBuffer) 159
161: 73 Load 160
162: 31(fvec4) ImageRead 161 67
163: 28(float) CompositeExtract 162 0
164: 28(float) Load 30(b)
165: 28(float) FAdd 164 163
Store 30(b) 165
170: 7(ptr) AccessChain 168(v) 169
171: 6(int) Load 170
172: 92(ptr) AccessChain 88(uniformBuffer) 171 51
173: 28(float) Load 172
174: 28(float) Load 30(b)
175: 28(float) FAdd 174 173
Store 30(b) 175
177: 7(ptr) AccessChain 168(v) 176
178: 6(int) Load 177
179: 92(ptr) AccessChain 88(uniformBuffer) 178 51
180: 28(float) Load 179
181: 28(float) Load 30(b)
182: 28(float) FAdd 181 180
Store 30(b) 182
184: 6(int) Load 90(nu_ii)
185: 7(ptr) AccessChain 183(uv) 184
186: 6(int) Load 185
187: 92(ptr) AccessChain 88(uniformBuffer) 186 51
188: 28(float) Load 187
189: 28(float) Load 30(b)
190: 28(float) FAdd 189 188
Store 30(b) 190
194: 29(ptr) AccessChain 193(m) 25 176
195: 28(float) Load 194
196: 6(int) ConvertFToS 195
197: 92(ptr) AccessChain 88(uniformBuffer) 196 51
198: 28(float) Load 197
199: 28(float) Load 30(b)
200: 28(float) FAdd 199 198
Store 30(b) 200
204: 7(ptr) AccessChain 203(s) 51
205: 6(int) Load 204
206: 92(ptr) AccessChain 88(uniformBuffer) 205 51
207: 28(float) Load 206
208: 28(float) Load 30(b)
209: 28(float) FAdd 208 207
Store 30(b) 209
Return
FunctionEnd
11(foo(i1;i1;): 6(int) Function None 8
9(nupi): 7(ptr) FunctionParameter
10(f): 7(ptr) FunctionParameter
12: Label
13: 6(int) Load 9(nupi)
ReturnValue 13
FunctionEnd

33
Test/nonuniform.frag Normal file
View File

@ -0,0 +1,33 @@
#version 450
int nonuniformEXT;
#extension GL_EXT_nonuniform_qualifier : enable
nonuniformEXT in vec4 nu_inv4;
nonuniformEXT float nu_gf;
nonuniformEXT out vec4 nu_outv4; // ERROR, out
nonuniformEXT uniform vec4 nu_uv4; // ERROR, uniform
nonuniformEXT const float nu_constf = 1.0; // ERROR, const
nonuniformEXT int foo(nonuniformEXT int nupi, nonuniformEXT out int f)
{
return nupi;
}
void main()
{
nonuniformEXT int nu_li;
nonuniformEXT const int nu_ci = 2; // ERROR, const
foo(nu_li, nu_li);
int a;
nu_li = nonuniformEXT(a) + nonuniformEXT(a * 2);
nu_li = nonuniformEXT(a, a); // ERROR, too many arguments
nu_li = nonuniformEXT(); // ERROR, no arguments
}
layout(location=1) in struct S { float a; nonuniformEXT float b; } ins; // ERROR, not on member
layout(location=3) in inbName { float a; nonuniformEXT float b; } inb; // ERROR, not on member

View File

@ -30,6 +30,15 @@ uniform aun {
float aub[];
};
layout(binding=1) uniform samplerBuffer uniformTexelBufferDyn[];
layout(binding=2, r32f) uniform imageBuffer storageTexelBufferDyn[];
layout(binding=3) uniform uname { float a; } uniformBuffer[];
layout(binding=4) buffer bname { float b; } storageBuffer[];
layout(binding=5) uniform sampler2D sampledImage[];
layout(binding=6, r32f) uniform image2D storageImage[];
layout(binding=8) uniform samplerBuffer uniformTexelBuffer[];
layout(binding=9, r32f) uniform imageBuffer storageTexelBuffer[];
int i;
void main()
@ -78,4 +87,22 @@ void main()
aub.length(); // ERROR
aba.length(); // ERROR
abb.length();
uniformTexelBufferDyn[1];
storageTexelBufferDyn[1];
uniformBuffer[1];
storageBuffer[1];
sampledImage[1];
storageImage[1];
uniformTexelBuffer[1];
storageTexelBuffer[1];
uniformTexelBufferDyn[i]; // ERROR, need extension
storageTexelBufferDyn[i]; // ERROR, need extension
uniformBuffer[i]; // ERROR, need extension
storageBuffer[i]; // ERROR, need extension
sampledImage[i]; // ERROR, need extension
storageImage[i]; // ERROR, need extension
uniformTexelBuffer[i]; // ERROR, need extension
storageTexelBuffer[i]; // ERROR, need extension
}

55
Test/spv.nonuniform.frag Normal file
View File

@ -0,0 +1,55 @@
#version 450
#extension GL_EXT_nonuniform_qualifier : enable
layout(location=0) nonuniformEXT in vec4 nu_inv4;
nonuniformEXT float nu_gf;
layout(location=1) in nonuniformEXT flat int nu_ii;
layout(binding=0, input_attachment_index = 0) uniform subpassInput inputAttachmentDyn[];
layout(binding=1) uniform samplerBuffer uniformTexelBufferDyn[];
layout(binding=2, r32f) uniform imageBuffer storageTexelBufferDyn[];
layout(binding=3) uniform uname { float a; } uniformBuffer[];
layout(binding=4) buffer bname { float b; } storageBuffer[];
layout(binding=5) uniform sampler2D sampledImage[];
layout(binding=6, r32f) uniform image2D storageImage[];
layout(binding=7, input_attachment_index = 1) uniform subpassInput inputAttachment[];
layout(binding=8) uniform samplerBuffer uniformTexelBuffer[];
layout(binding=9, r32f) uniform imageBuffer storageTexelBuffer[];
nonuniformEXT int foo(nonuniformEXT int nupi, nonuniformEXT out int f)
{
return nupi;
}
void main()
{
nonuniformEXT int nu_li;
int dyn_i;
int a = foo(nu_li, nu_li);
nu_li = nonuniformEXT(a) + nonuniformEXT(a * 2);
float b;
b = nu_inv4.x * nu_gf;
b += subpassLoad(inputAttachmentDyn[dyn_i]).x;
b += texelFetch(uniformTexelBufferDyn[dyn_i], 1).x;
b += imageLoad(storageTexelBufferDyn[dyn_i], 1).x;
b += uniformBuffer[nu_ii].a;
b += storageBuffer[nu_ii].b;
b += texture(sampledImage[nu_ii], vec2(0.5)).x;
b += imageLoad(storageImage[nu_ii], ivec2(1)).x;
b += subpassLoad(inputAttachment[nu_ii]).x;
b += texelFetch(uniformTexelBuffer[nu_ii], 1).x;
b += imageLoad(storageTexelBuffer[nu_ii], 1).x;
nonuniformEXT ivec4 v;
nonuniformEXT mat4 m;
nonuniformEXT struct S { int a; } s;
ivec4 uv;
b += uniformBuffer[v.y].a;
b += uniformBuffer[v[2]].a;
b += uniformBuffer[uv[nu_ii]].a;
b += uniformBuffer[int(m[2].z)].a;
b += uniformBuffer[s.a].a;
}

View File

@ -437,6 +437,7 @@ public:
clearInterstage();
clearMemory();
specConstant = false;
nonUniform = false;
clearLayout();
}
@ -478,6 +479,7 @@ public:
{
storage = EvqTemporary;
specConstant = false;
nonUniform = false;
}
const char* semanticName;
@ -502,6 +504,7 @@ public:
bool readonly : 1;
bool writeonly : 1;
bool specConstant : 1; // having a constant_id is not sufficient: expressions have no id, but are still specConstant
bool nonUniform : 1;
bool isMemory() const
{
@ -833,6 +836,10 @@ public:
// true front-end constant.
return specConstant;
}
bool isNonUniform() const
{
return nonUniform;
}
bool isFrontEndConstant() const
{
// True if the front-end knows the final constant value.
@ -1383,8 +1390,9 @@ public:
virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; }
// "Image" is a superset of "Subpass"
virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); }
virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); }
virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); }
virtual bool isTexture() const { return basicType == EbtSampler && getSampler().isTexture(); }
// return true if this type contains any subtype which satisfies the given predicate.
template <typename P>
@ -1689,6 +1697,8 @@ public:
appendStr(" writeonly");
if (qualifier.specConstant)
appendStr(" specialization-constant");
if (qualifier.nonUniform)
appendStr(" nonuniform");
appendStr(" ");
appendStr(getStorageQualifierString());
if (isArray()) {

View File

@ -729,6 +729,7 @@ enum TOperator {
EOpConstructF16Mat4x4,
EOpConstructStruct,
EOpConstructTextureSampler,
EOpConstructNonuniform, // expected to be transformed away, not present in final AST
EOpConstructGuardEnd,
//

View File

@ -158,6 +158,11 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
if (specConstantPropagates(*node->getLeft(), *node->getRight()) && isSpecializationOperation(*node))
node->getWritableType().getQualifier().makeSpecConstant();
// If must propagate nonuniform, make a nonuniform.
if ((node->getLeft()->getQualifier().nonUniform || node->getRight()->getQualifier().nonUniform) &&
isNonuniformPropagating(node->getOp()))
node->getWritableType().getQualifier().nonUniform = true;
return node;
}
@ -366,6 +371,10 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
if (node->getOperand()->getType().getQualifier().isSpecConstant() && isSpecializationOperation(*node))
node->getWritableType().getQualifier().makeSpecConstant();
// If must propagate nonuniform, make a nonuniform.
if (node->getOperand()->getQualifier().nonUniform && isNonuniformPropagating(node->getOp()))
node->getWritableType().getQualifier().nonUniform = true;
return node;
}
@ -1748,6 +1757,9 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
{
TOperator op = EOpNull;
if (type.getQualifier().nonUniform)
return EOpConstructNonuniform;
switch (type.getBasicType()) {
case EbtStruct:
op = EOpConstructStruct;
@ -2800,6 +2812,64 @@ bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const
}
}
// Is the operation one that must propagate nonuniform?
bool TIntermediate::isNonuniformPropagating(TOperator op) const
{
// "* All Operators in Section 5.1 (Operators), except for assignment,
// arithmetic assignment, and sequence
// * Component selection in Section 5.5
// * Matrix components in Section 5.6
// * Structure and Array Operations in Section 5.7, except for the length
// method."
switch (op) {
case EOpPostIncrement:
case EOpPostDecrement:
case EOpPreIncrement:
case EOpPreDecrement:
case EOpNegative:
case EOpLogicalNot:
case EOpVectorLogicalNot:
case EOpBitwiseNot:
case EOpAdd:
case EOpSub:
case EOpMul:
case EOpDiv:
case EOpMod:
case EOpRightShift:
case EOpLeftShift:
case EOpAnd:
case EOpInclusiveOr:
case EOpExclusiveOr:
case EOpEqual:
case EOpNotEqual:
case EOpLessThan:
case EOpGreaterThan:
case EOpLessThanEqual:
case EOpGreaterThanEqual:
case EOpVectorTimesScalar:
case EOpVectorTimesMatrix:
case EOpMatrixTimesVector:
case EOpMatrixTimesScalar:
case EOpLogicalOr:
case EOpLogicalXor:
case EOpLogicalAnd:
case EOpIndexDirect:
case EOpIndexIndirect:
case EOpIndexDirectStruct:
case EOpVectorSwizzle:
return true;
default:
break;
}
return false;
}
////////////////////////////////////////////////////////////////
//
// Member functions of the nodes used for building the tree.

View File

@ -381,6 +381,8 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
if (index->getQualifier().isFrontEndConstant()) {
if (base->getType().isUnsizedArray())
base->getWritableType().updateImplicitArraySize(indexValue + 1);
else
checkIndex(loc, base->getType(), indexValue);
result = intermediate.addIndex(EOpIndexDirect, base, index, loc);
} else {
if (base->getType().isUnsizedArray()) {
@ -390,8 +392,7 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
error(loc, "", "[", "array must be sized by a redeclaration or layout qualifier before being indexed with a variable");
else {
// it is okay for a run-time sized array
if (!isRuntimeSizable(*base))
error(loc, "", "[", "array must be redeclared with a size before being indexed with a variable");
checkRuntimeSizable(loc, *base);
}
base->getWritableType().setArrayVariablyIndexed();
}
@ -434,6 +435,10 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
}
result->setType(newType);
// Propagate nonuniform
if (base->getQualifier().isNonUniform() || index->getQualifier().isNonUniform())
result->getWritableType().getQualifier().nonUniform = true;
if (anyIndexLimits)
handleIndexLimits(loc, base, index);
}
@ -742,6 +747,10 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm
if (base->getQualifier().noContraction)
result->getWritableType().getQualifier().noContraction = true;
// Propagate nonuniform
if (base->getQualifier().isNonUniform())
result->getWritableType().getQualifier().nonUniform = true;
return result;
}
@ -2622,6 +2631,10 @@ void TParseContext::memberQualifierCheck(glslang::TPublicType& publicType)
{
globalQualifierFixCheck(publicType.loc, publicType.qualifier);
checkNoShaderLayouts(publicType.loc, publicType.shaderQualifiers);
if (publicType.qualifier.isNonUniform()) {
error(publicType.loc, "not allowed on block or structure members", "nonuniformEXT", "");
publicType.qualifier.nonUniform = false;
}
}
//
@ -2629,12 +2642,15 @@ void TParseContext::memberQualifierCheck(glslang::TPublicType& publicType)
//
void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& qualifier)
{
bool nonuniformOkay = false;
// move from parameter/unknown qualifiers to pipeline in/out qualifiers
switch (qualifier.storage) {
case EvqIn:
profileRequires(loc, ENoProfile, 130, nullptr, "in for stage inputs");
profileRequires(loc, EEsProfile, 300, nullptr, "in for stage inputs");
qualifier.storage = EvqVaryingIn;
nonuniformOkay = true;
break;
case EvqOut:
profileRequires(loc, ENoProfile, 130, nullptr, "out for stage outputs");
@ -2645,10 +2661,17 @@ void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& q
qualifier.storage = EvqVaryingIn;
error(loc, "cannot use 'inout' at global scope", "", "");
break;
case EvqGlobal:
case EvqTemporary:
nonuniformOkay = true;
break;
default:
break;
}
if (!nonuniformOkay && qualifier.nonUniform)
error(loc, "for non-parameter, can only apply to 'in' or no storage qualifier", "nonuniformEXT", "");
invariantCheck(loc, qualifier);
}
@ -2897,6 +2920,7 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons
MERGE_SINGLETON(readonly);
MERGE_SINGLETON(writeonly);
MERGE_SINGLETON(specConstant);
MERGE_SINGLETON(nonUniform);
if (repeated)
error(loc, "replicated qualifiers", "", "");
@ -3268,11 +3292,25 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie
checkIoArraysConsistency(loc);
}
// Policy decision for whether a node could potentially be sized at runtime.
bool TParseContext::isRuntimeSizable(const TIntermTyped& base) const
// Policy and error check for needing a runtime sized array.
void TParseContext::checkRuntimeSizable(const TSourceLoc& loc, const TIntermTyped& base)
{
const TType& type = base.getType();
if (type.getQualifier().storage == EvqBuffer) {
// runtime length implies runtime sizeable, so no problem
if (isRuntimeLength(base))
return;
// check for additional things allowed by GL_EXT_nonuniform_qualifier
if (base.getBasicType() == EbtSampler ||
(base.getBasicType() == EbtBlock && base.getType().getQualifier().isUniformOrBuffer()))
requireExtensions(loc, 1, &E_GL_EXT_nonuniform_qualifier, "variable index");
else
error(loc, "", "[", "array must be redeclared with a size before being indexed with a variable");
}
// Policy decision for whether a run-time .length() is allowed.
bool TParseContext::isRuntimeLength(const TIntermTyped& base) const
{
if (base.getType().getQualifier().storage == EvqBuffer) {
// in a buffer block
const TIntermBinary* binary = base.getAsBinaryNode();
if (binary != nullptr && binary->getOp() == EOpIndexDirectStruct) {
@ -3287,12 +3325,6 @@ bool TParseContext::isRuntimeSizable(const TIntermTyped& base) const
return false;
}
// Policy decision for whether a run-time .length() is allowed.
bool TParseContext::isRuntimeLength(const TIntermTyped& base) const
{
return isRuntimeSizable(base);
}
// Returns true if the first argument to the #line directive is the line number for the next line.
//
// Desktop, pre-version 3.30: "After processing this directive
@ -3703,6 +3735,8 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali
else
warn(loc, "qualifier has no effect on non-output parameters", "precise", "");
}
if (qualifier.isNonUniform())
type.getQualifier().nonUniform = qualifier.nonUniform;
paramCheckFixStorage(loc, qualifier.storage, type);
}
@ -4680,11 +4714,16 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
if (type.getBasicType() == EbtSampler) {
int lastBinding = qualifier.layoutBinding;
if (type.isArray()) {
if (type.isSizedArray())
lastBinding += type.getCumulativeArraySize();
else {
if (spvVersion.vulkan > 0)
lastBinding += 1;
warn(loc, "assuming array size of one for compile-time checking of binding numbers for unsized array", "[]", "");
else {
if (type.isSizedArray())
lastBinding += type.getCumulativeArraySize();
else {
lastBinding += 1;
if (spvVersion.vulkan == 0)
warn(loc, "assuming binding count of one for compile-time checking of binding numbers for unsized array", "[]", "");
}
}
}
if (spvVersion.vulkan == 0 && lastBinding >= resources.maxCombinedTextureImageUnits)
@ -5852,6 +5891,11 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
basicOp = EOpConstructBool;
break;
case EOpConstructNonuniform:
node->getWritableType().getQualifier().nonUniform = true;
return node;
break;
default:
error(loc, "unsupported construction", "", "");

View File

@ -427,7 +427,7 @@ protected:
TVariable* makeInternalVariable(const char* name, const TType&) const;
TVariable* declareNonArray(const TSourceLoc&, const TString& identifier, const TType&);
void declareArray(const TSourceLoc&, const TString& identifier, const TType&, TSymbol*&);
bool isRuntimeSizable(const TIntermTyped&) const;
void checkRuntimeSizable(const TSourceLoc&, const TIntermTyped&);
bool isRuntimeLength(const TIntermTyped&) const;
TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer);

View File

@ -341,6 +341,7 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["const"] = CONST;
(*KeywordMap)["uniform"] = UNIFORM;
(*KeywordMap)["nonuniformEXT"] = NONUNIFORM;
(*KeywordMap)["in"] = IN;
(*KeywordMap)["out"] = OUT;
(*KeywordMap)["inout"] = INOUT;
@ -873,6 +874,12 @@ int TScanContext::tokenizeIdentifier()
case CASE:
return keyword;
case NONUNIFORM:
if (parseContext.extensionTurnedOn(E_GL_EXT_nonuniform_qualifier))
return keyword;
else
return identifierOrType();
case SWITCH:
case DEFAULT:
if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||

View File

@ -199,6 +199,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_EXT_shader_image_load_formatted] = EBhDisable;
extensionBehavior[E_GL_EXT_post_depth_coverage] = EBhDisable;
extensionBehavior[E_GL_EXT_control_flow_attributes] = EBhDisable;
extensionBehavior[E_GL_EXT_nonuniform_qualifier] = EBhDisable;
// #line and #include
extensionBehavior[E_GL_GOOGLE_cpp_style_line_directive] = EBhDisable;
@ -360,6 +361,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_EXT_shader_image_load_formatted 1\n"
"#define GL_EXT_post_depth_coverage 1\n"
"#define GL_EXT_control_flow_attributes 1\n"
"#define GL_EXT_nonuniform_qualifier 1\n"
// GL_KHR_shader_subgroup
"#define GL_KHR_shader_subgroup_basic 1\n"

View File

@ -157,6 +157,7 @@ const char* const E_GL_EXT_device_group = "GL_EXT_device_group";
const char* const E_GL_EXT_multiview = "GL_EXT_multiview";
const char* const E_GL_EXT_post_depth_coverage = "GL_EXT_post_depth_coverage";
const char* const E_GL_EXT_control_flow_attributes = "GL_EXT_control_flow_attributes";
const char* const E_GL_EXT_nonuniform_qualifier = "GL_EXT_nonuniform_qualifier";
// Arrays of extensions for the above viewportEXTs duplications

View File

@ -140,7 +140,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> U8VEC2 U8VEC3 U8VEC4
%token <lex> VEC2 VEC3 VEC4
%token <lex> MAT2 MAT3 MAT4 CENTROID IN OUT INOUT
%token <lex> UNIFORM PATCH SAMPLE BUFFER SHARED
%token <lex> UNIFORM PATCH SAMPLE BUFFER SHARED NONUNIFORM
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY
%token <lex> DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4
%token <lex> F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4
@ -268,6 +268,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%type <interm> array_specifier
%type <interm.type> precise_qualifier invariant_qualifier interpolation_qualifier storage_qualifier precision_qualifier
%type <interm.type> layout_qualifier layout_qualifier_id_list layout_qualifier_id
%type <interm.type> non_uniform_qualifier
%type <interm.type> type_qualifier fully_specified_type type_specifier
%type <interm.type> single_type_qualifier
@ -473,6 +474,11 @@ function_identifier
$$.function = new TFunction(&empty, TType(EbtVoid), EOpNull);
}
}
| non_uniform_qualifier {
// Constructor
$$.intermNode = 0;
$$.function = parseContext.handleConstructorCall($1.loc, $1);
}
;
unary_expression
@ -1217,6 +1223,9 @@ single_type_qualifier
// allow inheritance of storage qualifier from block declaration
$$ = $1;
}
| non_uniform_qualifier {
$$ = $1;
}
;
storage_qualifier
@ -1337,6 +1346,13 @@ storage_qualifier
}
;
non_uniform_qualifier
: NONUNIFORM {
$$.init($1.loc);
$$.qualifier.nonUniform = true;
}
;
type_name_list
: IDENTIFIER {
// TODO

File diff suppressed because it is too large Load Diff

View File

@ -124,314 +124,315 @@ extern int yydebug;
SAMPLE = 334,
BUFFER = 335,
SHARED = 336,
COHERENT = 337,
VOLATILE = 338,
RESTRICT = 339,
READONLY = 340,
WRITEONLY = 341,
DVEC2 = 342,
DVEC3 = 343,
DVEC4 = 344,
DMAT2 = 345,
DMAT3 = 346,
DMAT4 = 347,
F16VEC2 = 348,
F16VEC3 = 349,
F16VEC4 = 350,
F16MAT2 = 351,
F16MAT3 = 352,
F16MAT4 = 353,
F32VEC2 = 354,
F32VEC3 = 355,
F32VEC4 = 356,
F32MAT2 = 357,
F32MAT3 = 358,
F32MAT4 = 359,
F64VEC2 = 360,
F64VEC3 = 361,
F64VEC4 = 362,
F64MAT2 = 363,
F64MAT3 = 364,
F64MAT4 = 365,
NOPERSPECTIVE = 366,
FLAT = 367,
SMOOTH = 368,
LAYOUT = 369,
__EXPLICITINTERPAMD = 370,
MAT2X2 = 371,
MAT2X3 = 372,
MAT2X4 = 373,
MAT3X2 = 374,
MAT3X3 = 375,
MAT3X4 = 376,
MAT4X2 = 377,
MAT4X3 = 378,
MAT4X4 = 379,
DMAT2X2 = 380,
DMAT2X3 = 381,
DMAT2X4 = 382,
DMAT3X2 = 383,
DMAT3X3 = 384,
DMAT3X4 = 385,
DMAT4X2 = 386,
DMAT4X3 = 387,
DMAT4X4 = 388,
F16MAT2X2 = 389,
F16MAT2X3 = 390,
F16MAT2X4 = 391,
F16MAT3X2 = 392,
F16MAT3X3 = 393,
F16MAT3X4 = 394,
F16MAT4X2 = 395,
F16MAT4X3 = 396,
F16MAT4X4 = 397,
F32MAT2X2 = 398,
F32MAT2X3 = 399,
F32MAT2X4 = 400,
F32MAT3X2 = 401,
F32MAT3X3 = 402,
F32MAT3X4 = 403,
F32MAT4X2 = 404,
F32MAT4X3 = 405,
F32MAT4X4 = 406,
F64MAT2X2 = 407,
F64MAT2X3 = 408,
F64MAT2X4 = 409,
F64MAT3X2 = 410,
F64MAT3X3 = 411,
F64MAT3X4 = 412,
F64MAT4X2 = 413,
F64MAT4X3 = 414,
F64MAT4X4 = 415,
ATOMIC_UINT = 416,
SAMPLER1D = 417,
SAMPLER2D = 418,
SAMPLER3D = 419,
SAMPLERCUBE = 420,
SAMPLER1DSHADOW = 421,
SAMPLER2DSHADOW = 422,
SAMPLERCUBESHADOW = 423,
SAMPLER1DARRAY = 424,
SAMPLER2DARRAY = 425,
SAMPLER1DARRAYSHADOW = 426,
SAMPLER2DARRAYSHADOW = 427,
ISAMPLER1D = 428,
ISAMPLER2D = 429,
ISAMPLER3D = 430,
ISAMPLERCUBE = 431,
ISAMPLER1DARRAY = 432,
ISAMPLER2DARRAY = 433,
USAMPLER1D = 434,
USAMPLER2D = 435,
USAMPLER3D = 436,
USAMPLERCUBE = 437,
USAMPLER1DARRAY = 438,
USAMPLER2DARRAY = 439,
SAMPLER2DRECT = 440,
SAMPLER2DRECTSHADOW = 441,
ISAMPLER2DRECT = 442,
USAMPLER2DRECT = 443,
SAMPLERBUFFER = 444,
ISAMPLERBUFFER = 445,
USAMPLERBUFFER = 446,
SAMPLERCUBEARRAY = 447,
SAMPLERCUBEARRAYSHADOW = 448,
ISAMPLERCUBEARRAY = 449,
USAMPLERCUBEARRAY = 450,
SAMPLER2DMS = 451,
ISAMPLER2DMS = 452,
USAMPLER2DMS = 453,
SAMPLER2DMSARRAY = 454,
ISAMPLER2DMSARRAY = 455,
USAMPLER2DMSARRAY = 456,
SAMPLEREXTERNALOES = 457,
F16SAMPLER1D = 458,
F16SAMPLER2D = 459,
F16SAMPLER3D = 460,
F16SAMPLER2DRECT = 461,
F16SAMPLERCUBE = 462,
F16SAMPLER1DARRAY = 463,
F16SAMPLER2DARRAY = 464,
F16SAMPLERCUBEARRAY = 465,
F16SAMPLERBUFFER = 466,
F16SAMPLER2DMS = 467,
F16SAMPLER2DMSARRAY = 468,
F16SAMPLER1DSHADOW = 469,
F16SAMPLER2DSHADOW = 470,
F16SAMPLER1DARRAYSHADOW = 471,
F16SAMPLER2DARRAYSHADOW = 472,
F16SAMPLER2DRECTSHADOW = 473,
F16SAMPLERCUBESHADOW = 474,
F16SAMPLERCUBEARRAYSHADOW = 475,
SAMPLER = 476,
SAMPLERSHADOW = 477,
TEXTURE1D = 478,
TEXTURE2D = 479,
TEXTURE3D = 480,
TEXTURECUBE = 481,
TEXTURE1DARRAY = 482,
TEXTURE2DARRAY = 483,
ITEXTURE1D = 484,
ITEXTURE2D = 485,
ITEXTURE3D = 486,
ITEXTURECUBE = 487,
ITEXTURE1DARRAY = 488,
ITEXTURE2DARRAY = 489,
UTEXTURE1D = 490,
UTEXTURE2D = 491,
UTEXTURE3D = 492,
UTEXTURECUBE = 493,
UTEXTURE1DARRAY = 494,
UTEXTURE2DARRAY = 495,
TEXTURE2DRECT = 496,
ITEXTURE2DRECT = 497,
UTEXTURE2DRECT = 498,
TEXTUREBUFFER = 499,
ITEXTUREBUFFER = 500,
UTEXTUREBUFFER = 501,
TEXTURECUBEARRAY = 502,
ITEXTURECUBEARRAY = 503,
UTEXTURECUBEARRAY = 504,
TEXTURE2DMS = 505,
ITEXTURE2DMS = 506,
UTEXTURE2DMS = 507,
TEXTURE2DMSARRAY = 508,
ITEXTURE2DMSARRAY = 509,
UTEXTURE2DMSARRAY = 510,
F16TEXTURE1D = 511,
F16TEXTURE2D = 512,
F16TEXTURE3D = 513,
F16TEXTURE2DRECT = 514,
F16TEXTURECUBE = 515,
F16TEXTURE1DARRAY = 516,
F16TEXTURE2DARRAY = 517,
F16TEXTURECUBEARRAY = 518,
F16TEXTUREBUFFER = 519,
F16TEXTURE2DMS = 520,
F16TEXTURE2DMSARRAY = 521,
SUBPASSINPUT = 522,
SUBPASSINPUTMS = 523,
ISUBPASSINPUT = 524,
ISUBPASSINPUTMS = 525,
USUBPASSINPUT = 526,
USUBPASSINPUTMS = 527,
F16SUBPASSINPUT = 528,
F16SUBPASSINPUTMS = 529,
IMAGE1D = 530,
IIMAGE1D = 531,
UIMAGE1D = 532,
IMAGE2D = 533,
IIMAGE2D = 534,
UIMAGE2D = 535,
IMAGE3D = 536,
IIMAGE3D = 537,
UIMAGE3D = 538,
IMAGE2DRECT = 539,
IIMAGE2DRECT = 540,
UIMAGE2DRECT = 541,
IMAGECUBE = 542,
IIMAGECUBE = 543,
UIMAGECUBE = 544,
IMAGEBUFFER = 545,
IIMAGEBUFFER = 546,
UIMAGEBUFFER = 547,
IMAGE1DARRAY = 548,
IIMAGE1DARRAY = 549,
UIMAGE1DARRAY = 550,
IMAGE2DARRAY = 551,
IIMAGE2DARRAY = 552,
UIMAGE2DARRAY = 553,
IMAGECUBEARRAY = 554,
IIMAGECUBEARRAY = 555,
UIMAGECUBEARRAY = 556,
IMAGE2DMS = 557,
IIMAGE2DMS = 558,
UIMAGE2DMS = 559,
IMAGE2DMSARRAY = 560,
IIMAGE2DMSARRAY = 561,
UIMAGE2DMSARRAY = 562,
F16IMAGE1D = 563,
F16IMAGE2D = 564,
F16IMAGE3D = 565,
F16IMAGE2DRECT = 566,
F16IMAGECUBE = 567,
F16IMAGE1DARRAY = 568,
F16IMAGE2DARRAY = 569,
F16IMAGECUBEARRAY = 570,
F16IMAGEBUFFER = 571,
F16IMAGE2DMS = 572,
F16IMAGE2DMSARRAY = 573,
STRUCT = 574,
VOID = 575,
WHILE = 576,
IDENTIFIER = 577,
TYPE_NAME = 578,
FLOATCONSTANT = 579,
DOUBLECONSTANT = 580,
INT16CONSTANT = 581,
UINT16CONSTANT = 582,
INT32CONSTANT = 583,
UINT32CONSTANT = 584,
INTCONSTANT = 585,
UINTCONSTANT = 586,
INT64CONSTANT = 587,
UINT64CONSTANT = 588,
BOOLCONSTANT = 589,
FLOAT16CONSTANT = 590,
LEFT_OP = 591,
RIGHT_OP = 592,
INC_OP = 593,
DEC_OP = 594,
LE_OP = 595,
GE_OP = 596,
EQ_OP = 597,
NE_OP = 598,
AND_OP = 599,
OR_OP = 600,
XOR_OP = 601,
MUL_ASSIGN = 602,
DIV_ASSIGN = 603,
ADD_ASSIGN = 604,
MOD_ASSIGN = 605,
LEFT_ASSIGN = 606,
RIGHT_ASSIGN = 607,
AND_ASSIGN = 608,
XOR_ASSIGN = 609,
OR_ASSIGN = 610,
SUB_ASSIGN = 611,
LEFT_PAREN = 612,
RIGHT_PAREN = 613,
LEFT_BRACKET = 614,
RIGHT_BRACKET = 615,
LEFT_BRACE = 616,
RIGHT_BRACE = 617,
DOT = 618,
COMMA = 619,
COLON = 620,
EQUAL = 621,
SEMICOLON = 622,
BANG = 623,
DASH = 624,
TILDE = 625,
PLUS = 626,
STAR = 627,
SLASH = 628,
PERCENT = 629,
LEFT_ANGLE = 630,
RIGHT_ANGLE = 631,
VERTICAL_BAR = 632,
CARET = 633,
AMPERSAND = 634,
QUESTION = 635,
INVARIANT = 636,
PRECISE = 637,
HIGH_PRECISION = 638,
MEDIUM_PRECISION = 639,
LOW_PRECISION = 640,
PRECISION = 641,
PACKED = 642,
RESOURCE = 643,
SUPERP = 644
NONUNIFORM = 337,
COHERENT = 338,
VOLATILE = 339,
RESTRICT = 340,
READONLY = 341,
WRITEONLY = 342,
DVEC2 = 343,
DVEC3 = 344,
DVEC4 = 345,
DMAT2 = 346,
DMAT3 = 347,
DMAT4 = 348,
F16VEC2 = 349,
F16VEC3 = 350,
F16VEC4 = 351,
F16MAT2 = 352,
F16MAT3 = 353,
F16MAT4 = 354,
F32VEC2 = 355,
F32VEC3 = 356,
F32VEC4 = 357,
F32MAT2 = 358,
F32MAT3 = 359,
F32MAT4 = 360,
F64VEC2 = 361,
F64VEC3 = 362,
F64VEC4 = 363,
F64MAT2 = 364,
F64MAT3 = 365,
F64MAT4 = 366,
NOPERSPECTIVE = 367,
FLAT = 368,
SMOOTH = 369,
LAYOUT = 370,
__EXPLICITINTERPAMD = 371,
MAT2X2 = 372,
MAT2X3 = 373,
MAT2X4 = 374,
MAT3X2 = 375,
MAT3X3 = 376,
MAT3X4 = 377,
MAT4X2 = 378,
MAT4X3 = 379,
MAT4X4 = 380,
DMAT2X2 = 381,
DMAT2X3 = 382,
DMAT2X4 = 383,
DMAT3X2 = 384,
DMAT3X3 = 385,
DMAT3X4 = 386,
DMAT4X2 = 387,
DMAT4X3 = 388,
DMAT4X4 = 389,
F16MAT2X2 = 390,
F16MAT2X3 = 391,
F16MAT2X4 = 392,
F16MAT3X2 = 393,
F16MAT3X3 = 394,
F16MAT3X4 = 395,
F16MAT4X2 = 396,
F16MAT4X3 = 397,
F16MAT4X4 = 398,
F32MAT2X2 = 399,
F32MAT2X3 = 400,
F32MAT2X4 = 401,
F32MAT3X2 = 402,
F32MAT3X3 = 403,
F32MAT3X4 = 404,
F32MAT4X2 = 405,
F32MAT4X3 = 406,
F32MAT4X4 = 407,
F64MAT2X2 = 408,
F64MAT2X3 = 409,
F64MAT2X4 = 410,
F64MAT3X2 = 411,
F64MAT3X3 = 412,
F64MAT3X4 = 413,
F64MAT4X2 = 414,
F64MAT4X3 = 415,
F64MAT4X4 = 416,
ATOMIC_UINT = 417,
SAMPLER1D = 418,
SAMPLER2D = 419,
SAMPLER3D = 420,
SAMPLERCUBE = 421,
SAMPLER1DSHADOW = 422,
SAMPLER2DSHADOW = 423,
SAMPLERCUBESHADOW = 424,
SAMPLER1DARRAY = 425,
SAMPLER2DARRAY = 426,
SAMPLER1DARRAYSHADOW = 427,
SAMPLER2DARRAYSHADOW = 428,
ISAMPLER1D = 429,
ISAMPLER2D = 430,
ISAMPLER3D = 431,
ISAMPLERCUBE = 432,
ISAMPLER1DARRAY = 433,
ISAMPLER2DARRAY = 434,
USAMPLER1D = 435,
USAMPLER2D = 436,
USAMPLER3D = 437,
USAMPLERCUBE = 438,
USAMPLER1DARRAY = 439,
USAMPLER2DARRAY = 440,
SAMPLER2DRECT = 441,
SAMPLER2DRECTSHADOW = 442,
ISAMPLER2DRECT = 443,
USAMPLER2DRECT = 444,
SAMPLERBUFFER = 445,
ISAMPLERBUFFER = 446,
USAMPLERBUFFER = 447,
SAMPLERCUBEARRAY = 448,
SAMPLERCUBEARRAYSHADOW = 449,
ISAMPLERCUBEARRAY = 450,
USAMPLERCUBEARRAY = 451,
SAMPLER2DMS = 452,
ISAMPLER2DMS = 453,
USAMPLER2DMS = 454,
SAMPLER2DMSARRAY = 455,
ISAMPLER2DMSARRAY = 456,
USAMPLER2DMSARRAY = 457,
SAMPLEREXTERNALOES = 458,
F16SAMPLER1D = 459,
F16SAMPLER2D = 460,
F16SAMPLER3D = 461,
F16SAMPLER2DRECT = 462,
F16SAMPLERCUBE = 463,
F16SAMPLER1DARRAY = 464,
F16SAMPLER2DARRAY = 465,
F16SAMPLERCUBEARRAY = 466,
F16SAMPLERBUFFER = 467,
F16SAMPLER2DMS = 468,
F16SAMPLER2DMSARRAY = 469,
F16SAMPLER1DSHADOW = 470,
F16SAMPLER2DSHADOW = 471,
F16SAMPLER1DARRAYSHADOW = 472,
F16SAMPLER2DARRAYSHADOW = 473,
F16SAMPLER2DRECTSHADOW = 474,
F16SAMPLERCUBESHADOW = 475,
F16SAMPLERCUBEARRAYSHADOW = 476,
SAMPLER = 477,
SAMPLERSHADOW = 478,
TEXTURE1D = 479,
TEXTURE2D = 480,
TEXTURE3D = 481,
TEXTURECUBE = 482,
TEXTURE1DARRAY = 483,
TEXTURE2DARRAY = 484,
ITEXTURE1D = 485,
ITEXTURE2D = 486,
ITEXTURE3D = 487,
ITEXTURECUBE = 488,
ITEXTURE1DARRAY = 489,
ITEXTURE2DARRAY = 490,
UTEXTURE1D = 491,
UTEXTURE2D = 492,
UTEXTURE3D = 493,
UTEXTURECUBE = 494,
UTEXTURE1DARRAY = 495,
UTEXTURE2DARRAY = 496,
TEXTURE2DRECT = 497,
ITEXTURE2DRECT = 498,
UTEXTURE2DRECT = 499,
TEXTUREBUFFER = 500,
ITEXTUREBUFFER = 501,
UTEXTUREBUFFER = 502,
TEXTURECUBEARRAY = 503,
ITEXTURECUBEARRAY = 504,
UTEXTURECUBEARRAY = 505,
TEXTURE2DMS = 506,
ITEXTURE2DMS = 507,
UTEXTURE2DMS = 508,
TEXTURE2DMSARRAY = 509,
ITEXTURE2DMSARRAY = 510,
UTEXTURE2DMSARRAY = 511,
F16TEXTURE1D = 512,
F16TEXTURE2D = 513,
F16TEXTURE3D = 514,
F16TEXTURE2DRECT = 515,
F16TEXTURECUBE = 516,
F16TEXTURE1DARRAY = 517,
F16TEXTURE2DARRAY = 518,
F16TEXTURECUBEARRAY = 519,
F16TEXTUREBUFFER = 520,
F16TEXTURE2DMS = 521,
F16TEXTURE2DMSARRAY = 522,
SUBPASSINPUT = 523,
SUBPASSINPUTMS = 524,
ISUBPASSINPUT = 525,
ISUBPASSINPUTMS = 526,
USUBPASSINPUT = 527,
USUBPASSINPUTMS = 528,
F16SUBPASSINPUT = 529,
F16SUBPASSINPUTMS = 530,
IMAGE1D = 531,
IIMAGE1D = 532,
UIMAGE1D = 533,
IMAGE2D = 534,
IIMAGE2D = 535,
UIMAGE2D = 536,
IMAGE3D = 537,
IIMAGE3D = 538,
UIMAGE3D = 539,
IMAGE2DRECT = 540,
IIMAGE2DRECT = 541,
UIMAGE2DRECT = 542,
IMAGECUBE = 543,
IIMAGECUBE = 544,
UIMAGECUBE = 545,
IMAGEBUFFER = 546,
IIMAGEBUFFER = 547,
UIMAGEBUFFER = 548,
IMAGE1DARRAY = 549,
IIMAGE1DARRAY = 550,
UIMAGE1DARRAY = 551,
IMAGE2DARRAY = 552,
IIMAGE2DARRAY = 553,
UIMAGE2DARRAY = 554,
IMAGECUBEARRAY = 555,
IIMAGECUBEARRAY = 556,
UIMAGECUBEARRAY = 557,
IMAGE2DMS = 558,
IIMAGE2DMS = 559,
UIMAGE2DMS = 560,
IMAGE2DMSARRAY = 561,
IIMAGE2DMSARRAY = 562,
UIMAGE2DMSARRAY = 563,
F16IMAGE1D = 564,
F16IMAGE2D = 565,
F16IMAGE3D = 566,
F16IMAGE2DRECT = 567,
F16IMAGECUBE = 568,
F16IMAGE1DARRAY = 569,
F16IMAGE2DARRAY = 570,
F16IMAGECUBEARRAY = 571,
F16IMAGEBUFFER = 572,
F16IMAGE2DMS = 573,
F16IMAGE2DMSARRAY = 574,
STRUCT = 575,
VOID = 576,
WHILE = 577,
IDENTIFIER = 578,
TYPE_NAME = 579,
FLOATCONSTANT = 580,
DOUBLECONSTANT = 581,
INT16CONSTANT = 582,
UINT16CONSTANT = 583,
INT32CONSTANT = 584,
UINT32CONSTANT = 585,
INTCONSTANT = 586,
UINTCONSTANT = 587,
INT64CONSTANT = 588,
UINT64CONSTANT = 589,
BOOLCONSTANT = 590,
FLOAT16CONSTANT = 591,
LEFT_OP = 592,
RIGHT_OP = 593,
INC_OP = 594,
DEC_OP = 595,
LE_OP = 596,
GE_OP = 597,
EQ_OP = 598,
NE_OP = 599,
AND_OP = 600,
OR_OP = 601,
XOR_OP = 602,
MUL_ASSIGN = 603,
DIV_ASSIGN = 604,
ADD_ASSIGN = 605,
MOD_ASSIGN = 606,
LEFT_ASSIGN = 607,
RIGHT_ASSIGN = 608,
AND_ASSIGN = 609,
XOR_ASSIGN = 610,
OR_ASSIGN = 611,
SUB_ASSIGN = 612,
LEFT_PAREN = 613,
RIGHT_PAREN = 614,
LEFT_BRACKET = 615,
RIGHT_BRACKET = 616,
LEFT_BRACE = 617,
RIGHT_BRACE = 618,
DOT = 619,
COMMA = 620,
COLON = 621,
EQUAL = 622,
SEMICOLON = 623,
BANG = 624,
DASH = 625,
TILDE = 626,
PLUS = 627,
STAR = 628,
SLASH = 629,
PERCENT = 630,
LEFT_ANGLE = 631,
RIGHT_ANGLE = 632,
VERTICAL_BAR = 633,
CARET = 634,
AMPERSAND = 635,
QUESTION = 636,
INVARIANT = 637,
PRECISE = 638,
HIGH_PRECISION = 639,
MEDIUM_PRECISION = 640,
LOW_PRECISION = 641,
PRECISION = 642,
PACKED = 643,
RESOURCE = 644,
SUPERP = 645
};
#endif
@ -475,7 +476,7 @@ union YYSTYPE
};
} interm;
#line 479 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
#line 480 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
};
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1

View File

@ -651,6 +651,7 @@ protected:
TIntermSequence& findLinkerObjects() const;
bool userOutputUsed() const;
bool isSpecializationOperation(const TIntermOperator&) const;
bool isNonuniformPropagating(TOperator) const;
bool promoteUnary(TIntermUnary&);
bool promoteBinary(TIntermBinary&);
void addSymbolLinkageNode(TIntermAggregate*& linkage, TSymbolTable&, const TString&);

View File

@ -121,6 +121,7 @@ INSTANTIATE_TEST_CASE_P(
"310.tese",
"310implicitSizeArrayError.vert",
"310AofA.vert",
"310runtimeArray.vert",
"320.comp",
"320.vert",
"320.geom",
@ -200,6 +201,7 @@ INSTANTIATE_TEST_CASE_P(
"matrix.frag",
"matrix2.frag",
"mixedArrayDecls.frag",
"nonuniform.frag",
"newTexture.frag",
"Operations.frag",
"overlongLiteral.frag",

View File

@ -282,6 +282,7 @@ INSTANTIATE_TEST_CASE_P(
"spv.newTexture.frag",
"spv.noDeadDecorations.vert",
"spv.nonSquare.vert",
"spv.nonuniform.frag",
"spv.noWorkgroup.comp",
"spv.offsets.frag",
"spv.Operations.frag",

View File

@ -844,6 +844,8 @@ TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc,
if (index->getQualifier().isFrontEndConstant()) {
if (base->getType().isUnsizedArray())
base->getWritableType().updateImplicitArraySize(indexValue + 1);
else
checkIndex(loc, base->getType(), indexValue);
result = intermediate.addIndex(EOpIndexDirect, base, index, loc);
} else
result = intermediate.addIndex(EOpIndexIndirect, base, index, loc);
@ -6551,6 +6553,7 @@ void HlslParseContext::mergeQualifiers(TQualifier& dst, const TQualifier& src)
MERGE_SINGLETON(readonly);
MERGE_SINGLETON(writeonly);
MERGE_SINGLETON(specConstant);
MERGE_SINGLETON(nonUniform);
}
// used to flatten the sampler type space into a single dimension

18
known_good_khr.json Normal file
View File

@ -0,0 +1,18 @@
{
"commits" : [
{
"name" : "spirv-tools",
"site" : "gitlab",
"subrepo" : "spirv/spirv-tools",
"subdir" : "External/spirv-tools",
"commit" : "d4e2c2eaa6fd2e9f9cd218ea9add9b0c8ae759ba"
},
{
"name" : "spirv-tools/external/spirv-headers",
"site" : "gitlab",
"subrepo" : "spirv/SPIRV-Headers",
"subdir" : "External/spirv-tools/external/spirv-headers",
"commit" : "4082a777bd5df31ed45acf40e64263094e85ed2e"
}
]
}