Remove the VulkanDeviceAllocator

This commit is contained in:
Henrik Rydgård committed 2021-11-22 18:54:09 +01:00
1 parent 1b1e585a35
commit c2f594cc73
5 files changed
+5 -472

No files matched your search

+2 -17
View File
@@ -204,17 +204,6 @@ void TextureCacheVulkan::DeviceLost() {
Clear(true);
if (allocator_) {
allocator_->Destroy();
// We have to delete on queue, so this can free its queued deletions.
vulkan->Delete().QueueCallback([](void *ptr) {
auto allocator = static_cast<VulkanDeviceAllocator *>(ptr);
delete allocator;
}, allocator_);
allocator_ = nullptr;
}
samplerCache_.DeviceLost();
if (samplerNearest_)
@@ -234,7 +223,6 @@ void TextureCacheVulkan::DeviceRestore(Draw::DrawContext *draw) {
_assert_(!allocator_);
allocator_ = new VulkanDeviceAllocator(vulkan, TEXCACHE_MIN_SLAB_SIZE, TEXCACHE_MAX_SLAB_SIZE);
samplerCache_.DeviceRestore(vulkan);
VkSamplerCreateInfo samp{ VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO };
@@ -341,15 +329,13 @@ void TextureCacheVulkan::StartFrame() {
// Since textures are 2D maybe we should square this, but might get too non-aggressive.
slabPressureLimit *= g_Config.iTexScalingLevel;
}
Decimate(allocator_->GetSlabCount() > slabPressureLimit);
Decimate(false); // TODO: Use some indication from VMA.
}
allocator_->Begin();
computeShaderManager_.BeginFrame();
}
void TextureCacheVulkan::EndFrame() {
allocator_->End();
computeShaderManager_.EndFrame();
if (texelsScaledThisFrame_) {
@@ -1058,8 +1044,7 @@ bool TextureCacheVulkan::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int leve
}
void TextureCacheVulkan::GetStats(char *ptr, size_t size) {
snprintf(ptr, size, "Alloc: %d slabs\nSlab min/max: %d/%d\nAlloc usage: %d%%",
allocator_->GetSlabCount(), allocator_->GetMinSlabSize(), allocator_->GetMaxSlabSize(), allocator_->ComputeUsagePercent());
snprintf(ptr, size, "N/A");
}
std::vector<std::string> TextureCacheVulkan::DebugGetSamplerIDs() const {