aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/renderer_vulkan/vk_device.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-05-04 16:41:19 -0300
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-05-04 20:49:23 -0300
commitaa86309d1548a5e33c66ad4f96557f179ff43d96 (patch)
tree02012403a62f080c9f5844526b80ca1d03551eb2 /src/video_core/renderer_vulkan/vk_device.cpp
parent151b3e562227d173eb89cb61b4f59c8d29a400b6 (diff)
vk_sampler_cache: Use VK_EXT_custom_border_color when available
This should fix grass interactions on Breath of the Wild on Vulkan. It is currently untested against validation layers. Nvidia's Windows 443.09 beta driver or Linux 440.66.12 is required for now.
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_device.cpp')
-rw-r--r--src/video_core/renderer_vulkan/vk_device.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_device.cpp b/src/video_core/renderer_vulkan/vk_device.cpp
index 0e4bbca975..09ddfa59c8 100644
--- a/src/video_core/renderer_vulkan/vk_device.cpp
+++ b/src/video_core/renderer_vulkan/vk_device.cpp
@@ -293,6 +293,17 @@ bool VKDevice::Create() {
LOG_INFO(Render_Vulkan, "Device doesn't support transform feedbacks");
}
+ VkPhysicalDeviceCustomBorderColorFeaturesEXT custom_border;
+ if (ext_custom_border_color) {
+ custom_border.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT;
+ custom_border.pNext = nullptr;
+ custom_border.customBorderColors = VK_TRUE;
+ custom_border.customBorderColorWithoutFormat = VK_TRUE;
+ SetNext(next, custom_border);
+ } else {
+ LOG_INFO(Render_Vulkan, "Device doesn't support custom border colors");
+ }
+
if (!ext_depth_range_unrestricted) {
LOG_INFO(Render_Vulkan, "Device doesn't support depth range unrestricted");
}
@@ -520,6 +531,7 @@ std::vector<const char*> VKDevice::LoadExtensions() {
bool has_khr_shader_float16_int8{};
bool has_ext_subgroup_size_control{};
bool has_ext_transform_feedback{};
+ bool has_ext_custom_border_color{};
for (const auto& extension : physical.EnumerateDeviceExtensionProperties()) {
Test(extension, khr_uniform_buffer_standard_layout,
VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME, true);
@@ -534,6 +546,8 @@ std::vector<const char*> VKDevice::LoadExtensions() {
false);
Test(extension, has_ext_transform_feedback, VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME,
false);
+ Test(extension, has_ext_custom_border_color, VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME,
+ false);
if (Settings::values.renderer_debug) {
Test(extension, nv_device_diagnostics_config,
VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME, true);
@@ -606,6 +620,19 @@ std::vector<const char*> VKDevice::LoadExtensions() {
}
}
+ if (has_ext_custom_border_color) {
+ VkPhysicalDeviceCustomBorderColorFeaturesEXT border_features;
+ border_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT;
+ border_features.pNext = nullptr;
+ features.pNext = &border_features;
+ physical.GetFeatures2KHR(features);
+
+ if (border_features.customBorderColors && border_features.customBorderColorWithoutFormat) {
+ extensions.push_back(VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME);
+ ext_custom_border_color = true;
+ }
+ }
+
return extensions;
}