Merge pull request #1663 from jeffbolznv/reference_vs_memorymodel

More precisely check for the qualifiers that enable the vulkan memory model for buffer references.
This commit is contained in:
John Kessenich 2019-01-20 08:43:06 -07:00 committed by GitHub
commit 4e06d7a2bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -4,13 +4,11 @@ spv.bufferhandle13.frag
// Id's are bound by 58 // Id's are bound by 58
Capability Shader Capability Shader
Capability CapabilityVulkanMemoryModelKHR
Capability CapabilityPhysicalStorageBufferAddressesEXT Capability CapabilityPhysicalStorageBufferAddressesEXT
Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_EXT_physical_storage_buffer"
Extension "SPV_KHR_storage_buffer_storage_class" Extension "SPV_KHR_storage_buffer_storage_class"
Extension "SPV_KHR_vulkan_memory_model"
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel PhysicalStorageBuffer64EXT VulkanKHR MemoryModel PhysicalStorageBuffer64EXT GLSL450
EntryPoint Fragment 4 "main" EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source GLSL 450 Source GLSL 450

View File

@ -537,6 +537,11 @@ public:
{ {
return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly; return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly;
} }
bool bufferReferenceNeedsVulkanMemoryModel() const
{
// include qualifiers that map to load/store availability/visibility/nonprivate memory access operands
return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || nonprivate;
}
bool isInterpolation() const bool isInterpolation() const
{ {

View File

@ -355,7 +355,7 @@ TIntermTyped* TParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symb
intermediate.addIoAccessed(*string); intermediate.addIoAccessed(*string);
if (variable->getType().getBasicType() == EbtReference && if (variable->getType().getBasicType() == EbtReference &&
variable->getType().getQualifier().isMemory()) { variable->getType().getQualifier().bufferReferenceNeedsVulkanMemoryModel()) {
intermediate.setUseVulkanMemoryModel(); intermediate.setUseVulkanMemoryModel();
} }