Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsx: Minor tweaks #5922

Merged
merged 2 commits into from May 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions rpcs3/Emu/RSX/GL/GLTextureCache.h
Expand Up @@ -299,6 +299,7 @@ namespace gl

pixel_pack_settings pack_settings;
pack_settings.alignment(1);
pack_settings.swap_bytes(pack_unpack_swap_bytes);

target_texture->copy_to(nullptr, format, type, pack_settings);
real_pitch = target_texture->pitch();
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/RSX/VK/VKCompute.h
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/RSX/VK/VKFragmentProgram.cpp
Expand Up @@ -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);
}
Expand Down
15 changes: 13 additions & 2 deletions rpcs3/Emu/RSX/VK/VKGSRender.cpp
Expand Up @@ -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()))
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions rpcs3/Emu/RSX/VK/VKHelpers.cpp
Expand Up @@ -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);
}
Expand Down
40 changes: 39 additions & 1 deletion rpcs3/Emu/RSX/VK/VKHelpers.h
Expand Up @@ -78,7 +78,8 @@ namespace vk
unknown,
AMD,
NVIDIA,
RADV
RADV,
INTEL
};

class context;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -1627,6 +1633,11 @@ namespace vk
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;
Expand Down Expand Up @@ -1972,6 +1983,8 @@ namespace vk
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
{
Expand Down Expand Up @@ -2003,6 +2016,26 @@ namespace vk

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()
Expand Down Expand Up @@ -2165,6 +2198,11 @@ namespace vk
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);
Expand Down