summaryrefslogtreecommitdiff
path: root/src/video_core/vulkan_common
diff options
context:
space:
mode:
authorGravatar Liam2022-12-02 16:47:33 -0500
committerGravatar Liam2022-12-04 10:55:13 -0500
commita948ab3e4846df49a8087d856c27a323800300c3 (patch)
tree697d3572c886356e6a140c8fea261a73c738df51 /src/video_core/vulkan_common
parentMerge pull request #9375 from jbeich/xbyak-no-install (diff)
downloadyuzu-a948ab3e4846df49a8087d856c27a323800300c3.tar.gz
yuzu-a948ab3e4846df49a8087d856c27a323800300c3.tar.xz
yuzu-a948ab3e4846df49a8087d856c27a323800300c3.zip
vulkan_common: promote timeline semaphore usage to core
Diffstat (limited to 'src/video_core/vulkan_common')
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp1
-rw-r--r--src/video_core/vulkan_common/vulkan_wrapper.cpp11
-rw-r--r--src/video_core/vulkan_common/vulkan_wrapper.h12
3 files changed, 15 insertions, 9 deletions
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp
index 652329c38..f4c1bd979 100644
--- a/src/video_core/vulkan_common/vulkan_device.cpp
+++ b/src/video_core/vulkan_common/vulkan_device.cpp
@@ -80,7 +80,6 @@ constexpr std::array REQUIRED_EXTENSIONS{
80 80
81 // Core in 1.2, but required due to use of extension methods, 81 // Core in 1.2, but required due to use of extension methods,
82 // and well-supported by drivers 82 // and well-supported by drivers
83 VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME,
84 VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME, 83 VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME,
85 VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME, 84 VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME,
86#ifdef _WIN32 85#ifdef _WIN32
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.cpp b/src/video_core/vulkan_common/vulkan_wrapper.cpp
index 2ad98dcfe..af79ffd61 100644
--- a/src/video_core/vulkan_common/vulkan_wrapper.cpp
+++ b/src/video_core/vulkan_common/vulkan_wrapper.cpp
@@ -180,7 +180,7 @@ void Load(VkDevice device, DeviceDispatch& dld) noexcept {
180 X(vkGetQueryPoolResults); 180 X(vkGetQueryPoolResults);
181 X(vkGetPipelineExecutablePropertiesKHR); 181 X(vkGetPipelineExecutablePropertiesKHR);
182 X(vkGetPipelineExecutableStatisticsKHR); 182 X(vkGetPipelineExecutableStatisticsKHR);
183 X(vkGetSemaphoreCounterValueKHR); 183 X(vkGetSemaphoreCounterValue);
184 X(vkMapMemory); 184 X(vkMapMemory);
185 X(vkQueueSubmit); 185 X(vkQueueSubmit);
186 X(vkResetFences); 186 X(vkResetFences);
@@ -191,7 +191,14 @@ void Load(VkDevice device, DeviceDispatch& dld) noexcept {
191 X(vkUpdateDescriptorSetWithTemplateKHR); 191 X(vkUpdateDescriptorSetWithTemplateKHR);
192 X(vkUpdateDescriptorSets); 192 X(vkUpdateDescriptorSets);
193 X(vkWaitForFences); 193 X(vkWaitForFences);
194 X(vkWaitSemaphoresKHR); 194 X(vkWaitSemaphores);
195
196 // Support for timeline semaphores is mandatory in Vulkan 1.2
197 if (!dld.vkGetSemaphoreCounterValue) {
198 Proc(dld.vkGetSemaphoreCounterValue, dld, "vkGetSemaphoreCounterValue", device);
199 Proc(dld.vkWaitForFences, dld, "vkWaitForFencesKHR", device);
200 Proc(dld.vkWaitSemaphores, dld, "vkWaitSemaphoresKHR", device);
201 }
195#undef X 202#undef X
196} 203}
197 204
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.h b/src/video_core/vulkan_common/vulkan_wrapper.h
index 1b3f493bd..fb6c59f60 100644
--- a/src/video_core/vulkan_common/vulkan_wrapper.h
+++ b/src/video_core/vulkan_common/vulkan_wrapper.h
@@ -297,7 +297,7 @@ struct DeviceDispatch : InstanceDispatch {
297 PFN_vkGetPipelineExecutablePropertiesKHR vkGetPipelineExecutablePropertiesKHR{}; 297 PFN_vkGetPipelineExecutablePropertiesKHR vkGetPipelineExecutablePropertiesKHR{};
298 PFN_vkGetPipelineExecutableStatisticsKHR vkGetPipelineExecutableStatisticsKHR{}; 298 PFN_vkGetPipelineExecutableStatisticsKHR vkGetPipelineExecutableStatisticsKHR{};
299 PFN_vkGetQueryPoolResults vkGetQueryPoolResults{}; 299 PFN_vkGetQueryPoolResults vkGetQueryPoolResults{};
300 PFN_vkGetSemaphoreCounterValueKHR vkGetSemaphoreCounterValueKHR{}; 300 PFN_vkGetSemaphoreCounterValue vkGetSemaphoreCounterValue{};
301 PFN_vkMapMemory vkMapMemory{}; 301 PFN_vkMapMemory vkMapMemory{};
302 PFN_vkQueueSubmit vkQueueSubmit{}; 302 PFN_vkQueueSubmit vkQueueSubmit{};
303 PFN_vkResetFences vkResetFences{}; 303 PFN_vkResetFences vkResetFences{};
@@ -308,7 +308,7 @@ struct DeviceDispatch : InstanceDispatch {
308 PFN_vkUpdateDescriptorSetWithTemplateKHR vkUpdateDescriptorSetWithTemplateKHR{}; 308 PFN_vkUpdateDescriptorSetWithTemplateKHR vkUpdateDescriptorSetWithTemplateKHR{};
309 PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets{}; 309 PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets{};
310 PFN_vkWaitForFences vkWaitForFences{}; 310 PFN_vkWaitForFences vkWaitForFences{};
311 PFN_vkWaitSemaphoresKHR vkWaitSemaphoresKHR{}; 311 PFN_vkWaitSemaphores vkWaitSemaphores{};
312}; 312};
313 313
314/// Loads instance agnostic function pointers. 314/// Loads instance agnostic function pointers.
@@ -766,7 +766,7 @@ public:
766 766
767 [[nodiscard]] u64 GetCounter() const { 767 [[nodiscard]] u64 GetCounter() const {
768 u64 value; 768 u64 value;
769 Check(dld->vkGetSemaphoreCounterValueKHR(owner, handle, &value)); 769 Check(dld->vkGetSemaphoreCounterValue(owner, handle, &value));
770 return value; 770 return value;
771 } 771 }
772 772
@@ -778,15 +778,15 @@ public:
778 * @return True on successful wait, false on timeout 778 * @return True on successful wait, false on timeout
779 */ 779 */
780 bool Wait(u64 value, u64 timeout = std::numeric_limits<u64>::max()) const { 780 bool Wait(u64 value, u64 timeout = std::numeric_limits<u64>::max()) const {
781 const VkSemaphoreWaitInfoKHR wait_info{ 781 const VkSemaphoreWaitInfo wait_info{
782 .sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO_KHR, 782 .sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO,
783 .pNext = nullptr, 783 .pNext = nullptr,
784 .flags = 0, 784 .flags = 0,
785 .semaphoreCount = 1, 785 .semaphoreCount = 1,
786 .pSemaphores = &handle, 786 .pSemaphores = &handle,
787 .pValues = &value, 787 .pValues = &value,
788 }; 788 };
789 const VkResult result = dld->vkWaitSemaphoresKHR(owner, &wait_info, timeout); 789 const VkResult result = dld->vkWaitSemaphores(owner, &wait_info, timeout);
790 switch (result) { 790 switch (result) {
791 case VK_SUCCESS: 791 case VK_SUCCESS:
792 return true; 792 return true;