mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 12:42:41 +01:00
vk: Allow some drivers to bypass window polling if not needed
This commit is contained in:
parent
f246a8666a
commit
2bec304cca
@ -73,7 +73,7 @@ namespace vk
|
||||
switch (vk::get_driver_vendor())
|
||||
{
|
||||
case vk::driver_vendor::unknown:
|
||||
// Probably intel
|
||||
case vk::driver_vendor::INTEL:
|
||||
case vk::driver_vendor::NVIDIA:
|
||||
unroll_loops = true;
|
||||
optimal_group_size = 32;
|
||||
|
@ -235,7 +235,7 @@ void VKFragmentDecompilerThread::insertGlobalFunctions(std::stringstream &OS)
|
||||
properties2.require_wpos = properties.has_wpos_input;
|
||||
properties2.require_texture_ops = properties.has_tex_op;
|
||||
properties2.emulate_shadow_compare = device_props.emulate_depth_compare;
|
||||
properties2.low_precision_tests = vk::get_current_renderer()->gpu().get_driver_vendor() == vk::driver_vendor::NVIDIA;
|
||||
properties2.low_precision_tests = vk::get_driver_vendor() == vk::driver_vendor::NVIDIA;
|
||||
|
||||
glsl::insert_glsl_legacy_function(OS, properties2);
|
||||
}
|
||||
|
@ -1067,6 +1067,13 @@ void VKGSRender::check_descriptors()
|
||||
|
||||
void VKGSRender::check_window_status()
|
||||
{
|
||||
if (m_swapchain->supports_automatic_wm_reports())
|
||||
{
|
||||
// This driver will report window events as VK_ERROR_OUT_OF_DATE_KHR
|
||||
m_frame->clear_wm_events();
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
if (LIKELY(!m_frame->has_wm_events()))
|
||||
@ -2032,8 +2039,11 @@ void VKGSRender::on_init_thread()
|
||||
m_frame->enable_wm_event_queue();
|
||||
|
||||
#ifdef _WIN32
|
||||
// On windows switching to fullscreen is done by the renderer, not the UI
|
||||
m_frame->disable_wm_fullscreen();
|
||||
if (!m_swapchain->supports_automatic_wm_reports())
|
||||
{
|
||||
// If the renderer does not handle WM events itself, switching to fullscreen is done by the renderer, not the UI
|
||||
m_frame->disable_wm_fullscreen();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -2355,6 +2365,7 @@ void VKGSRender::present(frame_context_t *ctx)
|
||||
switch (VkResult error = m_swapchain->present(ctx->present_image))
|
||||
{
|
||||
case VK_SUCCESS:
|
||||
break;
|
||||
case VK_SUBOPTIMAL_KHR:
|
||||
break;
|
||||
case VK_ERROR_OUT_OF_DATE_KHR:
|
||||
|
@ -313,6 +313,7 @@ namespace vk
|
||||
// Nvidia cards are easily susceptible to NaN poisoning
|
||||
g_drv_sanitize_fp_values = true;
|
||||
break;
|
||||
case driver_vendor::INTEL:
|
||||
default:
|
||||
LOG_WARNING(RSX, "Unsupported device: %s", gpu_name);
|
||||
}
|
||||
|
@ -78,7 +78,8 @@ namespace vk
|
||||
unknown,
|
||||
AMD,
|
||||
NVIDIA,
|
||||
RADV
|
||||
RADV,
|
||||
INTEL
|
||||
};
|
||||
|
||||
class context;
|
||||
@ -448,6 +449,11 @@ namespace vk
|
||||
return driver_vendor::RADV;
|
||||
}
|
||||
|
||||
if (gpu_name.find("Intel") != std::string::npos)
|
||||
{
|
||||
return driver_vendor::INTEL;
|
||||
}
|
||||
|
||||
return driver_vendor::unknown;
|
||||
}
|
||||
|
||||
@ -1627,6 +1633,11 @@ public:
|
||||
virtual VkResult present(u32 index) = 0;
|
||||
virtual VkImageLayout get_optimal_present_layout() = 0;
|
||||
|
||||
virtual bool supports_automatic_wm_reports() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool init(u32 w, u32 h)
|
||||
{
|
||||
m_width = w;
|
||||
@ -1972,6 +1983,8 @@ public:
|
||||
PFN_vkAcquireNextImageKHR acquireNextImageKHR = nullptr;
|
||||
PFN_vkQueuePresentKHR queuePresentKHR = nullptr;
|
||||
|
||||
bool m_wm_reports_flag = false;
|
||||
|
||||
protected:
|
||||
void init_swapchain_images(render_device& dev, u32 /*preferred_count*/ = 0) override
|
||||
{
|
||||
@ -2003,6 +2016,26 @@ public:
|
||||
|
||||
m_surface = surface;
|
||||
m_color_space = color_space;
|
||||
|
||||
switch (gpu.get_driver_vendor())
|
||||
{
|
||||
case driver_vendor::NVIDIA:
|
||||
#ifndef _WIN32
|
||||
m_wm_reports_flag = true;
|
||||
#endif
|
||||
break;
|
||||
case driver_vendor::AMD:
|
||||
#ifdef _WIN32
|
||||
break;
|
||||
#endif
|
||||
case driver_vendor::INTEL:
|
||||
// Untested
|
||||
case driver_vendor::RADV:
|
||||
m_wm_reports_flag = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
~swapchain_WSI()
|
||||
@ -2165,6 +2198,11 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool supports_automatic_wm_reports() const override
|
||||
{
|
||||
return m_wm_reports_flag;
|
||||
}
|
||||
|
||||
VkResult acquire_next_swapchain_image(VkSemaphore semaphore, u64 timeout, u32* result) override
|
||||
{
|
||||
return vkAcquireNextImageKHR(dev, m_vk_swapchain, timeout, semaphore, VK_NULL_HANDLE, result);
|
||||
|
Loading…
Reference in New Issue
Block a user