Unverified Commit 344a03c0 by John Kessenich Committed by GitHub

Merge pull request #1644 from jeffbolznv/buffer_reference

GL_EXT_buffer_reference
parents d12fbc4c 9f2aec49
......@@ -40,5 +40,6 @@ static const char* const E_SPV_KHR_8bit_storage = "SPV_KHR_8bit_
static const char* const E_SPV_KHR_storage_buffer_storage_class = "SPV_KHR_storage_buffer_storage_class";
static const char* const E_SPV_KHR_post_depth_coverage = "SPV_KHR_post_depth_coverage";
static const char* const E_SPV_KHR_vulkan_memory_model = "SPV_KHR_vulkan_memory_model";
static const char* const E_SPV_EXT_physical_storage_buffer = "SPV_EXT_physical_storage_buffer";
#endif // #ifndef GLSLextKHR_H
......@@ -194,6 +194,40 @@ Id Builder::makePointer(StorageClass storageClass, Id pointee)
return type->getResultId();
}
Id Builder::makeForwardPointer(StorageClass storageClass)
{
// Caching/uniquifying doesn't work here, because we don't know the
// pointee type and there can be multiple forward pointers of the same
// storage type. Somebody higher up in the stack must keep track.
Instruction* type = new Instruction(getUniqueId(), NoType, OpTypeForwardPointer);
type->addImmediateOperand(storageClass);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
return type->getResultId();
}
Id Builder::makePointerFromForwardPointer(StorageClass storageClass, Id forwardPointerType, Id pointee)
{
// try to find it
Instruction* type;
for (int t = 0; t < (int)groupedTypes[OpTypePointer].size(); ++t) {
type = groupedTypes[OpTypePointer][t];
if (type->getImmediateOperand(0) == (unsigned)storageClass &&
type->getIdOperand(1) == pointee)
return type->getResultId();
}
type = new Instruction(forwardPointerType, NoType, OpTypePointer);
type->addImmediateOperand(storageClass);
type->addIdOperand(pointee);
groupedTypes[OpTypePointer].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
return type->getResultId();
}
Id Builder::makeIntegerType(int width, bool hasSign)
{
// try to find it
......@@ -576,6 +610,7 @@ int Builder::getNumTypeConstituents(Id typeId) const
case OpTypeBool:
case OpTypeInt:
case OpTypeFloat:
case OpTypePointer:
return 1;
case OpTypeVector:
case OpTypeMatrix:
......@@ -669,17 +704,36 @@ bool Builder::containsType(Id typeId, spv::Op typeOp, unsigned int width) const
return true;
}
return false;
case OpTypePointer:
return false;
case OpTypeVector:
case OpTypeMatrix:
case OpTypeArray:
case OpTypeRuntimeArray:
case OpTypePointer:
return containsType(getContainedTypeId(typeId), typeOp, width);
default:
return typeClass == typeOp;
}
}
// return true if the type is a pointer to PhysicalStorageBufferEXT or an
// array of such pointers. These require restrict/aliased decorations.
bool Builder::containsPhysicalStorageBufferOrArray(Id typeId) const
{
const Instruction& instr = *module.getInstruction(typeId);
Op typeClass = instr.getOpCode();
switch (typeClass)
{
case OpTypePointer:
return getTypeStorageClass(typeId) == StorageClassPhysicalStorageBufferEXT;
case OpTypeArray:
return containsPhysicalStorageBufferOrArray(getContainedTypeId(typeId));
default:
return false;
}
}
// See if a scalar constant of this type has already been created, so it
// can be reused rather than duplicated. (Required by the specification).
Id Builder::findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value)
......@@ -1252,15 +1306,39 @@ Id Builder::createUndefined(Id type)
return inst->getResultId();
}
// av/vis/nonprivate are unnecessary and illegal for some storage classes.
spv::MemoryAccessMask Builder::sanitizeMemoryAccessForStorageClass(spv::MemoryAccessMask memoryAccess, StorageClass sc) const
{
switch (sc) {
case spv::StorageClassUniform:
case spv::StorageClassWorkgroup:
case spv::StorageClassStorageBuffer:
case spv::StorageClassPhysicalStorageBufferEXT:
break;
default:
memoryAccess = spv::MemoryAccessMask(memoryAccess &
~(spv::MemoryAccessMakePointerAvailableKHRMask |
spv::MemoryAccessMakePointerVisibleKHRMask |
spv::MemoryAccessNonPrivatePointerKHRMask));
break;
}
return memoryAccess;
}
// Comments in header
void Builder::createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess, spv::Scope scope)
void Builder::createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment)
{
Instruction* store = new Instruction(OpStore);
store->addIdOperand(lValue);
store->addIdOperand(rValue);
memoryAccess = sanitizeMemoryAccessForStorageClass(memoryAccess, getStorageClass(lValue));
if (memoryAccess != MemoryAccessMaskNone) {
store->addImmediateOperand(memoryAccess);
if (memoryAccess & spv::MemoryAccessAlignedMask) {
store->addImmediateOperand(alignment);
}
if (memoryAccess & spv::MemoryAccessMakePointerAvailableKHRMask) {
store->addIdOperand(makeUintConstant(scope));
}
......@@ -1270,13 +1348,18 @@ void Builder::createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAcce
}
// Comments in header
Id Builder::createLoad(Id lValue, spv::MemoryAccessMask memoryAccess, spv::Scope scope)
Id Builder::createLoad(Id lValue, spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment)
{
Instruction* load = new Instruction(getUniqueId(), getDerefTypeId(lValue), OpLoad);
load->addIdOperand(lValue);
memoryAccess = sanitizeMemoryAccessForStorageClass(memoryAccess, getStorageClass(lValue));
if (memoryAccess != MemoryAccessMaskNone) {
load->addImmediateOperand(memoryAccess);
if (memoryAccess & spv::MemoryAccessAlignedMask) {
load->addImmediateOperand(alignment);
}
if (memoryAccess & spv::MemoryAccessMakePointerVisibleKHRMask) {
load->addIdOperand(makeUintConstant(scope));
}
......@@ -2118,7 +2201,8 @@ Id Builder::createConstructor(Decoration precision, const std::vector<Id>& sourc
// Go through the source arguments, each one could have either
// a single or multiple components to contribute.
for (unsigned int i = 0; i < sources.size(); ++i) {
if (isScalar(sources[i]))
if (isScalar(sources[i]) || isPointer(sources[i]))
latchResult(sources[i]);
else if (isVector(sources[i]))
accumulateVectorConstituents(sources[i]);
......@@ -2433,11 +2517,15 @@ void Builder::clearAccessChain()
accessChain.preSwizzleBaseType = NoType;
accessChain.isRValue = false;
accessChain.coherentFlags.clear();
accessChain.alignment = 0;
}
// Comments in header
void Builder::accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizzleBaseType)
void Builder::accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizzleBaseType, AccessChain::CoherentFlags coherentFlags, unsigned int alignment)
{
accessChain.coherentFlags |= coherentFlags;
accessChain.alignment |= alignment;
// swizzles can be stacked in GLSL, but simplified to a single
// one here; the base type doesn't change
if (accessChain.preSwizzleBaseType == NoType)
......@@ -2459,7 +2547,7 @@ void Builder::accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizz
}
// Comments in header
void Builder::accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess, spv::Scope scope)
void Builder::accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment)
{
assert(accessChain.isRValue == false);
......@@ -2477,11 +2565,17 @@ void Builder::accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess, sp
source = createLvalueSwizzle(getTypeId(tempBaseId), tempBaseId, source, accessChain.swizzle);
}
createStore(source, base, memoryAccess, scope);
// take LSB of alignment
alignment = alignment & ~(alignment & (alignment-1));
if (getStorageClass(base) == StorageClassPhysicalStorageBufferEXT) {
memoryAccess = (spv::MemoryAccessMask)(memoryAccess | spv::MemoryAccessAlignedMask);
}
createStore(source, base, memoryAccess, scope, alignment);
}
// Comments in header
Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resultType, spv::MemoryAccessMask memoryAccess, spv::Scope scope)
Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resultType, spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment)
{
Id id;
......@@ -2524,8 +2618,15 @@ Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resu
id = accessChain.base; // no precision, it was set when this was defined
} else {
transferAccessChainSwizzle(true);
// take LSB of alignment
alignment = alignment & ~(alignment & (alignment-1));
if (getStorageClass(accessChain.base) == StorageClassPhysicalStorageBufferEXT) {
memoryAccess = (spv::MemoryAccessMask)(memoryAccess | spv::MemoryAccessAlignedMask);
}
// load through the access chain
id = createLoad(collapseAccessChain(), memoryAccess, scope);
id = createLoad(collapseAccessChain(), memoryAccess, scope, alignment);
setPrecision(id, precision);
addDecoration(id, nonUniform);
}
......
......@@ -138,7 +138,9 @@ public:
// For creating new types (will return old type if the requested one was already made).
Id makeVoidType();
Id makeBoolType();
Id makePointer(StorageClass, Id type);
Id makePointer(StorageClass, Id pointee);
Id makeForwardPointer(StorageClass);
Id makePointerFromForwardPointer(StorageClass, Id forwardPointerType, Id pointee);
Id makeIntegerType(int width, bool hasSign); // generic
Id makeIntType(int width) { return makeIntegerType(width, true); }
Id makeUintType(int width) { return makeIntegerType(width, false); }
......@@ -194,6 +196,7 @@ public:
bool isSamplerType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampler; }
bool isSampledImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampledImage; }
bool containsType(Id typeId, Op typeOp, unsigned int width) const;
bool containsPhysicalStorageBufferOrArray(Id typeId) const;
bool isConstantOpCode(Op opcode) const;
bool isSpecConstantOpCode(Op opcode) const;
......@@ -300,10 +303,10 @@ public:
Id createUndefined(Id type);
// Store into an Id and return the l-value
void createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax);
void createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
// Load from an Id and return it
Id createLoad(Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax);
Id createLoad(Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
// Create an OpAccessChain instruction
Id createAccessChain(StorageClass, Id base, const std::vector<Id>& offsets);
......@@ -535,6 +538,7 @@ public:
Id component; // a dynamic component index, can coexist with a swizzle, done after the swizzle, NoResult if not present
Id preSwizzleBaseType; // dereferenced type, before swizzle or component is applied; NoType unless a swizzle or component is present
bool isRValue; // true if 'base' is an r-value, otherwise, base is an l-value
unsigned int alignment; // bitwise OR of alignment values passed in. Accumulates worst alignment. Only tracks base and (optional) component selection alignment.
// Accumulate whether anything in the chain of structures has coherent decorations.
struct CoherentFlags {
......@@ -601,31 +605,34 @@ public:
}
// push offset onto the end of the chain
void accessChainPush(Id offset, AccessChain::CoherentFlags coherentFlags)
void accessChainPush(Id offset, AccessChain::CoherentFlags coherentFlags, unsigned int alignment)
{
accessChain.indexChain.push_back(offset);
accessChain.coherentFlags |= coherentFlags;
accessChain.alignment |= alignment;
}
// push new swizzle onto the end of any existing swizzle, merging into a single swizzle
void accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizzleBaseType);
void accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizzleBaseType, AccessChain::CoherentFlags coherentFlags, unsigned int alignment);
// push a dynamic component selection onto the access chain, only applicable with a
// non-trivial swizzle or no swizzle
void accessChainPushComponent(Id component, Id preSwizzleBaseType)
void accessChainPushComponent(Id component, Id preSwizzleBaseType, AccessChain::CoherentFlags coherentFlags, unsigned int alignment)
{
if (accessChain.swizzle.size() != 1) {
accessChain.component = component;
if (accessChain.preSwizzleBaseType == NoType)
accessChain.preSwizzleBaseType = preSwizzleBaseType;
}
accessChain.coherentFlags |= coherentFlags;
accessChain.alignment |= alignment;
}
// use accessChain and swizzle to store value
void accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax);
void accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
// use accessChain and swizzle to load an r-value
Id accessChainLoad(Decoration precision, Decoration nonUniform, Id ResultType, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax);
Id accessChainLoad(Decoration precision, Decoration nonUniform, Id ResultType, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
// get the direct pointer for an l-value
Id accessChainGetLValue();
......@@ -639,7 +646,7 @@ public:
void postProcess();
// Hook to visit each instruction in a block in a function
void postProcess(const Instruction&);
void postProcess(Instruction&);
// Hook to visit each instruction in a reachable block in a function.
void postProcessReachable(const Instruction&);
// Hook to visit each non-32-bit sized float/int operation in a block.
......@@ -675,6 +682,7 @@ public:
void dumpSourceInstructions(const spv::Id fileId, const std::string& text, std::vector<unsigned int>&) const;
void dumpInstructions(std::vector<unsigned int>&, const std::vector<std::unique_ptr<Instruction> >&) const;
void dumpModuleProcesses(std::vector<unsigned int>&) const;
spv::MemoryAccessMask sanitizeMemoryAccessForStorageClass(spv::MemoryAccessMask memoryAccess, StorageClass sc) const;
unsigned int spvVersion; // the version of SPIR-V to emit in the header
SourceLanguage source;
......
......@@ -87,6 +87,7 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
StorageClass storageClass = getStorageClass(inst.getIdOperand(0));
if (width == 8) {
switch (storageClass) {
case StorageClassPhysicalStorageBufferEXT:
case StorageClassUniform:
case StorageClassStorageBuffer:
case StorageClassPushConstant:
......@@ -97,6 +98,7 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
}
} else if (width == 16) {
switch (storageClass) {
case StorageClassPhysicalStorageBufferEXT:
case StorageClassUniform:
case StorageClassStorageBuffer:
case StorageClassPushConstant:
......@@ -151,7 +153,7 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
}
// Called for each instruction that resides in a block.
void Builder::postProcess(const Instruction& inst)
void Builder::postProcess(Instruction& inst)
{
// Add capabilities based simply on the opcode.
switch (inst.getOpCode()) {
......@@ -190,6 +192,88 @@ void Builder::postProcess(const Instruction& inst)
break;
#endif
case OpLoad:
case OpStore:
{
// For any load/store to a PhysicalStorageBufferEXT, walk the accesschain
// index list to compute the misalignment. The pre-existing alignment value
// (set via Builder::AccessChain::alignment) only accounts for the base of
// the reference type and any scalar component selection in the accesschain,
// and this function computes the rest from the SPIR-V Offset decorations.
Instruction *accessChain = module.getInstruction(inst.getIdOperand(0));
if (accessChain->getOpCode() == OpAccessChain) {
Instruction *base = module.getInstruction(accessChain->getIdOperand(0));
// Get the type of the base of the access chain. It must be a pointer type.
Id typeId = base->getTypeId();
Instruction *type = module.getInstruction(typeId);
assert(type->getOpCode() == OpTypePointer);
if (type->getImmediateOperand(0) != StorageClassPhysicalStorageBufferEXT) {
break;
}
// Get the pointee type.
typeId = type->getIdOperand(1);
type = module.getInstruction(typeId);
// Walk the index list for the access chain. For each index, find any
// misalignment that can apply when accessing the member/element via
// Offset/ArrayStride/MatrixStride decorations, and bitwise OR them all
// together.
int alignment = 0;
for (int i = 1; i < accessChain->getNumOperands(); ++i) {
Instruction *idx = module.getInstruction(accessChain->getIdOperand(i));
if (type->getOpCode() == OpTypeStruct) {
assert(idx->getOpCode() == OpConstant);
int c = idx->getImmediateOperand(0);
const auto function = [&](const std::unique_ptr<Instruction>& decoration) {
if (decoration.get()->getOpCode() == OpMemberDecorate &&
decoration.get()->getIdOperand(0) == typeId &&
decoration.get()->getImmediateOperand(1) == c &&
(decoration.get()->getImmediateOperand(2) == DecorationOffset ||
decoration.get()->getImmediateOperand(2) == DecorationMatrixStride)) {
alignment |= decoration.get()->getImmediateOperand(3);
}
};
std::for_each(decorations.begin(), decorations.end(), function);
// get the next member type
typeId = type->getIdOperand(c);
type = module.getInstruction(typeId);
} else if (type->getOpCode() == OpTypeArray ||
type->getOpCode() == OpTypeRuntimeArray) {
const auto function = [&](const std::unique_ptr<Instruction>& decoration) {
if (decoration.get()->getOpCode() == OpDecorate &&
decoration.get()->getIdOperand(0) == typeId &&
decoration.get()->getImmediateOperand(1) == DecorationArrayStride) {
alignment |= decoration.get()->getImmediateOperand(2);
}
};
std::for_each(decorations.begin(), decorations.end(), function);
// Get the element type
typeId = type->getIdOperand(0);
type = module.getInstruction(typeId);
} else {
// Once we get to any non-aggregate type, we're done.
break;
}
}
assert(inst.getNumOperands() >= 3);
unsigned int memoryAccess = inst.getImmediateOperand((inst.getOpCode() == OpStore) ? 2 : 1);
assert(memoryAccess & MemoryAccessAlignedMask);
// Compute the index of the alignment operand.
int alignmentIdx = 2;
if (memoryAccess & MemoryAccessVolatileMask)
alignmentIdx++;
if (inst.getOpCode() == OpStore)
alignmentIdx++;
// Merge new and old (mis)alignment
alignment |= inst.getImmediateOperand(alignmentIdx);
// Pick the LSB
alignment = alignment & ~(alignment & (alignment-1));
// update the Aligned operand
inst.setImmediateOperand(alignmentIdx, alignment);
}
break;
}
default:
break;
}
......@@ -258,6 +342,47 @@ void Builder::postProcess()
Block* b = *bi;
for (auto ii = b->getInstructions().cbegin(); ii != b->getInstructions().cend(); ii++)
postProcess(*ii->get());
// For all local variables that contain pointers to PhysicalStorageBufferEXT, check whether
// there is an existing restrict/aliased decoration. If we don't find one, add Aliased as the
// default.
for (auto vi = b->getLocalVariables().cbegin(); vi != b->getLocalVariables().cend(); vi++) {
const Instruction& inst = *vi->get();
Id resultId = inst.getResultId();
if (containsPhysicalStorageBufferOrArray(getDerefTypeId(resultId))) {
bool foundDecoration = false;
const auto function = [&](const std::unique_ptr<Instruction>& decoration) {
if (decoration.get()->getIdOperand(0) == resultId &&
decoration.get()->getOpCode() == OpDecorate &&
(decoration.get()->getImmediateOperand(1) == spv::DecorationAliasedPointerEXT ||
decoration.get()->getImmediateOperand(1) == spv::DecorationRestrictPointerEXT)) {
foundDecoration = true;
}
};
std::for_each(decorations.begin(), decorations.end(), function);
if (!foundDecoration) {
addDecoration(resultId, spv::DecorationAliasedPointerEXT);
}
}
}
}
}
// Look for any 8/16 bit type in physical storage buffer class, and set the
// appropriate capability. This happens in createSpvVariable for other storage
// classes, but there isn't always a variable for physical storage buffer.
for (int t = 0; t < (int)groupedTypes[OpTypePointer].size(); ++t) {
Instruction* type = groupedTypes[OpTypePointer][t];
if (type->getImmediateOperand(0) == (unsigned)StorageClassPhysicalStorageBufferEXT) {
if (containsType(type->getIdOperand(1), OpTypeInt, 8)) {
addExtension(spv::E_SPV_KHR_8bit_storage);
addCapability(spv::CapabilityStorageBuffer8BitAccess);
}
if (containsType(type->getIdOperand(1), OpTypeInt, 16) ||
containsType(type->getIdOperand(1), OpTypeFloat, 16)) {
addExtension(spv::E_SPV_KHR_16bit_storage);
addCapability(spv::CapabilityStorageBuffer16BitAccess);
}
}
}
}
......
......@@ -540,6 +540,14 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
case OperandMemoryAccess:
outputMask(OperandMemoryAccess, stream[word++]);
--numOperands;
// Aligned is the only memory access operand that uses an immediate
// value, and it is also the first operand that uses a value at all.
if (stream[word-1] & MemoryAccessAlignedMask) {
disassembleImmediates(1);
numOperands--;
if (numOperands)
out << " ";
}
disassembleIds(numOperands);
return;
default:
......
......@@ -124,6 +124,8 @@ const char* AddressingString(int addr)
case 1: return "Physical32";
case 2: return "Physical64";
case AddressingModelPhysicalStorageBuffer64EXT: return "PhysicalStorageBuffer64EXT";
default: return "Bad";
}
}
......@@ -220,6 +222,8 @@ const char* StorageClassString(int StorageClass)
case StorageClassIncomingCallableDataNV: return "IncomingCallableDataNV";
#endif
case StorageClassPhysicalStorageBufferEXT: return "PhysicalStorageBufferEXT";
default: return "Bad";
}
}
......@@ -295,6 +299,8 @@ const char* DecorationString(int decoration)
case DecorationNonUniformEXT: return "DecorationNonUniformEXT";
case DecorationHlslCounterBufferGOOGLE: return "DecorationHlslCounterBufferGOOGLE";
case DecorationHlslSemanticGOOGLE: return "DecorationHlslSemanticGOOGLE";
case DecorationRestrictPointerEXT: return "DecorationRestrictPointerEXT";
case DecorationAliasedPointerEXT: return "DecorationAliasedPointerEXT";
}
}
......@@ -922,6 +928,8 @@ const char* CapabilityString(int info)
case CapabilityVulkanMemoryModelKHR: return "CapabilityVulkanMemoryModelKHR";
case CapabilityVulkanMemoryModelDeviceScopeKHR: return "CapabilityVulkanMemoryModelDeviceScopeKHR";
case CapabilityPhysicalStorageBufferAddressesEXT: return "CapabilityPhysicalStorageBufferAddressesEXT";
default: return "Bad";
}
}
......
......@@ -102,6 +102,11 @@ public:
operands.push_back(immediate);
idOperand.push_back(false);
}
void setImmediateOperand(unsigned idx, unsigned int immediate) {
assert(!idOperand[idx]);
operands[idx] = immediate;
}
void addStringOperand(const char* str)
{
unsigned int word;
......@@ -203,6 +208,7 @@ public:
const std::vector<std::unique_ptr<Instruction> >& getInstructions() const {
return instructions;
}
const std::vector<std::unique_ptr<Instruction> >& getLocalVariables() const { return localVariables; }
void setUnreachable() { unreachable = true; }
bool isUnreachable() const { return unreachable; }
// Returns the block's merge instruction, if one exists (otherwise null).
......
spv.bufferhandle1.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 52
Capability Shader
Capability CapabilityVulkanMemoryModelKHR
Capability CapabilityPhysicalStorageBufferAddressesEXT
Extension "SPV_EXT_physical_storage_buffer"
Extension "SPV_KHR_storage_buffer_storage_class"
Extension "SPV_KHR_vulkan_memory_model"
1: ExtInstImport "GLSL.std.450"
MemoryModel PhysicalStorageBuffer64EXT VulkanKHR
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_buffer_reference"
Name 4 "main"
Name 7 "t2"
MemberName 7(t2) 0 "f"
MemberName 7(t2) 1 "g"
Name 13 "blockType"
MemberName 13(blockType) 0 "a"
MemberName 13(blockType) 1 "b"
MemberName 13(blockType) 2 "c"
MemberName 13(blockType) 3 "d"
MemberName 13(blockType) 4 "e"
MemberName 13(blockType) 5 "f"
MemberName 13(blockType) 6 "g"
Name 15 "t"
Name 28 "j"
MemberDecorate 7(t2) 0 Offset 0
MemberDecorate 7(t2) 1 Offset 8
Decorate 7(t2) Block
Decorate 11 ArrayStride 4
MemberDecorate 13(blockType) 0 Offset 0
MemberDecorate 13(blockType) 1 Offset 4
MemberDecorate 13(blockType) 2 Offset 8
MemberDecorate 13(blockType) 3 Offset 12
MemberDecorate 13(blockType) 4 Offset 16
MemberDecorate 13(blockType) 5 Offset 32
MemberDecorate 13(blockType) 6 Offset 48
Decorate 13(blockType) Block
Decorate 15(t) DescriptorSet 0
Decorate 15(t) Binding 0
Decorate 28(j) DecorationAliasedPointerEXT
2: TypeVoid
3: TypeFunction 2
TypeForwardPointer 6 PhysicalStorageBufferEXT
7(t2): TypeStruct 6 6
8: TypeInt 32 1
9: TypeInt 32 0
10: 9(int) Constant 2
11: TypeArray 8(int) 10
12: TypeVector 8(int) 4
13(blockType): TypeStruct 8(int) 8(int) 8(int) 8(int) 8(int) 11 12(ivec4)
6: TypePointer PhysicalStorageBufferEXT 13(blockType)
14: TypePointer StorageBuffer 7(t2)
15(t): 14(ptr) Variable StorageBuffer
16: 8(int) Constant 0
17: TypePointer StorageBuffer 6(ptr)
20: 8(int) Constant 1
23: TypePointer PhysicalStorageBufferEXT 8(int)
27: TypePointer Function 6(ptr)
32: 8(int) Constant 3
34: 8(int) Constant 2
40: 8(int) Constant 5
46: 8(int) Constant 6
47: 9(int) Constant 1
50: 9(int) Constant 5
4(main): 2 Function None 3
5: Label
28(j): 27(ptr) Variable Function
18: 17(ptr) AccessChain 15(t) 16
19: 6(ptr) Load 18
21: 17(ptr) AccessChain 15(t) 20
22: 6(ptr) Load 21
24: 23(ptr) AccessChain 22 16
25: 8(int) Load 24 Aligned 16
26: 23(ptr) AccessChain 19 20
Store 26 25 Aligned 4
29: 17(ptr) AccessChain 15(t) 16
30: 6(ptr) Load 29
Store 28(j) 30
31: 6(ptr) Load 28(j)
33: 6(ptr) Load 28(j)
35: 23(ptr) AccessChain 33 34
36: 8(int) Load 35 Aligned 8
37: 23(ptr) AccessChain 31 32
Store 37 36 Aligned 4
38: 6(ptr) Load 28(j)
39: 6(ptr) Load 28(j)
41: 23(ptr) AccessChain 39 40 20
42: 8(int) Load 41 Aligned 4
43: 23(ptr) AccessChain 38 32
Store 43 42 Aligned 4
44: 6(ptr) Load 28(j)
45: 6(ptr) Load 28(j)
48: 23(ptr) AccessChain 45 46 47
49: 8(int) Load 48 Aligned MakePointerVisibleKHR NonPrivatePointerKHR 4 50
51: 23(ptr) AccessChain 44 32
Store 51 49 Aligned 4
Return
FunctionEnd
spv.bufferhandle10.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 34
Capability Shader
Capability CapabilityVulkanMemoryModelKHR
Capability CapabilityPhysicalStorageBufferAddressesEXT
Extension "SPV_EXT_physical_storage_buffer"
Extension "SPV_KHR_storage_buffer_storage_class"
Extension "SPV_KHR_vulkan_memory_model"
1: ExtInstImport "GLSL.std.450"
MemoryModel PhysicalStorageBuffer64EXT VulkanKHR
EntryPoint Fragment 4 "main" 19
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_ARB_gpu_shader_int64"
SourceExtension "GL_EXT_buffer_reference"
Name 4 "main"
Name 7 "t2"
MemberName 7(t2) 0 "f"
Name 10 "blockType"
MemberName 10(blockType) 0 "x"
Name 12 "t"
Name 19 "i"
Name 28 "b"
MemberDecorate 7(t2) 0 Offset 0
Decorate 7(t2) Block
Decorate 9 ArrayStride 4
MemberDecorate 10(blockType) 0 Offset 0
Decorate 10(blockType) Block
Decorate 12(t) DescriptorSet 0
Decorate 12(t) Binding 0
Decorate 19(i) Flat
Decorate 19(i) Location 0
Decorate 28(b) DecorationAliasedPointerEXT
2: TypeVoid
3: TypeFunction 2
TypeForwardPointer 6 PhysicalStorageBufferEXT
7(t2): TypeStruct 6
8: TypeInt 32 0
9: TypeRuntimeArray 8(int)
10(blockType): TypeStruct 9
6: TypePointer PhysicalStorageBufferEXT 10(blockType)
11: TypePointer StorageBuffer 7(t2)
12(t): 11(ptr) Variable StorageBuffer
13: TypeInt 32 1
14: 13(int) Constant 0
15: TypePointer StorageBuffer 6(ptr)
18: TypePointer Input 8(int)
19(i): 18(ptr) Variable Input
21: TypePointer PhysicalStorageBufferEXT 8(int)
23: 8(int) Constant 1
24: 8(int) Constant 5
25: 8(int) Constant 0
27: TypePointer Function 6(ptr)
32: 8(int) Constant 2
4(main): 2 Function None 3
5: Label
28(b): 27(ptr) Variable Function
16: 15(ptr) AccessChain 12(t) 14
17: 6(ptr) Load 16
20: 8(int) Load 19(i)
22: 21(ptr) AccessChain 17 14 20
26: 8(int) AtomicIAdd 22 24 25 23
29: 15(ptr) AccessChain 12(t) 14
30: 6(ptr) Load 29
Store 28(b) 30
31: 6(ptr) Load 28(b)
33: 21(ptr) AccessChain 31 14 14
Store 33 32 Aligned MakePointerAvailableKHR NonPrivatePointerKHR 4 24
Return
FunctionEnd
spv.bufferhandle11.frag
WARNING: 0:6: '' : all default precisions are highp; use precision statements to quiet warning, e.g.:
"precision mediump int; precision highp float;"
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 60
Capability Shader
Capability CapabilityStorageBuffer8BitAccess
Capability CapabilityPhysicalStorageBufferAddressesEXT
Extension "SPV_EXT_physical_storage_buffer"
Extension "SPV_KHR_8bit_storage"
Extension "SPV_KHR_storage_buffer_storage_class"
1: ExtInstImport "GLSL.std.450"
MemoryModel PhysicalStorageBuffer64EXT GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_buffer_reference"
SourceExtension "GL_EXT_shader_16bit_storage"
SourceExtension "GL_EXT_shader_8bit_storage"
Name 4 "main"
Name 12 "compare_uint8_t(u1;u1;"
Name 10 "a"
Name 11 "b"
Name 20 "allOk"
Name 26 "PC"
MemberName 26(PC) 0 "block"
Name 28 "Block"
MemberName 28(Block) 0 "var"
Name 30 ""
Name 41 "param"
Name 42 "param"
Name 48 "AcBlock"
MemberName 48(AcBlock) 0 "ac_numPassed"
Name 50 ""
MemberDecorate 26(PC) 0 Offset 0
Decorate 26(PC) Block
MemberDecorate 28(Block) 0 Offset 0
Decorate 28(Block) Block
MemberDecorate 48(AcBlock) 0 Offset 0
Decorate 48(AcBlock) Block
Decorate 50 DescriptorSet 0
Decorate 50 Binding 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypePointer Function 6(int)
8: TypeBool
9: TypeFunction 8(bool) 7(ptr) 7(ptr)
19: TypePointer Function 8(bool)
21: 8(bool) ConstantTrue
TypeForwardPointer 25 PhysicalStorageBufferEXT
26(PC): TypeStruct 25
27: TypeInt 8 0
28(Block): TypeStruct 27(int8_t)
25: TypePointer PhysicalStorageBufferEXT 28(Block)
29: TypePointer PushConstant 26(PC)
30: 29(ptr) Variable PushConstant
31: TypeInt 32 1
32: 31(int) Constant 0
33: TypePointer PushConstant 25(ptr)
36: TypePointer PhysicalStorageBufferEXT 27(int8_t)
40: 6(int) Constant 7
48(AcBlock): TypeStruct 6(int)
49: TypePointer StorageBuffer 48(AcBlock)
50: 49(ptr) Variable StorageBuffer
51: TypePointer StorageBuffer 6(int)
54: 31(int) Constant 1
58: 27(int8_t) Constant 9
4(main): 2 Function None 3
5: Label
20(allOk): 19(ptr) Variable Function
41(param): 7(ptr) Variable Function
42(param): 7(ptr) Variable Function
Store 20(allOk) 21
22: 8(bool) Load 20(allOk)
SelectionMerge 24 None
BranchConditional 22 23 24
23: Label
34: 33(ptr) AccessChain 30 32
35: 25(ptr) Load 34
37: 36(ptr) AccessChain 35 32
38: 27(int8_t) Load 37 Aligned 16
39: 6(int) UConvert 38
Store 41(param) 39
Store 42(param) 40
43: 8(bool) FunctionCall 12(compare_uint8_t(u1;u1;) 41(param) 42(param)
Branch 24
24: Label
44: 8(bool) Phi 22 5 43 23
Store 20(allOk) 44
45: 8(bool) Load 20(allOk)
SelectionMerge 47 None
BranchConditional 45 46 47
46: Label
52: 51(ptr) AccessChain 50 32
53: 6(int) Load 52
55: 6(int) IAdd 53 54
Store 52 55
Branch 47
47: Label
56: 33(ptr) AccessChain 30 32
57: 25(ptr) Load 56
59: 36(ptr) AccessChain 57 32
Store 59 58 Aligned 16
Return
FunctionEnd
12(compare_uint8_t(u1;u1;): 8(bool) Function None 9
10(a): 7(ptr) FunctionParameter
11(b): 7(ptr) FunctionParameter
13: Label
14: 6(int) Load 10(a)
15: 6(int) Load 11(b)
16: 8(bool) IEqual 14 15
ReturnValue 16
FunctionEnd
spv.bufferhandle13.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 58
Capability Shader
Capability CapabilityVulkanMemoryModelKHR
Capability CapabilityPhysicalStorageBufferAddressesEXT
Extension "SPV_EXT_physical_storage_buffer"
Extension "SPV_KHR_storage_buffer_storage_class"
Extension "SPV_KHR_vulkan_memory_model"
1: ExtInstImport "GLSL.std.450"
MemoryModel PhysicalStorageBuffer64EXT VulkanKHR
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_buffer_reference"
Name 4 "main"
Name 8 "t4"
MemberName 8(t4) 0 "j"
Name 11 "f1(1;"
Name 10 "y"
Name 16 "f2(1;"
Name 15 "y"
Name 19 "f3(1;"
Name 18 "y"
Name 22 "f4(1;"
Name 21 "y"
Name 34 "a"
Name 35 "t5"
MemberName 35(t5) 0 "m"
Name 37 "s5"
Name 42 "b"
Name 47 "param"
Name 52 "param"
Name 56 "g1"
Name 57 "g2"
MemberDecorate 8(t4) 0 Offset 0
Decorate 8(t4) Block
Decorate 10(y) Aliased
Decorate 15(y) DecorationAliasedPointerEXT
Decorate 18(y) Restrict
Decorate 18(y) Restrict
Decorate 21(y) Restrict
Decorate 21(y) DecorationRestrictPointerEXT
Decorate 34(a) DecorationAliasedPointerEXT
MemberDecorate 35(t5) 0 Offset 0
Decorate 35(t5) Block
Decorate 37(s5) DescriptorSet 0
Decorate 37(s5) Binding 0
Decorate 42(b) DecorationRestrictPointerEXT
Decorate 56(g1) DecorationAliasedPointerEXT
Decorate 57(g2) DecorationRestrictPointerEXT
Decorate 47(param) DecorationAliasedPointerEXT
Decorate 52(param) DecorationAliasedPointerEXT
2: TypeVoid
3: TypeFunction 2
TypeForwardPointer 6 PhysicalStorageBufferEXT
7: TypeInt 32 1
8(t4): TypeStruct 7(int)
6: TypePointer PhysicalStorageBufferEXT 8(t4)
9: TypeFunction 6(ptr) 6(ptr)
13: TypePointer Function 6(ptr)
14: TypeFunction 6(ptr) 13(ptr)
35(t5): TypeStruct 6(ptr)
36: TypePointer StorageBuffer 35(t5)
37(s5): 36(ptr) Variable StorageBuffer
38: 7(int) Constant 0
39: TypePointer StorageBuffer 6(ptr)
55: TypePointer Private 6(ptr)
56(g1): 55(ptr) Variable Private
4(main): 2 Function None 3
5: Label
34(a): 13(ptr) Variable Function
42(b): 13(ptr) Variable Function
47(param): 13(ptr) Variable Function
52(param): 13(ptr) Variable Function
57(g2): 13(ptr) Variable Function
40: 39(ptr) AccessChain 37(s5) 38
41: 6(ptr) Load 40
Store 34(a) 41
43: 39(ptr) AccessChain 37(s5) 38
44: 6(ptr) Load 43
Store 42(b) 44
45: 6(ptr) Load 34(a)
46: 6(ptr) FunctionCall 11(f1(1;) 45
48: 6(ptr) Load 34(a)
Store 47(param) 48
49: 6(ptr) FunctionCall 16(f2(1;) 47(param)
50: 6(ptr) Load 34(a)
51: 6(ptr) FunctionCall 19(f3(1;) 50
53: 6(ptr) Load 34(a)
Store 52(param) 53
54: 6(ptr) FunctionCall 22(f4(1;) 52(param)
Return
FunctionEnd
11(f1(1;): 6(ptr) Function None 9
10(y): 6(ptr) FunctionParameter
12: Label
ReturnValue 10(y)
FunctionEnd
16(f2(1;): 6(ptr) Function None 14
15(y): 13(ptr) FunctionParameter
17: Label
26: 6(ptr) Load 15(y)
ReturnValue 26
FunctionEnd
19(f3(1;): 6(ptr) Function None 9
18(y): 6(ptr) FunctionParameter
20: Label
ReturnValue 18(y)
FunctionEnd
22(f4(1;): 6(ptr) Function None 14
21(y): 13(ptr) FunctionParameter
23: Label
31: 6(ptr) Load 21(y)
ReturnValue 31
FunctionEnd
spv.bufferhandle14.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 46
Capability Shader
Capability CapabilityPhysicalStorageBufferAddressesEXT
Extension "SPV_EXT_physical_storage_buffer"
1: ExtInstImport "GLSL.std.450"
MemoryModel PhysicalStorageBuffer64EXT GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_buffer_reference"
Name 4 "main"
Name 8 "T1"
MemberName 8(T1) 0 "i"
MemberName 8(T1) 1 "j"
MemberName 8(T1) 2 "k"
Name 10 "t1"
Name 20 "T2"
MemberName 20(T2) 0 "i"
MemberName 20(T2) 1 "j"
MemberName 20(T2) 2 "k"
Name 22 "t2"
Name 29 "T3"
MemberName 29(T3) 0 "i"
MemberName 29(T3) 1 "j"
MemberName 29(T3) 2 "k"
Name 31 "t3"
Name 38 "T4"
MemberName 38(T4) 0 "i"
MemberName 38(T4) 1 "j"
MemberName 38(T4) 2 "k"
Name 40 "t4"
MemberDecorate 8(T1) 0 Offset 0
MemberDecorate 8(T1) 1 Offset 4
MemberDecorate 8(T1) 2 Offset 8
Decorate 8(T1) Block
Decorate 10(t1) DecorationAliasedPointerEXT
MemberDecorate 20(T2) 0 Offset 0
MemberDecorate 20(T2) 1 Offset 4
MemberDecorate 20(T2) 2 Offset 8
Decorate 20(T2) Block
Decorate 22(t2) DecorationAliasedPointerEXT
MemberDecorate 29(T3) 0 Offset 0
MemberDecorate 29(T3) 1 Offset 4
MemberDecorate 29(T3) 2 Offset 8
Decorate 29(T3) Block
Decorate 31(t3) DecorationAliasedPointerEXT
MemberDecorate 38(T4) 0 Offset 0
MemberDecorate 38(T4) 1 Offset 4
MemberDecorate 38(T4) 2 Offset 8
Decorate 38(T4) Block
Decorate 40(t4) DecorationAliasedPointerEXT
2: TypeVoid
3: TypeFunction 2
TypeForwardPointer 6 PhysicalStorageBufferEXT
7: TypeInt 32 1
8(T1): TypeStruct 7(int) 7(int) 7(int)
6: TypePointer PhysicalStorageBufferEXT 8(T1)
9: TypePointer Function 6(ptr)
12: 7(int) Constant 0
14: 7(int) Constant 2
15: TypePointer PhysicalStorageBufferEXT 7(int)
TypeForwardPointer 19 PhysicalStorageBufferEXT
20(T2): TypeStruct 7(int) 7(int) 7(int)
19: TypePointer PhysicalStorageBufferEXT 20(T2)
21: TypePointer Function 19(ptr)
TypeForwardPointer 28 PhysicalStorageBufferEXT
29(T3): TypeStruct 7(int) 7(int) 7(int)
28: TypePointer PhysicalStorageBufferEXT 29(T3)
30: TypePointer Function 28(ptr)
TypeForwardPointer 37 PhysicalStorageBufferEXT
38(T4): TypeStruct 7(int) 7(int) 7(int)
37: TypePointer PhysicalStorageBufferEXT 38(T4)
39: TypePointer Function 37(ptr)
4(main): 2 Function None 3
5: Label
10(t1): 9(ptr) Variable Function
22(t2): 21(ptr) Variable Function
31(t3): 30(ptr) Variable Function
40(t4): 39(ptr) Variable Function
11: 6(ptr) Load 10(t1)
13: 6(ptr) Load 10(t1)
16: 15(ptr) AccessChain 13 14
17: 7(int) Load 16 Aligned 4
18: 15(ptr) AccessChain 11 12
Store 18 17 Aligned 4
23: 19(ptr) Load 22(t2)
24: 19(ptr) Load 22(t2)
25: 15(ptr) AccessChain 24 14
26: 7(int) Load 25 Aligned 8
27: 15(ptr) AccessChain 23 12
Store 27 26 Aligned 8
32: 28(ptr) Load 31(t3)
33: 28(ptr) Load 31(t3)
34: 15(ptr) AccessChain 33 14
35: 7(int) Load 34 Aligned 8
36: 15(ptr) AccessChain 32 12
Store 36 35 Aligned 16
41: 37(ptr) Load 40(t4)
42: 37(ptr) Load 40(t4)
43: 15(ptr) AccessChain 42 14
44: 7(int) Load 43 Aligned 8
45: 15(ptr) AccessChain 41 12
Store 45 44 Aligned 32
Return
FunctionEnd
spv.bufferhandle15.frag
WARNING: 0:16: '' : all default precisions are highp; use precision statements to quiet warning, e.g.:
"precision mediump int; precision highp float;"
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 60
Capability Shader
Capability CapabilityPhysicalStorageBufferAddressesEXT
Extension "SPV_EXT_physical_storage_buffer"
Extension "SPV_KHR_storage_buffer_storage_class"
1: ExtInstImport "GLSL.std.450"
MemoryModel PhysicalStorageBuffer64EXT GLSL450
EntryPoint Fragment 4 "main" 37
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_buffer_reference"
SourceExtension "GL_EXT_scalar_block_layout"
Name 4 "main"
Name 9 "y"
Name 13 "T4"
MemberName 13(T4) 0 "t1"
MemberName 13(T4) 1 "t2"
MemberName 13(T4) 2 "t3"
Name 15 "T1"
MemberName 15(T1) 0 "x"
Name 22 "T2"
MemberName 22(T2) 0 "x"
Name 28 "S"
MemberName 28(S) 0 "a"
MemberName 28(S) 1 "b"
MemberName 28(S) 2 "c"
Name 29 "T3"
MemberName 29(T3) 0 "s"
Name 31 "t4"
Name 37 "i"
Name 52 "z"
MemberDecorate 13(T4) 0 Offset 0
MemberDecorate 13(T4) 1 Offset 8
MemberDecorate 13(T4) 2 Offset 16
Decorate 13(T4) Block
Decorate 14 ArrayStride 12
MemberDecorate 15(T1) 0 Offset 0
Decorate 15(T1) Block
Decorate 18 ArrayStride 12
Decorate 20 ArrayStride 24
Decorate 21 ArrayStride 96
MemberDecorate 22(T2) 0 Offset 0
Decorate 22(T2) Block
Decorate 26 ArrayStride 36
MemberDecorate 28(S) 0 Offset 0
MemberDecorate 28(S) 1 ColMajor
MemberDecorate 28(S) 1 RelaxedPrecision
MemberDecorate 28(S) 1 Offset 12
MemberDecorate 28(S) 1 MatrixStride 12
MemberDecorate 28(S) 2 Offset 156
MemberDecorate 29(T3) 0 Offset 0
Decorate 29(T3) Block
Decorate 31(t4) DescriptorSet 0
Decorate 31(t4) Binding 0
Decorate 37(i) Flat
Decorate 37(i) Location 0
Decorate 59 RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 3
8: TypePointer Function 7(fvec3)
TypeForwardPointer 10 PhysicalStorageBufferEXT
TypeForwardPointer 11 PhysicalStorageBufferEXT
TypeForwardPointer 12 PhysicalStorageBufferEXT
13(T4): TypeStruct 10 11 12
14: TypeRuntimeArray 7(fvec3)
15(T1): TypeStruct 14
10: TypePointer PhysicalStorageBufferEXT 15(T1)
16: TypeInt 32 0
17: 16(int) Constant 2
18: TypeArray 7(fvec3) 17
19: 16(int) Constant 4
20: TypeArray 18 19
21: TypeRuntimeArray 20
22(T2): TypeStruct 21
11: TypePointer PhysicalStorageBufferEXT 22(T2)
23: TypeInt 32 1
24: TypeVector 23(int) 3
25: TypeMatrix 7(fvec3) 3
26: TypeArray 25 19
27: TypeVector 6(float) 4
28(S): TypeStruct 24(ivec3) 26 27(fvec4)
29(T3): TypeStruct 28(S)
12: TypePointer PhysicalStorageBufferEXT 29(T3)
30: TypePointer StorageBuffer 13(T4)
31(t4): 30(ptr) Variable StorageBuffer
32: 23(int) Constant 0
33: TypePointer StorageBuffer 10(ptr)
36: TypePointer Input 23(int)
37(i): 36(ptr) Variable Input
39: TypePointer PhysicalStorageBufferEXT 7(fvec3)
42: 23(int) Constant 1
43: TypePointer StorageBuffer 11(ptr)
51: TypePointer Function 25
53: 23(int) Constant 2
54: TypePointer StorageBuffer 12(ptr)
57: TypePointer PhysicalStorageBufferEXT 25
4(main): 2 Function None 3
5: Label
9(y): 8(ptr) Variable Function
52(z): 51(ptr) Variable Function
34: 33(ptr) AccessChain 31(t4) 32
35: 10(ptr) Load 34
38: 23(int) Load 37(i)
40: 39(ptr) AccessChain 35 32 38
41: 7(fvec3) Load 40 Aligned 4
Store 9(y) 41
44: 43(ptr) AccessChain 31(t4) 42
45: 11(ptr) Load 44
46: 23(int) Load 37(i)
47: 23(int) Load 37(i)
48: 23(int) Load 37(i)
49: 39(ptr) AccessChain 45 32 46 47 48
50: 7(fvec3) Load 49 Aligned 4
Store 9(y) 50
55: 54(ptr) AccessChain 31(t4) 53
56: 12(ptr) Load 55
58: 57(ptr) AccessChain 56 32 42 32
59: 25 Load 58 Aligned 4
Store 52(z) 59
Return
FunctionEnd
spv.bufferhandle2.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 45
Capability Shader
Capability CapabilityPhysicalStorageBufferAddressesEXT
Extension "SPV_EXT_physical_storage_buffer"
Extension "SPV_KHR_storage_buffer_storage_class"
1: ExtInstImport "GLSL.std.450"
MemoryModel PhysicalStorageBuffer64EXT GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_buffer_reference"
Name 4 "main"
Name 8 "blockType"
MemberName 8(blockType) 0 "a"
MemberName 8(blockType) 1 "b"
MemberName 8(blockType) 2 "c"
MemberName 8(blockType) 3 "d"
MemberName 8(blockType) 4 "e"
Name 13 "b1"
Name 14 "t2"
MemberName 14(t2) 0 "f"
MemberName 14(t2) 1 "g"
Name 16 "t"
Name 34 "b2"
Name 37 "b3"
MemberDecorate 8(blockType) 0 Offset 0
MemberDecorate 8(blockType) 1 Offset 4
MemberDecorate 8(blockType) 2 Offset 8
MemberDecorate 8(blockType) 3 Offset 12
MemberDecorate 8(blockType) 4 Offset 16
Decorate 8(blockType) Block
Decorate 13(b1) DecorationAliasedPointerEXT
MemberDecorate 14(t2) 0 Offset 0
MemberDecorate 14(t2) 1 Offset 8
Decorate 14(t2) Block
Decorate 16(t) DescriptorSet 0
Decorate 16(t) Binding 0
Decorate 34(b2) DecorationAliasedPointerEXT
Decorate 37(b3) DecorationAliasedPointerEXT
2: TypeVoid
3: TypeFunction 2
TypeForwardPointer 6 PhysicalStorageBufferEXT
7: TypeInt 32 1
8(blockType): TypeStruct 7(int) 7(int) 7(int) 7(int) 7(int)
6: TypePointer PhysicalStorageBufferEXT 8(blockType)
9: TypeInt 32 0
10: 9(int) Constant 2
11: TypeArray 6(ptr) 10
12: TypePointer Function 11
14(t2): TypeStruct 6(ptr) 6(ptr)
15: TypePointer StorageBuffer 14(t2)
16(t): 15(ptr) Variable StorageBuffer
17: 7(int) Constant 0
18: TypePointer StorageBuffer 6(ptr)
21: 7(int) Constant 1
25: TypePointer Function 6(ptr)
30: TypePointer PhysicalStorageBufferEXT 7(int)
4(main): 2 Function None 3
5: Label
13(b1): 12(ptr) Variable Function
34(b2): 25(ptr) Variable Function
37(b3): 25(ptr) Variable Function
19: 18(ptr) AccessChain 16(t) 17
20: 6(ptr) Load 19
22: 18(ptr) AccessChain 16(t) 21
23: 6(ptr) Load 22
24: 11 CompositeConstruct 20 23
Store 13(b1) 24
26: 25(ptr) AccessChain 13(b1) 17
27: 6(ptr) Load 26
28: 25(ptr) AccessChain 13(b1) 21
29: 6(ptr) Load 28
31: 30(ptr) AccessChain 29 21
32: 7(int) Load 31 Aligned 4
33: 30(ptr) AccessChain 27 17
Store 33 32 Aligned 16
35: 18(ptr) AccessChain 16(t) 17
36: 6(ptr) Load 35
Store 34(b2) 36
38: 18(ptr) AccessChain 16(t) 21
39: 6(ptr) Load 38
Store 37(b3) 39
40: 6(ptr) Load 34(b2)
41: 6(ptr) Load 37(b3)
42: 30(ptr) AccessChain 41 21
43: 7(int) Load 42 Aligned 4
44: 30(ptr) AccessChain 40 17
Store 44 43 Aligned 16
Return
FunctionEnd
spv.bufferhandle3.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 50
Capability Shader
Capability CapabilityPhysicalStorageBufferAddressesEXT
Extension "SPV_EXT_physical_storage_buffer"
Extension "SPV_KHR_storage_buffer_storage_class"
1: ExtInstImport "GLSL.std.450"
MemoryModel PhysicalStorageBuffer64EXT GLSL450
EntryPoint Fragment 4 "main" 42
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_buffer_reference"
Name 4 "main"
Name 9 "t4"
MemberName 9(t4) 0 "j"
MemberName 9(t4) 1 "k"
Name 10 "t3"
MemberName 10(t3) 0 "h"
Name 14 "foo(1;"
Name 13 "y"
Name 19 "t5"
MemberName 19(t5) 0 "m"
Name 21 "s5"
Name 23 "param"
Name 38 "t4"
MemberName 38(t4) 0 "j"
MemberName 38(t4) 1 "k"
Name 40 "x"
Name 42 "k"
MemberDecorate 9(t4) 0 Offset 0
MemberDecorate 9(t4) 1 Offset 8
Decorate 9(t4) Block
MemberDecorate 10(t3) 0 Offset 0
Decorate 10(t3) Block
Decorate 13(y) DecorationAliasedPointerEXT
MemberDecorate 19(t5) 0 Offset 0
Decorate 19(t5) Block
Decorate 21(s5) DescriptorSet 0
Decorate 21(s5) Binding 0
MemberDecorate 38(t4) 0 Offset 0
MemberDecorate 38(t4) 1 Offset 8
Decorate 38(t4) Block
Decorate 40(x) DescriptorSet 1
Decorate 40(x) Binding 2
Decorate 42(k) Flat
Decorate 42(k) DecorationAliasedPointerEXT
Decorate 23(param) DecorationAliasedPointerEXT
2: TypeVoid
3: TypeFunction 2
TypeForwardPointer 6 PhysicalStorageBufferEXT
7: TypeInt 32 1
TypeForwardPointer 8 PhysicalStorageBufferEXT
9(t4): TypeStruct 7(int) 8
10(t3): TypeStruct 7(int)
8: TypePointer PhysicalStorageBufferEXT 10(t3)
6: TypePointer PhysicalStorageBufferEXT 9(t4)
11: TypePointer Function 6(ptr)
12: TypeFunction 6(ptr) 11(ptr)
19(t5): TypeStruct 6(ptr)
20: TypePointer StorageBuffer 19(t5)
21(s5): 20(ptr) Variable StorageBuffer
22: 7(int) Constant 0
24: TypePointer StorageBuffer 6(ptr)
30: 7(int) Constant 1
31: TypePointer PhysicalStorageBufferEXT 8(ptr)
34: TypePointer PhysicalStorageBufferEXT 7(int)
38(t4): TypeStruct 7(int) 8(ptr)
39: TypePointer StorageBuffer 38(t4)
40(x): 39(ptr) Variable StorageBuffer
41: TypePointer Input 6(ptr)
42(k): 41(ptr) Variable Input
48: TypePointer StorageBuffer 7(int)
4(main): 2 Function None 3
5: Label
23(param): 11(ptr) Variable Function
25: 24(ptr) AccessChain 21(s5) 22
26: 6(ptr) Load 25
Store 23(param) 26
27: 6(ptr) FunctionCall 14(foo(1;) 23(param)
28: 24(ptr) AccessChain 21(s5) 22
29: 6(ptr) Load 28
32: 31(ptr) AccessChain 29 30
33: 8(ptr) Load 32 Aligned 8
35: 34(ptr) AccessChain 33 22
36: 7(int) Load 35 Aligned 16
37: 34(ptr) AccessChain 27 22
Store 37 36 Aligned 16
43: 6(ptr) Load 42(k)
44: 31(ptr) AccessChain 43 30
45: 8(ptr) Load 44 Aligned 8
46: 34(ptr) AccessChain 45 22
47: 7(int) Load 46 Aligned 16
49: 48(ptr) AccessChain 40(x) 22
Store 49 47
Return
FunctionEnd
14(foo(1;): 6(ptr) Function None 12
13(y): 11(ptr) FunctionParameter
15: Label
16: 6(ptr) Load 13(y)
ReturnValue 16
FunctionEnd
spv.bufferhandle4.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 61
Capability Shader
Capability CapabilityPhysicalStorageBufferAddressesEXT
Extension "SPV_EXT_physical_storage_buffer"
Extension "SPV_KHR_storage_buffer_storage_class"
1: ExtInstImport "GLSL.std.450"
MemoryModel PhysicalStorageBuffer64EXT GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_buffer_reference"
Name 4 "main"
Name 8 "t4"
MemberName 8(t4) 0 "j"
MemberName 8(t4) 1 "k"
Name 10 "t3"
MemberName 10(t3) 0 "h"
MemberName 10(t3) 1 "i"
Name 11 "t4"
MemberName 11(t4) 0 "j"
MemberName 11(t4) 1 "k"
Name 13 "x"
Name 19 "t5"
MemberName 19(t5) 0 "m"
Name 21 "s5"
Name 43 "b"
MemberDecorate 8(t4) 0 Offset 0
MemberDecorate 8(t4) 1 Offset 8
Decorate 8(t4) Block
MemberDecorate 10(t3) 0 Offset 0
MemberDecorate 10(t3) 1 Offset 8
Decorate 10(t3) Block
MemberDecorate 11(t4) 0 Offset 0
MemberDecorate 11(t4) 1 Offset 8
Decorate 11(t4) Block
Decorate 13(x) DescriptorSet 1
Decorate 13(x) Binding 2
MemberDecorate 19(t5) 0 Offset 0
Decorate 19(t5) Block
Decorate 21(s5) DescriptorSet 0
Decorate 21(s5) Binding 0
Decorate 47 DecorationAliasedPointerEXT
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
TypeForwardPointer 7 PhysicalStorageBufferEXT
8(t4): TypeStruct 6(int) 7
TypeForwardPointer 9 PhysicalStorageBufferEXT
10(t3): TypeStruct 6(int) 9
11(t4): TypeStruct 6(int) 7
9: TypePointer PhysicalStorageBufferEXT 11(t4)
7: TypePointer PhysicalStorageBufferEXT 10(t3)
12: TypePointer StorageBuffer 8(t4)
13(x): 12(ptr) Variable StorageBuffer
14: 6(int) Constant 1
15: TypePointer StorageBuffer 7(ptr)
18: 6(int) Constant 0
19(t5): TypeStruct 9(ptr)
20: TypePointer StorageBuffer 19(t5)
21(s5): 20(ptr) Variable StorageBuffer
22: TypePointer StorageBuffer 9(ptr)
25: TypePointer PhysicalStorageBufferEXT 7(ptr)
28: TypePointer PhysicalStorageBufferEXT 9(ptr)
37: TypePointer PhysicalStorageBufferEXT 6(int)
41: TypeBool
42: TypePointer Function 41(bool)
44: 41(bool) ConstantTrue
46: TypePointer Function 9(ptr)
4(main): 2 Function None 3
5: Label
43(b): 42(ptr) Variable Function
47: 46(ptr) Variable Function
16: 15(ptr) AccessChain 13(x) 14
17: 7(ptr) Load 16
23: 22(ptr) AccessChain 21(s5) 18
24: 9(ptr) Load 23
26: 25(ptr) AccessChain 24 14
27: 7(ptr) Load 26 Aligned 8
29: 28(ptr) AccessChain 27 14
30: 9(ptr) Load 29 Aligned 8
31: 25(ptr) AccessChain 30 14
32: 7(ptr) Load 31 Aligned 8
33: 28(ptr) AccessChain 32 14
34: 9(ptr) Load 33 Aligned 8
35: 25(ptr) AccessChain 34 14
36: 7(ptr) Load 35 Aligned 8
38: 37(ptr) AccessChain 36 18
39: 6(int) Load 38 Aligned 16
40: 37(ptr) AccessChain 17 18
Store 40 39 Aligned 16
Store 43(b) 44
45: 41(bool) Load 43(b)
SelectionMerge 49 None
BranchConditional 45 48 52
48: Label
50: 22(ptr) AccessChain 21(s5) 18
51: 9(ptr) Load 50
Store 47 51
Branch 49
52: Label
53: 22(ptr) AccessChain 21(s5) 18
54: 9(ptr) Load 53
55: 25(ptr) AccessChain 54 14
56: 7(ptr) Load 55 Aligned 8
57: 28(ptr) AccessChain 56 14
58: 9(ptr) Load 57 Aligned 8
Store 47 58
Branch 49
49: Label
59: 9(ptr) Load 47
60: 22(ptr) AccessChain 21(s5) 18
Store 60 59
Return
FunctionEnd
spv.bufferhandle5.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 22
Capability Shader
Capability CapabilityPhysicalStorageBufferAddressesEXT
Extension "SPV_EXT_physical_storage_buffer"
1: ExtInstImport "GLSL.std.450"
MemoryModel PhysicalStorageBuffer64EXT GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_buffer_reference"
Name 4 "main"
Name 8 "t4"
MemberName 8(t4) 0 "j"
MemberName 8(t4) 1 "k"
Name 9 "t3"
MemberName 9(t3) 0 "h"
Name 11 "x"
MemberDecorate 8(t4) 0 Offset 0
MemberDecorate 8(t4) 1 Offset 8
Decorate 8(t4) Block
MemberDecorate 9(t3) 0 Offset 0
Decorate 9(t3) Block
Decorate 11(x) DescriptorSet 1
Decorate 11(x) Binding 2
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
TypeForwardPointer 7 PhysicalStorageBufferEXT
8(t4): TypeStruct 6(int) 7
9(t3): TypeStruct 6(int)
7: TypePointer PhysicalStorageBufferEXT 9(t3)
10: TypePointer Uniform 8(t4)
11(x): 10(ptr) Variable Uniform
12: 6(int) Constant 1
13: TypePointer Uniform 7(ptr)
16: 6(int) Constant 0
17: TypePointer Uniform 6(int)
20: TypePointer PhysicalStorageBufferEXT 6(int)
4(main): 2 Function None 3
5: Label
14: 13(ptr) AccessChain 11(x) 12
15: 7(ptr) Load 14
18: 17(ptr) AccessChain 11(x) 16
19: 6(int) Load 18
21: 20(ptr) AccessChain 15 16
Store 21 19 Aligned 16
Return
FunctionEnd
spv.bufferhandle7.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 24
Capability Shader
Capability CapabilityPhysicalStorageBufferAddressesEXT
Extension "SPV_EXT_physical_storage_buffer"
Extension "SPV_KHR_storage_buffer_storage_class"
1: ExtInstImport "GLSL.std.450"
MemoryModel PhysicalStorageBuffer64EXT GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_buffer_reference"
Name 4 "main"
Name 7 "t2"
MemberName 7(t2) 0 "f"
MemberName 7(t2) 1 "g"
Name 9 "blockType"
MemberName 9(blockType) 0 "a"
MemberName 9(blockType) 1 "b"
MemberName 9(blockType) 2 "c"
MemberName 9(blockType) 3 "d"
MemberName 9(blockType) 4 "e"
Name 11 "t"
Name 14 "t3"
MemberName 14(t3) 0 "f"
Name 15 "t2"
MemberName 15(t2) 0 "f"
MemberName 15(t2) 1 "g"
Name 17 "u"
MemberDecorate 7(t2) 0 Offset 0
MemberDecorate 7(t2) 1 Offset 8
Decorate 7(t2) Block
MemberDecorate 9(blockType) 0 Offset 0
MemberDecorate 9(blockType) 1 Offset 4
MemberDecorate 9(blockType) 2 Offset 8
MemberDecorate 9(blockType) 3 Offset 12
MemberDecorate 9(blockType) 4 Offset 16
Decorate 9(blockType) Block
Decorate 11(t) DescriptorSet 0
Decorate 11(t) Binding 0
MemberDecorate 14(t3) 0 Offset 0
Decorate 14(t3) Block
MemberDecorate 15(t2) 0 Offset 0
MemberDecorate 15(t2) 1 Offset 8
Decorate 15(t2) Block
Decorate 17(u) DescriptorSet 0
Decorate 17(u) Binding 0
2: TypeVoid
3: TypeFunction 2
TypeForwardPointer 6 PhysicalStorageBufferEXT
7(t2): TypeStruct 6 6
8: TypeInt 32 1
9(blockType): TypeStruct 8(int) 8(int) 8(int) 8(int) 8(int)
6: TypePointer PhysicalStorageBufferEXT 9(blockType)
10: TypePointer StorageBuffer 7(t2)
11(t): 10(ptr) Variable StorageBuffer
12: 8(int) Constant 0
TypeForwardPointer 13 PhysicalStorageBufferEXT
14(t3): TypeStruct 13
15(t2): TypeStruct 6(ptr) 6(ptr)
13: TypePointer PhysicalStorageBufferEXT 15(t2)
16: TypePointer StorageBuffer 14(t3)
17(u): 16(ptr) Variable StorageBuffer
18: TypePointer StorageBuffer 13(ptr)
22: TypePointer StorageBuffer 6(ptr)
4(main): 2 Function None 3
5: Label
19: 18(ptr) AccessChain 17(u) 12
20: 13(ptr) Load 19
21: 6(ptr) Bitcast 20
23: 22(ptr) AccessChain 11(t) 12
Store 23 21
Return
FunctionEnd
spv.bufferhandle8.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 27
Capability Shader
Capability CapabilityPhysicalStorageBufferAddressesEXT
Extension "SPV_EXT_physical_storage_buffer"
Extension "SPV_KHR_storage_buffer_storage_class"
1: ExtInstImport "GLSL.std.450"
MemoryModel PhysicalStorageBuffer64EXT GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_buffer_reference"
Name 4 "main"
Name 8 "Blah"
MemberName 8(Blah) 0 "t1"
MemberName 8(Blah) 1 "t2"
Name 10 "T1"
MemberName 10(T1) 0 "x"
Name 11 "T2"
MemberName 11(T2) 0 "x"
Name 13 "T3"
MemberName 13(T3) 0 "Bindings"
Name 15 "t3"
Name 23 "t2"
MemberName 23(t2) 0 "f"
MemberName 23(t2) 1 "g"
Name 24 "blockType"
MemberName 24(blockType) 0 "a"
MemberName 24(blockType) 1 "b"
MemberName 24(blockType) 2 "c"
MemberName 24(blockType) 3 "d"
MemberName 24(blockType) 4 "e"
Name 26 "t"
MemberDecorate 8(Blah) 0 Offset 0
MemberDecorate 8(Blah) 1 Offset 8
MemberDecorate 10(T1) 0 Offset 0
Decorate 10(T1) Block
MemberDecorate 11(T2) 0 Offset 0
Decorate 11(T2) Block
Decorate 12 ArrayStride 16
MemberDecorate 13(T3) 0 Offset 0
Decorate 13(T3) Block
Decorate 15(t3) DescriptorSet 0
Decorate 15(t3) Binding 0
MemberDecorate 23(t2) 0 Offset 0
MemberDecorate 23(t2) 1 Offset 8
Decorate 23(t2) Block
MemberDecorate 24(blockType) 0 Offset 0
MemberDecorate 24(blockType) 1 Offset 4
MemberDecorate 24(blockType) 2 Offset 8
MemberDecorate 24(blockType) 3 Offset 12
MemberDecorate 24(blockType) 4 Offset 16
Decorate 24(blockType) Block
Decorate 26(t) DescriptorSet 0
Decorate 26(t) Binding 0
2: TypeVoid
3: TypeFunction 2
TypeForwardPointer 6 PhysicalStorageBufferEXT
TypeForwardPointer 7 PhysicalStorageBufferEXT
8(Blah): TypeStruct 6 7
9: TypeInt 32 1
10(T1): TypeStruct 9(int)
6: TypePointer PhysicalStorageBufferEXT 10(T1)
11(T2): TypeStruct 9(int)
7: TypePointer PhysicalStorageBufferEXT 11(T2)
12: TypeRuntimeArray 8(Blah)
13(T3): TypeStruct 12
14: TypePointer StorageBuffer 13(T3)
15(t3): 14(ptr) Variable StorageBuffer
16: 9(int) Constant 0
17: 9(int) Constant 1
18: TypePointer StorageBuffer 8(Blah)
TypeForwardPointer 22 PhysicalStorageBufferEXT
23(t2): TypeStruct 22 22
24(blockType): TypeStruct 9(int) 9(int) 9(int) 9(int) 9(int)
22: TypePointer PhysicalStorageBufferEXT 24(blockType)
25: TypePointer StorageBuffer 23(t2)
26(t): 25(ptr) Variable StorageBuffer
4(main): 2 Function None 3
5: Label
19: 18(ptr) AccessChain 15(t3) 16 17
20: 8(Blah) Load 19
21: 18(ptr) AccessChain 15(t3) 16 16
Store 21 20
Return
FunctionEnd
spv.bufferhandle9.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 56
Capability Shader
Capability Int64
Capability CapabilityPhysicalStorageBufferAddressesEXT
Extension "SPV_EXT_physical_storage_buffer"
Extension "SPV_KHR_storage_buffer_storage_class"
1: ExtInstImport "GLSL.std.450"
MemoryModel PhysicalStorageBuffer64EXT GLSL450
EntryPoint Fragment 4 "main" 16 19
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_ARB_gpu_shader_int64"
SourceExtension "GL_EXT_buffer_reference"
Name 4 "main"
Name 8 "blockType"
MemberName 8(blockType) 0 "a"
MemberName 8(blockType) 1 "b"
MemberName 8(blockType) 2 "c"
MemberName 8(blockType) 3 "d"
MemberName 8(blockType) 4 "e"
Name 13 "b1"
Name 16 "h"
Name 19 "i"
Name 34 "b2"
Name 37 "b3"
Name 46 "j"
Name 53 "t2"
MemberName 53(t2) 0 "f"
MemberName 53(t2) 1 "g"
Name 55 "t"
MemberDecorate 8(blockType) 0 Offset 0
MemberDecorate 8(blockType) 1 Offset 4
MemberDecorate 8(blockType) 2 Offset 8
MemberDecorate 8(blockType) 3 Offset 12
MemberDecorate 8(blockType) 4 Offset 16
Decorate 8(blockType) Block
Decorate 13(b1) DecorationAliasedPointerEXT
Decorate 16(h) Flat
Decorate 19(i) Flat
Decorate 34(b2) DecorationAliasedPointerEXT
Decorate 37(b3) DecorationAliasedPointerEXT
MemberDecorate 53(t2) 0 Offset 0
MemberDecorate 53(t2) 1 Offset 8
Decorate 53(t2) Block
Decorate 55(t) DescriptorSet 0
Decorate 55(t) Binding 0
2: TypeVoid
3: TypeFunction 2
TypeForwardPointer 6 PhysicalStorageBufferEXT
7: TypeInt 32 1
8(blockType): TypeStruct 7(int) 7(int) 7(int) 7(int) 7(int)
6: TypePointer PhysicalStorageBufferEXT 8(blockType)
9: TypeInt 32 0
10: 9(int) Constant 2
11: TypeArray 6(ptr) 10
12: TypePointer Function 11
14: TypeInt 64 0
15: TypePointer Input 14(int64_t)
16(h): 15(ptr) Variable Input
19(i): 15(ptr) Variable Input
23: 7(int) Constant 0
24: TypePointer Function 6(ptr)
27: 7(int) Constant 1
30: TypePointer PhysicalStorageBufferEXT 7(int)
45: TypePointer Function 14(int64_t)
50: 14(int64_t) Constant 256 0
53(t2): TypeStruct 6(ptr) 6(ptr)
54: TypePointer StorageBuffer 53(t2)
55(t): 54(ptr) Variable StorageBuffer
4(main): 2 Function None 3
5: Label
13(b1): 12(ptr) Variable Function
34(b2): 24(ptr) Variable Function
37(b3): 24(ptr) Variable Function
46(j): 45(ptr) Variable Function
17: 14(int64_t) Load 16(h)
18: 6(ptr) ConvertUToPtr 17
20: 14(int64_t) Load 19(i)
21: 6(ptr) ConvertUToPtr 20
22: 11 CompositeConstruct 18 21
Store 13(b1) 22
25: 24(ptr) AccessChain 13(b1) 23
26: 6(ptr) Load 25
28: 24(ptr) AccessChain 13(b1) 27
29: 6(ptr) Load 28
31: 30(ptr) AccessChain 29 27
32: 7(int) Load 31 Aligned 4
33: 30(ptr) AccessChain 26 23
Store 33 32 Aligned 16
35: 14(int64_t) Load 16(h)
36: 6(ptr) ConvertUToPtr 35
Store 34(b2) 36
38: 14(int64_t) Load 19(i)
39: 6(ptr) ConvertUToPtr 38
Store 37(b3) 39
40: 6(ptr) Load 34(b2)
41: 6(ptr) Load 37(b3)
42: 30(ptr) AccessChain 41 27
43: 7(int) Load 42 Aligned 4
44: 30(ptr) AccessChain 40 23
Store 44 43 Aligned 16
47: 6(ptr) Load 34(b2)
48: 14(int64_t) ConvertPtrToU 47
Store 46(j) 48
49: 14(int64_t) Load 46(j)
51: 14(int64_t) IAdd 49 50
52: 6(ptr) ConvertUToPtr 51
Store 34(b2) 52
Return
FunctionEnd
spv.bufferhandle_Error.frag
ERROR: 0:7: 'buffer_reference' : can only be used with buffer
ERROR: 0:9: 'buffer_reference' : cannot declare a default, can only be used on a block
ERROR: 0:10: 'buffer_reference' : can only be used with buffer
ERROR: 0:10: 'buffer_reference' : cannot declare a default, can only be used on a block
ERROR: 0:11: 'buffer_reference' : can only be used with buffer
ERROR: 0:11: 'buffer_reference' : cannot declare a default, can only be used on a block
ERROR: 0:12: 'buffer_reference' : can only be used with buffer
ERROR: 0:12: 'buffer_reference' : cannot declare a default, can only be used on a block
ERROR: 0:13: 'buffer_reference' : can only be used with buffer
ERROR: 0:13: 'buffer_reference' : can only be used with buffer
ERROR: 0:14: 'output block' : not supported in this stage: fragment
ERROR: 0:14: 'buffer_reference' : can only be used with buffer
ERROR: 0:14: 'buffer_reference' : can only be used with buffer
ERROR: 0:30: 'length' : array must be declared with a size before using this method
ERROR: 0:31: 'length' : array must be declared with a size before using this method
ERROR: 0:35: '=' : cannot convert from 'layout( column_major std430) buffer reference' to ' temp reference'
ERROR: 0:40: 'assign' : cannot convert from 'layout( column_major std430) buffer reference' to 'layout( column_major std430) buffer reference'
ERROR: 0:41: 'assign' : cannot convert from 'layout( column_major std430) buffer reference' to 'layout( column_major std430) buffer reference'
ERROR: 0:42: 'assign' : cannot convert from 'layout( column_major std430) buffer reference' to 'layout( column_major std430) buffer reference'
ERROR: 0:45: '' : syntax error, unexpected LEFT_BRACE, expecting COMMA or SEMICOLON
ERROR: 20 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link
#version 450
#extension GL_EXT_buffer_reference : enable
#pragma use_vulkan_memory_model
layout(buffer_reference, std430) buffer blockType {
layout(offset = 0) int a;
layout(offset = 4) int b;
layout(offset = 8) int c;
layout(offset = 12) int d;
layout(offset = 16) int e;
layout(offset = 32) int f[2];
coherent layout(offset = 48) ivec4 g;
};
layout(std430) buffer t2 {
blockType f;
blockType g;
} t;
void main() {
t.f.b = t.g.a;
blockType j = t.f;
j.d = j.c;
j.d = j.f[1];
j.d = j.g.y;
}
#version 450
#extension GL_ARB_gpu_shader_int64 : enable
#extension GL_EXT_buffer_reference : enable
layout(buffer_reference, std430) buffer blockType {
uint x[];
};
layout(std430) buffer t2 {
blockType f;
} t;
layout(location = 0) flat in uint i;
void main() {
atomicAdd(t.f.x[i], 1);
coherent blockType b = t.f;
b.x[0] = 2;
}
#version 450
#extension GL_EXT_shader_16bit_storage : enable
#extension GL_EXT_shader_8bit_storage : enable
#extension GL_EXT_buffer_reference : enable
layout(std140, binding = 0) buffer AcBlock { highp uint ac_numPassed; };
layout(std140, buffer_reference) buffer Block
{
uint8_t var;
};
layout (push_constant, std430) uniform PC {
Block block;
};
bool compare_uint8_t (highp uint a, highp uint b) { return a == b; }
void main (void)
{
bool allOk = true;
allOk = allOk && compare_uint8_t(uint(block.var), 7u);
if (allOk)
ac_numPassed++;
block.var = uint8_t(9u);
}
\ No newline at end of file
#version 450
#extension GL_EXT_shader_16bit_storage : enable
#extension GL_EXT_shader_8bit_storage : enable
#extension GL_EXT_buffer_reference : enable
layout(std140, binding = 0) buffer AcBlock { highp uint ac_numPassed; };
layout(std430, column_major, buffer_reference) buffer BlockB
{
float16_t a;
highp ivec2 b;
};
layout(std430, buffer_reference) buffer BlockC
{
mediump mat2x3 c;
};
layout(std430, row_major, buffer_reference) buffer BlockD
{
lowp uvec3 d;
};
layout (push_constant, std430) uniform PC {
BlockB blockB;
BlockC blockC;
BlockD blockD;
};
bool compare_float (highp float a, highp float b) { return abs(a - b) < 0.05; }
bool compare_vec3 (highp vec3 a, highp vec3 b) { return compare_float(a.x, b.x)&&compare_float(a.y, b.y)&&compare_float(a.z, b.z); }
bool compare_mat2x3 (highp mat2x3 a, highp mat2x3 b){ return compare_vec3(a[0], b[0])&&compare_vec3(a[1], b[1]); }
bool compare_ivec2 (highp ivec2 a, highp ivec2 b) { return a == b; }
bool compare_uvec3 (highp uvec3 a, highp uvec3 b) { return a == b; }
bool compare_float16_t(highp float a, highp float b) { return abs(a - b) < 0.05; }
void main (void)
{
bool allOk = true;
allOk = allOk && compare_mat2x3(blockC.c, mat2x3(-5.0, 1.0, -7.0, 1.0, 2.0, 8.0));
if (allOk)
ac_numPassed++;
blockD.d = (uvec3(8u, 1u, 5u));
}
\ No newline at end of file
#version 450
#extension GL_EXT_buffer_reference : enable
layout(set = 1, binding = 2, buffer_reference, std430) buffer t4 {
layout(offset = 0) int j;
};
layout(std430) buffer t5 {
t4 m;
} s5;
t4 f1(const t4 y) { return y; }
t4 f2(t4 y) { return y; }
t4 f3(const restrict t4 y) { return y; }
t4 f4(restrict t4 y) { return y; }
t4 g1;
restrict t4 g2;
void main()
{
t4 a = s5.m;
restrict t4 b = s5.m;
f1(a);
f2(a);
f3(a);
f4(a);
}
#version 450
#extension GL_EXT_buffer_reference : enable
layout(buffer_reference, std430, buffer_reference_align = 4) buffer T1 {
int i;
int j;
int k;
};
layout(buffer_reference, std430, buffer_reference_align = 8) buffer T2 {
int i;
int j;
int k;
};
layout(buffer_reference, std430) buffer T3 {
int i;
int j;
int k;
};
layout(buffer_reference, std430, buffer_reference_align = 32) buffer T4 {
int i;
int j;
int k;
};
void main()
{
T1 t1;
T2 t2;
T3 t3;
T4 t4;
t1.i = t1.k;
t2.i = t2.k;
t3.i = t3.k;
t4.i = t4.k;
}
#version 450
#extension GL_EXT_buffer_reference : enable
#extension GL_EXT_scalar_block_layout : enable
layout(buffer_reference, scalar) buffer T1 {
vec3 x[];
};
layout(buffer_reference, scalar) buffer T2 {
vec3 x[][4][2];
};
struct S
{
highp ivec3 a;
mediump mat3 b[4];
highp vec4 c;
};
layout(buffer_reference, scalar) buffer T3 {
S s;
};
layout(std430) buffer T4 {
T1 t1;
T2 t2;
T3 t3;
} t4;
layout(location = 0) flat in int i;
void main()
{
vec3 y;
y = t4.t1.x[i];
y = t4.t2.x[i][i][i];
mat3 z = t4.t3.s.b[0];
}
#version 450
#extension GL_EXT_buffer_reference : enable
layout(buffer_reference, std430) buffer blockType {
layout(offset = 0) int a;
layout(offset = 4) int b;
layout(offset = 8) int c;
layout(offset = 12) int d;
layout(offset = 16) int e;
};
layout(std430) buffer t2 {
blockType f;
blockType g;
} t;
void main() {
blockType b1[2] = blockType[2](t.f, t.g);
b1[0].a = b1[1].b;
blockType b2 = t.f;
blockType b3 = t.g;
b2.a = b3.b;
}
#version 450
#extension GL_EXT_buffer_reference : enable
layout(buffer_reference, std430) buffer t3 {
int h;
};
layout(set = 1, binding = 2, buffer_reference, std430) buffer t4 {
layout(offset = 0) int j;
t3 k;
} x;
layout(std430) buffer t5 {
t4 m;
} s5;
flat in t4 k;
t4 foo(t4 y) { return y; }
void main() {
foo(s5.m).j = s5.m.k.h;
x.j = k.k.h;
}
#version 450
#extension GL_EXT_buffer_reference : enable
layout(buffer_reference) buffer t4;
layout(buffer_reference, std430) buffer t3 {
int h;
t4 i;
};
layout(set = 1, binding = 2, buffer_reference, std430) buffer t4 {
layout(offset = 0) int j;
t3 k;
} x;
layout(std430) buffer t5 {
t4 m;
} s5;
void main() {
x.k.h = s5.m.k.i.k.i.k.h;
bool b = true;
s5.m = b ? s5.m : s5.m.k.i;
}
#version 450
#extension GL_EXT_buffer_reference : enable
layout(buffer_reference, std140) buffer t3 {
int h;
};
layout(set = 1, binding = 2, std140) uniform t4 {
layout(offset = 0) int j;
t3 k;
} x;
void main() {
x.k.h = x.j;
}
#version 450 core
#extension GL_EXT_buffer_reference : enable
layout (push_constant, std430) uniform Block { int identity[32]; } pc;
layout(r32ui, set = 3, binding = 0) uniform uimage2D image0_0;
layout(buffer_reference) buffer T1;
layout(set = 3, binding = 1, buffer_reference) buffer T1 {
layout(offset = 0) int a[2]; // stride = 4 for std430, 16 for std140
layout(offset = 32) int b;
layout(offset = 48) T1 c[2]; // stride = 8 for std430, 16 for std140
layout(offset = 80) T1 d;
} x;
void main()
{
int accum = 0, temp;
accum |= x.a[0] - 0;
accum |= x.a[pc.identity[1]] - 1;
accum |= x.b - 2;
accum |= x.c[0].a[0] - 3;
accum |= x.c[0].a[pc.identity[1]] - 4;
accum |= x.c[0].b - 5;
accum |= x.c[pc.identity[1]].a[0] - 6;
accum |= x.c[pc.identity[1]].a[pc.identity[1]] - 7;
accum |= x.c[pc.identity[1]].b - 8;
accum |= x.d.a[0] - 9;
accum |= x.d.a[pc.identity[1]] - 10;
accum |= x.d.b - 11;
uvec4 color = (accum != 0) ? uvec4(0,0,0,0) : uvec4(1,0,0,1);
imageStore(image0_0, ivec2(gl_FragCoord.x, gl_FragCoord.y), color);
}
\ No newline at end of file
#version 450
#extension GL_EXT_buffer_reference : enable
layout(buffer_reference, std430) buffer blockType {
layout(offset = 0) int a;
layout(offset = 4) int b;
layout(offset = 8) int c;
layout(offset = 12) int d;
layout(offset = 16) int e;
};
layout(std430, buffer_reference) buffer t2 {
blockType f;
blockType g;
} t;
layout(std430) buffer t3 {
t2 f;
} u;
void main() {
t.f = blockType(u.f);
}
#version 450
#extension GL_EXT_buffer_reference : enable
layout(buffer_reference, std430) buffer blockType {
layout(offset = 0) int a;
layout(offset = 4) int b;
layout(offset = 8) int c;
layout(offset = 12) int d;
layout(offset = 16) int e;
};
layout(std430) buffer t2 {
blockType f;
blockType g;
} t;
layout(std430, buffer_reference) buffer T2 { int x; };
layout(std430, buffer_reference) buffer T1 { int x; };
struct Blah {
T1 t1;
T2 t2;
};
layout(set=0, binding=0) buffer T3 {
Blah Bindings[];
} t3;
void main() {
t3.Bindings[0] = t3.Bindings[1];
}
#version 450
#extension GL_ARB_gpu_shader_int64 : enable
#extension GL_EXT_buffer_reference : enable
layout(buffer_reference, std430) buffer blockType {
layout(offset = 0) int a;
layout(offset = 4) int b;
layout(offset = 8) int c;
layout(offset = 12) int d;
layout(offset = 16) int e;
};
layout(std430) buffer t2 {
blockType f;
blockType g;
} t;
flat in uint64_t h, i;
void main() {
blockType b1[2] = blockType[2](blockType(h), blockType(i));
b1[0].a = b1[1].b;
blockType b2 = blockType(h);
blockType b3 = blockType(i);
b2.a = b3.b;
uint64_t j = uint64_t(b2);
b2 = blockType(j+256);
}
#version 450
#extension GL_EXT_buffer_reference : enable
layout(buffer_reference) buffer bufType1 { int x; };
layout(buffer_reference) buffer bufType2 { int x; };
layout(buffer_reference) uniform bufType3 { int x; };
layout(buffer_reference) buffer;
layout(buffer_reference) uniform;
layout(buffer_reference) in;
layout(buffer_reference) out;
layout(buffer_reference) in badin { float x; } badin2;
layout(buffer_reference) out badout { float x; } badout2;
layout(buffer_reference) buffer bufType5;
layout(buffer_reference) buffer bufType6 { int x[]; };
buffer bufType4 {
bufType1 b1;
bufType2 b2;
bufType3 b3;
bufType6 b6;
} b4;
void f()
{
bufType6 b;
b.x.length();
b4.b6.x.length();
}
void main() {
bufType2 x1 = b4.b1;
bufType2 x2 = bufType2(b4.b1);
bufType2 x3 = bufType2(b4.b2);
bufType2 x4 = bufType2(b4.b3);
b4.b1 = b4.b2;
b4.b1 = b4.b3;
b4.b3 = b4.b2;
}
layout(buffer_reference) uniform bufType5 { int x; };
......@@ -66,6 +66,8 @@ enum TBasicType {
EbtAccStructNV,
#endif
EbtReference,
// HLSL types that live only temporarily.
EbtString,
......
......@@ -269,6 +269,10 @@ enum TOperator {
EOpConvDoubleToFloat16,
EOpConvDoubleToFloat,
// uint64_t <-> pointer
EOpConvUint64ToPtr,
EOpConvPtrToUint64,
//
// binary operations
//
......@@ -732,6 +736,7 @@ enum TOperator {
EOpConstructStruct,
EOpConstructTextureSampler,
EOpConstructNonuniform, // expected to be transformed away, not present in final AST
EOpConstructReference,
EOpConstructGuardEnd,
//
......
......@@ -984,6 +984,14 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
case EOpSequence:
case EOpConstructStruct:
if (type.getBasicType() == EbtReference || node->getType().getBasicType() == EbtReference) {
// types must match to assign a reference
if (type == node->getType())
return node;
else
return nullptr;
}
if (type.getBasicType() == node->getType().getBasicType())
return node;
......@@ -2131,6 +2139,9 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
}
}
break;
case EbtReference:
op = EOpConstructReference;
break;
default:
break;
}
......
......@@ -776,7 +776,7 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
loc = ppToken.loc;
parserToken->sType.lex.loc = loc;
switch (token) {
case ';': afterType = false; return SEMICOLON;
case ';': afterType = false; afterBuffer = false; return SEMICOLON;
case ',': afterType = false; return COMMA;
case ':': return COLON;
case '=': afterType = false; return EQUAL;
......@@ -798,7 +798,7 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
case '?': return QUESTION;
case '[': return LEFT_BRACKET;
case ']': return RIGHT_BRACKET;
case '{': afterStruct = false; return LEFT_BRACE;
case '{': afterStruct = false; afterBuffer = false; return LEFT_BRACE;
case '}': return RIGHT_BRACE;
case '\\':
parseContext.error(loc, "illegal use of escape character", "\\", "");
......@@ -945,6 +945,7 @@ int TScanContext::tokenizeIdentifier()
return keyword;
case BUFFER:
afterBuffer = true;
if ((parseContext.profile == EEsProfile && parseContext.version < 310) ||
(parseContext.profile != EEsProfile && parseContext.version < 430))
return identifierOrType();
......@@ -1617,7 +1618,9 @@ int TScanContext::identifierOrType()
parserToken->sType.lex.symbol = parseContext.symbolTable.find(*parserToken->sType.lex.string);
if ((afterType == false && afterStruct == false) && parserToken->sType.lex.symbol != nullptr) {
if (const TVariable* variable = parserToken->sType.lex.symbol->getAsVariable()) {
if (variable->isUserType()) {
if (variable->isUserType() &&
// treat redeclaration of forward-declared buffer/uniform reference as an identifier
!(variable->getType().getBasicType() == EbtReference && afterBuffer)) {
afterType = true;
return TYPE_NAME;
......
......@@ -53,7 +53,7 @@ public:
explicit TScanContext(TParseContextBase& pc) :
parseContext(pc),
afterType(false), afterStruct(false),
field(false) { }
field(false), afterBuffer(false) { }
virtual ~TScanContext() { }
static void fillInKeywordMap();
......@@ -81,6 +81,7 @@ protected:
bool afterType; // true if we've recognized a type, so can only be looking for an identifier
bool afterStruct; // true if we've recognized the STRUCT keyword, so can only be looking for an identifier
bool field; // true if we're on a field, right after a '.'
bool afterBuffer; // true if we've recognized the BUFFER keyword
TSourceLoc loc;
TParserToken* parserToken;
TPpToken* ppToken;
......
......@@ -207,6 +207,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_EXT_samplerless_texture_functions] = EBhDisable;
extensionBehavior[E_GL_EXT_scalar_block_layout] = EBhDisable;
extensionBehavior[E_GL_EXT_fragment_invocation_density] = EBhDisable;
extensionBehavior[E_GL_EXT_buffer_reference] = EBhDisable;
extensionBehavior[E_GL_EXT_shader_16bit_storage] = EBhDisable;
extensionBehavior[E_GL_EXT_shader_8bit_storage] = EBhDisable;
......@@ -383,6 +384,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_EXT_samplerless_texture_functions 1\n"
"#define GL_EXT_scalar_block_layout 1\n"
"#define GL_EXT_fragment_invocation_density 1\n"
"#define GL_EXT_buffer_reference 1\n"
// GL_KHR_shader_subgroup
"#define GL_KHR_shader_subgroup_basic 1\n"
......
......@@ -169,6 +169,7 @@ const char* const E_GL_EXT_nonuniform_qualifier = "GL_EXT_nonuniform
const char* const E_GL_EXT_samplerless_texture_functions = "GL_EXT_samplerless_texture_functions";
const char* const E_GL_EXT_scalar_block_layout = "GL_EXT_scalar_block_layout";
const char* const E_GL_EXT_fragment_invocation_density = "GL_EXT_fragment_invocation_density";
const char* const E_GL_EXT_buffer_reference = "GL_EXT_buffer_reference";
// Arrays of extensions for the above viewportEXTs duplications
......
......@@ -172,8 +172,12 @@ bool TOutputTraverser::visitBinary(TVisit /* visit */, TIntermBinary* node)
case EOpIndexDirect: out.debug << "direct index"; break;
case EOpIndexIndirect: out.debug << "indirect index"; break;
case EOpIndexDirectStruct:
out.debug << (*node->getLeft()->getType().getStruct())[node->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst()].type->getFieldName();
out.debug << ": direct index for structure"; break;
{
bool reference = node->getLeft()->getType().getBasicType() == EbtReference;
const TTypeList *members = reference ? node->getLeft()->getType().getReferentType()->getStruct() : node->getLeft()->getType().getStruct();
out.debug << (*members)[node->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst()].type->getFieldName();
out.debug << ": direct index for structure"; break;
}
case EOpVectorSwizzle: out.debug << "vector swizzle"; break;
case EOpMatrixSwizzle: out.debug << "matrix swizzle"; break;
......@@ -419,6 +423,8 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
case EOpConvDoubleToUint: out.debug << "Convert double to uint"; break;
case EOpConvDoubleToUint64: out.debug << "Convert double to uint64"; break;
case EOpConvUint64ToPtr: out.debug << "Convert uint64_t to pointer"; break;
case EOpConvPtrToUint64: out.debug << "Convert pointer to uint64_t"; break;
case EOpRadians: out.debug << "radians"; break;
case EOpDegrees: out.debug << "degrees"; break;
......@@ -674,6 +680,8 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
case EOpSubpassLoad: out.debug << "subpassLoad"; break;
case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
case EOpConstructReference: out.debug << "Construct reference type"; break;
default: out.debug.message(EPrefixError, "Bad unary op");
}
......@@ -808,6 +816,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
case EOpConstructF16Mat4x4: out.debug << "Construct f16mat4"; break;
case EOpConstructStruct: out.debug << "Construct structure"; break;
case EOpConstructTextureSampler: out.debug << "Construct combined texture-sampler"; break;
case EOpConstructReference: out.debug << "Construct reference"; break;
case EOpLessThan: out.debug << "Compare Less Than"; break;
case EOpGreaterThan: out.debug << "Compare Greater Than"; break;
......
......@@ -261,6 +261,7 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
MERGE_TRUE(needToLegalize);
MERGE_TRUE(binaryDoubleOutput);
MERGE_TRUE(usePhysicalStorageBuffer);
}
//
......@@ -1355,6 +1356,7 @@ int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
case EbtUint8: size = 1; return 1;
case EbtInt16:
case EbtUint16: size = 2; return 2;
case EbtReference: size = 8; return 8;
default: size = 4; return 4;
}
}
......
......@@ -255,6 +255,7 @@ public:
textureSamplerTransformMode(EShTexSampTransKeep),
needToLegalize(false),
binaryDoubleOutput(false),
usePhysicalStorageBuffer(false),
uniformLocationBase(0)
{
localSize[0] = 1;
......@@ -390,6 +391,11 @@ public:
processes.addProcess("use-vulkan-memory-model");
}
bool usingVulkanMemoryModel() const { return useVulkanMemoryModel; }
void setUsePhysicalStorageBuffer()
{
usePhysicalStorageBuffer = true;
}
bool usingPhysicalStorageBuffer() const { return usePhysicalStorageBuffer; }
template<class T> T addCounterBufferName(const T& name) const { return name + implicitCounterName; }
bool hasCounterBufferName(const TString& name) const {
......@@ -825,6 +831,7 @@ protected:
bool needToLegalize;
bool binaryDoubleOutput;
bool usePhysicalStorageBuffer;
std::unordered_map<std::string, int> uniformLocationOverrides;
int uniformLocationBase;
......
......@@ -265,6 +265,22 @@ INSTANTIATE_TEST_CASE_P(
"spv.bool.vert",
"spv.boolInBlock.frag",
"spv.branch-return.vert",
"spv.bufferhandle1.frag",
"spv.bufferhandle10.frag",
"spv.bufferhandle11.frag",
"spv.bufferhandle12.frag",
"spv.bufferhandle13.frag",
"spv.bufferhandle14.frag",
"spv.bufferhandle15.frag",
"spv.bufferhandle2.frag",
"spv.bufferhandle3.frag",
"spv.bufferhandle4.frag",
"spv.bufferhandle5.frag",
"spv.bufferhandle6.frag",
"spv.bufferhandle7.frag",
"spv.bufferhandle8.frag",
"spv.bufferhandle9.frag",
"spv.bufferhandle_Error.frag",
"spv.builtInXFB.vert",
"spv.conditionalDiscard.frag",
"spv.constStruct.vert",
......
......@@ -5,14 +5,14 @@
"site" : "github",
"subrepo" : "KhronosGroup/SPIRV-Tools",
"subdir" : "External/spirv-tools",
"commit" : "a87d3ce48e88a653e855c3245a6b68deeae58efc"
"commit" : "5eab6df648eace6eab69c44ccd17bd0f5e57406d"
},
{
"name" : "spirv-tools/external/spirv-headers",
"site" : "github",
"subrepo" : "KhronosGroup/SPIRV-Headers",
"subdir" : "External/spirv-tools/external/spirv-headers",
"commit" : "4618b86e9e4b027a22040732dfee35e399cd2c47"
"commit" : "79b6681aadcb53c27d1052e5f8a0e82a981dbf2f"
}
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment