mirror of
https://github.com/TheBozos/BozoEngine.git
synced 2026-12-01 07:38:19 -10:00
The upscaler's and the replacements' worker threads now run at the lowest thread priority (Windows THREAD_PRIORITY_LOWEST, nice 10 elsewhere), so making a level's copies never takes a core from the game or the present thread. A texture whose replacement is being read no longer gets an upscaled copy too (with a full pack every texture was made twice at a level's start). PS2X_TEXTURE_STATS also counts the uploads since its last line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
29 lines
717 B
C++
29 lines
717 B
C++
// SPDX-License-Identifier: MIT
|
|
// Copyright (c) 2026 The Bozos (boubou666 and Arzaroth). MIT licence (see LICENSE at the repository root).
|
|
//
|
|
// bozo/render/worker_priority.h.
|
|
#include "bozo/render/worker_priority.h"
|
|
|
|
#if defined(_WIN32)
|
|
#ifndef WIN32_LEAN_AND_MEAN
|
|
#define WIN32_LEAN_AND_MEAN
|
|
#endif
|
|
#include <windows.h>
|
|
#else
|
|
#include <sys/resource.h>
|
|
#include <sys/syscall.h>
|
|
#include <unistd.h>
|
|
#endif
|
|
|
|
namespace bozo::render
|
|
{
|
|
void lowerWorkerPriority()
|
|
{
|
|
#if defined(_WIN32)
|
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_LOWEST);
|
|
#elif defined(SYS_gettid)
|
|
setpriority(PRIO_PROCESS, static_cast<id_t>(syscall(SYS_gettid)), 10); // Linux: a thread's own nice value
|
|
#endif
|
|
}
|
|
}
|