mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-07-06 23:32:59 +12:00
Ubershader: Add lighting shadergen override
This commit is contained in:
parent
69daed6ace
commit
69c79a7f6c
6 changed files with 34 additions and 2 deletions
|
@ -58,6 +58,10 @@ GPU::GPU(Memory& mem, EmulatorConfig& config) : mem(mem), config(config) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (renderer != nullptr) {
|
||||
renderer->setConfig(&config);
|
||||
}
|
||||
}
|
||||
|
||||
void GPU::reset() {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <cmrc/cmrc.hpp>
|
||||
|
||||
#include "config.hpp"
|
||||
#include "PICA/float_types.hpp"
|
||||
#include "PICA/pica_frag_uniforms.hpp"
|
||||
#include "PICA/gpu.hpp"
|
||||
|
@ -383,6 +384,18 @@ void RendererGL::drawVertices(PICA::PrimType primType, std::span<const Vertex> v
|
|||
OpenGL::Triangle,
|
||||
};
|
||||
|
||||
bool usingUbershader = enableUbershader;
|
||||
if (usingUbershader) {
|
||||
const bool lightsEnabled = (regs[InternalRegs::LightingEnable] & 1) != 0;
|
||||
const uint lightCount = (regs[InternalRegs::LightNumber] & 0x7) + 1;
|
||||
|
||||
// Emulating lights in the ubershader is incredibly slow, so we've got an option to render draws using moret han N lights via shadergen
|
||||
// This way we generate fewer shaders overall than with full shadergen, but don't tank performance
|
||||
if (emulatorConfig->forceShadergenForLights && lightsEnabled && lightCount >= emulatorConfig->lightShadergenThreshold) {
|
||||
usingUbershader = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (usingUbershader) {
|
||||
gl.useProgram(triangleProgram);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue