Add accurate shader multiplication option

This commit is contained in:
wheremyfoodat 2024-07-16 22:14:01 +03:00
parent 61e2e71f68
commit 0ecdf00e64
10 changed files with 20 additions and 12 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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

View file

@ -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;