{GL renderer] Better screen stub

This commit is contained in:
wheremyfoodat 2023-06-14 21:47:17 +03:00
parent 8284c3cda4
commit 87ac4d5a0f

View file

@ -466,26 +466,26 @@ void Renderer::displayTransfer(u32 inputAddr, u32 outputAddr, u32 inputSize, u32
const u32 outputGap = outputSize >> 16; const u32 outputGap = outputSize >> 16;
auto framebuffer = colourBufferCache.findFromAddress(inputAddr); auto framebuffer = colourBufferCache.findFromAddress(inputAddr);
if (framebuffer.has_value()) { // If there's a framebuffer at this address, use it. Otherwise go back to our old hack and display framebuffer 0
OpenGL::Texture& texture = framebuffer.value().get().texture; // Displays are hard I really don't want to try implementing them because getting a fast solution is terrible
texture.bind(); OpenGL::Texture& tex = framebuffer.has_value() ? framebuffer.value().get().texture : colourBufferCache[0].texture;
tex.bind();
screenFramebuffer.bind(OpenGL::DrawFramebuffer); screenFramebuffer.bind(OpenGL::DrawFramebuffer);
OpenGL::disableBlend(); OpenGL::disableBlend();
OpenGL::disableDepth(); OpenGL::disableDepth();
OpenGL::disableScissor(); OpenGL::disableScissor();
displayProgram.use(); displayProgram.use();
// Hack: Detect whether we are writing to the top or bottom screen by checking output gap and drawing to the proper part of the output texture // Hack: Detect whether we are writing to the top or bottom screen by checking output gap and drawing to the proper part of the output texture
// We consider output gap == 320 to mean bottom, and anything else to mean top // We consider output gap == 320 to mean bottom, and anything else to mean top
if (outputGap == 320) { if (outputGap == 320) {
OpenGL::setViewport(40, 0, 320, 240); OpenGL::setViewport(40, 0, 320, 240); // Bottom screen viewport
} else { } else {
OpenGL::setViewport(0, 240, 400, 240); OpenGL::setViewport(0, 240, 400, 240); // Top screen viewport
} }
dummyVAO.bind(); dummyVAO.bind();
OpenGL::draw(OpenGL::TriangleStrip, 4); // Actually draw our 3DS screen OpenGL::draw(OpenGL::TriangleStrip, 4); // Actually draw our 3DS screen
} }
}