Add accurate shader multiplication option
This commit is contained in:
@@ -62,6 +62,7 @@ void EmulatorConfig::load() {
|
||||
|
||||
shaderJitEnabled = toml::find_or<toml::boolean>(gpu, "EnableShaderJIT", shaderJitDefault);
|
||||
vsyncEnabled = toml::find_or<toml::boolean>(gpu, "EnableVSync", true);
|
||||
accurateShaderMul = toml::find_or<toml::boolean>(gpu, "AccurateShaderMultiplication", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,6 +126,7 @@ void EmulatorConfig::save() {
|
||||
data["GPU"]["EnableShaderJIT"] = shaderJitEnabled;
|
||||
data["GPU"]["Renderer"] = std::string(Renderer::typeToString(rendererType));
|
||||
data["GPU"]["EnableVSync"] = vsyncEnabled;
|
||||
data["GPU"]["AccurateShaderMultiplication"] = accurateShaderMul;
|
||||
data["Audio"]["DSPEmulation"] = std::string(Audio::DSPCore::typeToString(dspType));
|
||||
data["Audio"]["EnableAudio"] = audioEnabled;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ void ShaderJIT::prepare(PICAShader& shaderUnit) {
|
||||
auto it = cache.find(hash);
|
||||
|
||||
if (it == cache.end()) { // Block has not been compiled yet
|
||||
auto emitter = std::make_unique<ShaderEmitter>();
|
||||
auto emitter = std::make_unique<ShaderEmitter>(accurateMul);
|
||||
emitter->compile(shaderUnit);
|
||||
// Get pointer to callbacks
|
||||
entrypointCallback = emitter->getInstructionCallback(shaderUnit.entrypoint);
|
||||
|
||||
@@ -7,9 +7,6 @@ using namespace Helpers;
|
||||
using namespace oaknut;
|
||||
using namespace oaknut::util;
|
||||
|
||||
// TODO: Expose safe/unsafe optimizations to the user
|
||||
constexpr bool useSafeMUL = true;
|
||||
|
||||
// Similar to the x64 recompiler, we use an odd internal ABI, which abuses the fact that we'll very rarely be calling C++ functions
|
||||
// So to avoid pushing and popping, we'll be making use of volatile registers as much as possible
|
||||
static constexpr QReg src1Vec = Q1;
|
||||
|
||||
@@ -12,9 +12,6 @@ using namespace Xbyak;
|
||||
using namespace Xbyak::util;
|
||||
using namespace Helpers;
|
||||
|
||||
// TODO: Expose safe/unsafe optimizations to the user
|
||||
constexpr bool useSafeMUL = false;
|
||||
|
||||
// The shader recompiler uses quite an odd internal ABI
|
||||
// We make use of the fact that in regular conditions, we should pretty much never be calling C++ code from recompiled shader code
|
||||
// This allows us to establish an ABI that's optimized for this sort of workflow, statically allocating volatile host registers
|
||||
|
||||
@@ -64,6 +64,8 @@ void GPU::reset() {
|
||||
regs.fill(0);
|
||||
shaderUnit.reset();
|
||||
shaderJIT.reset();
|
||||
shaderJIT.setAccurateMul(config.accurateShaderMul);
|
||||
|
||||
std::memset(vram, 0, vramSize);
|
||||
lightingLUT.fill(0);
|
||||
lightingLUTDirty = true;
|
||||
|
||||
@@ -146,6 +146,7 @@ static bool FetchVariableBool(std::string key, bool def) {
|
||||
static void configInit() {
|
||||
static const retro_variable values[] = {
|
||||
{"panda3ds_use_shader_jit", "Enable shader JIT; enabled|disabled"},
|
||||
{"panda3ds_accurate_shader_mul", "Enable accurate shader multiplication; disabled|enabled"},
|
||||
{"panda3ds_use_vsync", "Enable VSync; enabled|disabled"},
|
||||
{"panda3ds_dsp_emulation", "DSP emulation; Null|HLE|LLE"},
|
||||
{"panda3ds_use_audio", "Enable audio; disabled|enabled"},
|
||||
@@ -153,7 +154,7 @@ static void configInit() {
|
||||
{"panda3ds_write_protect_virtual_sd", "Write protect virtual SD card; disabled|enabled"},
|
||||
{"panda3ds_battery_level", "Battery percentage; 5|10|20|30|50|70|90|100"},
|
||||
{"panda3ds_use_charger", "Charger plugged; enabled|disabled"},
|
||||
{nullptr, nullptr}
|
||||
{nullptr, nullptr},
|
||||
};
|
||||
|
||||
envCallbacks(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)values);
|
||||
@@ -171,6 +172,7 @@ static void configUpdate() {
|
||||
config.audioEnabled = FetchVariableBool("panda3ds_use_audio", false);
|
||||
config.sdCardInserted = FetchVariableBool("panda3ds_use_virtual_sd", true);
|
||||
config.sdWriteProtected = FetchVariableBool("panda3ds_write_protect_virtual_sd", false);
|
||||
config.accurateShaderMul = FetchVariableBool("panda3ds_accurate_shader_mul", false);
|
||||
config.discordRpcEnabled = false;
|
||||
|
||||
config.save();
|
||||
|
||||
Reference in New Issue
Block a user