Add idle thread priority option, use it in shader compilation threads.

This commit is contained in:
Dario 2024-05-05 12:49:03 -03:00
parent 66057e8d51
commit 95fa9cbbd8
3 changed files with 5 additions and 2 deletions

View File

@ -18,6 +18,8 @@ namespace RT64 {
# if defined(_WIN32)
static int toWindowsPriority(Thread::Priority priority) {
switch (priority) {
case Thread::Priority::Idle:
return THREAD_PRIORITY_IDLE;
case Thread::Priority::Lowest:
return THREAD_PRIORITY_LOWEST;
case Thread::Priority::Low:

View File

@ -10,6 +10,7 @@
namespace RT64 {
struct Thread {
enum class Priority {
Idle,
Lowest,
Low,
Normal,

View File

@ -141,8 +141,8 @@ namespace RT64 {
void RasterShaderCache::CompilationThread::loop() {
Thread::setCurrentThreadName("RT64 Shader");
// The shader compilation thread should have the lowest priority by default as the application can use the ubershader in the meantime.
Thread::setCurrentThreadPriority(Thread::Priority::Lowest);
// The shader compilation thread should have idle priority by default as the application can use the ubershader in the meantime.
Thread::setCurrentThreadPriority(Thread::Priority::Idle);
threadRunning = true;