rsx: Some shader compiler threads tuning

- Allow more threads for wide CPUs
- Simplify 'auto' selection a bit
This commit is contained in:
kd-11 2020-11-14 14:58:51 +03:00 committed by kd-11
parent 14358d5e84
commit cab4c78b7b
4 changed files with 16 additions and 12 deletions

View File

@ -76,9 +76,7 @@ void GLGSRender::on_init_thread()
m_frame->delete_context(ctx);
};
int thread_count = g_cfg.video.shader_compiler_threads_count;
if (!thread_count) thread_count = -1;
gl::initialize_pipe_compiler(context_create_func, context_bind_func, context_destroy_func, thread_count);
gl::initialize_pipe_compiler(context_create_func, context_bind_func, context_destroy_func, g_cfg.video.shader_compiler_threads_count);
}
else
{

View File

@ -94,15 +94,19 @@ namespace gl
std::function<void(draw_context_t)> context_destroy_func,
int num_worker_threads)
{
if (num_worker_threads == -1)
if (num_worker_threads == 0)
{
// Select optimal number of compiler threads
const auto hw_threads = std::thread::hardware_concurrency();
if (hw_threads >= 12)
if (hw_threads > 12)
{
num_worker_threads = 6;
}
else if (hw_threads > 8)
{
num_worker_threads = 4;
}
else if (hw_threads >= 8)
else if (hw_threads == 8)
{
num_worker_threads = 2;
}

View File

@ -473,10 +473,8 @@ VKGSRender::VKGSRender() : GSRender()
null_buffer = std::make_unique<vk::buffer>(*m_device, 32, memory_map.device_local, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT, 0);
null_buffer_view = std::make_unique<vk::buffer_view>(*m_device, null_buffer->value, VK_FORMAT_R8_UINT, 0, 32);
int thread_count = g_cfg.video.shader_compiler_threads_count;
if (!thread_count) thread_count = -1;
vk::initialize_compiler_context();
vk::initialize_pipe_compiler(thread_count);
vk::initialize_pipe_compiler(g_cfg.video.shader_compiler_threads_count);
if (g_cfg.video.overlay)
{

View File

@ -182,15 +182,19 @@ namespace vk
void initialize_pipe_compiler(int num_worker_threads)
{
if (num_worker_threads == -1)
if (num_worker_threads == 0)
{
// Select optimal number of compiler threads
const auto hw_threads = std::thread::hardware_concurrency();
if (hw_threads >= 12)
if (hw_threads > 12)
{
num_worker_threads = 6;
}
else if (hw_threads > 8)
{
num_worker_threads = 4;
}
else if (hw_threads >= 8)
else if (hw_threads == 8)
{
num_worker_threads = 2;
}