1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[dxvk] Replace VK_KHR_buffer_device_address with core feature

This commit is contained in:
Philip Rebohle 2022-07-14 19:59:20 +02:00
parent 0b47297b7d
commit afdaba6caf
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
5 changed files with 9 additions and 26 deletions

View File

@ -2500,7 +2500,7 @@ namespace dxvk {
case D3D11_VK_NVX_BINARY_IMPORT: case D3D11_VK_NVX_BINARY_IMPORT:
return deviceExtensions.nvxBinaryImport return deviceExtensions.nvxBinaryImport
&& deviceExtensions.khrBufferDeviceAddress; && deviceFeatures.vk12.bufferDeviceAddress;
default: default:
return false; return false;
@ -2659,9 +2659,10 @@ namespace dxvk {
const DxvkBufferSliceHandle bufSliceHandle = buffer->GetBuffer()->getSliceHandle(); const DxvkBufferSliceHandle bufSliceHandle = buffer->GetBuffer()->getSliceHandle();
VkBuffer vkBuffer = bufSliceHandle.handle; VkBuffer vkBuffer = bufSliceHandle.handle;
VkBufferDeviceAddressInfoKHR bdaInfo = { VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_KHR }; VkBufferDeviceAddressInfo bdaInfo = { VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO };
bdaInfo.buffer = vkBuffer; bdaInfo.buffer = vkBuffer;
VkDeviceAddress bufAddr = dxvkDevice->vkd()->vkGetBufferDeviceAddressKHR(vkDevice, &bdaInfo);
VkDeviceAddress bufAddr = dxvkDevice->vkd()->vkGetBufferDeviceAddress(vkDevice, &bdaInfo);
*gpuVAStart = uint64_t(bufAddr) + bufSliceHandle.offset; *gpuVAStart = uint64_t(bufAddr) + bufSliceHandle.offset;
*gpuVASize = bufSliceHandle.length; *gpuVASize = bufSliceHandle.length;
} }

View File

@ -283,7 +283,7 @@ namespace dxvk {
DxvkDeviceFeatures enabledFeatures) { DxvkDeviceFeatures enabledFeatures) {
DxvkDeviceExtensions devExtensions; DxvkDeviceExtensions devExtensions;
std::array<DxvkExt*, 32> devExtensionList = {{ std::array<DxvkExt*, 31> devExtensionList = {{
&devExtensions.amdMemoryOverallocationBehaviour, &devExtensions.amdMemoryOverallocationBehaviour,
&devExtensions.amdShaderFragmentMask, &devExtensions.amdShaderFragmentMask,
&devExtensions.ext4444Formats, &devExtensions.ext4444Formats,
@ -304,7 +304,6 @@ namespace dxvk {
&devExtensions.extShaderViewportIndexLayer, &devExtensions.extShaderViewportIndexLayer,
&devExtensions.extTransformFeedback, &devExtensions.extTransformFeedback,
&devExtensions.extVertexAttributeDivisor, &devExtensions.extVertexAttributeDivisor,
&devExtensions.khrBufferDeviceAddress,
&devExtensions.khrCreateRenderPass2, &devExtensions.khrCreateRenderPass2,
&devExtensions.khrDepthStencilResolve, &devExtensions.khrDepthStencilResolve,
&devExtensions.khrDriverProperties, &devExtensions.khrDriverProperties,
@ -324,14 +323,13 @@ namespace dxvk {
bool enableCudaInterop = !env::is32BitHostPlatform() && bool enableCudaInterop = !env::is32BitHostPlatform() &&
m_deviceExtensions.supports(devExtensions.nvxBinaryImport.name()) && m_deviceExtensions.supports(devExtensions.nvxBinaryImport.name()) &&
m_deviceExtensions.supports(devExtensions.nvxImageViewHandle.name()) && m_deviceExtensions.supports(devExtensions.nvxImageViewHandle.name()) &&
m_deviceFeatures.khrBufferDeviceAddress.bufferDeviceAddress; m_deviceFeatures.vk12.bufferDeviceAddress;
if (enableCudaInterop) { if (enableCudaInterop) {
devExtensions.nvxBinaryImport.setMode(DxvkExtMode::Optional); devExtensions.nvxBinaryImport.setMode(DxvkExtMode::Optional);
devExtensions.nvxImageViewHandle.setMode(DxvkExtMode::Optional); devExtensions.nvxImageViewHandle.setMode(DxvkExtMode::Optional);
devExtensions.khrBufferDeviceAddress.setMode(DxvkExtMode::Optional);
enabledFeatures.khrBufferDeviceAddress.bufferDeviceAddress = VK_TRUE; enabledFeatures.vk12.bufferDeviceAddress = VK_TRUE;
} }
DxvkNameSet extensionsEnabled; DxvkNameSet extensionsEnabled;
@ -513,14 +511,10 @@ namespace dxvk {
// that in advance since the extensions are reported as supported anyway. // that in advance since the extensions are reported as supported anyway.
Logger::err("DxvkAdapter: Failed to create device, retrying without CUDA interop extensions"); Logger::err("DxvkAdapter: Failed to create device, retrying without CUDA interop extensions");
extensionsEnabled.disableExtension(devExtensions.khrBufferDeviceAddress);
extensionsEnabled.disableExtension(devExtensions.nvxBinaryImport); extensionsEnabled.disableExtension(devExtensions.nvxBinaryImport);
extensionsEnabled.disableExtension(devExtensions.nvxImageViewHandle); extensionsEnabled.disableExtension(devExtensions.nvxImageViewHandle);
enabledFeatures.khrBufferDeviceAddress.bufferDeviceAddress = VK_FALSE; enabledFeatures.vk12.bufferDeviceAddress = VK_FALSE;
vk::removeStructFromPNextChain(&enabledFeatures.core.pNext,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR);
extensionNameList = extensionsEnabled.toNameList(); extensionNameList = extensionsEnabled.toNameList();
info.enabledExtensionCount = extensionNameList.count(); info.enabledExtensionCount = extensionNameList.count();
@ -782,11 +776,6 @@ namespace dxvk {
m_deviceFeatures.extVertexAttributeDivisor.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extVertexAttributeDivisor); m_deviceFeatures.extVertexAttributeDivisor.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extVertexAttributeDivisor);
} }
if (m_deviceExtensions.supports(VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME)) {
m_deviceFeatures.khrBufferDeviceAddress.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR;
m_deviceFeatures.khrBufferDeviceAddress.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.khrBufferDeviceAddress);
}
if (m_deviceExtensions.supports(VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME)) { 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.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES_KHR;
m_deviceFeatures.khrDynamicRendering.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.khrDynamicRendering); m_deviceFeatures.khrDynamicRendering.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.khrDynamicRendering);
@ -900,8 +889,6 @@ namespace dxvk {
"\n", VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME, "\n", VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME,
"\n vertexAttributeInstanceRateDivisor : ", features.extVertexAttributeDivisor.vertexAttributeInstanceRateDivisor ? "1" : "0", "\n vertexAttributeInstanceRateDivisor : ", features.extVertexAttributeDivisor.vertexAttributeInstanceRateDivisor ? "1" : "0",
"\n vertexAttributeInstanceRateZeroDivisor : ", features.extVertexAttributeDivisor.vertexAttributeInstanceRateZeroDivisor ? "1" : "0", "\n vertexAttributeInstanceRateZeroDivisor : ", features.extVertexAttributeDivisor.vertexAttributeInstanceRateZeroDivisor ? "1" : "0",
"\n", VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME,
"\n bufferDeviceAddress : ", features.khrBufferDeviceAddress.bufferDeviceAddress ? "1" : "0",
"\n", VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME, "\n", VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME,
"\n dynamicRendering : ", features.khrDynamicRendering.dynamicRendering ? "1" : "0")); "\n dynamicRendering : ", features.khrDynamicRendering.dynamicRendering ? "1" : "0"));
} }

