1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-05 01:24:14 +01:00

[dxvk] Enable VK_EXT_memory_priority and features if available

This commit is contained in:
Philip Rebohle 2019-01-30 13:04:32 +01:00
parent e7bf1647dd
commit b884c56631
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
4 changed files with 20 additions and 1 deletions

View File

@ -1353,6 +1353,10 @@ namespace dxvk {
enabled.core.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR; enabled.core.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR;
enabled.core.pNext = nullptr; enabled.core.pNext = nullptr;
enabled.extMemoryPriority.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT;
enabled.extMemoryPriority.pNext = nullptr;
enabled.extMemoryPriority.memoryPriority = supported.extMemoryPriority.memoryPriority;
enabled.extTransformFeedback.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT; enabled.extTransformFeedback.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT;
enabled.extTransformFeedback.pNext = nullptr; enabled.extTransformFeedback.pNext = nullptr;

View File

@ -199,6 +199,8 @@ namespace dxvk {
|| !required.core.features.variableMultisampleRate) || !required.core.features.variableMultisampleRate)
&& (m_deviceFeatures.core.features.inheritedQueries && (m_deviceFeatures.core.features.inheritedQueries
|| !required.core.features.inheritedQueries) || !required.core.features.inheritedQueries)
&& (m_deviceFeatures.extMemoryPriority.memoryPriority
|| !required.extMemoryPriority.memoryPriority)
&& (m_deviceFeatures.extTransformFeedback.transformFeedback && (m_deviceFeatures.extTransformFeedback.transformFeedback
|| !required.extTransformFeedback.transformFeedback) || !required.extTransformFeedback.transformFeedback)
&& (m_deviceFeatures.extVertexAttributeDivisor.vertexAttributeInstanceRateDivisor && (m_deviceFeatures.extVertexAttributeDivisor.vertexAttributeInstanceRateDivisor
@ -216,8 +218,9 @@ namespace dxvk {
Rc<DxvkDevice> DxvkAdapter::createDevice(DxvkDeviceFeatures enabledFeatures) { Rc<DxvkDevice> DxvkAdapter::createDevice(DxvkDeviceFeatures enabledFeatures) {
DxvkDeviceExtensions devExtensions; DxvkDeviceExtensions devExtensions;
std::array<DxvkExt*, 14> devExtensionList = {{ std::array<DxvkExt*, 15> devExtensionList = {{
&devExtensions.amdMemoryOverallocationBehaviour, &devExtensions.amdMemoryOverallocationBehaviour,
&devExtensions.extMemoryPriority,
&devExtensions.extShaderViewportIndexLayer, &devExtensions.extShaderViewportIndexLayer,
&devExtensions.extTransformFeedback, &devExtensions.extTransformFeedback,
&devExtensions.extVertexAttributeDivisor, &devExtensions.extVertexAttributeDivisor,
@ -251,6 +254,11 @@ namespace dxvk {
// Create pNext chain for additional device features // Create pNext chain for additional device features
enabledFeatures.core.pNext = nullptr; enabledFeatures.core.pNext = nullptr;
if (devExtensions.extMemoryPriority) {
enabledFeatures.extMemoryPriority.pNext = enabledFeatures.core.pNext;
enabledFeatures.core.pNext = &enabledFeatures.extMemoryPriority;
}
if (devExtensions.extTransformFeedback) { if (devExtensions.extTransformFeedback) {
enabledFeatures.extTransformFeedback.pNext = enabledFeatures.core.pNext; enabledFeatures.extTransformFeedback.pNext = enabledFeatures.core.pNext;
enabledFeatures.core.pNext = &enabledFeatures.extTransformFeedback; enabledFeatures.core.pNext = &enabledFeatures.extTransformFeedback;
@ -442,6 +450,11 @@ namespace dxvk {
m_deviceFeatures.core.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR; m_deviceFeatures.core.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR;
m_deviceFeatures.core.pNext = nullptr; m_deviceFeatures.core.pNext = nullptr;
if (m_deviceExtensions.supports(VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME)) {
m_deviceFeatures.extMemoryPriority.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT;
m_deviceFeatures.extMemoryPriority.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extMemoryPriority);
}
if (m_deviceExtensions.supports(VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME)) { if (m_deviceExtensions.supports(VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME)) {
m_deviceFeatures.extTransformFeedback.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT; m_deviceFeatures.extTransformFeedback.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT;
m_deviceFeatures.extTransformFeedback.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extTransformFeedback); m_deviceFeatures.extTransformFeedback.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extTransformFeedback);

View File

@ -31,6 +31,7 @@ namespace dxvk {
*/ */
struct DxvkDeviceFeatures { struct DxvkDeviceFeatures {
VkPhysicalDeviceFeatures2KHR core; VkPhysicalDeviceFeatures2KHR core;
VkPhysicalDeviceMemoryPriorityFeaturesEXT extMemoryPriority;
VkPhysicalDeviceTransformFeedbackFeaturesEXT extTransformFeedback; VkPhysicalDeviceTransformFeedbackFeaturesEXT extTransformFeedback;
VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT extVertexAttributeDivisor; VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT extVertexAttributeDivisor;
}; };

View File

@ -258,6 +258,7 @@ namespace dxvk {
*/ */
struct DxvkDeviceExtensions { struct DxvkDeviceExtensions {
DxvkExt amdMemoryOverallocationBehaviour= { VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt amdMemoryOverallocationBehaviour= { VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_EXTENSION_NAME, DxvkExtMode::Optional };
DxvkExt extMemoryPriority = { VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME, DxvkExtMode::Optional };
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 };