[ATOM][RHI][Vulkan][Android] - pick the correct share mode based on f… (#2166)

* [ATOM][RHI][Vulkan][Android] - pick the correct share mode based on flags and size of queue families

Signed-off-by: Peng <tonypeng@amazon.com>
This commit is contained in:
AMZN-tpeng
2021-07-20 11:24:35 -07:00
committed by GitHub
parent a08f850766
commit 216542c939
@@ -815,11 +815,12 @@ namespace AZ
createInfo.size = descriptor.m_byteCount;
createInfo.usage = GetBufferUsageFlagBitsUnderRestrictions(descriptor.m_bindFlags);
// Trying to guess here if the buffers are going to be used as attachments. Maybe it would be better to add an explicit flag in the descriptor.
createInfo.sharingMode =
RHI::CheckBitsAny(
descriptor.m_bindFlags,
RHI::BufferBindFlags::ShaderWrite | RHI::BufferBindFlags::Predication | RHI::BufferBindFlags::Indirect)
? VK_SHARING_MODE_EXCLUSIVE
createInfo.sharingMode =
(RHI::CheckBitsAny(
descriptor.m_bindFlags,
RHI::BufferBindFlags::ShaderWrite | RHI::BufferBindFlags::Predication | RHI::BufferBindFlags::Indirect) ||
(queueFamilies.size()) <= 1)
? VK_SHARING_MODE_EXCLUSIVE
: VK_SHARING_MODE_CONCURRENT;
createInfo.queueFamilyIndexCount = static_cast<uint32_t>(queueFamilies.size());
createInfo.pQueueFamilyIndices = queueFamilies.empty() ? nullptr : queueFamilies.data();