summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp46
1 files changed, 30 insertions, 16 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp
index 077b4500..45b7a69e 100644
--- a/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp
@@ -96,27 +96,41 @@ BufferVkImpl::BufferVkImpl(IReferenceCounters* pRefCounters,
switch (BindFlag)
{
- case BIND_UNORDERED_ACCESS:
+ case BIND_SHADER_RESOURCE:
{
- // RWStructured and RWByteAddress buffers are mapped to storage buffers in Vulkan.
- // RW formatted buffers are mapped to storage texel buffers in Vulkan.
- VkBuffCI.usage |= m_Desc.Mode == BUFFER_MODE_FORMATTED ? VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT : VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
-
- // Each element of pDynamicOffsets of vkCmdBindDescriptorSets function which corresponds to a descriptor
- // binding with type VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC must be a multiple of
- // VkPhysicalDeviceLimits::minStorageBufferOffsetAlignment (13.2.5)
- m_DynamicOffsetAlignment = std::max(m_DynamicOffsetAlignment, static_cast<Uint32>(DeviceLimits.minTexelBufferOffsetAlignment));
- m_DynamicOffsetAlignment = std::max(m_DynamicOffsetAlignment, static_cast<Uint32>(DeviceLimits.minStorageBufferOffsetAlignment));
+ if (m_Desc.Mode == BUFFER_MODE_FORMATTED)
+ {
+ // Formatted buffers are mapped to uniform texel buffers in Vulkan.
+ VkBuffCI.usage |= VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT;
+ m_DynamicOffsetAlignment = std::max(m_DynamicOffsetAlignment, static_cast<Uint32>(DeviceLimits.minTexelBufferOffsetAlignment));
+ }
+ else
+ {
+ // Structured and ByteAddress buffers are mapped to read-only storage buffers in Vulkan.
+ VkBuffCI.usage |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
+ m_DynamicOffsetAlignment = std::max(m_DynamicOffsetAlignment, static_cast<Uint32>(DeviceLimits.minStorageBufferOffsetAlignment));
+ }
+
break;
}
- case BIND_SHADER_RESOURCE:
+ case BIND_UNORDERED_ACCESS:
{
- // Structured and ByteAddress buffers are mapped to read-only storage buffers in Vulkan.
- // Formatted buffers are mapped to uniform texel buffers in Vulkan.
- VkBuffCI.usage |= m_Desc.Mode == BUFFER_MODE_FORMATTED ? VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT : VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
+ if (m_Desc.Mode == BUFFER_MODE_FORMATTED)
+ {
+ // RW formatted buffers are mapped to storage texel buffers in Vulkan.
+ VkBuffCI.usage |= VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT;
+ m_DynamicOffsetAlignment = std::max(m_DynamicOffsetAlignment, static_cast<Uint32>(DeviceLimits.minTexelBufferOffsetAlignment));
+ }
+ else
+ {
+ // RWStructured and RWByteAddress buffers are mapped to storage buffers in Vulkan.
+ VkBuffCI.usage |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
+ // Each element of pDynamicOffsets of vkCmdBindDescriptorSets function which corresponds to a descriptor
+ // binding with type VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC must be a multiple of
+ // VkPhysicalDeviceLimits::minStorageBufferOffsetAlignment (13.2.5)
+ m_DynamicOffsetAlignment = std::max(m_DynamicOffsetAlignment, static_cast<Uint32>(DeviceLimits.minStorageBufferOffsetAlignment));
+ }
- m_DynamicOffsetAlignment = std::max(m_DynamicOffsetAlignment, static_cast<Uint32>(DeviceLimits.minTexelBufferOffsetAlignment));
- m_DynamicOffsetAlignment = std::max(m_DynamicOffsetAlignment, static_cast<Uint32>(DeviceLimits.minStorageBufferOffsetAlignment));
break;
}
case BIND_VERTEX_BUFFER: