VK: In UMA, apply the staging bypass for everything (#9538)

Currently only uniform buffers benefit from the bypass,
but this can also be extended to others buffers too.

This also help trying to match the performance of the
GL backend in Android.

FIXES=[470138463]

Co-authored-by: Serge Metral <sergemetral@google.com>
This commit is contained in:
rafadevai
2026-01-05 11:36:54 -08:00
committed by GitHub
parent a6d1b9188f
commit c0e3aa2b0a

View File

@@ -54,17 +54,12 @@ void VulkanBufferProxy::loadFromCpu(VulkanCommandBuffer& commands, const void* c
// Check if we can just memcpy directly to the GPU memory.
bool const isMemcopyable = mBuffer->getGpuBuffer()->allocationInfo.pMappedData != nullptr;
// In the case of UNIFORMS, check that is available to see to know if a memcpy is possible.
// This works regardless if it's a full or partial update of the buffer.
bool const isUniformAndAvailable = getBinding() == VulkanBufferBinding::UNIFORM && isAvailable;
// In the case the content is marked as memory mapped or static, is guaranteed to be safe to do
// a memcpy if its available.
bool const isStaticOrShared =
any(mUsage & (BufferUsage::STATIC | BufferUsage::SHARED_WRITE_BIT));
bool const useMemcpy =
((isUniformAndAvailable && mStagingBufferBypassEnabled) || isStaticOrShared) &&
isMemcopyable;
((isAvailable && mStagingBufferBypassEnabled) || isStaticOrShared) && isMemcopyable;
if (useMemcpy) {
char* dest = static_cast<char*>(mBuffer->getGpuBuffer()->allocationInfo.pMappedData) +
byteOffset;