mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-27 04:25:12 +00:00
config: Add vblank divider option
This commit is contained in:
parent
fb325e33bd
commit
6d86c6f9bf
@ -22,6 +22,7 @@ static bool isShowSplash = false;
|
|||||||
static bool isNullGpu = false;
|
static bool isNullGpu = false;
|
||||||
static bool shouldDumpShaders = false;
|
static bool shouldDumpShaders = false;
|
||||||
static bool shouldDumpPM4 = false;
|
static bool shouldDumpPM4 = false;
|
||||||
|
static u32 vblankDivider = 1;
|
||||||
static bool vkValidation = false;
|
static bool vkValidation = false;
|
||||||
static bool vkValidationSync = false;
|
static bool vkValidationSync = false;
|
||||||
// Gui
|
// Gui
|
||||||
@ -94,6 +95,10 @@ bool dumpPM4() {
|
|||||||
return shouldDumpPM4;
|
return shouldDumpPM4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 vblankDiv() {
|
||||||
|
return vblankDivider;
|
||||||
|
}
|
||||||
|
|
||||||
bool vkValidationEnabled() {
|
bool vkValidationEnabled() {
|
||||||
return vkValidation;
|
return vkValidation;
|
||||||
}
|
}
|
||||||
@ -237,6 +242,7 @@ void load(const std::filesystem::path& path) {
|
|||||||
isNullGpu = toml::find_or<toml::boolean>(gpu, "nullGpu", false);
|
isNullGpu = toml::find_or<toml::boolean>(gpu, "nullGpu", false);
|
||||||
shouldDumpShaders = toml::find_or<toml::boolean>(gpu, "dumpShaders", false);
|
shouldDumpShaders = toml::find_or<toml::boolean>(gpu, "dumpShaders", false);
|
||||||
shouldDumpPM4 = toml::find_or<toml::boolean>(gpu, "dumpPM4", false);
|
shouldDumpPM4 = toml::find_or<toml::boolean>(gpu, "dumpPM4", false);
|
||||||
|
vblankDivider = toml::find_or<toml::integer>(gpu, "vblankDivider", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (data.contains("Vulkan")) {
|
if (data.contains("Vulkan")) {
|
||||||
@ -318,6 +324,7 @@ void save(const std::filesystem::path& path) {
|
|||||||
data["GPU"]["nullGpu"] = isNullGpu;
|
data["GPU"]["nullGpu"] = isNullGpu;
|
||||||
data["GPU"]["dumpShaders"] = shouldDumpShaders;
|
data["GPU"]["dumpShaders"] = shouldDumpShaders;
|
||||||
data["GPU"]["dumpPM4"] = shouldDumpPM4;
|
data["GPU"]["dumpPM4"] = shouldDumpPM4;
|
||||||
|
data["GPU"]["vblankDivider"] = vblankDivider;
|
||||||
data["Vulkan"]["validation"] = vkValidation;
|
data["Vulkan"]["validation"] = vkValidation;
|
||||||
data["Vulkan"]["validation_sync"] = vkValidationSync;
|
data["Vulkan"]["validation_sync"] = vkValidationSync;
|
||||||
data["Debug"]["DebugDump"] = isDebugDump;
|
data["Debug"]["DebugDump"] = isDebugDump;
|
||||||
|
@ -26,6 +26,7 @@ bool showSplash();
|
|||||||
bool nullGpu();
|
bool nullGpu();
|
||||||
bool dumpShaders();
|
bool dumpShaders();
|
||||||
bool dumpPM4();
|
bool dumpPM4();
|
||||||
|
u32 vblankDiv();
|
||||||
|
|
||||||
bool vkValidationEnabled();
|
bool vkValidationEnabled();
|
||||||
bool vkValidationSyncEnabled();
|
bool vkValidationSyncEnabled();
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/config.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/thread.h"
|
#include "common/thread.h"
|
||||||
#include "core/libraries/error_codes.h"
|
#include "core/libraries/error_codes.h"
|
||||||
@ -269,10 +270,11 @@ void VideoOutDriver::PresentThread(std::stop_token token) {
|
|||||||
return {};
|
return {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto vblank_period = VblankPeriod / Config::vblankDiv();
|
||||||
auto delay = std::chrono::microseconds{0};
|
auto delay = std::chrono::microseconds{0};
|
||||||
while (!token.stop_requested()) {
|
while (!token.stop_requested()) {
|
||||||
// Sleep for most of the vblank duration.
|
// Sleep for most of the vblank duration.
|
||||||
std::this_thread::sleep_for(VblankPeriod - delay);
|
std::this_thread::sleep_for(vblank_period - delay);
|
||||||
|
|
||||||
// Check if it's time to take a request.
|
// Check if it's time to take a request.
|
||||||
auto& vblank_status = main_port.vblank_status;
|
auto& vblank_status = main_port.vblank_status;
|
||||||
|
Loading…
Reference in New Issue
Block a user