mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-07 22:55:40 +12:00
gsp: Fix setbufferswap framebuffer selection
This commit is contained in:
parent
ca3c2550f2
commit
9417c75ca7
3 changed files with 11 additions and 8 deletions
|
@ -191,8 +191,7 @@ namespace PICA {
|
||||||
VramBankControl = 0xB,
|
VramBankControl = 0xB,
|
||||||
GPUBusy = 0xC,
|
GPUBusy = 0xC,
|
||||||
BacklightControl = 0xBC,
|
BacklightControl = 0xBC,
|
||||||
// TODO: Framebuffer regs
|
Framebuffer0Size = 0x118,
|
||||||
Framebuffer0Size = 0x2F,
|
|
||||||
Framebuffer0AFirstAddr = 0x119,
|
Framebuffer0AFirstAddr = 0x119,
|
||||||
Framebuffer0ASecondAddr = 0x11A,
|
Framebuffer0ASecondAddr = 0x11A,
|
||||||
Framebuffer0Config = 0x11B,
|
Framebuffer0Config = 0x11B,
|
||||||
|
|
|
@ -462,13 +462,17 @@ void RendererGL::display() {
|
||||||
gl.disableClipPlane(1);
|
gl.disableClipPlane(1);
|
||||||
|
|
||||||
using namespace PICA::ExternalRegs;
|
using namespace PICA::ExternalRegs;
|
||||||
const u32 topScreenAddr = externalRegs[Framebuffer0AFirstAddr];
|
const u32 topActiveFb = externalRegs[Framebuffer0Select] & 1;
|
||||||
const u32 bottomScreenAddr = externalRegs[Framebuffer1AFirstAddr];
|
const u32 topScreenAddr = externalRegs[topActiveFb == 0 ? Framebuffer0AFirstAddr : Framebuffer0ASecondAddr];
|
||||||
|
const u32 bottomActiveFb = externalRegs[Framebuffer1Select] & 1;
|
||||||
|
const u32 bottomScreenAddr = externalRegs[bottomActiveFb == 0 ? Framebuffer1AFirstAddr : Framebuffer1ASecondAddr];
|
||||||
|
|
||||||
auto topScreen = colourBufferCache.findFromAddress(topScreenAddr);
|
auto topScreen = colourBufferCache.findFromAddress(topScreenAddr);
|
||||||
auto bottomScreen = colourBufferCache.findFromAddress(bottomScreenAddr);
|
auto bottomScreen = colourBufferCache.findFromAddress(bottomScreenAddr);
|
||||||
screenFramebuffer.bind(OpenGL::DrawFramebuffer);
|
screenFramebuffer.bind(OpenGL::DrawFramebuffer);
|
||||||
|
|
||||||
|
OpenGL::clearColor();
|
||||||
|
|
||||||
if (topScreen) {
|
if (topScreen) {
|
||||||
topScreen->get().texture.bind();
|
topScreen->get().texture.bind();
|
||||||
OpenGL::setViewport(0, 240, 400, 240); // Top screen viewport
|
OpenGL::setViewport(0, 240, 400, 240); // Top screen viewport
|
||||||
|
|
|
@ -398,16 +398,16 @@ void GPUService::setBufferSwapImpl(u32 screenId, const FramebufferInfo& info) {
|
||||||
|
|
||||||
constexpr static std::array<u32, 8> fb_addresses = {
|
constexpr static std::array<u32, 8> fb_addresses = {
|
||||||
Framebuffer0AFirstAddr,
|
Framebuffer0AFirstAddr,
|
||||||
Framebuffer0ASecondAddr,
|
|
||||||
Framebuffer0BFirstAddr,
|
Framebuffer0BFirstAddr,
|
||||||
Framebuffer0BSecondAddr,
|
|
||||||
Framebuffer1AFirstAddr,
|
Framebuffer1AFirstAddr,
|
||||||
Framebuffer1ASecondAddr,
|
|
||||||
Framebuffer1BFirstAddr,
|
Framebuffer1BFirstAddr,
|
||||||
|
Framebuffer0ASecondAddr,
|
||||||
|
Framebuffer0BSecondAddr,
|
||||||
|
Framebuffer1ASecondAddr,
|
||||||
Framebuffer1BSecondAddr,
|
Framebuffer1BSecondAddr,
|
||||||
};
|
};
|
||||||
|
|
||||||
const u32 fb_index = screenId * 4 + info.activeFb * 2;
|
const u32 fb_index = info.activeFb * 4 + screenId * 2;
|
||||||
gpu.writeExternalReg(fb_addresses[fb_index], VaddrToPaddr(info.leftFramebufferVaddr));
|
gpu.writeExternalReg(fb_addresses[fb_index], VaddrToPaddr(info.leftFramebufferVaddr));
|
||||||
gpu.writeExternalReg(fb_addresses[fb_index + 1], VaddrToPaddr(info.rightFramebufferVaddr));
|
gpu.writeExternalReg(fb_addresses[fb_index + 1], VaddrToPaddr(info.rightFramebufferVaddr));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue