Remove SK_USE_LEGACY_VK_ALLOCATOR_USAGE_NAMES code.

Bug: skia:11207
Change-Id: I7e6f7bc93bac6d36c61c2e6500a2c5e0f7556bcb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369477
Auto-Submit: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Greg Daniel 2021-02-11 14:55:03 -05:00 committed by Skia Commit-Bot
parent 270cec21a7
commit d50ccf2d53
3 changed files with 0 additions and 55 deletions

View File

@ -35,23 +35,6 @@ public:
GR_DECL_BITFIELD_CLASS_OPS_FRIENDS(AllocationPropertyFlags);
enum class BufferUsage {
#ifdef SK_USE_LEGACY_VK_ALLOCATOR_USAGE_NAMES
// Buffers that will only be accessed from the device (large const buffers). Will always be
// in device local memory.
kGpuOnly,
// DEPRECATED: Depending on the direction of transfer buffers they should use
// kCpuWritesGpuReads or kGpuWritesCpuReads instead.
// Buffers that will be accessed on the host and copied to and from a GPU resource (transfer
// buffers). Will always be mappable and coherent memory.
kCpuOnly,
// Buffers that typically will be updated multiple times by the host and read on the gpu
// (e.g. uniform or vertex buffers). Will always be mappable memory, and will prefer to be
// in device local memory.
kCpuWritesGpuReads,
// Buffers which are typically writted to by the GPU and then read on the host. Will always
// be mappable memory, and will prefer cached memory.
kGpuWritesCpuReads,
#else
// Buffers that will only be accessed from the device (large const buffers). Will always be
// in device local memory.
kGpuOnly,
@ -67,7 +50,6 @@ public:
// Buffers which are typically writted to by the GPU and then read on the host. Will always
// be mappable memory, and will prefer cached memory.
kTransfersFromGpuToCpu,
#endif
};
// DEPRECATED: Use and implement allocateImageMemory instead

View File

@ -146,38 +146,6 @@ VkResult GrVkAMDMemoryAllocator::allocateBufferMemory(VkBuffer buffer, BufferUsa
info.pUserData = nullptr;
switch (usage) {
#ifdef SK_USE_LEGACY_VK_ALLOCATOR_USAGE_NAMES
case BufferUsage::kGpuOnly:
info.requiredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
info.preferredFlags = 0;
break;
case BufferUsage::kCpuOnly:
info.requiredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
info.preferredFlags = VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
break;
case BufferUsage::kCpuWritesGpuReads:
// When doing cpu writes and gpu reads the general rule of thumb is to use coherent
// memory. Though this depends on the fact that we are not doing any cpu reads and the
// cpu writes are sequential. For sparse writes we'd want cpu cached memory, however we
// don't do these types of writes in Skia.
//
// TODO: In the future there may be times where specific types of memory could benefit
// from a coherent and cached memory. Typically these allow for the gpu to read cpu
// writes from the cache without needing to flush the writes throughout the cache. The
// reverse is not true and GPU writes tend to invalidate the cache regardless. Also
// these gpu cache read access are typically lower bandwidth than non-cached memory.
// For now Skia doesn't really have a need or want of this type of memory. But if we
// ever do we could pass in an AllocationPropertyFlag that requests the cached property.
info.requiredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
info.preferredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
break;
case BufferUsage::kGpuWritesCpuReads:
info.requiredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
info.preferredFlags = VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
break;
#else
case BufferUsage::kGpuOnly:
info.requiredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
info.preferredFlags = 0;
@ -207,7 +175,6 @@ VkResult GrVkAMDMemoryAllocator::allocateBufferMemory(VkBuffer buffer, BufferUsa
info.requiredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
info.preferredFlags = VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
break;
#endif
}
if (fMustUseCoherentHostVisibleMemory &&

View File

@ -111,11 +111,7 @@ sk_sp<GrVkBuffer> GrVkBuffer::Make(GrVkGpu* gpu,
break;
case GrGpuBufferType::kXferGpuToCpu:
bufInfo.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT;
#ifdef SK_USE_LEGACY_VK_ALLOCATOR_USAGE_NAMES
allocUsage = BufferUsage::kGpuWritesCpuReads;
#else
allocUsage = BufferUsage::kTransfersFromGpuToCpu;
#endif
break;
}
// We may not always get a mappable buffer for non dynamic access buffers. Thus we set the