From 60145f0167acfb2fa3ec3dae8ec9f909f3c5b782 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 16 Jan 2020 20:10:37 +0100 Subject: [PATCH] [dxvk] Don't enable VK_KHR_dedicated_allocation, VK_KHR_get_memory_requirements2 Core in Vulkan 1.1. --- src/dxvk/dxvk_adapter.cpp | 4 +--- src/dxvk/dxvk_buffer.cpp | 18 +++++++++--------- src/dxvk/dxvk_extensions.h | 2 -- src/dxvk/dxvk_image.cpp | 18 +++++++++--------- src/dxvk/dxvk_memory.cpp | 8 ++++---- src/dxvk/dxvk_memory.h | 8 ++++---- src/vulkan/vulkan_loader.h | 8 +++----- 7 files changed, 30 insertions(+), 36 deletions(-) diff --git a/src/dxvk/dxvk_adapter.cpp b/src/dxvk/dxvk_adapter.cpp index 0d788ed6d..d5bd4a009 100644 --- a/src/dxvk/dxvk_adapter.cpp +++ b/src/dxvk/dxvk_adapter.cpp @@ -241,7 +241,7 @@ namespace dxvk { DxvkDeviceFeatures enabledFeatures) { DxvkDeviceExtensions devExtensions; - std::array devExtensionList = {{ + std::array devExtensionList = {{ &devExtensions.amdMemoryOverallocationBehaviour, &devExtensions.amdShaderFragmentMask, &devExtensions.extConditionalRendering, @@ -256,12 +256,10 @@ namespace dxvk { &devExtensions.extTransformFeedback, &devExtensions.extVertexAttributeDivisor, &devExtensions.khrCreateRenderPass2, - &devExtensions.khrDedicatedAllocation, &devExtensions.khrDepthStencilResolve, &devExtensions.khrDescriptorUpdateTemplate, &devExtensions.khrDrawIndirectCount, &devExtensions.khrDriverProperties, - &devExtensions.khrGetMemoryRequirements2, &devExtensions.khrImageFormatList, &devExtensions.khrMaintenance1, &devExtensions.khrMaintenance2, diff --git a/src/dxvk/dxvk_buffer.cpp b/src/dxvk/dxvk_buffer.cpp index 17f4a53bc..9d07e06cf 100644 --- a/src/dxvk/dxvk_buffer.cpp +++ b/src/dxvk/dxvk_buffer.cpp @@ -74,28 +74,28 @@ namespace dxvk { "\n usage: ", info.usage)); } - VkMemoryDedicatedRequirementsKHR dedicatedRequirements; - dedicatedRequirements.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR; + VkMemoryDedicatedRequirements dedicatedRequirements; + dedicatedRequirements.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS; dedicatedRequirements.pNext = VK_NULL_HANDLE; dedicatedRequirements.prefersDedicatedAllocation = VK_FALSE; dedicatedRequirements.requiresDedicatedAllocation = VK_FALSE; - VkMemoryRequirements2KHR memReq; - memReq.sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR; + VkMemoryRequirements2 memReq; + memReq.sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2; memReq.pNext = &dedicatedRequirements; - VkBufferMemoryRequirementsInfo2KHR memReqInfo; - memReqInfo.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR; + VkBufferMemoryRequirementsInfo2 memReqInfo; + memReqInfo.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2; memReqInfo.buffer = handle.buffer; memReqInfo.pNext = VK_NULL_HANDLE; - VkMemoryDedicatedAllocateInfoKHR dedMemoryAllocInfo; - dedMemoryAllocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR; + VkMemoryDedicatedAllocateInfo dedMemoryAllocInfo; + dedMemoryAllocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO; dedMemoryAllocInfo.pNext = VK_NULL_HANDLE; dedMemoryAllocInfo.buffer = handle.buffer; dedMemoryAllocInfo.image = VK_NULL_HANDLE; - vkd->vkGetBufferMemoryRequirements2KHR( + vkd->vkGetBufferMemoryRequirements2( vkd->device(), &memReqInfo, &memReq); // Use high memory priority for GPU-writable resources diff --git a/src/dxvk/dxvk_extensions.h b/src/dxvk/dxvk_extensions.h index ecc0f7b21..0db0c58e5 100644 --- a/src/dxvk/dxvk_extensions.h +++ b/src/dxvk/dxvk_extensions.h @@ -272,12 +272,10 @@ namespace dxvk { DxvkExt extTransformFeedback = { VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt extVertexAttributeDivisor = { VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt khrCreateRenderPass2 = { VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME, DxvkExtMode::Optional }; - DxvkExt khrDedicatedAllocation = { VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME, DxvkExtMode::Required }; DxvkExt khrDepthStencilResolve = { VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt khrDescriptorUpdateTemplate = { VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME, DxvkExtMode::Required }; DxvkExt khrDrawIndirectCount = { VK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt khrDriverProperties = { VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME, DxvkExtMode::Optional }; - DxvkExt khrGetMemoryRequirements2 = { VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME, DxvkExtMode::Required }; DxvkExt khrImageFormatList = { VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME, DxvkExtMode::Required }; DxvkExt khrMaintenance1 = { VK_KHR_MAINTENANCE1_EXTENSION_NAME, DxvkExtMode::Required }; DxvkExt khrMaintenance2 = { VK_KHR_MAINTENANCE2_EXTENSION_NAME, DxvkExtMode::Required }; diff --git a/src/dxvk/dxvk_image.cpp b/src/dxvk/dxvk_image.cpp index 7dda7805b..af8ca3b55 100644 --- a/src/dxvk/dxvk_image.cpp +++ b/src/dxvk/dxvk_image.cpp @@ -60,28 +60,28 @@ namespace dxvk { // alignment on non-linear images in order not to violate the // bufferImageGranularity limit, which may be greater than the // required resource memory alignment on some GPUs. - VkMemoryDedicatedRequirementsKHR dedicatedRequirements; - dedicatedRequirements.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR; + VkMemoryDedicatedRequirements dedicatedRequirements; + dedicatedRequirements.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS; dedicatedRequirements.pNext = VK_NULL_HANDLE; dedicatedRequirements.prefersDedicatedAllocation = VK_FALSE; dedicatedRequirements.requiresDedicatedAllocation = VK_FALSE; - VkMemoryRequirements2KHR memReq; - memReq.sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR; + VkMemoryRequirements2 memReq; + memReq.sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2; memReq.pNext = &dedicatedRequirements; - VkImageMemoryRequirementsInfo2KHR memReqInfo; - memReqInfo.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR; + VkImageMemoryRequirementsInfo2 memReqInfo; + memReqInfo.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2; memReqInfo.image = m_image.image; memReqInfo.pNext = VK_NULL_HANDLE; - VkMemoryDedicatedAllocateInfoKHR dedMemoryAllocInfo; - dedMemoryAllocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR; + VkMemoryDedicatedAllocateInfo dedMemoryAllocInfo; + dedMemoryAllocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO; dedMemoryAllocInfo.pNext = VK_NULL_HANDLE; dedMemoryAllocInfo.buffer = VK_NULL_HANDLE; dedMemoryAllocInfo.image = m_image.image; - m_vkd->vkGetImageMemoryRequirements2KHR( + m_vkd->vkGetImageMemoryRequirements2( m_vkd->device(), &memReqInfo, &memReq); if (info.tiling != VK_IMAGE_TILING_LINEAR) { diff --git a/src/dxvk/dxvk_memory.cpp b/src/dxvk/dxvk_memory.cpp index 52fee77e3..3ebe5f0e8 100644 --- a/src/dxvk/dxvk_memory.cpp +++ b/src/dxvk/dxvk_memory.cpp @@ -180,7 +180,7 @@ namespace dxvk { DxvkMemory DxvkMemoryAllocator::alloc( const VkMemoryRequirements* req, const VkMemoryDedicatedRequirements& dedAllocReq, - const VkMemoryDedicatedAllocateInfoKHR& dedAllocInfo, + const VkMemoryDedicatedAllocateInfo& dedAllocInfo, VkMemoryPropertyFlags flags, float priority) { std::lock_guard lock(m_mutex); @@ -234,7 +234,7 @@ namespace dxvk { DxvkMemory DxvkMemoryAllocator::tryAlloc( const VkMemoryRequirements* req, - const VkMemoryDedicatedAllocateInfoKHR* dedAllocInfo, + const VkMemoryDedicatedAllocateInfo* dedAllocInfo, VkMemoryPropertyFlags flags, float priority) { DxvkMemory result; @@ -259,7 +259,7 @@ namespace dxvk { VkDeviceSize size, VkDeviceSize align, float priority, - const VkMemoryDedicatedAllocateInfoKHR* dedAllocInfo) { + const VkMemoryDedicatedAllocateInfo* dedAllocInfo) { // Prevent unnecessary external host memory fragmentation bool isDeviceLocal = (flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) != 0; @@ -305,7 +305,7 @@ namespace dxvk { VkMemoryPropertyFlags flags, VkDeviceSize size, float priority, - const VkMemoryDedicatedAllocateInfoKHR* dedAllocInfo) { + const VkMemoryDedicatedAllocateInfo* dedAllocInfo) { bool useMemoryPriority = (flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) && (m_device->features().extMemoryPriority.memoryPriority); diff --git a/src/dxvk/dxvk_memory.h b/src/dxvk/dxvk_memory.h index 8d365b480..8034c361f 100644 --- a/src/dxvk/dxvk_memory.h +++ b/src/dxvk/dxvk_memory.h @@ -258,7 +258,7 @@ namespace dxvk { DxvkMemory alloc( const VkMemoryRequirements* req, const VkMemoryDedicatedRequirements& dedAllocReq, - const VkMemoryDedicatedAllocateInfoKHR& dedAllocInfo, + const VkMemoryDedicatedAllocateInfo& dedAllocInfo, VkMemoryPropertyFlags flags, float priority); @@ -287,7 +287,7 @@ namespace dxvk { DxvkMemory tryAlloc( const VkMemoryRequirements* req, - const VkMemoryDedicatedAllocateInfoKHR* dedAllocInfo, + const VkMemoryDedicatedAllocateInfo* dedAllocInfo, VkMemoryPropertyFlags flags, float priority); @@ -297,14 +297,14 @@ namespace dxvk { VkDeviceSize size, VkDeviceSize align, float priority, - const VkMemoryDedicatedAllocateInfoKHR* dedAllocInfo); + const VkMemoryDedicatedAllocateInfo* dedAllocInfo); DxvkDeviceMemory tryAllocDeviceMemory( DxvkMemoryType* type, VkMemoryPropertyFlags flags, VkDeviceSize size, float priority, - const VkMemoryDedicatedAllocateInfoKHR* dedAllocInfo); + const VkMemoryDedicatedAllocateInfo* dedAllocInfo); void free( const DxvkMemory& memory); diff --git a/src/vulkan/vulkan_loader.h b/src/vulkan/vulkan_loader.h index 46a5f41bd..ad0ca05b2 100644 --- a/src/vulkan/vulkan_loader.h +++ b/src/vulkan/vulkan_loader.h @@ -167,8 +167,11 @@ namespace dxvk::vk { VULKAN_FN(vkBindBufferMemory); VULKAN_FN(vkBindImageMemory); VULKAN_FN(vkGetBufferMemoryRequirements); + VULKAN_FN(vkGetBufferMemoryRequirements2); VULKAN_FN(vkGetImageMemoryRequirements); + VULKAN_FN(vkGetImageMemoryRequirements2); VULKAN_FN(vkGetImageSparseMemoryRequirements); + VULKAN_FN(vkGetImageSparseMemoryRequirements2); VULKAN_FN(vkQueueBindSparse); VULKAN_FN(vkCreateFence); VULKAN_FN(vkDestroyFence); @@ -300,11 +303,6 @@ namespace dxvk::vk { VULKAN_FN(vkQueuePresentKHR); #endif - #ifdef VK_KHR_get_memory_requirements2 - VULKAN_FN(vkGetBufferMemoryRequirements2KHR); - VULKAN_FN(vkGetImageMemoryRequirements2KHR); - #endif - #ifdef VK_EXT_conditional_rendering VULKAN_FN(vkCmdBeginConditionalRenderingEXT); VULKAN_FN(vkCmdEndConditionalRenderingEXT);