Expose bufferDeviceAddress support
This CL adds support for the bufferDeviceAddress feature,
which include SPV_KHR_physical_storage_buffer support.
Tests: dEQP-VK.binding_model.buffer_device_address.*
Tests: dEQP-VK.memory_model.*.physbuffer.*
Tests: dEQP-VK.spirv_assembly.instruction.*storage_buffer*
Tests: dEQP-VK.spirv_assembly.instruction.compute.physical_pointers.*
Bug: b/184952772
Change-Id: I0280b57f9c798304441f87f197c23cf84997f393
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/63989
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Commit-Queue: Alexis Hétu <sugoi@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
diff --git a/src/Pipeline/SpirvShader.cpp b/src/Pipeline/SpirvShader.cpp
index c4788bc..4c436f9 100644
--- a/src/Pipeline/SpirvShader.cpp
+++ b/src/Pipeline/SpirvShader.cpp
@@ -453,6 +453,7 @@
case spv::CapabilityRuntimeDescriptorArray: capabilities.RuntimeDescriptorArray = true; break;
case spv::CapabilityStorageBufferArrayNonUniformIndexing: capabilities.StorageBufferArrayNonUniformIndexing = true; break;
case spv::CapabilityStorageTexelBufferArrayNonUniformIndexing: capabilities.StorageTexelBufferArrayNonUniformIndexing = true; break;
+ case spv::CapabilityPhysicalStorageBufferAddresses: capabilities.PhysicalStorageBufferAddresses = true; break;
default:
UNSUPPORTED("Unsupported capability %u", insn.word(1));
}
@@ -813,6 +814,7 @@
if(!strcmp(ext, "SPV_KHR_float_controls")) break;
if(!strcmp(ext, "SPV_KHR_integer_dot_product")) break;
if(!strcmp(ext, "SPV_KHR_non_semantic_info")) break;
+ if(!strcmp(ext, "SPV_KHR_physical_storage_buffer")) break;
if(!strcmp(ext, "SPV_KHR_vulkan_memory_model")) break;
if(!strcmp(ext, "SPV_GOOGLE_decorate_string")) break;
if(!strcmp(ext, "SPV_GOOGLE_hlsl_functionality1")) break;
diff --git a/src/Pipeline/SpirvShader.hpp b/src/Pipeline/SpirvShader.hpp
index e454090..c102bb8 100644
--- a/src/Pipeline/SpirvShader.hpp
+++ b/src/Pipeline/SpirvShader.hpp
@@ -727,6 +727,7 @@
bool RuntimeDescriptorArray : 1;
bool StorageBufferArrayNonUniformIndexing : 1;
bool StorageTexelBufferArrayNonUniformIndexing : 1;
+ bool PhysicalStorageBufferAddresses : 1;
};
const Capabilities &getUsedCapabilities() const
diff --git a/src/Vulkan/VkPhysicalDevice.cpp b/src/Vulkan/VkPhysicalDevice.cpp
index 6b7351e..5163496 100644
--- a/src/Vulkan/VkPhysicalDevice.cpp
+++ b/src/Vulkan/VkPhysicalDevice.cpp
@@ -296,7 +296,7 @@
template<typename T>
static void getPhysicalDeviceBufferDeviceAddressFeatures(T *features)
{
- features->bufferDeviceAddress = VK_FALSE;
+ features->bufferDeviceAddress = VK_TRUE;
features->bufferDeviceAddressCaptureReplay = VK_FALSE;
features->bufferDeviceAddressMultiDevice = VK_FALSE;
}