Merge pull request #1714 from jeffbolznv/volatil
Fix interactions between 'volatile' and the Vulkan memory model
This commit is contained in:
@@ -565,14 +565,15 @@ spv::Builder::AccessChain::CoherentFlags TGlslangToSpvTraverser::TranslateCohere
|
||||
flags.workgroupcoherent = type.getQualifier().workgroupcoherent ||
|
||||
type.getQualifier().storage == glslang::EvqShared;
|
||||
flags.subgroupcoherent = type.getQualifier().subgroupcoherent;
|
||||
flags.volatil = type.getQualifier().volatil;
|
||||
// *coherent variables are implicitly nonprivate in GLSL
|
||||
flags.nonprivate = type.getQualifier().nonprivate ||
|
||||
flags.subgroupcoherent ||
|
||||
flags.workgroupcoherent ||
|
||||
flags.queuefamilycoherent ||
|
||||
flags.devicecoherent ||
|
||||
flags.coherent;
|
||||
flags.volatil = type.getQualifier().volatil;
|
||||
flags.coherent ||
|
||||
flags.volatil;
|
||||
flags.isImage = type.getBasicType() == glslang::EbtSampler;
|
||||
return flags;
|
||||
}
|
||||
@@ -580,7 +581,7 @@ spv::Builder::AccessChain::CoherentFlags TGlslangToSpvTraverser::TranslateCohere
|
||||
spv::Scope TGlslangToSpvTraverser::TranslateMemoryScope(const spv::Builder::AccessChain::CoherentFlags &coherentFlags)
|
||||
{
|
||||
spv::Scope scope;
|
||||
if (coherentFlags.coherent) {
|
||||
if (coherentFlags.volatil || coherentFlags.coherent) {
|
||||
// coherent defaults to Device scope in the old model, QueueFamilyKHR scope in the new model
|
||||
scope = glslangIntermediate->usingVulkanMemoryModel() ? spv::ScopeQueueFamilyKHR : spv::ScopeDevice;
|
||||
} else if (coherentFlags.devicecoherent) {
|
||||
|
||||
2
SPIRV/SpvPostProcess.cpp
Executable file → Normal file
2
SPIRV/SpvPostProcess.cpp
Executable file → Normal file
@@ -260,8 +260,6 @@ void Builder::postProcess(Instruction& inst)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user