Merge pull request #1761 from KhronosGroup/SPIR-V_1.4
SPV 1.4: Add code generation for SPIR-V 1.4 features
This commit is contained in:
commit
b03da6edd8
@ -135,7 +135,7 @@ protected:
|
||||
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::LoopControlMask TranslateLoopControl(const glslang::TIntermLoop&, std::vector<unsigned int>& operands) const;
|
||||
spv::StorageClass TranslateStorageClass(const glslang::TType&);
|
||||
void addIndirectionIndexCapabilities(const glslang::TType& baseType, const glslang::TType& indexType);
|
||||
spv::Id createSpvVariable(const glslang::TIntermSymbol*);
|
||||
@ -1055,7 +1055,7 @@ spv::SelectionControlMask TGlslangToSpvTraverser::TranslateSwitchControl(const g
|
||||
|
||||
// return a non-0 dependency if the dependency argument must be set
|
||||
spv::LoopControlMask TGlslangToSpvTraverser::TranslateLoopControl(const glslang::TIntermLoop& loopNode,
|
||||
unsigned int& dependencyLength) const
|
||||
std::vector<unsigned int>& operands) const
|
||||
{
|
||||
spv::LoopControlMask control = spv::LoopControlMaskNone;
|
||||
|
||||
@ -1067,7 +1067,29 @@ spv::LoopControlMask TGlslangToSpvTraverser::TranslateLoopControl(const glslang:
|
||||
control = control | spv::LoopControlDependencyInfiniteMask;
|
||||
else if (loopNode.getLoopDependency() > 0) {
|
||||
control = control | spv::LoopControlDependencyLengthMask;
|
||||
dependencyLength = loopNode.getLoopDependency();
|
||||
operands.push_back((unsigned int)loopNode.getLoopDependency());
|
||||
}
|
||||
if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4) {
|
||||
if (loopNode.getMinIterations() > 0) {
|
||||
control = control | spv::LoopControlMinIterationsMask;
|
||||
operands.push_back(loopNode.getMinIterations());
|
||||
}
|
||||
if (loopNode.getMaxIterations() < glslang::TIntermLoop::iterationsInfinite) {
|
||||
control = control | spv::LoopControlMaxIterationsMask;
|
||||
operands.push_back(loopNode.getMaxIterations());
|
||||
}
|
||||
if (loopNode.getIterationMultiple() > 1) {
|
||||
control = control | spv::LoopControlIterationMultipleMask;
|
||||
operands.push_back(loopNode.getIterationMultiple());
|
||||
}
|
||||
if (loopNode.getPeelCount() > 0) {
|
||||
control = control | spv::LoopControlPeelCountMask;
|
||||
operands.push_back(loopNode.getPeelCount());
|
||||
}
|
||||
if (loopNode.getPartialCount() > 0) {
|
||||
control = control | spv::LoopControlPartialCountMask;
|
||||
operands.push_back(loopNode.getPartialCount());
|
||||
}
|
||||
}
|
||||
|
||||
return control;
|
||||
@ -1552,10 +1574,16 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol)
|
||||
|
||||
// Include all "static use" and "linkage only" interface variables on the OpEntryPoint instruction
|
||||
if (builder.isPointer(id)) {
|
||||
spv::StorageClass sc = builder.getStorageClass(id);
|
||||
if (sc == spv::StorageClassInput || sc == spv::StorageClassOutput) {
|
||||
if (!symbol->getType().isStruct() || symbol->getType().getStruct()->size() > 0)
|
||||
// Consider adding to the OpEntryPoint interface list.
|
||||
// Only looking at structures if they have at least one member.
|
||||
if (!symbol->getType().isStruct() || symbol->getType().getStruct()->size() > 0) {
|
||||
spv::StorageClass sc = builder.getStorageClass(id);
|
||||
// Before SPIR-V 1.4, we only want to include Input and Output.
|
||||
// Starting with SPIR-V 1.4, we want all globals.
|
||||
if ((glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4 && sc != spv::StorageClassFunction) ||
|
||||
(sc == spv::StorageClassInput || sc == spv::StorageClassOutput)) {
|
||||
iOSet.insert(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1683,6 +1711,7 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T
|
||||
case glslang::EOpIndexDirect:
|
||||
case glslang::EOpIndexDirectStruct:
|
||||
{
|
||||
// Structure, array, matrix, or vector indirection with statically known index.
|
||||
// Get the left part of the access chain.
|
||||
node->getLeft()->traverse(this);
|
||||
|
||||
@ -1737,8 +1766,8 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T
|
||||
return false;
|
||||
case glslang::EOpIndexIndirect:
|
||||
{
|
||||
// Structure or array or vector indirection.
|
||||
// Will use native SPIR-V access-chain for struct and array indirection;
|
||||
// Array, matrix, or vector indirection with variable index.
|
||||
// Will use native SPIR-V access-chain for and array indirection;
|
||||
// matrices are arrays of vectors, so will also work for a matrix.
|
||||
// Will use the access chain's 'component' for variable index into a vector.
|
||||
|
||||
@ -2609,6 +2638,19 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
||||
// next layer copies r-values into memory to use the access-chain mechanism
|
||||
bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang::TIntermSelection* node)
|
||||
{
|
||||
// see if OpSelect can handle it
|
||||
const auto isOpSelectable = [&]() {
|
||||
if (node->getBasicType() == glslang::EbtVoid)
|
||||
return false;
|
||||
// OpSelect can do all other types starting with SPV 1.4
|
||||
if (glslangIntermediate->getSpv().spv < glslang::EShTargetSpv_1_4) {
|
||||
// pre-1.4, only scalars and vectors can be handled
|
||||
if ((!node->getType().isScalar() && !node->getType().isVector()))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
// See if it simple and safe, or required, to execute both sides.
|
||||
// Crucially, side effects must be either semantically required or avoided,
|
||||
// and there are performance trade-offs.
|
||||
@ -2627,9 +2669,7 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang
|
||||
|
||||
// if not required to execute both, decide based on performance/practicality...
|
||||
|
||||
// see if OpSelect can handle it
|
||||
if ((!node->getType().isScalar() && !node->getType().isVector()) ||
|
||||
node->getBasicType() == glslang::EbtVoid)
|
||||
if (!isOpSelectable())
|
||||
return false;
|
||||
|
||||
assert(node->getType() == node->getTrueBlock() ->getAsTyped()->getType() &&
|
||||
@ -2666,14 +2706,16 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang
|
||||
// emit code to select between trueValue and falseValue
|
||||
|
||||
// see if OpSelect can handle it
|
||||
if (node->getType().isScalar() || node->getType().isVector()) {
|
||||
if (isOpSelectable()) {
|
||||
// Emit OpSelect for this selection.
|
||||
|
||||
// smear condition to vector, if necessary (AST is always scalar)
|
||||
if (builder.isVector(trueValue))
|
||||
// Before 1.4, smear like for mix(), starting with 1.4, keep it scalar
|
||||
if (glslangIntermediate->getSpv().spv < glslang::EShTargetSpv_1_4 && builder.isVector(trueValue)) {
|
||||
condition = builder.smearScalar(spv::NoPrecision, condition,
|
||||
builder.makeVectorType(builder.makeBoolType(),
|
||||
builder.getNumComponents(trueValue)));
|
||||
}
|
||||
|
||||
// OpSelect
|
||||
result = builder.createTriOp(spv::OpSelect,
|
||||
@ -2822,8 +2864,8 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn
|
||||
builder.createBranch(&blocks.head);
|
||||
|
||||
// Loop control:
|
||||
unsigned int dependencyLength = glslang::TIntermLoop::dependencyInfinite;
|
||||
const spv::LoopControlMask control = TranslateLoopControl(*node, dependencyLength);
|
||||
std::vector<unsigned int> operands;
|
||||
const spv::LoopControlMask control = TranslateLoopControl(*node, operands);
|
||||
|
||||
// Spec requires back edges to target header blocks, and every header block
|
||||
// must dominate its merge block. Make a header block first to ensure these
|
||||
@ -2833,7 +2875,7 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn
|
||||
// including merges of its own.
|
||||
builder.setLine(node->getLoc().line, node->getLoc().getFilename());
|
||||
builder.setBuildPoint(&blocks.head);
|
||||
builder.createLoopMerge(&blocks.merge, &blocks.continue_target, control, dependencyLength);
|
||||
builder.createLoopMerge(&blocks.merge, &blocks.continue_target, control, operands);
|
||||
if (node->testFirst() && node->getTest()) {
|
||||
spv::Block& test = builder.makeNewBlock();
|
||||
builder.createBranch(&test);
|
||||
@ -3615,6 +3657,20 @@ void TGlslangToSpvTraverser::multiTypeStore(const glslang::TType& type, spv::Id
|
||||
// where the two types were the same type in GLSL. This requires member
|
||||
// by member copy, recursively.
|
||||
|
||||
// SPIR-V 1.4 added an instruction to do help do this.
|
||||
if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4) {
|
||||
// However, bool in uniform space is changed to int, so
|
||||
// OpCopyLogical does not work for that.
|
||||
// TODO: It would be more robust to do a full recursive verification of the types satisfying SPIR-V rules.
|
||||
bool rBool = builder.containsType(builder.getTypeId(rValue), spv::OpTypeBool, 0);
|
||||
bool lBool = builder.containsType(lType, spv::OpTypeBool, 0);
|
||||
if (lBool == rBool) {
|
||||
spv::Id logicalCopy = builder.createUnaryOp(spv::OpCopyLogical, lType, rValue);
|
||||
accessChainStore(type, logicalCopy);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If an array, copy element by element.
|
||||
if (type.isArray()) {
|
||||
glslang::TType glslangElementType(type, 0);
|
||||
@ -4126,15 +4182,26 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
||||
|
||||
// Process a GLSL texturing op (will be SPV image)
|
||||
|
||||
const glslang::TType &imageType = node->getAsAggregate() ? node->getAsAggregate()->getSequence()[0]->getAsTyped()->getType()
|
||||
: node->getAsUnaryNode()->getOperand()->getAsTyped()->getType();
|
||||
const glslang::TType &imageType = node->getAsAggregate()
|
||||
? node->getAsAggregate()->getSequence()[0]->getAsTyped()->getType()
|
||||
: node->getAsUnaryNode()->getOperand()->getAsTyped()->getType();
|
||||
const glslang::TSampler sampler = imageType.getSampler();
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool f16ShadowCompare = (sampler.shadow && node->getAsAggregate())
|
||||
? node->getAsAggregate()->getSequence()[1]->getAsTyped()->getType().getBasicType() == glslang::EbtFloat16
|
||||
: false;
|
||||
? node->getAsAggregate()->getSequence()[1]->getAsTyped()->getType().getBasicType() == glslang::EbtFloat16
|
||||
: false;
|
||||
#endif
|
||||
|
||||
const auto signExtensionMask = [&]() {
|
||||
if (builder.getSpvVersion() >= spv::Spv_1_4) {
|
||||
if (sampler.type == glslang::EbtUint)
|
||||
return spv::ImageOperandsZeroExtendMask;
|
||||
else if (sampler.type == glslang::EbtInt)
|
||||
return spv::ImageOperandsSignExtendMask;
|
||||
}
|
||||
return spv::ImageOperandsMaskNone;
|
||||
};
|
||||
|
||||
std::vector<spv::Id> arguments;
|
||||
if (node->getAsAggregate())
|
||||
translateArguments(*node->getAsAggregate(), arguments);
|
||||
@ -4213,11 +4280,17 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
||||
spv::IdImmediate coord = { true,
|
||||
builder.makeCompositeConstant(builder.makeVectorType(builder.makeIntType(32), 2), comps) };
|
||||
operands.push_back(coord);
|
||||
spv::IdImmediate imageOperands = { false, spv::ImageOperandsMaskNone };
|
||||
imageOperands.word = imageOperands.word | signExtensionMask();
|
||||
if (sampler.ms) {
|
||||
spv::IdImmediate imageOperands = { false, spv::ImageOperandsSampleMask };
|
||||
imageOperands.word = imageOperands.word | spv::ImageOperandsSampleMask;
|
||||
}
|
||||
if (imageOperands.word != spv::ImageOperandsMaskNone) {
|
||||
operands.push_back(imageOperands);
|
||||
spv::IdImmediate imageOperand = { true, *(opIt++) };
|
||||
operands.push_back(imageOperand);
|
||||
if (sampler.ms) {
|
||||
spv::IdImmediate imageOperand = { true, *(opIt++) };
|
||||
operands.push_back(imageOperand);
|
||||
}
|
||||
}
|
||||
spv::Id result = builder.createOp(spv::OpImageRead, resultType(), operands);
|
||||
builder.setPrecision(result, precision);
|
||||
@ -4244,7 +4317,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
||||
#endif
|
||||
mask = mask | TranslateImageOperands(TranslateCoherent(imageType));
|
||||
mask = (spv::ImageOperandsMask)(mask & ~spv::ImageOperandsMakeTexelAvailableKHRMask);
|
||||
if (mask) {
|
||||
mask = mask | signExtensionMask();
|
||||
if (mask != spv::MemoryAccessMaskNone) {
|
||||
spv::IdImmediate imageOperands = { false, (unsigned int)mask };
|
||||
operands.push_back(imageOperands);
|
||||
}
|
||||
@ -4259,7 +4333,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
||||
}
|
||||
#endif
|
||||
if (mask & spv::ImageOperandsMakeTexelVisibleKHRMask) {
|
||||
spv::IdImmediate imageOperand = { true, builder.makeUintConstant(TranslateMemoryScope(TranslateCoherent(imageType))) };
|
||||
spv::IdImmediate imageOperand = { true,
|
||||
builder.makeUintConstant(TranslateMemoryScope(TranslateCoherent(imageType))) };
|
||||
operands.push_back(imageOperand);
|
||||
}
|
||||
|
||||
@ -4306,7 +4381,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
||||
#endif
|
||||
mask = mask | TranslateImageOperands(TranslateCoherent(imageType));
|
||||
mask = (spv::ImageOperandsMask)(mask & ~spv::ImageOperandsMakeTexelVisibleKHRMask);
|
||||
if (mask) {
|
||||
mask = mask | signExtensionMask();
|
||||
if (mask != spv::MemoryAccessMaskNone) {
|
||||
spv::IdImmediate imageOperands = { false, (unsigned int)mask };
|
||||
operands.push_back(imageOperands);
|
||||
}
|
||||
@ -4321,7 +4397,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
||||
}
|
||||
#endif
|
||||
if (mask & spv::ImageOperandsMakeTexelAvailableKHRMask) {
|
||||
spv::IdImmediate imageOperand = { true, builder.makeUintConstant(TranslateMemoryScope(TranslateCoherent(imageType))) };
|
||||
spv::IdImmediate imageOperand = { true,
|
||||
builder.makeUintConstant(TranslateMemoryScope(TranslateCoherent(imageType))) };
|
||||
operands.push_back(imageOperand);
|
||||
}
|
||||
|
||||
@ -4330,7 +4407,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
||||
builder.addCapability(spv::CapabilityStorageImageWriteWithoutFormat);
|
||||
return spv::NoResult;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if (node->getOp() == glslang::EOpSparseImageLoad || node->getOp() == glslang::EOpSparseImageLoadLod) {
|
||||
} else if (node->getOp() == glslang::EOpSparseImageLoad ||
|
||||
node->getOp() == glslang::EOpSparseImageLoadLod) {
|
||||
#else
|
||||
} else if (node->getOp() == glslang::EOpSparseImageLoad) {
|
||||
#endif
|
||||
@ -4352,7 +4430,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
||||
#endif
|
||||
mask = mask | TranslateImageOperands(TranslateCoherent(imageType));
|
||||
mask = (spv::ImageOperandsMask)(mask & ~spv::ImageOperandsMakeTexelAvailableKHRMask);
|
||||
if (mask) {
|
||||
mask = mask | signExtensionMask();
|
||||
if (mask != spv::MemoryAccessMaskNone) {
|
||||
spv::IdImmediate imageOperands = { false, (unsigned int)mask };
|
||||
operands.push_back(imageOperands);
|
||||
}
|
||||
@ -4654,7 +4733,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
||||
spv::Id resType = builder.makeStructType(members, "ResType");
|
||||
|
||||
//call ImageFootprintNV
|
||||
spv::Id res = builder.createTextureCall(precision, resType, sparse, cracked.fetch, cracked.proj, cracked.gather, noImplicitLod, params);
|
||||
spv::Id res = builder.createTextureCall(precision, resType, sparse, cracked.fetch, cracked.proj,
|
||||
cracked.gather, noImplicitLod, params, signExtensionMask());
|
||||
|
||||
//copy resType (SPIR-V type) to resultStructType(OpenGL type)
|
||||
for (int i = 0; i < 5; i++) {
|
||||
@ -4707,7 +4787,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
||||
}
|
||||
|
||||
std::vector<spv::Id> result( 1,
|
||||
builder.createTextureCall(precision, resultType(), sparse, cracked.fetch, cracked.proj, cracked.gather, noImplicitLod, params)
|
||||
builder.createTextureCall(precision, resultType(), sparse, cracked.fetch, cracked.proj, cracked.gather,
|
||||
noImplicitLod, params, signExtensionMask())
|
||||
);
|
||||
|
||||
if (components != node->getType().getVectorSize())
|
||||
|
||||
@ -1306,11 +1306,13 @@ void Builder::makeDiscard()
|
||||
}
|
||||
|
||||
// Comments in header
|
||||
Id Builder::createVariable(StorageClass storageClass, Id type, const char* name)
|
||||
Id Builder::createVariable(StorageClass storageClass, Id type, const char* name, Id initializer)
|
||||
{
|
||||
Id pointerType = makePointer(storageClass, type);
|
||||
Instruction* inst = new Instruction(getUniqueId(), pointerType, OpVariable);
|
||||
inst->addImmediateOperand(storageClass);
|
||||
if (initializer != NoResult)
|
||||
inst->addIdOperand(initializer);
|
||||
|
||||
switch (storageClass) {
|
||||
case StorageClassFunction:
|
||||
@ -1806,7 +1808,7 @@ Id Builder::createBuiltinCall(Id resultType, Id builtins, int entryPoint, const
|
||||
// Accept all parameters needed to create a texture instruction.
|
||||
// Create the correct instruction based on the inputs, and make the call.
|
||||
Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather,
|
||||
bool noImplicitLod, const TextureParameters& parameters)
|
||||
bool noImplicitLod, const TextureParameters& parameters, ImageOperandsMask signExtensionMask)
|
||||
{
|
||||
static const int maxTextureArgs = 10;
|
||||
Id texArgs[maxTextureArgs] = {};
|
||||
@ -1833,8 +1835,8 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
||||
//
|
||||
// Set up the optional arguments
|
||||
//
|
||||
int optArgNum = numArgs; // track which operand, if it exists, is the mask of optional arguments
|
||||
++numArgs; // speculatively make room for the mask operand
|
||||
int optArgNum = numArgs; // track which operand, if it exists, is the mask of optional arguments
|
||||
++numArgs; // speculatively make room for the mask operand
|
||||
ImageOperandsMask mask = ImageOperandsMaskNone; // the mask operand
|
||||
if (parameters.bias) {
|
||||
mask = (ImageOperandsMask)(mask | ImageOperandsBiasMask);
|
||||
@ -1887,6 +1889,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
||||
if (parameters.volatil) {
|
||||
mask = mask | ImageOperandsVolatileTexelKHRMask;
|
||||
}
|
||||
mask = mask | signExtensionMask;
|
||||
if (mask == ImageOperandsMaskNone)
|
||||
--numArgs; // undo speculative reservation for the mask argument
|
||||
else
|
||||
@ -2649,12 +2652,19 @@ Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resu
|
||||
if (constant) {
|
||||
id = createCompositeExtract(accessChain.base, swizzleBase, indexes);
|
||||
} else {
|
||||
// make a new function variable for this r-value
|
||||
Id lValue = createVariable(StorageClassFunction, getTypeId(accessChain.base), "indexable");
|
||||
|
||||
// store into it
|
||||
createStore(accessChain.base, lValue);
|
||||
|
||||
Id lValue = NoResult;
|
||||
if (spvVersion >= Spv_1_4) {
|
||||
// make a new function variable for this r-value, using an initializer,
|
||||
// and mark it as NonWritable so that downstream it can be detected as a lookup
|
||||
// table
|
||||
lValue = createVariable(StorageClassFunction, getTypeId(accessChain.base), "indexable",
|
||||
accessChain.base);
|
||||
addDecoration(lValue, DecorationNonWritable);
|
||||
} else {
|
||||
lValue = createVariable(StorageClassFunction, getTypeId(accessChain.base), "indexable");
|
||||
// store into it
|
||||
createStore(accessChain.base, lValue);
|
||||
}
|
||||
// move base to the new variable
|
||||
accessChain.base = lValue;
|
||||
accessChain.isRValue = false;
|
||||
@ -2956,14 +2966,14 @@ void Builder::createSelectionMerge(Block* mergeBlock, unsigned int control)
|
||||
}
|
||||
|
||||
void Builder::createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control,
|
||||
unsigned int dependencyLength)
|
||||
const std::vector<unsigned int>& operands)
|
||||
{
|
||||
Instruction* merge = new Instruction(OpLoopMerge);
|
||||
merge->addIdOperand(mergeBlock->getId());
|
||||
merge->addIdOperand(continueBlock->getId());
|
||||
merge->addImmediateOperand(control);
|
||||
if ((control & LoopControlDependencyLengthMask) != 0)
|
||||
merge->addImmediateOperand(dependencyLength);
|
||||
for (int op = 0; op < (int)operands.size(); ++op)
|
||||
merge->addImmediateOperand(operands[op]);
|
||||
buildPoint->addInstruction(std::unique_ptr<Instruction>(merge));
|
||||
}
|
||||
|
||||
|
||||
@ -61,6 +61,14 @@
|
||||
|
||||
namespace spv {
|
||||
|
||||
typedef enum {
|
||||
Spv_1_0 = (1 << 16),
|
||||
Spv_1_1 = (1 << 16) | (1 << 8),
|
||||
Spv_1_2 = (1 << 16) | (2 << 8),
|
||||
Spv_1_3 = (1 << 16) | (3 << 8),
|
||||
Spv_1_4 = (1 << 16) | (4 << 8),
|
||||
} SpvVersion;
|
||||
|
||||
class Builder {
|
||||
public:
|
||||
Builder(unsigned int spvVersion, unsigned int userNumber, SpvBuildLogger* logger);
|
||||
@ -300,7 +308,7 @@ public:
|
||||
void makeDiscard();
|
||||
|
||||
// Create a global or function local or IO variable.
|
||||
Id createVariable(StorageClass, Id type, const char* name = 0);
|
||||
Id createVariable(StorageClass, Id type, const char* name = 0, Id initializer = NoResult);
|
||||
|
||||
// Create an intermediate with an undefined value.
|
||||
Id createUndefined(Id type);
|
||||
@ -408,7 +416,8 @@ public:
|
||||
};
|
||||
|
||||
// Select the correct texture operation based on all inputs, and emit the correct instruction
|
||||
Id createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather, bool noImplicit, const TextureParameters&);
|
||||
Id createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather,
|
||||
bool noImplicit, const TextureParameters&, ImageOperandsMask);
|
||||
|
||||
// Emit the OpTextureQuery* instruction that was passed in.
|
||||
// Figure out the right return value and type, and return it.
|
||||
@ -662,7 +671,7 @@ public:
|
||||
|
||||
void createBranch(Block* block);
|
||||
void createConditionalBranch(Id condition, Block* thenBlock, Block* elseBlock);
|
||||
void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control, unsigned int dependencyLength);
|
||||
void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control, const std::vector<unsigned int>& operands);
|
||||
|
||||
// Sets to generate opcode for specialization constants.
|
||||
void setToSpecConstCodeGenMode() { generatingOpCodeForSpecConst = true; }
|
||||
|
||||
@ -52,8 +52,21 @@ namespace glslang {
|
||||
spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLogger* logger)
|
||||
{
|
||||
switch (spvVersion.vulkan) {
|
||||
case glslang::EShTargetVulkan_1_0: return spv_target_env::SPV_ENV_VULKAN_1_0;
|
||||
case glslang::EShTargetVulkan_1_1: return spv_target_env::SPV_ENV_VULKAN_1_1;
|
||||
case glslang::EShTargetVulkan_1_0:
|
||||
return spv_target_env::SPV_ENV_VULKAN_1_0;
|
||||
case glslang::EShTargetVulkan_1_1:
|
||||
switch (spvVersion.spv) {
|
||||
case EShTargetSpv_1_0:
|
||||
case EShTargetSpv_1_1:
|
||||
case EShTargetSpv_1_2:
|
||||
case EShTargetSpv_1_3:
|
||||
return spv_target_env::SPV_ENV_VULKAN_1_1;
|
||||
case EShTargetSpv_1_4:
|
||||
return spv_target_env::SPV_ENV_VULKAN_1_1_SPIRV_1_4;
|
||||
default:
|
||||
logger->missingFunctionality("Target version for SPIRV-Tools validator");
|
||||
return spv_target_env::SPV_ENV_VULKAN_1_1;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -575,7 +575,7 @@ const char* ImageChannelDataTypeString(int type)
|
||||
}
|
||||
}
|
||||
|
||||
const int ImageOperandsCeiling = 12;
|
||||
const int ImageOperandsCeiling = 14;
|
||||
|
||||
const char* ImageOperandsString(int format)
|
||||
{
|
||||
@ -592,6 +592,8 @@ const char* ImageOperandsString(int format)
|
||||
case ImageOperandsMakeTexelVisibleKHRShift: return "MakeTexelVisibleKHR";
|
||||
case ImageOperandsNonPrivateTexelKHRShift: return "NonPrivateTexelKHR";
|
||||
case ImageOperandsVolatileTexelKHRShift: return "VolatileTexelKHR";
|
||||
case ImageOperandsSignExtendShift: return "SignExtend";
|
||||
case ImageOperandsZeroExtendShift: return "ZeroExtend";
|
||||
|
||||
case ImageOperandsCeiling:
|
||||
default:
|
||||
@ -674,15 +676,20 @@ const char* SelectControlString(int cont)
|
||||
}
|
||||
}
|
||||
|
||||
const int LoopControlCeiling = 4;
|
||||
const int LoopControlCeiling = LoopControlPartialCountShift + 1;
|
||||
|
||||
const char* LoopControlString(int cont)
|
||||
{
|
||||
switch (cont) {
|
||||
case 0: return "Unroll";
|
||||
case 1: return "DontUnroll";
|
||||
case 2: return "DependencyInfinite";
|
||||
case 3: return "DependencyLength";
|
||||
case LoopControlUnrollShift: return "Unroll";
|
||||
case LoopControlDontUnrollShift: return "DontUnroll";
|
||||
case LoopControlDependencyInfiniteShift: return "DependencyInfinite";
|
||||
case LoopControlDependencyLengthShift: return "DependencyLength";
|
||||
case LoopControlMinIterationsShift: return "MinIterations";
|
||||
case LoopControlMaxIterationsShift: return "MaxIterations";
|
||||
case LoopControlIterationMultipleShift: return "IterationMultiple";
|
||||
case LoopControlPeelCountShift: return "PeelCount";
|
||||
case LoopControlPartialCountShift: return "PartialCount";
|
||||
|
||||
case LoopControlCeiling:
|
||||
default: return "Bad";
|
||||
@ -1026,6 +1033,7 @@ const char* OpcodeString(int op)
|
||||
case 82: return "OpCompositeInsert";
|
||||
case 83: return "OpCopyObject";
|
||||
case 84: return "OpTranspose";
|
||||
case OpCopyLogical: return "OpCopyLogical";
|
||||
case 85: return "Bad";
|
||||
case 86: return "OpSampledImage";
|
||||
case 87: return "OpImageSampleImplicitLod";
|
||||
@ -1933,6 +1941,8 @@ void Parameterize()
|
||||
|
||||
InstructionDesc[OpTranspose].operands.push(OperandId, "'Matrix'");
|
||||
|
||||
InstructionDesc[OpCopyLogical].operands.push(OperandId, "'Operand'");
|
||||
|
||||
InstructionDesc[OpIsNan].operands.push(OperandId, "'x'");
|
||||
|
||||
InstructionDesc[OpIsInf].operands.push(OperandId, "'x'");
|
||||
|
||||
@ -56,7 +56,7 @@ ERROR: node is still EOpNull!
|
||||
0:28 Function Definition: attExt( ( global void)
|
||||
0:28 Function Parameters:
|
||||
0:30 Sequence
|
||||
0:30 Loop with condition not tested first: Dependency -3
|
||||
0:30 Loop with condition not tested first
|
||||
0:30 Loop Condition
|
||||
0:30 Constant:
|
||||
0:30 true (const bool)
|
||||
|
||||
109
Test/baseResults/spv.1.4.LoopControl.frag.out
Normal file
109
Test/baseResults/spv.1.4.LoopControl.frag.out
Normal file
@ -0,0 +1,109 @@
|
||||
spv.1.4.LoopControl.frag
|
||||
WARNING: 0:15: 'min_iterations' : expected a single integer argument
|
||||
WARNING: 0:15: 'max_iterations' : expected a single integer argument
|
||||
|
||||
// Module Version 10400
|
||||
// Generated by (magic number): 80007
|
||||
// Id's are bound by 54
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 53
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source GLSL 450
|
||||
SourceExtension "GL_EXT_control_flow_attributes"
|
||||
Name 4 "main"
|
||||
Name 8 "i"
|
||||
Name 32 "i"
|
||||
Name 42 "i"
|
||||
Name 53 "cond"
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeInt 32 1
|
||||
7: TypePointer Function 6(int)
|
||||
9: 6(int) Constant 0
|
||||
16: 6(int) Constant 8
|
||||
17: TypeBool
|
||||
20: 6(int) Constant 1
|
||||
27: 17(bool) ConstantTrue
|
||||
52: TypePointer Private 17(bool)
|
||||
53(cond): 52(ptr) Variable Private
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
8(i): 7(ptr) Variable Function
|
||||
32(i): 7(ptr) Variable Function
|
||||
42(i): 7(ptr) Variable Function
|
||||
Store 8(i) 9
|
||||
Branch 10
|
||||
10: Label
|
||||
LoopMerge 12 13 MinIterations MaxIterations 3 7
|
||||
Branch 14
|
||||
14: Label
|
||||
15: 6(int) Load 8(i)
|
||||
18: 17(bool) SLessThan 15 16
|
||||
BranchConditional 18 11 12
|
||||
11: Label
|
||||
Branch 13
|
||||
13: Label
|
||||
19: 6(int) Load 8(i)
|
||||
21: 6(int) IAdd 19 20
|
||||
Store 8(i) 21
|
||||
Branch 10
|
||||
12: Label
|
||||
Branch 22
|
||||
22: Label
|
||||
LoopMerge 24 25 IterationMultiple 2
|
||||
Branch 26
|
||||
26: Label
|
||||
BranchConditional 27 23 24
|
||||
23: Label
|
||||
Branch 25
|
||||
25: Label
|
||||
Branch 22
|
||||
24: Label
|
||||
Branch 28
|
||||
28: Label
|
||||
LoopMerge 30 31 PeelCount 5
|
||||
Branch 29
|
||||
29: Label
|
||||
Branch 31
|
||||
31: Label
|
||||
BranchConditional 27 28 30
|
||||
30: Label
|
||||
Store 32(i) 9
|
||||
Branch 33
|
||||
33: Label
|
||||
LoopMerge 35 36 PartialCount 4
|
||||
Branch 37
|
||||
37: Label
|
||||
38: 6(int) Load 32(i)
|
||||
39: 17(bool) SLessThan 38 16
|
||||
BranchConditional 39 34 35
|
||||
34: Label
|
||||
Branch 36
|
||||
36: Label
|
||||
40: 6(int) Load 32(i)
|
||||
41: 6(int) IAdd 40 20
|
||||
Store 32(i) 41
|
||||
Branch 33
|
||||
35: Label
|
||||
Store 42(i) 9
|
||||
Branch 43
|
||||
43: Label
|
||||
LoopMerge 45 46 None
|
||||
Branch 47
|
||||
47: Label
|
||||
48: 6(int) Load 42(i)
|
||||
49: 17(bool) SLessThan 48 16
|
||||
BranchConditional 49 44 45
|
||||
44: Label
|
||||
Branch 46
|
||||
46: Label
|
||||
50: 6(int) Load 42(i)
|
||||
51: 6(int) IAdd 50 20
|
||||
Store 42(i) 51
|
||||
Branch 43
|
||||
45: Label
|
||||
Return
|
||||
FunctionEnd
|
||||
58
Test/baseResults/spv.1.4.NonWritable.frag.out
Executable file
58
Test/baseResults/spv.1.4.NonWritable.frag.out
Executable file
@ -0,0 +1,58 @@
|
||||
spv.1.4.NonWritable.frag
|
||||
// Module Version 10400
|
||||
// Generated by (magic number): 80007
|
||||
// Id's are bound by 38
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 8 31
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source GLSL 450
|
||||
Name 4 "main"
|
||||
Name 8 "color"
|
||||
Name 31 "index"
|
||||
Name 34 "indexable"
|
||||
Decorate 8(color) Location 0
|
||||
Decorate 31(index) Flat
|
||||
Decorate 31(index) Location 0
|
||||
Decorate 34(indexable) NonWritable
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypePointer Output 6(float)
|
||||
8(color): 7(ptr) Variable Output
|
||||
9: TypeInt 32 0
|
||||
10: 9(int) Constant 16
|
||||
11: TypeArray 6(float) 10
|
||||
12: 6(float) Constant 1065353216
|
||||
13: 6(float) Constant 1073741824
|
||||
14: 6(float) Constant 1077936128
|
||||
15: 6(float) Constant 1082130432
|
||||
16: 6(float) Constant 1084227584
|
||||
17: 6(float) Constant 1086324736
|
||||
18: 6(float) Constant 1088421888
|
||||
19: 6(float) Constant 1090519040
|
||||
20: 6(float) Constant 1091567616
|
||||
21: 6(float) Constant 1092616192
|
||||
22: 6(float) Constant 1093664768
|
||||
23: 6(float) Constant 1094713344
|
||||
24: 6(float) Constant 1095761920
|
||||
25: 6(float) Constant 1096810496
|
||||
26: 6(float) Constant 1097859072
|
||||
27: 6(float) Constant 1098907648
|
||||
28: 11 ConstantComposite 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
||||
29: TypeInt 32 1
|
||||
30: TypePointer Input 29(int)
|
||||
31(index): 30(ptr) Variable Input
|
||||
33: TypePointer Function 11
|
||||
35: TypePointer Function 6(float)
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
34(indexable): 33(ptr) Variable Function 28
|
||||
32: 29(int) Load 31(index)
|
||||
36: 35(ptr) AccessChain 34(indexable) 32
|
||||
37: 6(float) Load 36
|
||||
Store 8(color) 37
|
||||
Return
|
||||
FunctionEnd
|
||||
150
Test/baseResults/spv.1.4.OpCopyLogical.comp.out
Normal file
150
Test/baseResults/spv.1.4.OpCopyLogical.comp.out
Normal file
@ -0,0 +1,150 @@
|
||||
spv.1.4.OpCopyLogical.comp
|
||||
// Module Version 10400
|
||||
// Generated by (magic number): 80007
|
||||
// Id's are bound by 65
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint GLCompute 4 "main" 19 27 35 51 60
|
||||
ExecutionMode 4 LocalSize 1 1 1
|
||||
Source GLSL 450
|
||||
Name 4 "main"
|
||||
Name 12 "MyStruct"
|
||||
MemberName 12(MyStruct) 0 "foo"
|
||||
MemberName 12(MyStruct) 1 "sb"
|
||||
Name 14 "t"
|
||||
Name 16 "MyStruct"
|
||||
MemberName 16(MyStruct) 0 "foo"
|
||||
MemberName 16(MyStruct) 1 "sb"
|
||||
Name 17 "SSBO0"
|
||||
MemberName 17(SSBO0) 0 "a"
|
||||
Name 19 "inBuf"
|
||||
Name 25 "SSBO1"
|
||||
MemberName 25(SSBO1) 0 "b"
|
||||
Name 27 "outBuf"
|
||||
Name 32 "MyStruct"
|
||||
MemberName 32(MyStruct) 0 "foo"
|
||||
MemberName 32(MyStruct) 1 "sb"
|
||||
Name 33 "UBO"
|
||||
MemberName 33(UBO) 0 "c"
|
||||
Name 35 "uBuf"
|
||||
Name 44 "Nested"
|
||||
MemberName 44(Nested) 0 "f"
|
||||
MemberName 44(Nested) 1 "S"
|
||||
Name 46 "n"
|
||||
Name 48 "Nested"
|
||||
MemberName 48(Nested) 0 "f"
|
||||
MemberName 48(Nested) 1 "S"
|
||||
Name 49 "UBON"
|
||||
MemberName 49(UBON) 0 "N1"
|
||||
Name 51 "uBufN"
|
||||
Name 57 "Nested"
|
||||
MemberName 57(Nested) 0 "f"
|
||||
MemberName 57(Nested) 1 "S"
|
||||
Name 58 "SSBO1N"
|
||||
MemberName 58(SSBO1N) 0 "N2"
|
||||
Name 60 "outBufN"
|
||||
Decorate 15 ArrayStride 8
|
||||
MemberDecorate 16(MyStruct) 0 Offset 0
|
||||
MemberDecorate 16(MyStruct) 1 Offset 16
|
||||
MemberDecorate 17(SSBO0) 0 Offset 0
|
||||
Decorate 17(SSBO0) Block
|
||||
Decorate 19(inBuf) DescriptorSet 0
|
||||
Decorate 19(inBuf) Binding 0
|
||||
MemberDecorate 25(SSBO1) 0 Offset 0
|
||||
Decorate 25(SSBO1) Block
|
||||
Decorate 27(outBuf) DescriptorSet 0
|
||||
Decorate 27(outBuf) Binding 1
|
||||
Decorate 31 ArrayStride 16
|
||||
MemberDecorate 32(MyStruct) 0 Offset 0
|
||||
MemberDecorate 32(MyStruct) 1 Offset 32
|
||||
MemberDecorate 33(UBO) 0 Offset 0
|
||||
Decorate 33(UBO) Block
|
||||
Decorate 35(uBuf) DescriptorSet 0
|
||||
Decorate 35(uBuf) Binding 2
|
||||
Decorate 47 ArrayStride 48
|
||||
MemberDecorate 48(Nested) 0 Offset 0
|
||||
MemberDecorate 48(Nested) 1 Offset 16
|
||||
MemberDecorate 49(UBON) 0 Offset 0
|
||||
Decorate 49(UBON) Block
|
||||
Decorate 51(uBufN) DescriptorSet 0
|
||||
Decorate 51(uBufN) Binding 2
|
||||
Decorate 56 ArrayStride 24
|
||||
MemberDecorate 57(Nested) 0 Offset 0
|
||||
MemberDecorate 57(Nested) 1 Offset 8
|
||||
MemberDecorate 58(SSBO1N) 0 Offset 0
|
||||
Decorate 58(SSBO1N) Block
|
||||
Decorate 60(outBufN) DescriptorSet 0
|
||||
Decorate 60(outBufN) Binding 1
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 2
|
||||
8: TypeInt 32 0
|
||||
9: 8(int) Constant 2
|
||||
10: TypeArray 7(fvec2) 9
|
||||
11: TypeInt 32 1
|
||||
12(MyStruct): TypeStruct 10 11(int)
|
||||
13: TypePointer Function 12(MyStruct)
|
||||
15: TypeArray 7(fvec2) 9
|
||||
16(MyStruct): TypeStruct 15 11(int)
|
||||
17(SSBO0): TypeStruct 16(MyStruct)
|
||||
18: TypePointer StorageBuffer 17(SSBO0)
|
||||
19(inBuf): 18(ptr) Variable StorageBuffer
|
||||
20: 11(int) Constant 0
|
||||
21: TypePointer StorageBuffer 16(MyStruct)
|
||||
25(SSBO1): TypeStruct 16(MyStruct)
|
||||
26: TypePointer StorageBuffer 25(SSBO1)
|
||||
27(outBuf): 26(ptr) Variable StorageBuffer
|
||||
31: TypeArray 7(fvec2) 9
|
||||
32(MyStruct): TypeStruct 31 11(int)
|
||||
33(UBO): TypeStruct 32(MyStruct)
|
||||
34: TypePointer Uniform 33(UBO)
|
||||
35(uBuf): 34(ptr) Variable Uniform
|
||||
36: TypePointer Uniform 32(MyStruct)
|
||||
43: TypeArray 12(MyStruct) 9
|
||||
44(Nested): TypeStruct 6(float) 43
|
||||
45: TypePointer Function 44(Nested)
|
||||
47: TypeArray 32(MyStruct) 9
|
||||
48(Nested): TypeStruct 6(float) 47
|
||||
49(UBON): TypeStruct 48(Nested)
|
||||
50: TypePointer Uniform 49(UBON)
|
||||
51(uBufN): 50(ptr) Variable Uniform
|
||||
52: TypePointer Uniform 48(Nested)
|
||||
56: TypeArray 16(MyStruct) 9
|
||||
57(Nested): TypeStruct 6(float) 56
|
||||
58(SSBO1N): TypeStruct 57(Nested)
|
||||
59: TypePointer StorageBuffer 58(SSBO1N)
|
||||
60(outBufN): 59(ptr) Variable StorageBuffer
|
||||
62: TypePointer StorageBuffer 57(Nested)
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
14(t): 13(ptr) Variable Function
|
||||
46(n): 45(ptr) Variable Function
|
||||
22: 21(ptr) AccessChain 19(inBuf) 20
|
||||
23:16(MyStruct) Load 22
|
||||
24:12(MyStruct) CopyLogical 23
|
||||
Store 14(t) 24
|
||||
28:12(MyStruct) Load 14(t)
|
||||
29: 21(ptr) AccessChain 27(outBuf) 20
|
||||
30:16(MyStruct) CopyLogical 28
|
||||
Store 29 30
|
||||
37: 36(ptr) AccessChain 35(uBuf) 20
|
||||
38:32(MyStruct) Load 37
|
||||
39:12(MyStruct) CopyLogical 38
|
||||
Store 14(t) 39
|
||||
40:12(MyStruct) Load 14(t)
|
||||
41: 21(ptr) AccessChain 27(outBuf) 20
|
||||
42:16(MyStruct) CopyLogical 40
|
||||
Store 41 42
|
||||
53: 52(ptr) AccessChain 51(uBufN) 20
|
||||
54: 48(Nested) Load 53
|
||||
55: 44(Nested) CopyLogical 54
|
||||
Store 46(n) 55
|
||||
61: 44(Nested) Load 46(n)
|
||||
63: 62(ptr) AccessChain 60(outBufN) 20
|
||||
64: 57(Nested) CopyLogical 61
|
||||
Store 63 64
|
||||
Return
|
||||
FunctionEnd
|
||||
114
Test/baseResults/spv.1.4.OpCopyLogical.funcall.frag.out
Normal file
114
Test/baseResults/spv.1.4.OpCopyLogical.funcall.frag.out
Normal file
@ -0,0 +1,114 @@
|
||||
spv.1.4.OpCopyLogical.funcall.frag
|
||||
// Module Version 10400
|
||||
// Generated by (magic number): 80007
|
||||
// Id's are bound by 60
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 25 37
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source GLSL 450
|
||||
Name 4 "main"
|
||||
Name 9 "S"
|
||||
MemberName 9(S) 0 "m"
|
||||
Name 12 "fooConst(struct-S-mf441;"
|
||||
Name 11 "s"
|
||||
Name 17 "foo(struct-S-mf441;"
|
||||
Name 16 "s"
|
||||
Name 20 "fooOut(struct-S-mf441;"
|
||||
Name 19 "s"
|
||||
Name 22 "S"
|
||||
MemberName 22(S) 0 "m"
|
||||
Name 23 "blockName"
|
||||
MemberName 23(blockName) 0 "s1"
|
||||
Name 25 ""
|
||||
Name 31 "S"
|
||||
MemberName 31(S) 0 "m"
|
||||
Name 32 "arg"
|
||||
Name 37 "s2"
|
||||
Name 40 "param"
|
||||
Name 45 "param"
|
||||
Name 48 "param"
|
||||
Name 56 "param"
|
||||
MemberDecorate 22(S) 0 ColMajor
|
||||
MemberDecorate 22(S) 0 Offset 0
|
||||
MemberDecorate 22(S) 0 MatrixStride 16
|
||||
MemberDecorate 23(blockName) 0 Offset 0
|
||||
Decorate 23(blockName) Block
|
||||
Decorate 25 DescriptorSet 0
|
||||
Decorate 25 Binding 0
|
||||
MemberDecorate 31(S) 0 ColMajor
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypeMatrix 7(fvec4) 4
|
||||
9(S): TypeStruct 8
|
||||
10: TypeFunction 2 9(S)
|
||||
14: TypePointer Function 9(S)
|
||||
15: TypeFunction 2 14(ptr)
|
||||
22(S): TypeStruct 8
|
||||
23(blockName): TypeStruct 22(S)
|
||||
24: TypePointer StorageBuffer 23(blockName)
|
||||
25: 24(ptr) Variable StorageBuffer
|
||||
26: TypeInt 32 1
|
||||
27: 26(int) Constant 0
|
||||
28: TypePointer StorageBuffer 22(S)
|
||||
31(S): TypeStruct 8
|
||||
36: TypePointer Private 9(S)
|
||||
37(s2): 36(ptr) Variable Private
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
32(arg): 14(ptr) Variable Function
|
||||
40(param): 14(ptr) Variable Function
|
||||
45(param): 14(ptr) Variable Function
|
||||
48(param): 14(ptr) Variable Function
|
||||
56(param): 14(ptr) Variable Function
|
||||
29: 28(ptr) AccessChain 25 27
|
||||
30: 22(S) Load 29
|
||||
33: 9(S) CopyLogical 30
|
||||
Store 32(arg) 33
|
||||
34: 9(S) Load 32(arg)
|
||||
35: 2 FunctionCall 12(fooConst(struct-S-mf441;) 34
|
||||
38: 9(S) Load 37(s2)
|
||||
39: 2 FunctionCall 12(fooConst(struct-S-mf441;) 38
|
||||
41: 28(ptr) AccessChain 25 27
|
||||
42: 22(S) Load 41
|
||||
43: 9(S) CopyLogical 42
|
||||
Store 40(param) 43
|
||||
44: 2 FunctionCall 17(foo(struct-S-mf441;) 40(param)
|
||||
46: 9(S) Load 37(s2)
|
||||
Store 45(param) 46
|
||||
47: 2 FunctionCall 17(foo(struct-S-mf441;) 45(param)
|
||||
49: 28(ptr) AccessChain 25 27
|
||||
50: 22(S) Load 49
|
||||
51: 9(S) CopyLogical 50
|
||||
Store 48(param) 51
|
||||
52: 2 FunctionCall 20(fooOut(struct-S-mf441;) 48(param)
|
||||
53: 9(S) Load 48(param)
|
||||
54: 28(ptr) AccessChain 25 27
|
||||
55: 22(S) CopyLogical 53
|
||||
Store 54 55
|
||||
57: 9(S) Load 37(s2)
|
||||
Store 56(param) 57
|
||||
58: 2 FunctionCall 20(fooOut(struct-S-mf441;) 56(param)
|
||||
59: 9(S) Load 56(param)
|
||||
Store 37(s2) 59
|
||||
Return
|
||||
FunctionEnd
|
||||
12(fooConst(struct-S-mf441;): 2 Function None 10
|
||||
11(s): 9(S) FunctionParameter
|
||||
13: Label
|
||||
Return
|
||||
FunctionEnd
|
||||
17(foo(struct-S-mf441;): 2 Function None 15
|
||||
16(s): 14(ptr) FunctionParameter
|
||||
18: Label
|
||||
Return
|
||||
FunctionEnd
|
||||
20(fooOut(struct-S-mf441;): 2 Function None 15
|
||||
19(s): 14(ptr) FunctionParameter
|
||||
21: Label
|
||||
Return
|
||||
FunctionEnd
|
||||
232
Test/baseResults/spv.1.4.OpCopyLogicalBool.comp.out
Normal file
232
Test/baseResults/spv.1.4.OpCopyLogicalBool.comp.out
Normal file
@ -0,0 +1,232 @@
|
||||
spv.1.4.OpCopyLogicalBool.comp
|
||||
// Module Version 10400
|
||||
// Generated by (magic number): 80007
|
||||
// Id's are bound by 135
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint GLCompute 4 "main" 19 37 53 79 109
|
||||
ExecutionMode 4 LocalSize 1 1 1
|
||||
Source GLSL 450
|
||||
Name 4 "main"
|
||||
Name 12 "MyStruct"
|
||||
MemberName 12(MyStruct) 0 "foo"
|
||||
MemberName 12(MyStruct) 1 "sb"
|
||||
Name 14 "t"
|
||||
Name 16 "MyStruct"
|
||||
MemberName 16(MyStruct) 0 "foo"
|
||||
MemberName 16(MyStruct) 1 "sb"
|
||||
Name 17 "SSBO0"
|
||||
MemberName 17(SSBO0) 0 "a"
|
||||
Name 19 "inBuf"
|
||||
Name 35 "SSBO1"
|
||||
MemberName 35(SSBO1) 0 "b"
|
||||
Name 37 "outBuf"
|
||||
Name 50 "MyStruct"
|
||||
MemberName 50(MyStruct) 0 "foo"
|
||||
MemberName 50(MyStruct) 1 "sb"
|
||||
Name 51 "UBO"
|
||||
MemberName 51(UBO) 0 "c"
|
||||
Name 53 "uBuf"
|
||||
Name 72 "Nested"
|
||||
MemberName 72(Nested) 0 "b"
|
||||
MemberName 72(Nested) 1 "S"
|
||||
Name 74 "n"
|
||||
Name 76 "Nested"
|
||||
MemberName 76(Nested) 0 "b"
|
||||
MemberName 76(Nested) 1 "S"
|
||||
Name 77 "UBON"
|
||||
MemberName 77(UBON) 0 "N1"
|
||||
Name 79 "uBufN"
|
||||
Name 106 "Nested"
|
||||
MemberName 106(Nested) 0 "b"
|
||||
MemberName 106(Nested) 1 "S"
|
||||
Name 107 "SSBO1N"
|
||||
MemberName 107(SSBO1N) 0 "N2"
|
||||
Name 109 "outBufN"
|
||||
Decorate 15 ArrayStride 8
|
||||
MemberDecorate 16(MyStruct) 0 Offset 0
|
||||
MemberDecorate 16(MyStruct) 1 Offset 16
|
||||
MemberDecorate 17(SSBO0) 0 Offset 0
|
||||
Decorate 17(SSBO0) Block
|
||||
Decorate 19(inBuf) DescriptorSet 0
|
||||
Decorate 19(inBuf) Binding 0
|
||||
MemberDecorate 35(SSBO1) 0 Offset 0
|
||||
Decorate 35(SSBO1) Block
|
||||
Decorate 37(outBuf) DescriptorSet 0
|
||||
Decorate 37(outBuf) Binding 1
|
||||
Decorate 49 ArrayStride 16
|
||||
MemberDecorate 50(MyStruct) 0 Offset 0
|
||||
MemberDecorate 50(MyStruct) 1 Offset 32
|
||||
MemberDecorate 51(UBO) 0 Offset 0
|
||||
Decorate 51(UBO) Block
|
||||
Decorate 53(uBuf) DescriptorSet 0
|
||||
Decorate 53(uBuf) Binding 2
|
||||
Decorate 75 ArrayStride 48
|
||||
MemberDecorate 76(Nested) 0 Offset 0
|
||||
MemberDecorate 76(Nested) 1 Offset 16
|
||||
MemberDecorate 77(UBON) 0 Offset 0
|
||||
Decorate 77(UBON) Block
|
||||
Decorate 79(uBufN) DescriptorSet 0
|
||||
Decorate 79(uBufN) Binding 2
|
||||
Decorate 105 ArrayStride 24
|
||||
MemberDecorate 106(Nested) 0 Offset 0
|
||||
MemberDecorate 106(Nested) 1 Offset 8
|
||||
MemberDecorate 107(SSBO1N) 0 Offset 0
|
||||
Decorate 107(SSBO1N) Block
|
||||
Decorate 109(outBufN) DescriptorSet 0
|
||||
Decorate 109(outBufN) Binding 1
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 2
|
||||
8: TypeInt 32 0
|
||||
9: 8(int) Constant 2
|
||||
10: TypeArray 7(fvec2) 9
|
||||
11: TypeBool
|
||||
12(MyStruct): TypeStruct 10 11(bool)
|
||||
13: TypePointer Function 12(MyStruct)
|
||||
15: TypeArray 7(fvec2) 9
|
||||
16(MyStruct): TypeStruct 15 8(int)
|
||||
17(SSBO0): TypeStruct 16(MyStruct)
|
||||
18: TypePointer StorageBuffer 17(SSBO0)
|
||||
19(inBuf): 18(ptr) Variable StorageBuffer
|
||||
20: TypeInt 32 1
|
||||
21: 20(int) Constant 0
|
||||
22: TypePointer StorageBuffer 16(MyStruct)
|
||||
26: TypePointer Function 10
|
||||
30: 20(int) Constant 1
|
||||
31: 8(int) Constant 0
|
||||
33: TypePointer Function 11(bool)
|
||||
35(SSBO1): TypeStruct 16(MyStruct)
|
||||
36: TypePointer StorageBuffer 35(SSBO1)
|
||||
37(outBuf): 36(ptr) Variable StorageBuffer
|
||||
41: TypePointer StorageBuffer 15
|
||||
45: 8(int) Constant 1
|
||||
47: TypePointer StorageBuffer 8(int)
|
||||
49: TypeArray 7(fvec2) 9
|
||||
50(MyStruct): TypeStruct 49 8(int)
|
||||
51(UBO): TypeStruct 50(MyStruct)
|
||||
52: TypePointer Uniform 51(UBO)
|
||||
53(uBuf): 52(ptr) Variable Uniform
|
||||
54: TypePointer Uniform 50(MyStruct)
|
||||
71: TypeArray 12(MyStruct) 9
|
||||
72(Nested): TypeStruct 11(bool) 71
|
||||
73: TypePointer Function 72(Nested)
|
||||
75: TypeArray 50(MyStruct) 9
|
||||
76(Nested): TypeStruct 8(int) 75
|
||||
77(UBON): TypeStruct 76(Nested)
|
||||
78: TypePointer Uniform 77(UBON)
|
||||
79(uBufN): 78(ptr) Variable Uniform
|
||||
80: TypePointer Uniform 76(Nested)
|
||||
87: TypePointer Function 71
|
||||
105: TypeArray 16(MyStruct) 9
|
||||
106(Nested): TypeStruct 8(int) 105
|
||||
107(SSBO1N): TypeStruct 106(Nested)
|
||||
108: TypePointer StorageBuffer 107(SSBO1N)
|
||||
109(outBufN): 108(ptr) Variable StorageBuffer
|
||||
111: TypePointer StorageBuffer 106(Nested)
|
||||
117: TypePointer StorageBuffer 105
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
14(t): 13(ptr) Variable Function
|
||||
74(n): 73(ptr) Variable Function
|
||||
23: 22(ptr) AccessChain 19(inBuf) 21
|
||||
24:16(MyStruct) Load 23
|
||||
25: 15 CompositeExtract 24 0
|
||||
27: 26(ptr) AccessChain 14(t) 21
|
||||
28: 10 CopyLogical 25
|
||||
Store 27 28
|
||||
29: 8(int) CompositeExtract 24 1
|
||||
32: 11(bool) INotEqual 29 31
|
||||
34: 33(ptr) AccessChain 14(t) 30
|
||||
Store 34 32
|
||||
38:12(MyStruct) Load 14(t)
|
||||
39: 22(ptr) AccessChain 37(outBuf) 21
|
||||
40: 10 CompositeExtract 38 0
|
||||
42: 41(ptr) AccessChain 39 21
|
||||
43: 15 CopyLogical 40
|
||||
Store 42 43
|
||||
44: 11(bool) CompositeExtract 38 1
|
||||
46: 8(int) Select 44 45 31
|
||||
48: 47(ptr) AccessChain 39 30
|
||||
Store 48 46
|
||||
55: 54(ptr) AccessChain 53(uBuf) 21
|
||||
56:50(MyStruct) Load 55
|
||||
57: 49 CompositeExtract 56 0
|
||||
58: 26(ptr) AccessChain 14(t) 21
|
||||
59: 10 CopyLogical 57
|
||||
Store 58 59
|
||||
60: 8(int) CompositeExtract 56 1
|
||||
61: 11(bool) INotEqual 60 31
|
||||
62: 33(ptr) AccessChain 14(t) 30
|
||||
Store 62 61
|
||||
63:12(MyStruct) Load 14(t)
|
||||
64: 22(ptr) AccessChain 37(outBuf) 21
|
||||
65: 10 CompositeExtract 63 0
|
||||
66: 41(ptr) AccessChain 64 21
|
||||
67: 15 CopyLogical 65
|
||||
Store 66 67
|
||||
68: 11(bool) CompositeExtract 63 1
|
||||
69: 8(int) Select 68 45 31
|
||||
70: 47(ptr) AccessChain 64 30
|
||||
Store 70 69
|
||||
81: 80(ptr) AccessChain 79(uBufN) 21
|
||||
82: 76(Nested) Load 81
|
||||
83: 8(int) CompositeExtract 82 0
|
||||
84: 11(bool) INotEqual 83 31
|
||||
85: 33(ptr) AccessChain 74(n) 21
|
||||
Store 85 84
|
||||
86: 75 CompositeExtract 82 1
|
||||
88: 87(ptr) AccessChain 74(n) 30
|
||||
89:50(MyStruct) CompositeExtract 86 0
|
||||
90: 13(ptr) AccessChain 88 21
|
||||
91: 49 CompositeExtract 89 0
|
||||
92: 26(ptr) AccessChain 90 21
|
||||
93: 10 CopyLogical 91
|
||||
Store 92 93
|
||||
94: 8(int) CompositeExtract 89 1
|
||||
95: 11(bool) INotEqual 94 31
|
||||
96: 33(ptr) AccessChain 90 30
|
||||
Store 96 95
|
||||
97:50(MyStruct) CompositeExtract 86 1
|
||||
98: 13(ptr) AccessChain 88 30
|
||||
99: 49 CompositeExtract 97 0
|
||||
100: 26(ptr) AccessChain 98 21
|
||||
101: 10 CopyLogical 99
|
||||
Store 100 101
|
||||
102: 8(int) CompositeExtract 97 1
|
||||
103: 11(bool) INotEqual 102 31
|
||||
104: 33(ptr) AccessChain 98 30
|
||||
Store 104 103
|
||||
110: 72(Nested) Load 74(n)
|
||||
112: 111(ptr) AccessChain 109(outBufN) 21
|
||||
113: 11(bool) CompositeExtract 110 0
|
||||
114: 8(int) Select 113 45 31
|
||||
115: 47(ptr) AccessChain 112 21
|
||||
Store 115 114
|
||||
116: 71 CompositeExtract 110 1
|
||||
118: 117(ptr) AccessChain 112 30
|
||||
119:12(MyStruct) CompositeExtract 116 0
|
||||
120: 22(ptr) AccessChain 118 21
|
||||
121: 10 CompositeExtract 119 0
|
||||
122: 41(ptr) AccessChain 120 21
|
||||
123: 15 CopyLogical 121
|
||||
Store 122 123
|
||||
124: 11(bool) CompositeExtract 119 1
|
||||
125: 8(int) Select 124 45 31
|
||||
126: 47(ptr) AccessChain 120 30
|
||||
Store 126 125
|
||||
127:12(MyStruct) CompositeExtract 116 1
|
||||
128: 22(ptr) AccessChain 118 30
|
||||
129: 10 CompositeExtract 127 0
|
||||
130: 41(ptr) AccessChain 128 21
|
||||
131: 15 CopyLogical 129
|
||||
Store 130 131
|
||||
132: 11(bool) CompositeExtract 127 1
|
||||
133: 8(int) Select 132 45 31
|
||||
134: 47(ptr) AccessChain 128 30
|
||||
Store 134 133
|
||||
Return
|
||||
FunctionEnd
|
||||
106
Test/baseResults/spv.1.4.OpEntryPoint.frag.out
Normal file
106
Test/baseResults/spv.1.4.OpEntryPoint.frag.out
Normal file
@ -0,0 +1,106 @@
|
||||
spv.1.4.OpEntryPoint.frag
|
||||
// Module Version 10400
|
||||
// Generated by (magic number): 80007
|
||||
// Id's are bound by 64
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 11 14 17 25 33 41
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source GLSL 450
|
||||
Name 4 "main"
|
||||
Name 9 "functionv"
|
||||
Name 11 "inv"
|
||||
Name 14 "globalv"
|
||||
Name 17 "outv"
|
||||
Name 23 "ubt"
|
||||
MemberName 23(ubt) 0 "v"
|
||||
Name 25 "uniformv"
|
||||
Name 31 "pushB"
|
||||
MemberName 31(pushB) 0 "a"
|
||||
Name 33 "pushv"
|
||||
Name 39 "bbt"
|
||||
MemberName 39(bbt) 0 "f"
|
||||
Name 41 "bufferv"
|
||||
Decorate 11(inv) Location 0
|
||||
Decorate 17(outv) Location 0
|
||||
MemberDecorate 23(ubt) 0 Offset 0
|
||||
Decorate 23(ubt) Block
|
||||
Decorate 25(uniformv) DescriptorSet 0
|
||||
Decorate 25(uniformv) Binding 0
|
||||
MemberDecorate 31(pushB) 0 Offset 0
|
||||
Decorate 31(pushB) Block
|
||||
Decorate 33(pushv) Binding 2
|
||||
MemberDecorate 39(bbt) 0 Offset 0
|
||||
Decorate 39(bbt) Block
|
||||
Decorate 41(bufferv) DescriptorSet 0
|
||||
Decorate 41(bufferv) Binding 1
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypePointer Function 7(fvec4)
|
||||
10: TypePointer Input 7(fvec4)
|
||||
11(inv): 10(ptr) Variable Input
|
||||
13: TypePointer Private 7(fvec4)
|
||||
14(globalv): 13(ptr) Variable Private
|
||||
16: TypePointer Output 7(fvec4)
|
||||
17(outv): 16(ptr) Variable Output
|
||||
23(ubt): TypeStruct 7(fvec4)
|
||||
24: TypePointer Uniform 23(ubt)
|
||||
25(uniformv): 24(ptr) Variable Uniform
|
||||
26: TypeInt 32 1
|
||||
27: 26(int) Constant 0
|
||||
28: TypePointer Uniform 7(fvec4)
|
||||
31(pushB): TypeStruct 26(int)
|
||||
32: TypePointer PushConstant 31(pushB)
|
||||
33(pushv): 32(ptr) Variable PushConstant
|
||||
34: TypePointer PushConstant 26(int)
|
||||
39(bbt): TypeStruct 6(float)
|
||||
40: TypePointer StorageBuffer 39(bbt)
|
||||
41(bufferv): 40(ptr) Variable StorageBuffer
|
||||
42: TypePointer StorageBuffer 6(float)
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
9(functionv): 8(ptr) Variable Function
|
||||
12: 7(fvec4) Load 11(inv)
|
||||
Store 9(functionv) 12
|
||||
15: 7(fvec4) Load 11(inv)
|
||||
Store 14(globalv) 15
|
||||
18: 7(fvec4) Load 9(functionv)
|
||||
19: 7(fvec4) Load 11(inv)
|
||||
20: 7(fvec4) FAdd 18 19
|
||||
21: 7(fvec4) Load 14(globalv)
|
||||
22: 7(fvec4) FAdd 20 21
|
||||
29: 28(ptr) AccessChain 25(uniformv) 27
|
||||
30: 7(fvec4) Load 29
|
||||
35: 34(ptr) AccessChain 33(pushv) 27
|
||||
36: 26(int) Load 35
|
||||
37: 6(float) ConvertSToF 36
|
||||
38: 7(fvec4) VectorTimesScalar 30 37
|
||||
43: 42(ptr) AccessChain 41(bufferv) 27
|
||||
44: 6(float) Load 43
|
||||
45: 7(fvec4) VectorTimesScalar 38 44
|
||||
46: 7(fvec4) FAdd 22 45
|
||||
Store 17(outv) 46
|
||||
47: 7(fvec4) Load 9(functionv)
|
||||
48: 7(fvec4) Load 11(inv)
|
||||
49: 7(fvec4) FAdd 47 48
|
||||
50: 7(fvec4) Load 14(globalv)
|
||||
51: 7(fvec4) FAdd 49 50
|
||||
52: 28(ptr) AccessChain 25(uniformv) 27
|
||||
53: 7(fvec4) Load 52
|
||||
54: 34(ptr) AccessChain 33(pushv) 27
|
||||
55: 26(int) Load 54
|
||||
56: 6(float) ConvertSToF 55
|
||||
57: 7(fvec4) VectorTimesScalar 53 56
|
||||
58: 42(ptr) AccessChain 41(bufferv) 27
|
||||
59: 6(float) Load 58
|
||||
60: 7(fvec4) VectorTimesScalar 57 59
|
||||
61: 7(fvec4) FAdd 51 60
|
||||
62: 7(fvec4) Load 17(outv)
|
||||
63: 7(fvec4) FAdd 62 61
|
||||
Store 17(outv) 63
|
||||
Return
|
||||
FunctionEnd
|
||||
152
Test/baseResults/spv.1.4.OpSelect.frag.out
Executable file
152
Test/baseResults/spv.1.4.OpSelect.frag.out
Executable file
@ -0,0 +1,152 @@
|
||||
spv.1.4.OpSelect.frag
|
||||
// Module Version 10400
|
||||
// Generated by (magic number): 80007
|
||||
// Id's are bound by 98
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 17 20 82 84
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source GLSL 450
|
||||
Name 4 "main"
|
||||
Name 6 "fun1("
|
||||
Name 8 "fun2("
|
||||
Name 12 "f1"
|
||||
Name 14 "f2"
|
||||
Name 17 "outv"
|
||||
Name 20 "cond"
|
||||
Name 30 "iv1"
|
||||
Name 34 "iv2"
|
||||
Name 53 "m1"
|
||||
Name 59 "m2"
|
||||
Name 75 "S1"
|
||||
MemberName 75(S1) 0 "a"
|
||||
MemberName 75(S1) 1 "b"
|
||||
Name 77 "fv"
|
||||
Name 82 "in1"
|
||||
Name 84 "in2"
|
||||
Decorate 17(outv) Location 0
|
||||
Decorate 20(cond) Flat
|
||||
Decorate 20(cond) Location 4
|
||||
Decorate 82(in1) Flat
|
||||
Decorate 82(in1) Location 0
|
||||
Decorate 84(in2) Flat
|
||||
Decorate 84(in2) Location 2
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
10: TypeFloat 32
|
||||
11: TypePointer Function 10(float)
|
||||
13: 10(float) Constant 1065353216
|
||||
15: 10(float) Constant 1073741824
|
||||
16: TypePointer Output 10(float)
|
||||
17(outv): 16(ptr) Variable Output
|
||||
18: TypeInt 32 1
|
||||
19: TypePointer Input 18(int)
|
||||
20(cond): 19(ptr) Variable Input
|
||||
22: 18(int) Constant 8
|
||||
23: TypeBool
|
||||
28: TypeVector 18(int) 4
|
||||
29: TypePointer Function 28(ivec4)
|
||||
39: 18(int) Constant 0
|
||||
44: TypeInt 32 0
|
||||
45: 44(int) Constant 2
|
||||
50: TypeVector 10(float) 3
|
||||
51: TypeMatrix 50(fvec3) 3
|
||||
52: TypePointer Function 51
|
||||
54: 10(float) Constant 0
|
||||
55: 50(fvec3) ConstantComposite 13 54 54
|
||||
56: 50(fvec3) ConstantComposite 54 13 54
|
||||
57: 50(fvec3) ConstantComposite 54 54 13
|
||||
58: 51 ConstantComposite 55 56 57
|
||||
60: 50(fvec3) ConstantComposite 15 54 54
|
||||
61: 50(fvec3) ConstantComposite 54 15 54
|
||||
62: 50(fvec3) ConstantComposite 54 54 15
|
||||
63: 51 ConstantComposite 60 61 62
|
||||
65: 18(int) Constant 20
|
||||
70: 18(int) Constant 2
|
||||
71: 44(int) Constant 1
|
||||
75(S1): TypeStruct 10(float) 18(int)
|
||||
76: TypePointer Function 75(S1)
|
||||
79: 18(int) Constant 5
|
||||
81: TypePointer Input 75(S1)
|
||||
82(in1): 81(ptr) Variable Input
|
||||
84(in2): 81(ptr) Variable Input
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
12(f1): 11(ptr) Variable Function
|
||||
14(f2): 11(ptr) Variable Function
|
||||
30(iv1): 29(ptr) Variable Function
|
||||
34(iv2): 29(ptr) Variable Function
|
||||
53(m1): 52(ptr) Variable Function
|
||||
59(m2): 52(ptr) Variable Function
|
||||
77(fv): 76(ptr) Variable Function
|
||||
Store 12(f1) 13
|
||||
Store 14(f2) 15
|
||||
21: 18(int) Load 20(cond)
|
||||
24: 23(bool) SLessThan 21 22
|
||||
25: 10(float) Load 12(f1)
|
||||
26: 10(float) Load 14(f2)
|
||||
27: 10(float) Select 24 25 26
|
||||
Store 17(outv) 27
|
||||
31: 10(float) Load 12(f1)
|
||||
32: 18(int) ConvertFToS 31
|
||||
33: 28(ivec4) CompositeConstruct 32 32 32 32
|
||||
Store 30(iv1) 33
|
||||
35: 10(float) Load 14(f2)
|
||||
36: 18(int) ConvertFToS 35
|
||||
37: 28(ivec4) CompositeConstruct 36 36 36 36
|
||||
Store 34(iv2) 37
|
||||
38: 18(int) Load 20(cond)
|
||||
40: 23(bool) SGreaterThan 38 39
|
||||
41: 28(ivec4) Load 30(iv1)
|
||||
42: 28(ivec4) Load 34(iv2)
|
||||
43: 28(ivec4) Select 40 41 42
|
||||
46: 18(int) CompositeExtract 43 2
|
||||
47: 10(float) ConvertSToF 46
|
||||
48: 10(float) Load 17(outv)
|
||||
49: 10(float) FMul 48 47
|
||||
Store 17(outv) 49
|
||||
Store 53(m1) 58
|
||||
Store 59(m2) 63
|
||||
64: 18(int) Load 20(cond)
|
||||
66: 23(bool) SLessThan 64 65
|
||||
67: 51 Load 53(m1)
|
||||
68: 51 Load 59(m2)
|
||||
69: 51 Select 66 67 68
|
||||
72: 10(float) CompositeExtract 69 2 1
|
||||
73: 10(float) Load 17(outv)
|
||||
74: 10(float) FMul 73 72
|
||||
Store 17(outv) 74
|
||||
78: 18(int) Load 20(cond)
|
||||
80: 23(bool) SGreaterThan 78 79
|
||||
83: 75(S1) Load 82(in1)
|
||||
85: 75(S1) Load 84(in2)
|
||||
86: 75(S1) Select 80 83 85
|
||||
Store 77(fv) 86
|
||||
87: 11(ptr) AccessChain 77(fv) 39
|
||||
88: 10(float) Load 87
|
||||
89: 10(float) Load 17(outv)
|
||||
90: 10(float) FMul 89 88
|
||||
Store 17(outv) 90
|
||||
91: 18(int) Load 20(cond)
|
||||
92: 23(bool) SGreaterThan 91 39
|
||||
SelectionMerge 94 None
|
||||
BranchConditional 92 93 96
|
||||
93: Label
|
||||
95: 2 FunctionCall 6(fun1()
|
||||
Branch 94
|
||||
96: Label
|
||||
97: 2 FunctionCall 8(fun2()
|
||||
Branch 94
|
||||
94: Label
|
||||
Return
|
||||
FunctionEnd
|
||||
6(fun1(): 2 Function None 3
|
||||
7: Label
|
||||
Return
|
||||
FunctionEnd
|
||||
8(fun2(): 2 Function None 3
|
||||
9: Label
|
||||
Return
|
||||
FunctionEnd
|
||||
159
Test/baseResults/spv.1.4.image.frag.out
Executable file
159
Test/baseResults/spv.1.4.image.frag.out
Executable file
@ -0,0 +1,159 @@
|
||||
spv.1.4.image.frag
|
||||
// Module Version 10400
|
||||
// Generated by (magic number): 80007
|
||||
// Id's are bound by 104
|
||||
|
||||
Capability Shader
|
||||
Capability StorageImageMultisample
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 26 30 40 52 64 77 89 100 103
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source GLSL 450
|
||||
Name 4 "main"
|
||||
Name 9 "v"
|
||||
Name 15 "iv"
|
||||
Name 21 "uv"
|
||||
Name 26 "i2D"
|
||||
Name 30 "ic2D"
|
||||
Name 40 "ii2D"
|
||||
Name 52 "ui2D"
|
||||
Name 64 "i2DMS"
|
||||
Name 77 "ii2DMS"
|
||||
Name 89 "ui2DMS"
|
||||
Name 100 "fragData"
|
||||
Name 103 "value"
|
||||
Decorate 26(i2D) DescriptorSet 0
|
||||
Decorate 26(i2D) Binding 1
|
||||
Decorate 30(ic2D) Flat
|
||||
Decorate 40(ii2D) DescriptorSet 0
|
||||
Decorate 40(ii2D) Binding 12
|
||||
Decorate 52(ui2D) DescriptorSet 0
|
||||
Decorate 52(ui2D) Binding 12
|
||||
Decorate 64(i2DMS) DescriptorSet 0
|
||||
Decorate 64(i2DMS) Binding 9
|
||||
Decorate 77(ii2DMS) DescriptorSet 0
|
||||
Decorate 77(ii2DMS) Binding 13
|
||||
Decorate 89(ui2DMS) DescriptorSet 0
|
||||
Decorate 89(ui2DMS) Binding 13
|
||||
Decorate 103(value) Flat
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypePointer Function 7(fvec4)
|
||||
10: 6(float) Constant 0
|
||||
11: 7(fvec4) ConstantComposite 10 10 10 10
|
||||
12: TypeInt 32 1
|
||||
13: TypeVector 12(int) 4
|
||||
14: TypePointer Function 13(ivec4)
|
||||
16: 12(int) Constant 0
|
||||
17: 13(ivec4) ConstantComposite 16 16 16 16
|
||||
18: TypeInt 32 0
|
||||
19: TypeVector 18(int) 4
|
||||
20: TypePointer Function 19(ivec4)
|
||||
22: 18(int) Constant 0
|
||||
23: 19(ivec4) ConstantComposite 22 22 22 22
|
||||
24: TypeImage 6(float) 2D nonsampled format:Rgba32f
|
||||
25: TypePointer UniformConstant 24
|
||||
26(i2D): 25(ptr) Variable UniformConstant
|
||||
28: TypeVector 12(int) 2
|
||||
29: TypePointer Input 28(ivec2)
|
||||
30(ic2D): 29(ptr) Variable Input
|
||||
38: TypeImage 12(int) 2D nonsampled format:R32i
|
||||
39: TypePointer UniformConstant 38
|
||||
40(ii2D): 39(ptr) Variable UniformConstant
|
||||
50: TypeImage 18(int) 2D nonsampled format:R32ui
|
||||
51: TypePointer UniformConstant 50
|
||||
52(ui2D): 51(ptr) Variable UniformConstant
|
||||
62: TypeImage 6(float) 2D multi-sampled nonsampled format:Rgba32f
|
||||
63: TypePointer UniformConstant 62
|
||||
64(i2DMS): 63(ptr) Variable UniformConstant
|
||||
67: 12(int) Constant 1
|
||||
73: 12(int) Constant 2
|
||||
75: TypeImage 12(int) 2D multi-sampled nonsampled format:R32i
|
||||
76: TypePointer UniformConstant 75
|
||||
77(ii2DMS): 76(ptr) Variable UniformConstant
|
||||
87: TypeImage 18(int) 2D multi-sampled nonsampled format:R32ui
|
||||
88: TypePointer UniformConstant 87
|
||||
89(ui2DMS): 88(ptr) Variable UniformConstant
|
||||
99: TypePointer Output 7(fvec4)
|
||||
100(fragData): 99(ptr) Variable Output
|
||||
102: TypePointer Input 18(int)
|
||||
103(value): 102(ptr) Variable Input
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
9(v): 8(ptr) Variable Function
|
||||
15(iv): 14(ptr) Variable Function
|
||||
21(uv): 20(ptr) Variable Function
|
||||
Store 9(v) 11
|
||||
Store 15(iv) 17
|
||||
Store 21(uv) 23
|
||||
27: 24 Load 26(i2D)
|
||||
31: 28(ivec2) Load 30(ic2D)
|
||||
32: 7(fvec4) ImageRead 27 31
|
||||
33: 7(fvec4) Load 9(v)
|
||||
34: 7(fvec4) FAdd 33 32
|
||||
Store 9(v) 34
|
||||
35: 24 Load 26(i2D)
|
||||
36: 28(ivec2) Load 30(ic2D)
|
||||
37: 7(fvec4) Load 9(v)
|
||||
ImageWrite 35 36 37
|
||||
41: 38 Load 40(ii2D)
|
||||
42: 28(ivec2) Load 30(ic2D)
|
||||
43: 13(ivec4) ImageRead 41 42 SignExtend
|
||||
44: 7(fvec4) ConvertSToF 43
|
||||
45: 7(fvec4) Load 9(v)
|
||||
46: 7(fvec4) FAdd 45 44
|
||||
Store 9(v) 46
|
||||
47: 38 Load 40(ii2D)
|
||||
48: 28(ivec2) Load 30(ic2D)
|
||||
49: 13(ivec4) Load 15(iv)
|
||||
ImageWrite 47 48 49 SignExtend
|
||||
53: 50 Load 52(ui2D)
|
||||
54: 28(ivec2) Load 30(ic2D)
|
||||
55: 19(ivec4) ImageRead 53 54 ZeroExtend
|
||||
56: 7(fvec4) ConvertUToF 55
|
||||
57: 7(fvec4) Load 9(v)
|
||||
58: 7(fvec4) FAdd 57 56
|
||||
Store 9(v) 58
|
||||
59: 50 Load 52(ui2D)
|
||||
60: 28(ivec2) Load 30(ic2D)
|
||||
61: 19(ivec4) Load 21(uv)
|
||||
ImageWrite 59 60 61 ZeroExtend
|
||||
65: 62 Load 64(i2DMS)
|
||||
66: 28(ivec2) Load 30(ic2D)
|
||||
68: 7(fvec4) ImageRead 65 66 Sample 67
|
||||
69: 7(fvec4) Load 9(v)
|
||||
70: 7(fvec4) FAdd 69 68
|
||||
Store 9(v) 70
|
||||
71: 62 Load 64(i2DMS)
|
||||
72: 28(ivec2) Load 30(ic2D)
|
||||
74: 7(fvec4) Load 9(v)
|
||||
ImageWrite 71 72 74 Sample 73
|
||||
78: 75 Load 77(ii2DMS)
|
||||
79: 28(ivec2) Load 30(ic2D)
|
||||
80: 13(ivec4) ImageRead 78 79 Sample SignExtend 67
|
||||
81: 7(fvec4) ConvertSToF 80
|
||||
82: 7(fvec4) Load 9(v)
|
||||
83: 7(fvec4) FAdd 82 81
|
||||
Store 9(v) 83
|
||||
84: 75 Load 77(ii2DMS)
|
||||
85: 28(ivec2) Load 30(ic2D)
|
||||
86: 13(ivec4) Load 15(iv)
|
||||
ImageWrite 84 85 86 Sample SignExtend 73
|
||||
90: 87 Load 89(ui2DMS)
|
||||
91: 28(ivec2) Load 30(ic2D)
|
||||
92: 19(ivec4) ImageRead 90 91 Sample ZeroExtend 67
|
||||
93: 7(fvec4) ConvertUToF 92
|
||||
94: 7(fvec4) Load 9(v)
|
||||
95: 7(fvec4) FAdd 94 93
|
||||
Store 9(v) 95
|
||||
96: 87 Load 89(ui2DMS)
|
||||
97: 28(ivec2) Load 30(ic2D)
|
||||
98: 19(ivec4) Load 21(uv)
|
||||
ImageWrite 96 97 98 Sample ZeroExtend 73
|
||||
101: 7(fvec4) Load 9(v)
|
||||
Store 100(fragData) 101
|
||||
Return
|
||||
FunctionEnd
|
||||
326
Test/baseResults/spv.1.4.sparseTexture.frag.out
Executable file
326
Test/baseResults/spv.1.4.sparseTexture.frag.out
Executable file
@ -0,0 +1,326 @@
|
||||
spv.1.4.sparseTexture.frag
|
||||
// Module Version 10400
|
||||
// Generated by (magic number): 80007
|
||||
// Id's are bound by 213
|
||||
|
||||
Capability Shader
|
||||
Capability StorageImageMultisample
|
||||
Capability SparseResidency
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 29 33 42 46 59 63 84 96 119 133 149 152 159 162 177 181 189 206 208 212
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source GLSL 450
|
||||
SourceExtension "GL_ARB_sparse_texture2"
|
||||
Name 4 "main"
|
||||
Name 8 "resident"
|
||||
Name 13 "texel"
|
||||
Name 18 "itexel"
|
||||
Name 23 "utexel"
|
||||
Name 29 "s2D"
|
||||
Name 33 "c2"
|
||||
Name 35 "ResType"
|
||||
Name 42 "tempReturn"
|
||||
Name 46 "is2D"
|
||||
Name 49 "tempArg"
|
||||
Name 50 "ResType"
|
||||
Name 59 "tempReturn"
|
||||
Name 63 "us2D"
|
||||
Name 66 "tempArg"
|
||||
Name 67 "ResType"
|
||||
Name 84 "tempReturn"
|
||||
Name 87 "tempArg"
|
||||
Name 96 "tempReturn"
|
||||
Name 99 "tempArg"
|
||||
Name 119 "tempReturn"
|
||||
Name 123 "tempArg"
|
||||
Name 133 "tempReturn"
|
||||
Name 137 "tempArg"
|
||||
Name 149 "i2D"
|
||||
Name 152 "ic2"
|
||||
Name 159 "tempReturn"
|
||||
Name 162 "ii2DMS"
|
||||
Name 166 "tempArg"
|
||||
Name 177 "ui3D"
|
||||
Name 181 "ic3"
|
||||
Name 189 "outColor"
|
||||
Name 206 "c3"
|
||||
Name 208 "c4"
|
||||
Name 212 "offsets"
|
||||
Decorate 29(s2D) DescriptorSet 0
|
||||
Decorate 29(s2D) Binding 0
|
||||
Decorate 46(is2D) DescriptorSet 0
|
||||
Decorate 46(is2D) Binding 0
|
||||
Decorate 63(us2D) DescriptorSet 0
|
||||
Decorate 63(us2D) Binding 0
|
||||
Decorate 149(i2D) DescriptorSet 0
|
||||
Decorate 149(i2D) Binding 0
|
||||
Decorate 152(ic2) Flat
|
||||
Decorate 162(ii2DMS) DescriptorSet 0
|
||||
Decorate 162(ii2DMS) Binding 0
|
||||
Decorate 177(ui3D) DescriptorSet 0
|
||||
Decorate 177(ui3D) Binding 0
|
||||
Decorate 181(ic3) Flat
|
||||
Decorate 212(offsets) Flat
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeInt 32 1
|
||||
7: TypePointer Function 6(int)
|
||||
9: 6(int) Constant 0
|
||||
10: TypeFloat 32
|
||||
11: TypeVector 10(float) 4
|
||||
12: TypePointer Function 11(fvec4)
|
||||
14: 10(float) Constant 0
|
||||
15: 11(fvec4) ConstantComposite 14 14 14 14
|
||||
16: TypeVector 6(int) 4
|
||||
17: TypePointer Function 16(ivec4)
|
||||
19: 16(ivec4) ConstantComposite 9 9 9 9
|
||||
20: TypeInt 32 0
|
||||
21: TypeVector 20(int) 4
|
||||
22: TypePointer Function 21(ivec4)
|
||||
24: 20(int) Constant 0
|
||||
25: 21(ivec4) ConstantComposite 24 24 24 24
|
||||
26: TypeImage 10(float) 2D sampled format:Unknown
|
||||
27: TypeSampledImage 26
|
||||
28: TypePointer UniformConstant 27
|
||||
29(s2D): 28(ptr) Variable UniformConstant
|
||||
31: TypeVector 10(float) 2
|
||||
32: TypePointer Input 31(fvec2)
|
||||
33(c2): 32(ptr) Variable Input
|
||||
35(ResType): TypeStruct 6(int) 11(fvec4)
|
||||
41: TypePointer Private 6(int)
|
||||
42(tempReturn): 41(ptr) Variable Private
|
||||
43: TypeImage 6(int) 2D sampled format:Unknown
|
||||
44: TypeSampledImage 43
|
||||
45: TypePointer UniformConstant 44
|
||||
46(is2D): 45(ptr) Variable UniformConstant
|
||||
50(ResType): TypeStruct 6(int) 16(ivec4)
|
||||
59(tempReturn): 41(ptr) Variable Private
|
||||
60: TypeImage 20(int) 2D sampled format:Unknown
|
||||
61: TypeSampledImage 60
|
||||
62: TypePointer UniformConstant 61
|
||||
63(us2D): 62(ptr) Variable UniformConstant
|
||||
67(ResType): TypeStruct 6(int) 21(ivec4)
|
||||
78: 10(float) Constant 1073741824
|
||||
84(tempReturn): 41(ptr) Variable Private
|
||||
96(tempReturn): 41(ptr) Variable Private
|
||||
110: TypeVector 6(int) 2
|
||||
112: 6(int) Constant 2
|
||||
119(tempReturn): 41(ptr) Variable Private
|
||||
133(tempReturn): 41(ptr) Variable Private
|
||||
147: TypeImage 10(float) 2D nonsampled format:Rgba32f
|
||||
148: TypePointer UniformConstant 147
|
||||
149(i2D): 148(ptr) Variable UniformConstant
|
||||
151: TypePointer Input 110(ivec2)
|
||||
152(ic2): 151(ptr) Variable Input
|
||||
159(tempReturn): 41(ptr) Variable Private
|
||||
160: TypeImage 6(int) 2D multi-sampled nonsampled format:Rgba32i
|
||||
161: TypePointer UniformConstant 160
|
||||
162(ii2DMS): 161(ptr) Variable UniformConstant
|
||||
165: 6(int) Constant 3
|
||||
175: TypeImage 20(int) 3D nonsampled format:Rgba32ui
|
||||
176: TypePointer UniformConstant 175
|
||||
177(ui3D): 176(ptr) Variable UniformConstant
|
||||
179: TypeVector 6(int) 3
|
||||
180: TypePointer Input 179(ivec3)
|
||||
181(ic3): 180(ptr) Variable Input
|
||||
188: TypePointer Output 11(fvec4)
|
||||
189(outColor): 188(ptr) Variable Output
|
||||
191: TypeBool
|
||||
204: TypeVector 10(float) 3
|
||||
205: TypePointer Input 204(fvec3)
|
||||
206(c3): 205(ptr) Variable Input
|
||||
207: TypePointer Input 11(fvec4)
|
||||
208(c4): 207(ptr) Variable Input
|
||||
209: 20(int) Constant 4
|
||||
210: TypeArray 110(ivec2) 209
|
||||
211: TypePointer Input 210
|
||||
212(offsets): 211(ptr) Variable Input
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
8(resident): 7(ptr) Variable Function
|
||||
13(texel): 12(ptr) Variable Function
|
||||
18(itexel): 17(ptr) Variable Function
|
||||
23(utexel): 22(ptr) Variable Function
|
||||
49(tempArg): 17(ptr) Variable Function
|
||||
66(tempArg): 22(ptr) Variable Function
|
||||
87(tempArg): 17(ptr) Variable Function
|
||||
99(tempArg): 22(ptr) Variable Function
|
||||
123(tempArg): 17(ptr) Variable Function
|
||||
137(tempArg): 22(ptr) Variable Function
|
||||
166(tempArg): 17(ptr) Variable Function
|
||||
193: 12(ptr) Variable Function
|
||||
Store 8(resident) 9
|
||||
Store 13(texel) 15
|
||||
Store 18(itexel) 19
|
||||
Store 23(utexel) 25
|
||||
30: 27 Load 29(s2D)
|
||||
34: 31(fvec2) Load 33(c2)
|
||||
36: 35(ResType) ImageSparseSampleImplicitLod 30 34
|
||||
37: 11(fvec4) CompositeExtract 36 1
|
||||
Store 13(texel) 37
|
||||
38: 6(int) CompositeExtract 36 0
|
||||
39: 6(int) Load 8(resident)
|
||||
40: 6(int) BitwiseOr 39 38
|
||||
Store 8(resident) 40
|
||||
47: 44 Load 46(is2D)
|
||||
48: 31(fvec2) Load 33(c2)
|
||||
51: 50(ResType) ImageSparseSampleImplicitLod 47 48 SignExtend
|
||||
52: 16(ivec4) CompositeExtract 51 1
|
||||
Store 49(tempArg) 52
|
||||
53: 6(int) CompositeExtract 51 0
|
||||
Store 42(tempReturn) 53
|
||||
54: 16(ivec4) Load 49(tempArg)
|
||||
55: 11(fvec4) ConvertSToF 54
|
||||
Store 13(texel) 55
|
||||
56: 6(int) Load 42(tempReturn)
|
||||
57: 6(int) Load 8(resident)
|
||||
58: 6(int) BitwiseOr 57 56
|
||||
Store 8(resident) 58
|
||||
64: 61 Load 63(us2D)
|
||||
65: 31(fvec2) Load 33(c2)
|
||||
68: 67(ResType) ImageSparseSampleImplicitLod 64 65 ZeroExtend
|
||||
69: 21(ivec4) CompositeExtract 68 1
|
||||
Store 66(tempArg) 69
|
||||
70: 6(int) CompositeExtract 68 0
|
||||
Store 59(tempReturn) 70
|
||||
71: 21(ivec4) Load 66(tempArg)
|
||||
72: 11(fvec4) ConvertUToF 71
|
||||
Store 13(texel) 72
|
||||
73: 6(int) Load 59(tempReturn)
|
||||
74: 6(int) Load 8(resident)
|
||||
75: 6(int) BitwiseOr 74 73
|
||||
Store 8(resident) 75
|
||||
76: 27 Load 29(s2D)
|
||||
77: 31(fvec2) Load 33(c2)
|
||||
79: 35(ResType) ImageSparseSampleExplicitLod 76 77 Lod 78
|
||||
80: 11(fvec4) CompositeExtract 79 1
|
||||
Store 13(texel) 80
|
||||
81: 6(int) CompositeExtract 79 0
|
||||
82: 6(int) Load 8(resident)
|
||||
83: 6(int) BitwiseOr 82 81
|
||||
Store 8(resident) 83
|
||||
85: 44 Load 46(is2D)
|
||||
86: 31(fvec2) Load 33(c2)
|
||||
88: 50(ResType) ImageSparseSampleExplicitLod 85 86 Lod SignExtend 78
|
||||
89: 16(ivec4) CompositeExtract 88 1
|
||||
Store 87(tempArg) 89
|
||||
90: 6(int) CompositeExtract 88 0
|
||||
Store 84(tempReturn) 90
|
||||
91: 16(ivec4) Load 87(tempArg)
|
||||
92: 11(fvec4) ConvertSToF 91
|
||||
Store 13(texel) 92
|
||||
93: 6(int) Load 84(tempReturn)
|
||||
94: 6(int) Load 8(resident)
|
||||
95: 6(int) BitwiseOr 94 93
|
||||
Store 8(resident) 95
|
||||
97: 61 Load 63(us2D)
|
||||
98: 31(fvec2) Load 33(c2)
|
||||
100: 67(ResType) ImageSparseSampleExplicitLod 97 98 Lod ZeroExtend 78
|
||||
101: 21(ivec4) CompositeExtract 100 1
|
||||
Store 99(tempArg) 101
|
||||
102: 6(int) CompositeExtract 100 0
|
||||
Store 96(tempReturn) 102
|
||||
103: 21(ivec4) Load 99(tempArg)
|
||||
104: 11(fvec4) ConvertUToF 103
|
||||
Store 13(texel) 104
|
||||
105: 6(int) Load 96(tempReturn)
|
||||
106: 6(int) Load 8(resident)
|
||||
107: 6(int) BitwiseOr 106 105
|
||||
Store 8(resident) 107
|
||||
108: 27 Load 29(s2D)
|
||||
109: 31(fvec2) Load 33(c2)
|
||||
111: 110(ivec2) ConvertFToS 109
|
||||
113: 26 Image 108
|
||||
114: 35(ResType) ImageSparseFetch 113 111 Lod 112
|
||||
115: 11(fvec4) CompositeExtract 114 1
|
||||
Store 13(texel) 115
|
||||
116: 6(int) CompositeExtract 114 0
|
||||
117: 6(int) Load 8(resident)
|
||||
118: 6(int) BitwiseOr 117 116
|
||||
Store 8(resident) 118
|
||||
120: 44 Load 46(is2D)
|
||||
121: 31(fvec2) Load 33(c2)
|
||||
122: 110(ivec2) ConvertFToS 121
|
||||
124: 43 Image 120
|
||||
125: 50(ResType) ImageSparseFetch 124 122 Lod SignExtend 112
|
||||
126: 16(ivec4) CompositeExtract 125 1
|
||||
Store 123(tempArg) 126
|
||||
127: 6(int) CompositeExtract 125 0
|
||||
Store 119(tempReturn) 127
|
||||
128: 16(ivec4) Load 123(tempArg)
|
||||
129: 11(fvec4) ConvertSToF 128
|
||||
Store 13(texel) 129
|
||||
130: 6(int) Load 119(tempReturn)
|
||||
131: 6(int) Load 8(resident)
|
||||
132: 6(int) BitwiseOr 131 130
|
||||
Store 8(resident) 132
|
||||
134: 61 Load 63(us2D)
|
||||
135: 31(fvec2) Load 33(c2)
|
||||
136: 110(ivec2) ConvertFToS 135
|
||||
138: 60 Image 134
|
||||
139: 67(ResType) ImageSparseFetch 138 136 Lod ZeroExtend 112
|
||||
140: 21(ivec4) CompositeExtract 139 1
|
||||
Store 137(tempArg) 140
|
||||
141: 6(int) CompositeExtract 139 0
|
||||
Store 133(tempReturn) 141
|
||||
142: 21(ivec4) Load 137(tempArg)
|
||||
143: 11(fvec4) ConvertUToF 142
|
||||
Store 13(texel) 143
|
||||
144: 6(int) Load 133(tempReturn)
|
||||
145: 6(int) Load 8(resident)
|
||||
146: 6(int) BitwiseOr 145 144
|
||||
Store 8(resident) 146
|
||||
150: 147 Load 149(i2D)
|
||||
153: 110(ivec2) Load 152(ic2)
|
||||
154: 35(ResType) ImageSparseRead 150 153
|
||||
155: 11(fvec4) CompositeExtract 154 1
|
||||
Store 13(texel) 155
|
||||
156: 6(int) CompositeExtract 154 0
|
||||
157: 6(int) Load 8(resident)
|
||||
158: 6(int) BitwiseOr 157 156
|
||||
Store 8(resident) 158
|
||||
163: 160 Load 162(ii2DMS)
|
||||
164: 110(ivec2) Load 152(ic2)
|
||||
167: 50(ResType) ImageSparseRead 163 164 Sample SignExtend 165
|
||||
168: 16(ivec4) CompositeExtract 167 1
|
||||
Store 166(tempArg) 168
|
||||
169: 6(int) CompositeExtract 167 0
|
||||
Store 159(tempReturn) 169
|
||||
170: 16(ivec4) Load 166(tempArg)
|
||||
171: 11(fvec4) ConvertSToF 170
|
||||
Store 13(texel) 171
|
||||
172: 6(int) Load 159(tempReturn)
|
||||
173: 6(int) Load 8(resident)
|
||||
174: 6(int) BitwiseOr 173 172
|
||||
Store 8(resident) 174
|
||||
178: 175 Load 177(ui3D)
|
||||
182: 179(ivec3) Load 181(ic3)
|
||||
183: 67(ResType) ImageSparseRead 178 182 ZeroExtend
|
||||
184: 21(ivec4) CompositeExtract 183 1
|
||||
Store 23(utexel) 184
|
||||
185: 6(int) CompositeExtract 183 0
|
||||
186: 6(int) Load 8(resident)
|
||||
187: 6(int) BitwiseOr 186 185
|
||||
Store 8(resident) 187
|
||||
190: 6(int) Load 8(resident)
|
||||
192: 191(bool) ImageSparseTexelsResident 190
|
||||
SelectionMerge 195 None
|
||||
BranchConditional 192 194 197
|
||||
194: Label
|
||||
196: 11(fvec4) Load 13(texel)
|
||||
Store 193 196
|
||||
Branch 195
|
||||
197: Label
|
||||
198: 16(ivec4) Load 18(itexel)
|
||||
199: 11(fvec4) ConvertSToF 198
|
||||
200: 21(ivec4) Load 23(utexel)
|
||||
201: 11(fvec4) ConvertUToF 200
|
||||
202: 11(fvec4) FAdd 199 201
|
||||
Store 193 202
|
||||
Branch 195
|
||||
195: Label
|
||||
203: 11(fvec4) Load 193
|
||||
Store 189(outColor) 203
|
||||
Return
|
||||
FunctionEnd
|
||||
115
Test/baseResults/spv.1.4.texture.frag.out
Executable file
115
Test/baseResults/spv.1.4.texture.frag.out
Executable file
@ -0,0 +1,115 @@
|
||||
spv.1.4.texture.frag
|
||||
// Module Version 10400
|
||||
// Generated by (magic number): 80007
|
||||
// Id's are bound by 79
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 15 19 28 40 51 54 76 78
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source GLSL 450
|
||||
Name 4 "main"
|
||||
Name 9 "color"
|
||||
Name 15 "texSampler2D"
|
||||
Name 19 "coords2D"
|
||||
Name 28 "itexSampler2D"
|
||||
Name 40 "utexSampler2D"
|
||||
Name 51 "iCoords2D"
|
||||
Name 54 "iLod"
|
||||
Name 76 "t"
|
||||
Name 78 "color"
|
||||
Decorate 15(texSampler2D) DescriptorSet 0
|
||||
Decorate 15(texSampler2D) Binding 0
|
||||
Decorate 28(itexSampler2D) DescriptorSet 0
|
||||
Decorate 28(itexSampler2D) Binding 0
|
||||
Decorate 40(utexSampler2D) DescriptorSet 0
|
||||
Decorate 40(utexSampler2D) Binding 0
|
||||
Decorate 51(iCoords2D) Flat
|
||||
Decorate 54(iLod) Flat
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypePointer Function 7(fvec4)
|
||||
10: 6(float) Constant 0
|
||||
11: 7(fvec4) ConstantComposite 10 10 10 10
|
||||
12: TypeImage 6(float) 2D sampled format:Unknown
|
||||
13: TypeSampledImage 12
|
||||
14: TypePointer UniformConstant 13
|
||||
15(texSampler2D): 14(ptr) Variable UniformConstant
|
||||
17: TypeVector 6(float) 2
|
||||
18: TypePointer Input 17(fvec2)
|
||||
19(coords2D): 18(ptr) Variable Input
|
||||
24: TypeInt 32 1
|
||||
25: TypeImage 24(int) 2D sampled format:Unknown
|
||||
26: TypeSampledImage 25
|
||||
27: TypePointer UniformConstant 26
|
||||
28(itexSampler2D): 27(ptr) Variable UniformConstant
|
||||
31: TypeVector 24(int) 4
|
||||
36: TypeInt 32 0
|
||||
37: TypeImage 36(int) 2D sampled format:Unknown
|
||||
38: TypeSampledImage 37
|
||||
39: TypePointer UniformConstant 38
|
||||
40(utexSampler2D): 39(ptr) Variable UniformConstant
|
||||
43: TypeVector 36(int) 4
|
||||
49: TypeVector 24(int) 2
|
||||
50: TypePointer Input 49(ivec2)
|
||||
51(iCoords2D): 50(ptr) Variable Input
|
||||
53: TypePointer Input 24(int)
|
||||
54(iLod): 53(ptr) Variable Input
|
||||
76(t): 18(ptr) Variable Input
|
||||
77: TypePointer Output 7(fvec4)
|
||||
78(color): 77(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
9(color): 8(ptr) Variable Function
|
||||
Store 9(color) 11
|
||||
16: 13 Load 15(texSampler2D)
|
||||
20: 17(fvec2) Load 19(coords2D)
|
||||
21: 7(fvec4) ImageSampleImplicitLod 16 20
|
||||
22: 7(fvec4) Load 9(color)
|
||||
23: 7(fvec4) FAdd 22 21
|
||||
Store 9(color) 23
|
||||
29: 26 Load 28(itexSampler2D)
|
||||
30: 17(fvec2) Load 19(coords2D)
|
||||
32: 31(ivec4) ImageSampleImplicitLod 29 30 SignExtend
|
||||
33: 7(fvec4) ConvertSToF 32
|
||||
34: 7(fvec4) Load 9(color)
|
||||
35: 7(fvec4) FAdd 34 33
|
||||
Store 9(color) 35
|
||||
41: 38 Load 40(utexSampler2D)
|
||||
42: 17(fvec2) Load 19(coords2D)
|
||||
44: 43(ivec4) ImageSampleImplicitLod 41 42 ZeroExtend
|
||||
45: 7(fvec4) ConvertUToF 44
|
||||
46: 7(fvec4) Load 9(color)
|
||||
47: 7(fvec4) FAdd 46 45
|
||||
Store 9(color) 47
|
||||
48: 13 Load 15(texSampler2D)
|
||||
52: 49(ivec2) Load 51(iCoords2D)
|
||||
55: 24(int) Load 54(iLod)
|
||||
56: 12 Image 48
|
||||
57: 7(fvec4) ImageFetch 56 52 Lod 55
|
||||
58: 7(fvec4) Load 9(color)
|
||||
59: 7(fvec4) FAdd 58 57
|
||||
Store 9(color) 59
|
||||
60: 26 Load 28(itexSampler2D)
|
||||
61: 49(ivec2) Load 51(iCoords2D)
|
||||
62: 24(int) Load 54(iLod)
|
||||
63: 25 Image 60
|
||||
64: 31(ivec4) ImageFetch 63 61 Lod SignExtend 62
|
||||
65: 7(fvec4) ConvertSToF 64
|
||||
66: 7(fvec4) Load 9(color)
|
||||
67: 7(fvec4) FAdd 66 65
|
||||
Store 9(color) 67
|
||||
68: 38 Load 40(utexSampler2D)
|
||||
69: 49(ivec2) Load 51(iCoords2D)
|
||||
70: 24(int) Load 54(iLod)
|
||||
71: 37 Image 68
|
||||
72: 43(ivec4) ImageFetch 71 69 Lod ZeroExtend 70
|
||||
73: 7(fvec4) ConvertUToF 72
|
||||
74: 7(fvec4) Load 9(color)
|
||||
75: 7(fvec4) FAdd 74 73
|
||||
Store 9(color) 75
|
||||
Return
|
||||
FunctionEnd
|
||||
@ -1,7 +1,7 @@
|
||||
spv.controlFlowAttributes.frag
|
||||
WARNING: 0:20: '' : attribute with arguments not recognized, skipping
|
||||
WARNING: 0:21: '' : attribute with arguments not recognized, skipping
|
||||
WARNING: 0:22: '' : attribute with arguments not recognized, skipping
|
||||
WARNING: 0:20: 'unroll' : expected no arguments
|
||||
WARNING: 0:21: 'dont_unroll' : expected no arguments
|
||||
WARNING: 0:22: 'dependency_infinite' : expected no arguments
|
||||
WARNING: 0:23: 'dependency_length' : expected a single integer argument
|
||||
WARNING: 0:24: '' : attribute with arguments not recognized, skipping
|
||||
WARNING: 0:25: '' : attribute with arguments not recognized, skipping
|
||||
|
||||
19
Test/spv.1.4.LoopControl.frag
Normal file
19
Test/spv.1.4.LoopControl.frag
Normal file
@ -0,0 +1,19 @@
|
||||
#version 450
|
||||
|
||||
#extension GL_EXT_control_flow_attributes : enable
|
||||
|
||||
bool cond;
|
||||
|
||||
void main()
|
||||
{
|
||||
[[min_iterations(3), max_iterations(7)]] for (int i = 0; i < 8; ++i) { }
|
||||
[[iteration_multiple(2)]] while(true) { }
|
||||
[[peel_count(5)]] do { } while(true);
|
||||
[[partial_count(4)]] for (int i = 0; i < 8; ++i) { }
|
||||
|
||||
// warnings on all these
|
||||
[[min_iterations, max_iterations]] for (int i = 0; i < 8; ++i) { }
|
||||
//[[iteration_multiple(0)]] while(true) { }
|
||||
//[[peel_count]] do { } while(true);
|
||||
//[[partial_count]] for (int i = 0; i < 8; ++i) { }
|
||||
}
|
||||
13
Test/spv.1.4.NonWritable.frag
Executable file
13
Test/spv.1.4.NonWritable.frag
Executable file
@ -0,0 +1,13 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) flat in int index;
|
||||
|
||||
layout(location = 0) out float color;
|
||||
|
||||
// lookup table
|
||||
const float table[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
|
||||
|
||||
void main()
|
||||
{
|
||||
color = table[index];
|
||||
}
|
||||
48
Test/spv.1.4.OpCopyLogical.comp
Normal file
48
Test/spv.1.4.OpCopyLogical.comp
Normal file
@ -0,0 +1,48 @@
|
||||
#version 450 core
|
||||
|
||||
struct MyStruct
|
||||
{
|
||||
vec2 foo[2];
|
||||
int sb;
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO0
|
||||
{
|
||||
MyStruct a;
|
||||
} inBuf;
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO1
|
||||
{
|
||||
MyStruct b;
|
||||
} outBuf;
|
||||
|
||||
layout(binding = 2, std140) uniform UBO
|
||||
{
|
||||
MyStruct c;
|
||||
} uBuf;
|
||||
|
||||
struct Nested {
|
||||
float f;
|
||||
MyStruct S[2];
|
||||
};
|
||||
|
||||
layout(binding = 2, std140) uniform UBON
|
||||
{
|
||||
Nested N1;
|
||||
} uBufN;
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO1N
|
||||
{
|
||||
Nested N2;
|
||||
} outBufN;
|
||||
|
||||
void main()
|
||||
{
|
||||
MyStruct t = inBuf.a;
|
||||
outBuf.b = t;
|
||||
t = uBuf.c;
|
||||
outBuf.b = t;
|
||||
|
||||
Nested n = uBufN.N1;
|
||||
outBufN.N2 = n;
|
||||
}
|
||||
21
Test/spv.1.4.OpCopyLogical.funcall.frag
Normal file
21
Test/spv.1.4.OpCopyLogical.funcall.frag
Normal file
@ -0,0 +1,21 @@
|
||||
#version 450
|
||||
|
||||
struct S { mat4 m; };
|
||||
buffer blockName { S s1; }; // need an S with decoration
|
||||
S s2; // no decorations on S
|
||||
|
||||
void fooConst(const in S s) { }
|
||||
void foo(in S s) { }
|
||||
void fooOut(inout S s) { }
|
||||
|
||||
void main()
|
||||
{
|
||||
fooConst(s1);
|
||||
fooConst(s2);
|
||||
|
||||
foo(s1);
|
||||
foo(s2);
|
||||
|
||||
fooOut(s1);
|
||||
fooOut(s2);
|
||||
}
|
||||
48
Test/spv.1.4.OpCopyLogicalBool.comp
Normal file
48
Test/spv.1.4.OpCopyLogicalBool.comp
Normal file
@ -0,0 +1,48 @@
|
||||
#version 450 core
|
||||
|
||||
struct MyStruct
|
||||
{
|
||||
vec2 foo[2];
|
||||
bool sb;
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO0
|
||||
{
|
||||
MyStruct a;
|
||||
} inBuf;
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO1
|
||||
{
|
||||
MyStruct b;
|
||||
} outBuf;
|
||||
|
||||
layout(binding = 2, std140) uniform UBO
|
||||
{
|
||||
MyStruct c;
|
||||
} uBuf;
|
||||
|
||||
struct Nested {
|
||||
bool b;
|
||||
MyStruct S[2];
|
||||
};
|
||||
|
||||
layout(binding = 2, std140) uniform UBON
|
||||
{
|
||||
Nested N1;
|
||||
} uBufN;
|
||||
|
||||
layout(binding = 1, std430) buffer SSBO1N
|
||||
{
|
||||
Nested N2;
|
||||
} outBufN;
|
||||
|
||||
void main()
|
||||
{
|
||||
MyStruct t = inBuf.a;
|
||||
outBuf.b = t;
|
||||
t = uBuf.c;
|
||||
outBuf.b = t;
|
||||
|
||||
Nested n = uBufN.N1;
|
||||
outBufN.N2 = n;
|
||||
}
|
||||
27
Test/spv.1.4.OpEntryPoint.frag
Normal file
27
Test/spv.1.4.OpEntryPoint.frag
Normal file
@ -0,0 +1,27 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) in vec4 inv;
|
||||
layout(location = 0) out vec4 outv;
|
||||
|
||||
vec4 globalv;
|
||||
|
||||
layout(binding = 0) uniform ubt {
|
||||
vec4 v;
|
||||
} uniformv;
|
||||
|
||||
layout(binding = 1) buffer bbt {
|
||||
float f;
|
||||
} bufferv;
|
||||
|
||||
layout(binding = 2, push_constant) uniform pushB {
|
||||
int a;
|
||||
} pushv;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 functionv;
|
||||
functionv = inv;
|
||||
globalv = inv;
|
||||
outv = functionv + inv + globalv + uniformv.v * pushv.a * bufferv.f;
|
||||
outv += functionv + inv + globalv + uniformv.v * pushv.a * bufferv.f;
|
||||
}
|
||||
37
Test/spv.1.4.OpSelect.frag
Executable file
37
Test/spv.1.4.OpSelect.frag
Executable file
@ -0,0 +1,37 @@
|
||||
#version 450
|
||||
|
||||
struct S1 {
|
||||
float a;
|
||||
int b;
|
||||
};
|
||||
|
||||
layout(location = 0) flat in S1 in1;
|
||||
layout(location = 2) flat in S1 in2;
|
||||
layout(location = 4) flat in int cond;
|
||||
|
||||
layout(location = 0) out float outv;
|
||||
|
||||
void fun1(){}
|
||||
void fun2(){}
|
||||
|
||||
void main()
|
||||
{
|
||||
// glslang will only make OpSelect for very trivial looking expressions
|
||||
|
||||
float f1 = 1.0;
|
||||
float f2 = 2.0;
|
||||
outv = cond < 8 ? f1 : f2; // in all versions
|
||||
|
||||
ivec4 iv1 = ivec4(f1);
|
||||
ivec4 iv2 = ivec4(f2);
|
||||
outv *= (cond > 0 ? iv1 : iv2).z; // in all versions, but in 1.4 as scalar condition, not smeared ala mix()
|
||||
|
||||
mat3 m1 = mat3(1.0);
|
||||
mat3 m2 = mat3(2.0);
|
||||
outv *= (cond < 20 ? m1 : m2)[2][1]; // in 1.4, but not before
|
||||
|
||||
S1 fv = cond > 5 ? in1 : in2; // in 1.4, but not before
|
||||
outv *= fv.a;
|
||||
|
||||
cond > 0 ? fun1() : fun2(); // not allowed by any version
|
||||
}
|
||||
38
Test/spv.1.4.image.frag
Normal file
38
Test/spv.1.4.image.frag
Normal file
@ -0,0 +1,38 @@
|
||||
#version 450
|
||||
|
||||
layout(rgba32f, binding = 1) uniform image2D i2D;
|
||||
layout(r32i, binding = 12) uniform iimage2D ii2D;
|
||||
layout(r32ui, binding = 12) uniform uimage2D ui2D;
|
||||
|
||||
layout(rgba32f, binding = 9) uniform image2DMS i2DMS;
|
||||
layout(r32i, binding = 13) uniform iimage2DMS ii2DMS;
|
||||
layout(r32ui, binding = 13) uniform uimage2DMS ui2DMS;
|
||||
|
||||
flat in ivec2 ic2D;
|
||||
flat in uint value;
|
||||
|
||||
out vec4 fragData;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 v = vec4(0.0);
|
||||
ivec4 iv = ivec4(0.0);
|
||||
uvec4 uv = uvec4(0.0);
|
||||
|
||||
v += imageLoad(i2D, ic2D);
|
||||
imageStore(i2D, ic2D, v);
|
||||
v += imageLoad(ii2D, ic2D);
|
||||
imageStore(ii2D, ic2D, iv);
|
||||
v += imageLoad(ui2D, ic2D);
|
||||
imageStore(ui2D, ic2D, uv);
|
||||
|
||||
v += imageLoad(i2DMS, ic2D, 1);
|
||||
imageStore(i2DMS, ic2D, 2, v);
|
||||
v += imageLoad(ii2DMS, ic2D, 1);
|
||||
imageStore(ii2DMS, ic2D, 2, iv);
|
||||
v += imageLoad(ui2DMS, ic2D, 1);
|
||||
imageStore(ui2DMS, ic2D, 2, uv);
|
||||
|
||||
fragData = v;
|
||||
}
|
||||
|
||||
47
Test/spv.1.4.sparseTexture.frag
Normal file
47
Test/spv.1.4.sparseTexture.frag
Normal file
@ -0,0 +1,47 @@
|
||||
#version 450
|
||||
#extension GL_ARB_sparse_texture2: enable
|
||||
|
||||
uniform sampler2D s2D;
|
||||
uniform isampler2D is2D;
|
||||
uniform usampler2D us2D;
|
||||
|
||||
layout(rgba32f) uniform image2D i2D;
|
||||
layout(rgba32i) uniform iimage2DMS ii2DMS;
|
||||
layout(rgba32ui) uniform uimage3D ui3D;
|
||||
|
||||
in vec2 c2;
|
||||
in vec3 c3;
|
||||
in vec4 c4;
|
||||
|
||||
in flat ivec2 ic2;
|
||||
in flat ivec3 ic3;
|
||||
|
||||
in flat ivec2 offsets[4];
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
int resident = 0;
|
||||
vec4 texel = vec4(0.0);
|
||||
ivec4 itexel = ivec4(0);
|
||||
uvec4 utexel = uvec4(0);
|
||||
|
||||
resident |= sparseTextureARB(s2D, c2, texel);
|
||||
resident |= sparseTextureARB(is2D, c2, texel);
|
||||
resident |= sparseTextureARB(us2D, c2, texel);
|
||||
|
||||
resident |= sparseTextureLodARB( s2D, c2, 2.0, texel);
|
||||
resident |= sparseTextureLodARB(is2D, c2, 2.0, texel);
|
||||
resident |= sparseTextureLodARB(us2D, c2, 2.0, texel);
|
||||
|
||||
resident |= sparseTexelFetchARB( s2D, ivec2(c2), 2, texel);
|
||||
resident |= sparseTexelFetchARB(is2D, ivec2(c2), 2, texel);
|
||||
resident |= sparseTexelFetchARB(us2D, ivec2(c2), 2, texel);
|
||||
|
||||
resident |= sparseImageLoadARB(i2D, ic2, texel);
|
||||
resident |= sparseImageLoadARB(ii2DMS, ic2, 3, texel);
|
||||
resident |= sparseImageLoadARB(ui3D, ic3, utexel);
|
||||
|
||||
outColor = sparseTexelsResidentARB(resident) ? texel : vec4(itexel) + vec4(utexel);
|
||||
}
|
||||
26
Test/spv.1.4.texture.frag
Normal file
26
Test/spv.1.4.texture.frag
Normal file
@ -0,0 +1,26 @@
|
||||
#version 450
|
||||
|
||||
uniform sampler2D texSampler2D;
|
||||
uniform isampler2D itexSampler2D;
|
||||
uniform usampler2D utexSampler2D;
|
||||
|
||||
in vec2 t;
|
||||
in vec2 coords2D;
|
||||
flat in ivec2 iCoords2D;
|
||||
|
||||
out vec4 color;
|
||||
|
||||
flat in int iLod;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
color += texture( texSampler2D, coords2D);
|
||||
color += texture(itexSampler2D, coords2D);
|
||||
color += texture(utexSampler2D, coords2D);
|
||||
|
||||
color += texelFetch( texSampler2D, iCoords2D, iLod);
|
||||
color += texelFetch(itexSampler2D, iCoords2D, iLod);
|
||||
color += texelFetch(utexSampler2D, iCoords2D, iLod);
|
||||
}
|
||||
@ -1116,7 +1116,12 @@ public:
|
||||
first(testFirst),
|
||||
unroll(false),
|
||||
dontUnroll(false),
|
||||
dependency(0)
|
||||
dependency(0),
|
||||
minIterations(0),
|
||||
maxIterations(iterationsInfinite),
|
||||
iterationMultiple(1),
|
||||
peelCount(0),
|
||||
partialCount(0)
|
||||
{ }
|
||||
|
||||
virtual TIntermLoop* getAsLoopNode() { return this; }
|
||||
@ -1128,14 +1133,36 @@ public:
|
||||
bool testFirst() const { return first; }
|
||||
|
||||
void setUnroll() { unroll = true; }
|
||||
void setDontUnroll() { dontUnroll = true; }
|
||||
void setDontUnroll() {
|
||||
dontUnroll = true;
|
||||
peelCount = 0;
|
||||
partialCount = 0;
|
||||
}
|
||||
bool getUnroll() const { return unroll; }
|
||||
bool getDontUnroll() const { return dontUnroll; }
|
||||
|
||||
static const unsigned int dependencyInfinite = 0xFFFFFFFF;
|
||||
static const unsigned int iterationsInfinite = 0xFFFFFFFF;
|
||||
void setLoopDependency(int d) { dependency = d; }
|
||||
int getLoopDependency() const { return dependency; }
|
||||
|
||||
void setMinIterations(unsigned int v) { minIterations = v; }
|
||||
unsigned int getMinIterations() const { return minIterations; }
|
||||
void setMaxIterations(unsigned int v) { maxIterations = v; }
|
||||
unsigned int getMaxIterations() const { return maxIterations; }
|
||||
void setIterationMultiple(unsigned int v) { iterationMultiple = v; }
|
||||
unsigned int getIterationMultiple() const { return iterationMultiple; }
|
||||
void setPeelCount(unsigned int v) {
|
||||
peelCount = v;
|
||||
dontUnroll = false;
|
||||
}
|
||||
unsigned int getPeelCount() const { return peelCount; }
|
||||
void setPartialCount(unsigned int v) {
|
||||
partialCount = v;
|
||||
dontUnroll = false;
|
||||
}
|
||||
unsigned int getPartialCount() const { return partialCount; }
|
||||
|
||||
protected:
|
||||
TIntermNode* body; // code to loop over
|
||||
TIntermTyped* test; // exit condition associated with loop, could be 0 for 'for' loops
|
||||
@ -1144,6 +1171,11 @@ protected:
|
||||
bool unroll; // true if unroll requested
|
||||
bool dontUnroll; // true if request to not unroll
|
||||
unsigned int dependency; // loop dependency hint; 0 means not set or unknown
|
||||
unsigned int minIterations; // as per the SPIR-V specification
|
||||
unsigned int maxIterations; // as per the SPIR-V specification
|
||||
unsigned int iterationMultiple; // as per the SPIR-V specification
|
||||
unsigned int peelCount; // as per the SPIR-V specification
|
||||
unsigned int partialCount; // as per the SPIR-V specification
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
// This header is generated by the make-revision script.
|
||||
|
||||
#define GLSLANG_PATCH_LEVEL 3216
|
||||
#define GLSLANG_PATCH_LEVEL 3226
|
||||
|
||||
@ -52,6 +52,7 @@ bool TAttributeArgs::getInt(int& value, int argNum) const
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// extract strings out of attribute arguments stored in attribute aggregate.
|
||||
// convert to lower case if converToLower is true (for case-insensitive compare convenience)
|
||||
bool TAttributeArgs::getString(TString& value, int argNum, bool convertToLower) const
|
||||
@ -110,6 +111,16 @@ TAttributeType TParseContext::attributeFromName(const TString& name) const
|
||||
return EatDependencyInfinite;
|
||||
else if (name == "dependency_length")
|
||||
return EatDependencyLength;
|
||||
else if (name == "min_iterations")
|
||||
return EatMinIterations;
|
||||
else if (name == "max_iterations")
|
||||
return EatMaxIterations;
|
||||
else if (name == "iteration_multiple")
|
||||
return EatIterationMultiple;
|
||||
else if (name == "peel_count")
|
||||
return EatPeelCount;
|
||||
else if (name == "partial_count")
|
||||
return EatPartialCount;
|
||||
else
|
||||
return EatNone;
|
||||
}
|
||||
@ -225,29 +236,101 @@ void TParseContext::handleLoopAttributes(const TAttributes& attributes, TIntermN
|
||||
}
|
||||
|
||||
for (auto it = attributes.begin(); it != attributes.end(); ++it) {
|
||||
if (it->name != EatDependencyLength && it->size() > 0) {
|
||||
warn(node->getLoc(), "attribute with arguments not recognized, skipping", "", "");
|
||||
continue;
|
||||
}
|
||||
|
||||
int value;
|
||||
const auto noArgument = [&](const char* feature) {
|
||||
if (it->size() > 0) {
|
||||
warn(node->getLoc(), "expected no arguments", feature, "");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const auto positiveSignedArgument = [&](const char* feature, int& value) {
|
||||
if (it->size() == 1 && it->getInt(value)) {
|
||||
if (value <= 0) {
|
||||
error(node->getLoc(), "must be positive", feature, "");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
warn(node->getLoc(), "expected a single integer argument", feature, "");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const auto unsignedArgument = [&](const char* feature, unsigned int& uiValue) {
|
||||
int value;
|
||||
if (!(it->size() == 1 && it->getInt(value))) {
|
||||
warn(node->getLoc(), "expected a single integer argument", feature, "");
|
||||
return false;
|
||||
}
|
||||
uiValue = (unsigned int)value;
|
||||
return true;
|
||||
};
|
||||
|
||||
const auto positiveUnsignedArgument = [&](const char* feature, unsigned int& uiValue) {
|
||||
int value;
|
||||
if (it->size() == 1 && it->getInt(value)) {
|
||||
if (value == 0) {
|
||||
error(node->getLoc(), "must be greater than or equal to 1", feature, "");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
warn(node->getLoc(), "expected a single integer argument", feature, "");
|
||||
return false;
|
||||
}
|
||||
uiValue = (unsigned int)value;
|
||||
return true;
|
||||
};
|
||||
|
||||
const auto spirv14 = [&](const char* feature) {
|
||||
if (spvVersion.spv > 0 && spvVersion.spv < EShTargetSpv_1_4)
|
||||
warn(node->getLoc(), "attribute requires a SPIR-V 1.4 target-env", feature, "");
|
||||
};
|
||||
|
||||
int value = 0;
|
||||
unsigned uiValue = 0;
|
||||
switch (it->name) {
|
||||
case EatUnroll:
|
||||
loop->setUnroll();
|
||||
if (noArgument("unroll"))
|
||||
loop->setUnroll();
|
||||
break;
|
||||
case EatLoop:
|
||||
loop->setDontUnroll();
|
||||
if (noArgument("dont_unroll"))
|
||||
loop->setDontUnroll();
|
||||
break;
|
||||
case EatDependencyInfinite:
|
||||
loop->setLoopDependency(TIntermLoop::dependencyInfinite);
|
||||
if (noArgument("dependency_infinite"))
|
||||
loop->setLoopDependency(TIntermLoop::dependencyInfinite);
|
||||
break;
|
||||
case EatDependencyLength:
|
||||
if (it->size() == 1 && it->getInt(value)) {
|
||||
if (value <= 0)
|
||||
error(node->getLoc(), "must be positive", "dependency_length", "");
|
||||
if (positiveSignedArgument("dependency_length", value))
|
||||
loop->setLoopDependency(value);
|
||||
} else
|
||||
warn(node->getLoc(), "expected a single integer argument", "dependency_length", "");
|
||||
break;
|
||||
case EatMinIterations:
|
||||
spirv14("min_iterations");
|
||||
if (unsignedArgument("min_iterations", uiValue))
|
||||
loop->setMinIterations(uiValue);
|
||||
break;
|
||||
case EatMaxIterations:
|
||||
spirv14("max_iterations");
|
||||
if (unsignedArgument("max_iterations", uiValue))
|
||||
loop->setMaxIterations(uiValue);
|
||||
break;
|
||||
case EatIterationMultiple:
|
||||
spirv14("iteration_multiple");
|
||||
if (positiveUnsignedArgument("iteration_multiple", uiValue))
|
||||
loop->setIterationMultiple(uiValue);
|
||||
break;
|
||||
case EatPeelCount:
|
||||
spirv14("peel_count");
|
||||
if (unsignedArgument("peel_count", uiValue))
|
||||
loop->setPeelCount(uiValue);
|
||||
break;
|
||||
case EatPartialCount:
|
||||
spirv14("partial_count");
|
||||
if (unsignedArgument("partial_count", uiValue))
|
||||
loop->setPartialCount(uiValue);
|
||||
break;
|
||||
default:
|
||||
warn(node->getLoc(), "attribute does not apply to a loop", "", "");
|
||||
|
||||
@ -71,7 +71,12 @@ namespace glslang {
|
||||
EatPushConstant,
|
||||
EatConstantId,
|
||||
EatDependencyInfinite,
|
||||
EatDependencyLength
|
||||
EatDependencyLength,
|
||||
EatMinIterations,
|
||||
EatMaxIterations,
|
||||
EatIterationMultiple,
|
||||
EatPeelCount,
|
||||
EatPartialCount
|
||||
};
|
||||
|
||||
class TIntermAggregate;
|
||||
|
||||
@ -68,7 +68,7 @@
|
||||
// This should always increase, as some paths to do not consume
|
||||
// a more major number.
|
||||
// It should increment by one when new functionality is added.
|
||||
#define GLSLANG_MINOR_VERSION 11
|
||||
#define GLSLANG_MINOR_VERSION 12
|
||||
|
||||
//
|
||||
// Call before doing any other compiler/linker operations.
|
||||
|
||||
@ -48,7 +48,7 @@ using CompileToAstTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
TEST_P(CompileToAstTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
||||
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0,
|
||||
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::AST);
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ TEST_P(CompileToAstTest, FromFile)
|
||||
TEST_P(CompileToAstTestNV, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
||||
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0,
|
||||
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::AST);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -70,14 +70,14 @@ using HlslLegalDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPoi
|
||||
TEST_P(HlslCompileTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
|
||||
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
|
||||
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::BothASTAndSpv, true, GetParam().entryPoint);
|
||||
}
|
||||
|
||||
TEST_P(HlslVulkan1_1CompileTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
|
||||
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1,
|
||||
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_3,
|
||||
Target::BothASTAndSpv, true, GetParam().entryPoint);
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ TEST_P(HlslCompileAndFlattenTest, FromFile)
|
||||
TEST_P(HlslLegalizeTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
|
||||
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
|
||||
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::Spv, true, GetParam().entryPoint,
|
||||
"/baseLegalResults/", true);
|
||||
}
|
||||
@ -103,7 +103,7 @@ TEST_P(HlslLegalizeTest, FromFile)
|
||||
TEST_P(HlslDebugTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
|
||||
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
|
||||
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::Spv, true, GetParam().entryPoint,
|
||||
"/baseResults/", false, true);
|
||||
}
|
||||
@ -111,7 +111,8 @@ TEST_P(HlslDebugTest, FromFile)
|
||||
TEST_P(HlslDX9CompatibleTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheckWithOptions(GlobalTestSettings.testRoot, GetParam().fileName, Source::HLSL,
|
||||
Semantics::Vulkan, glslang::EShTargetVulkan_1_0, Target::BothASTAndSpv, true,
|
||||
Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::BothASTAndSpv, true,
|
||||
GetParam().entryPoint, "/baseResults/",
|
||||
EShMessages::EShMsgHlslDX9Compatible);
|
||||
}
|
||||
@ -122,7 +123,7 @@ TEST_P(HlslDX9CompatibleTest, FromFile)
|
||||
TEST_P(HlslLegalDebugTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
|
||||
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
|
||||
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::Spv, true, GetParam().entryPoint,
|
||||
"/baseResults/", true, true);
|
||||
}
|
||||
|
||||
44
gtests/Spv.FromFile.cpp
Normal file → Executable file
44
gtests/Spv.FromFile.cpp
Normal file → Executable file
@ -65,6 +65,7 @@ std::string FileNameAsCustomTestSuffixIoMap(
|
||||
using CompileVulkanToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
using CompileVulkanToDebugSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
using CompileVulkan1_1ToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
using CompileToSpirv14Test = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
using CompileOpenGLToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
using VulkanSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
using OpenGLSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
@ -84,7 +85,7 @@ using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::t
|
||||
TEST_P(CompileVulkanToSpirvTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::Spv);
|
||||
}
|
||||
|
||||
@ -94,7 +95,7 @@ TEST_P(CompileVulkanToDebugSpirvTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
||||
Source::GLSL, Semantics::Vulkan,
|
||||
glslang::EShTargetVulkan_1_0,
|
||||
glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::Spv, true, "",
|
||||
"/baseResults/", false, true);
|
||||
}
|
||||
@ -102,7 +103,14 @@ TEST_P(CompileVulkanToDebugSpirvTest, FromFile)
|
||||
TEST_P(CompileVulkan1_1ToSpirvTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1,
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_3,
|
||||
Target::Spv);
|
||||
}
|
||||
|
||||
TEST_P(CompileToSpirv14Test, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_4,
|
||||
Target::Spv);
|
||||
}
|
||||
|
||||
@ -111,7 +119,7 @@ TEST_P(CompileVulkan1_1ToSpirvTest, FromFile)
|
||||
TEST_P(CompileOpenGLToSpirvTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
||||
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0,
|
||||
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::Spv);
|
||||
}
|
||||
|
||||
@ -120,7 +128,7 @@ TEST_P(CompileOpenGLToSpirvTest, FromFile)
|
||||
TEST_P(VulkanSemantics, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::Spv, false);
|
||||
}
|
||||
|
||||
@ -129,7 +137,7 @@ TEST_P(VulkanSemantics, FromFile)
|
||||
TEST_P(OpenGLSemantics, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
||||
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0,
|
||||
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::Spv, false);
|
||||
}
|
||||
|
||||
@ -137,7 +145,7 @@ TEST_P(OpenGLSemantics, FromFile)
|
||||
TEST_P(VulkanAstSemantics, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::AST);
|
||||
}
|
||||
|
||||
@ -177,7 +185,7 @@ TEST_P(GlslIoMap, FromFile)
|
||||
TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::Spv);
|
||||
}
|
||||
#endif
|
||||
@ -188,7 +196,7 @@ TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
|
||||
TEST_P(CompileVulkanToSpirvTestNV, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::Spv);
|
||||
}
|
||||
#endif
|
||||
@ -453,6 +461,24 @@ INSTANTIATE_TEST_CASE_P(
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
|
||||
// clang-format off
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
Glsl, CompileToSpirv14Test,
|
||||
::testing::ValuesIn(std::vector<std::string>({
|
||||
"spv.1.4.LoopControl.frag",
|
||||
"spv.1.4.NonWritable.frag",
|
||||
"spv.1.4.OpEntryPoint.frag",
|
||||
"spv.1.4.OpSelect.frag",
|
||||
"spv.1.4.OpCopyLogical.comp",
|
||||
"spv.1.4.OpCopyLogicalBool.comp",
|
||||
"spv.1.4.OpCopyLogical.funcall.frag",
|
||||
"spv.1.4.image.frag",
|
||||
"spv.1.4.sparseTexture.frag",
|
||||
"spv.1.4.texture.frag",
|
||||
})),
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
|
||||
// clang-format off
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
Hlsl, HlslIoMap,
|
||||
|
||||
31
gtests/TestFixture.h
Normal file → Executable file
31
gtests/TestFixture.h
Normal file → Executable file
@ -212,6 +212,7 @@ public:
|
||||
const std::string& shaderName, const std::string& code,
|
||||
const std::string& entryPointName, EShMessages controls,
|
||||
glslang::EShTargetClientVersion clientTargetVersion,
|
||||
glslang::EShTargetLanguageVersion targetLanguageVersion,
|
||||
bool flattenUniformArrays = false,
|
||||
EShTextureSamplerTransformMode texSampTransMode = EShTexSampTransKeep,
|
||||
bool enableOptimizer = false,
|
||||
@ -234,9 +235,7 @@ public:
|
||||
: glslang::EShSourceGlsl,
|
||||
stage, glslang::EShClientVulkan, 100);
|
||||
shader.setEnvClient(glslang::EShClientVulkan, clientTargetVersion);
|
||||
shader.setEnvTarget(glslang::EShTargetSpv,
|
||||
clientTargetVersion == glslang::EShTargetVulkan_1_1 ? glslang::EShTargetSpv_1_3
|
||||
: glslang::EShTargetSpv_1_0);
|
||||
shader.setEnvTarget(glslang::EShTargetSpv, targetLanguageVersion);
|
||||
} else {
|
||||
shader.setEnvInput((controls & EShMsgReadHlsl) ? glslang::EShSourceHlsl
|
||||
: glslang::EShSourceGlsl,
|
||||
@ -429,6 +428,7 @@ public:
|
||||
Source source,
|
||||
Semantics semantics,
|
||||
glslang::EShTargetClientVersion clientTargetVersion,
|
||||
glslang::EShTargetLanguageVersion targetLanguageVersion,
|
||||
Target target,
|
||||
bool automap = true,
|
||||
const std::string& entryPointName="",
|
||||
@ -449,8 +449,8 @@ public:
|
||||
controls = static_cast<EShMessages>(controls & ~EShMsgHlslLegalization);
|
||||
if (enableDebug)
|
||||
controls = static_cast<EShMessages>(controls | EShMsgDebugInfo);
|
||||
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, clientTargetVersion, false,
|
||||
EShTexSampTransKeep, enableOptimizer, enableDebug, automap);
|
||||
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, clientTargetVersion,
|
||||
targetLanguageVersion, false, EShTexSampTransKeep, enableOptimizer, enableDebug, automap);
|
||||
|
||||
// Generate the hybrid output in the way of glslangValidator.
|
||||
std::ostringstream stream;
|
||||
@ -460,11 +460,12 @@ public:
|
||||
expectedOutputFname, result.spirvWarningsErrors);
|
||||
}
|
||||
|
||||
void loadFileCompileAndCheckWithOptions(const std::string &testDir,
|
||||
const std::string &testName,
|
||||
Source source,
|
||||
Semantics semantics,
|
||||
glslang::EShTargetClientVersion clientTargetVersion,
|
||||
void loadFileCompileAndCheckWithOptions(const std::string &testDir,
|
||||
const std::string &testName,
|
||||
Source source,
|
||||
Semantics semantics,
|
||||
glslang::EShTargetClientVersion clientTargetVersion,
|
||||
glslang::EShTargetLanguageVersion targetLanguageVersion,
|
||||
Target target, bool automap = true, const std::string &entryPointName = "",
|
||||
const std::string &baseDir = "/baseResults/",
|
||||
const EShMessages additionalOptions = EShMessages::EShMsgDefault)
|
||||
@ -478,15 +479,15 @@ public:
|
||||
|
||||
EShMessages controls = DeriveOptions(source, semantics, target);
|
||||
controls = static_cast<EShMessages>(controls | additionalOptions);
|
||||
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, clientTargetVersion, false,
|
||||
EShTexSampTransKeep, false, automap);
|
||||
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, clientTargetVersion,
|
||||
targetLanguageVersion, false, EShTexSampTransKeep, false, automap);
|
||||
|
||||
// Generate the hybrid output in the way of glslangValidator.
|
||||
std::ostringstream stream;
|
||||
outputResultToStream(&stream, result, controls);
|
||||
|
||||
checkEqAndUpdateIfRequested(expectedOutput, stream.str(), expectedOutputFname);
|
||||
}
|
||||
}
|
||||
|
||||
void loadFileCompileFlattenUniformsAndCheck(const std::string& testDir,
|
||||
const std::string& testName,
|
||||
@ -505,7 +506,7 @@ public:
|
||||
|
||||
const EShMessages controls = DeriveOptions(source, semantics, target);
|
||||
GlslangResult result = compileAndLink(testName, input, entryPointName, controls,
|
||||
glslang::EShTargetVulkan_1_0, true);
|
||||
glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, true);
|
||||
|
||||
// Generate the hybrid output in the way of glslangValidator.
|
||||
std::ostringstream stream;
|
||||
@ -675,7 +676,7 @@ public:
|
||||
|
||||
const EShMessages controls = DeriveOptions(source, semantics, target);
|
||||
GlslangResult result = compileAndLink(testName, input, entryPointName, controls,
|
||||
glslang::EShTargetVulkan_1_0, false,
|
||||
glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, false,
|
||||
EShTexSampTransUpgradeTextureRemoveSampler);
|
||||
|
||||
// Generate the hybrid output in the way of glslangValidator.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user