View File

@ -52,7 +52,6 @@ namespace dxvk {
VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT extShaderModuleIdentifier; VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT extShaderModuleIdentifier;
VkPhysicalDeviceTransformFeedbackFeaturesEXT extTransformFeedback; VkPhysicalDeviceTransformFeedbackFeaturesEXT extTransformFeedback;
VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT extVertexAttributeDivisor; VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT extVertexAttributeDivisor;
VkPhysicalDeviceBufferDeviceAddressFeaturesKHR khrBufferDeviceAddress;
VkPhysicalDeviceDynamicRenderingFeaturesKHR khrDynamicRendering; VkPhysicalDeviceDynamicRenderingFeaturesKHR khrDynamicRendering;
}; };

View File

@ -296,7 +296,6 @@ namespace dxvk {
DxvkExt extShaderViewportIndexLayer = { VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt extShaderViewportIndexLayer = { VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME, DxvkExtMode::Optional };
DxvkExt extTransformFeedback = { VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt extTransformFeedback = { VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME, DxvkExtMode::Optional };
DxvkExt extVertexAttributeDivisor = { VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME, DxvkExtMode::Optional }; 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::Required }; DxvkExt khrCreateRenderPass2 = { VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME, DxvkExtMode::Required };
DxvkExt khrDepthStencilResolve = { VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME, DxvkExtMode::Required }; DxvkExt khrDepthStencilResolve = { VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME, DxvkExtMode::Required };
DxvkExt khrDriverProperties = { VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt khrDriverProperties = { VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME, DxvkExtMode::Optional };

View File

@ -245,6 +245,7 @@ namespace dxvk::vk {
VULKAN_FN(vkDestroyDescriptorUpdateTemplate); VULKAN_FN(vkDestroyDescriptorUpdateTemplate);
VULKAN_FN(vkUpdateDescriptorSetWithTemplate); VULKAN_FN(vkUpdateDescriptorSetWithTemplate);
VULKAN_FN(vkResetQueryPool); VULKAN_FN(vkResetQueryPool);
VULKAN_FN(vkGetBufferDeviceAddress);
VULKAN_FN(vkCmdBindPipeline); VULKAN_FN(vkCmdBindPipeline);
VULKAN_FN(vkCmdSetViewport); VULKAN_FN(vkCmdSetViewport);
VULKAN_FN(vkCmdSetScissor); VULKAN_FN(vkCmdSetScissor);
@ -360,10 +361,6 @@ namespace dxvk::vk {
VULKAN_FN(vkCmdCuLaunchKernelNVX); VULKAN_FN(vkCmdCuLaunchKernelNVX);
#endif #endif
#ifdef VK_KHR_buffer_device_address
VULKAN_FN(vkGetBufferDeviceAddressKHR);
#endif
#ifdef VK_KHR_dynamic_rendering #ifdef VK_KHR_dynamic_rendering
VULKAN_FN(vkCmdBeginRenderingKHR); VULKAN_FN(vkCmdBeginRenderingKHR);
VULKAN_FN(vkCmdEndRenderingKHR); VULKAN_FN(vkCmdEndRenderingKHR);