mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-06 18:40:36 +00:00
vk: Add options to system configuration
This commit is contained in:
parent
48d0f80a86
commit
7d5a72c9e0
@ -8,13 +8,18 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#define WITH_CPU_SCHEDULER 1
|
|
||||||
|
|
||||||
namespace vk
|
namespace vk
|
||||||
{
|
{
|
||||||
void AsyncTaskScheduler::operator()()
|
void AsyncTaskScheduler::operator()()
|
||||||
{
|
{
|
||||||
#if WITH_CPU_SCHEDULER
|
if (!m_use_host_scheduler)
|
||||||
|
{
|
||||||
|
// No need to keep the GPU alive using a CPU thread.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If this thread is unavailable for too long, your GPU will hard crash and force a full reset
|
||||||
|
// TODO: Investigate if this can be executed outside the application context. Attach a debugger to rpcs3 and boom - GPU reset. Not fun rebooting so often.
|
||||||
thread_ctrl::set_native_priority(1);
|
thread_ctrl::set_native_priority(1);
|
||||||
|
|
||||||
add_ref();
|
add_ref();
|
||||||
@ -29,7 +34,6 @@ namespace vk
|
|||||||
}
|
}
|
||||||
|
|
||||||
release();
|
release();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncTaskScheduler::delayed_init()
|
void AsyncTaskScheduler::delayed_init()
|
||||||
@ -43,6 +47,9 @@ namespace vk
|
|||||||
auto ev2 = std::make_unique<event>(*get_current_renderer(), sync_domain::gpu);
|
auto ev2 = std::make_unique<event>(*get_current_renderer(), sync_domain::gpu);
|
||||||
m_events_pool.emplace_back(std::move(ev1), std::move(ev2), 0ull);
|
m_events_pool.emplace_back(std::move(ev1), std::move(ev2), 0ull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_use_host_scheduler = g_cfg.video.vk.asynchronous_scheduler == vk_gpu_scheduler_mode::host || g_cfg.video.strict_rendering_mode;
|
||||||
|
rsx_log.notice("Asynchronous task scheduler is active running in %s mode", m_use_host_scheduler? "'Host'" : "'Device'");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncTaskScheduler::insert_sync_event()
|
void AsyncTaskScheduler::insert_sync_event()
|
||||||
@ -67,16 +74,15 @@ namespace vk
|
|||||||
|
|
||||||
sync_label->queue1_signal->signal(*m_current_cb, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0);
|
sync_label->queue1_signal->signal(*m_current_cb, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0);
|
||||||
|
|
||||||
#if WITH_CPU_SCHEDULER
|
if (m_use_host_scheduler)
|
||||||
{
|
{
|
||||||
m_event_queue.push(sync_label);
|
m_event_queue.push(sync_label);
|
||||||
m_sync_label = sync_label->queue2_signal.get();
|
m_sync_label = sync_label->queue2_signal.get();
|
||||||
}
|
}
|
||||||
#else
|
else
|
||||||
{
|
{
|
||||||
m_sync_label = sync_label->queue1_signal.get();
|
m_sync_label = sync_label->queue1_signal.get();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncTaskScheduler::~AsyncTaskScheduler()
|
AsyncTaskScheduler::~AsyncTaskScheduler()
|
||||||
|
@ -27,6 +27,9 @@ namespace vk
|
|||||||
command_buffer* m_current_cb = nullptr;
|
command_buffer* m_current_cb = nullptr;
|
||||||
usz m_next_cb_index = 0;
|
usz m_next_cb_index = 0;
|
||||||
|
|
||||||
|
// Scheduler
|
||||||
|
bool m_use_host_scheduler = false;
|
||||||
|
|
||||||
// Sync
|
// Sync
|
||||||
event* m_sync_label = nullptr;
|
event* m_sync_label = nullptr;
|
||||||
atomic_t<bool> m_sync_required = false;
|
atomic_t<bool> m_sync_required = false;
|
||||||
|
@ -262,9 +262,16 @@ namespace vk
|
|||||||
bool allow_host_buffers;
|
bool allow_host_buffers;
|
||||||
if (vendor == driver_vendor::NVIDIA)
|
if (vendor == driver_vendor::NVIDIA)
|
||||||
{
|
{
|
||||||
allow_host_buffers = (chip != chip_class::NV_mobile_kepler) ?
|
if (g_cfg.video.vk.asynchronous_texture_streaming)
|
||||||
test_host_pointer(base_address, expected_length) :
|
{
|
||||||
false;
|
allow_host_buffers = (chip != chip_class::NV_mobile_kepler) ?
|
||||||
|
test_host_pointer(base_address, expected_length) :
|
||||||
|
false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
allow_host_buffers = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -935,8 +935,11 @@ namespace vk
|
|||||||
input_swizzled = false;
|
input_swizzled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rsx::flags32_t upload_command_flags = initialize_image_layout |
|
||||||
|
(g_cfg.video.vk.asynchronous_texture_streaming? upload_contents_async : upload_contents_inline);
|
||||||
|
|
||||||
vk::upload_image(cmd, image, subresource_layout, gcm_format, input_swizzled, mipmaps, image->aspect(),
|
vk::upload_image(cmd, image, subresource_layout, gcm_format, input_swizzled, mipmaps, image->aspect(),
|
||||||
*m_texture_upload_heap, upload_heap_align_default, initialize_image_layout | upload_contents_async);
|
*m_texture_upload_heap, upload_heap_align_default, upload_command_flags);
|
||||||
|
|
||||||
vk::leave_uninterruptible();
|
vk::leave_uninterruptible();
|
||||||
|
|
||||||
|
@ -168,6 +168,8 @@ struct cfg_root : cfg::node
|
|||||||
cfg::_bool force_fifo{ this, "Force FIFO present mode" };
|
cfg::_bool force_fifo{ this, "Force FIFO present mode" };
|
||||||
cfg::_bool force_primitive_restart{ this, "Force primitive restart flag" };
|
cfg::_bool force_primitive_restart{ this, "Force primitive restart flag" };
|
||||||
cfg::_bool force_disable_exclusive_fullscreen_mode{this, "Force Disable Exclusive Fullscreen Mode"};
|
cfg::_bool force_disable_exclusive_fullscreen_mode{this, "Force Disable Exclusive Fullscreen Mode"};
|
||||||
|
cfg::_bool asynchronous_texture_streaming{ this, "Asynchronous Texture Streaming Placeholder", false, true }; // Placeholder text because it'll have to be updated later
|
||||||
|
cfg::_enum<vk_gpu_scheduler_mode> asynchronous_scheduler{ this, "Asynchronous Queue Scheduler", vk_gpu_scheduler_mode::device };
|
||||||
|
|
||||||
} vk{ this };
|
} vk{ this };
|
||||||
|
|
||||||
|
@ -421,3 +421,18 @@ void fmt_class_string<audio_downmix>::format(std::string& out, u64 arg)
|
|||||||
return unknown;
|
return unknown;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void fmt_class_string<vk_gpu_scheduler_mode>::format(std::string& out, u64 arg)
|
||||||
|
{
|
||||||
|
format_enum(out, arg, [](vk_gpu_scheduler_mode value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case vk_gpu_scheduler_mode::host: return "Host";
|
||||||
|
case vk_gpu_scheduler_mode::device: return "Device";
|
||||||
|
}
|
||||||
|
|
||||||
|
return unknown;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -195,3 +195,9 @@ enum class shader_mode
|
|||||||
async_with_interpreter,
|
async_with_interpreter,
|
||||||
interpreter_only
|
interpreter_only
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class vk_gpu_scheduler_mode
|
||||||
|
{
|
||||||
|
host,
|
||||||
|
device
|
||||||
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user