Skip to content

Commit

Permalink
[dxvk] Enable and require VK_KHR_dynamic_rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
doitsujin committed Jul 7, 2022
1 parent 4a0a9d6 commit 38cf16a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
19 changes: 17 additions & 2 deletions src/dxvk/dxvk_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ namespace dxvk {
DxvkDeviceFeatures enabledFeatures) {
DxvkDeviceExtensions devExtensions;

std::array<DxvkExt*, 30> devExtensionList = {{
std::array<DxvkExt*, 31> devExtensionList = {{
&devExtensions.amdMemoryOverallocationBehaviour,
&devExtensions.amdShaderFragmentMask,
&devExtensions.ext4444Formats,
Expand All @@ -289,6 +289,7 @@ namespace dxvk {
&devExtensions.khrDepthStencilResolve,
&devExtensions.khrDrawIndirectCount,
&devExtensions.khrDriverProperties,
&devExtensions.khrDynamicRendering,
&devExtensions.khrExternalMemoryWin32,
&devExtensions.khrImageFormatList,
&devExtensions.khrSamplerMirrorClampToEdge,
Expand Down Expand Up @@ -334,6 +335,8 @@ namespace dxvk {

enabledFeatures.extRobustness2.nullDescriptor = VK_TRUE;

enabledFeatures.khrDynamicRendering.dynamicRendering = VK_TRUE;

Logger::info(str::format("Device properties:"
"\n Device name: : ", m_deviceInfo.core.properties.deviceName,
"\n Driver version : ",
Expand Down Expand Up @@ -412,6 +415,11 @@ namespace dxvk {
enabledFeatures.khrBufferDeviceAddress.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.khrBufferDeviceAddress);
}

if (devExtensions.khrDynamicRendering) {
enabledFeatures.khrDynamicRendering.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES_KHR;
enabledFeatures.khrDynamicRendering.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.khrDynamicRendering);
}

// Report the desired overallocation behaviour to the driver
VkDeviceMemoryOverallocationCreateInfoAMD overallocInfo;
overallocInfo.sType = VK_STRUCTURE_TYPE_DEVICE_MEMORY_OVERALLOCATION_CREATE_INFO_AMD;
Expand Down Expand Up @@ -722,6 +730,11 @@ namespace dxvk {
m_deviceFeatures.khrBufferDeviceAddress.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.khrBufferDeviceAddress);
}

if (m_deviceExtensions.supports(VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME)) {
m_deviceFeatures.khrDynamicRendering.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES_KHR;
m_deviceFeatures.khrDynamicRendering.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.khrDynamicRendering);
}

m_vki->vkGetPhysicalDeviceFeatures2(m_handle, &m_deviceFeatures.core);
}

Expand Down Expand Up @@ -817,7 +830,9 @@ namespace dxvk {
"\n vertexAttributeInstanceRateDivisor : ", features.extVertexAttributeDivisor.vertexAttributeInstanceRateDivisor ? "1" : "0",
"\n vertexAttributeInstanceRateZeroDivisor : ", features.extVertexAttributeDivisor.vertexAttributeInstanceRateZeroDivisor ? "1" : "0",
"\n", VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME,
"\n bufferDeviceAddress : ", features.khrBufferDeviceAddress.bufferDeviceAddress));
"\n bufferDeviceAddress : ", features.khrBufferDeviceAddress.bufferDeviceAddress ? "1" : "0",
"\n", VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME,
"\n dynamicRendering : ", features.khrDynamicRendering.dynamicRendering ? "1" : "0"));
}


Expand Down
1 change: 1 addition & 0 deletions src/dxvk/dxvk_device_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace dxvk {
VkPhysicalDeviceTransformFeedbackFeaturesEXT extTransformFeedback;
VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT extVertexAttributeDivisor;
VkPhysicalDeviceBufferDeviceAddressFeaturesKHR khrBufferDeviceAddress;
VkPhysicalDeviceDynamicRenderingFeaturesKHR khrDynamicRendering;
};

}
3 changes: 2 additions & 1 deletion src/dxvk/dxvk_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,10 @@ namespace dxvk {
DxvkExt extVertexAttributeDivisor = { VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME, DxvkExtMode::Optional };
DxvkExt khrBufferDeviceAddress = { VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME, DxvkExtMode::Disabled };
DxvkExt khrCreateRenderPass2 = { VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME, DxvkExtMode::Optional };
DxvkExt khrDepthStencilResolve = { VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME, DxvkExtMode::Optional };
DxvkExt khrDepthStencilResolve = { VK_KHR_DEPTH_STENCIL_RESOLVE_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 khrDynamicRendering = { VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME, DxvkExtMode::Required };
DxvkExt khrExternalMemoryWin32 = { VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME, DxvkExtMode::Optional };
DxvkExt khrImageFormatList = { VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME, DxvkExtMode::Required };
DxvkExt khrSamplerMirrorClampToEdge = { VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME, DxvkExtMode::Optional };
Expand Down
5 changes: 5 additions & 0 deletions src/vulkan/vulkan_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@ namespace dxvk::vk {
VULKAN_FN(vkGetBufferDeviceAddressKHR);
#endif

#ifdef VK_KHR_dynamic_rendering
VULKAN_FN(vkCmdBeginRenderingKHR);
VULKAN_FN(vkCmdEndRenderingKHR);
#endif

#ifdef VK_KHR_external_memory_win32
VULKAN_FN(vkGetMemoryWin32HandleKHR);
VULKAN_FN(vkGetMemoryWin32HandlePropertiesKHR);
Expand Down

0 comments on commit 38cf16a

Please sign in to comment.