Merge pull request #8722 from unknownbrackets/vulkan-alloc

Allocate more samplers in Vulkan, other fixes
This commit is contained in:
Henrik Rydgård 2016-05-07 09:32:31 +02:00
commit 5309d825c1
2 changed files with 20 additions and 5 deletions

View File

@ -138,7 +138,7 @@ DrawEngineVulkan::DrawEngineVulkan(VulkanContext *vulkan)
VkDescriptorPoolSize dpTypes[2];
dpTypes[0].descriptorCount = 2048;
dpTypes[0].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
dpTypes[1].descriptorCount = 200;
dpTypes[1].descriptorCount = 512;
dpTypes[1].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
VkDescriptorPoolCreateInfo dp = { VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO };
@ -151,8 +151,18 @@ DrawEngineVulkan::DrawEngineVulkan(VulkanContext *vulkan)
// We are going to use one-shot descriptors in the initial implementation. Might look into caching them
// if creating and updating them turns out to be expensive.
for (int i = 0; i < 2; i++) {
VkResult res = vkCreateDescriptorPool(vulkan_->GetDevice(), &dp, nullptr, &frame_[i].descPool);
assert(VK_SUCCESS == res);
// If we run out of memory, try with less descriptors.
for (int tries = 0; tries < 3; ++tries) {
VkResult res = vkCreateDescriptorPool(vulkan_->GetDevice(), &dp, nullptr, &frame_[i].descPool);
if (res == VK_SUCCESS) {
break;
}
// Let's try to reduce the counts.
assert(res == VK_ERROR_OUT_OF_HOST_MEMORY || res == VK_ERROR_OUT_OF_DEVICE_MEMORY);
dpTypes[0].descriptorCount /= 2;
dpTypes[1].descriptorCount /= 2;
}
frame_[i].pushUBO = new VulkanPushBuffer(vulkan_, 8 * 1024 * 1024);
frame_[i].pushVertex = new VulkanPushBuffer(vulkan_, 2 * 1024 * 1024);
frame_[i].pushIndex = new VulkanPushBuffer(vulkan_, 1 * 1024 * 1024);

View File

@ -147,7 +147,12 @@ TextureCacheVulkan::TextureCacheVulkan(VulkanContext *vulkan)
TextureCacheVulkan::~TextureCacheVulkan() {
Clear(true);
allocator_->Destroy();
delete allocator_;
// 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_);
}
void TextureCacheVulkan::DownloadFramebufferForClut(u32 clutAddr, u32 bytes) {
@ -1087,7 +1092,7 @@ void TextureCacheVulkan::SetTexture(VulkanPushBuffer *uploadBuffer) {
}
}
if (match && (entry->status & TexCacheEntry::STATUS_TO_SCALE) && g_Config.iTexScalingLevel != 1 && texelsScaledThisFrame_ < TEXCACHE_MAX_TEXELS_SCALED) {
if (match && (entry->status & TexCacheEntry::STATUS_TO_SCALE) && standardScaleFactor_ != 1 && texelsScaledThisFrame_ < TEXCACHE_MAX_TEXELS_SCALED) {
if ((entry->status & TexCacheEntry::STATUS_CHANGE_FREQUENT) == 0) {
// INFO_LOG(G3D, "Reloading texture to do the scaling we skipped..");
match = false;