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>
diff --git a/include/gpu/vk/GrVkMemoryAllocator.h b/include/gpu/vk/GrVkMemoryAllocator.h
index 0e8af45..e3782db 100644
--- a/include/gpu/vk/GrVkMemoryAllocator.h
+++ b/include/gpu/vk/GrVkMemoryAllocator.h
@@ -35,23 +35,6 @@
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 @@
// 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
diff --git a/src/gpu/vk/GrVkAMDMemoryAllocator.cpp b/src/gpu/vk/GrVkAMDMemoryAllocator.cpp
index b611322..f6e87c1 100644
--- a/src/gpu/vk/GrVkAMDMemoryAllocator.cpp
+++ b/src/gpu/vk/GrVkAMDMemoryAllocator.cpp
@@ -146,38 +146,6 @@
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 @@
info.requiredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
info.preferredFlags = VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
break;
-#endif
}
if (fMustUseCoherentHostVisibleMemory &&
diff --git a/src/gpu/vk/GrVkBuffer.cpp b/src/gpu/vk/GrVkBuffer.cpp
index 08d0752..5727c4e 100644
--- a/src/gpu/vk/GrVkBuffer.cpp
+++ b/src/gpu/vk/GrVkBuffer.cpp
@@ -111,11 +111,7 @@
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