mirror of https://github.com/mgba-emu/mgba.git
GBA Video: Mark framebuffer as dirty if the output texture changes
This commit is contained in:
parent
8997eda005
commit
004f317aba
|
@ -155,6 +155,7 @@ struct GBAVideoGLRenderer {
|
||||||
GLuint vbo;
|
GLuint vbo;
|
||||||
|
|
||||||
GLuint outputTex;
|
GLuint outputTex;
|
||||||
|
bool outputTexDirty;
|
||||||
|
|
||||||
GLuint paletteTex;
|
GLuint paletteTex;
|
||||||
uint16_t shadowPalette[GBA_VIDEO_VERTICAL_PIXELS][512];
|
uint16_t shadowPalette[GBA_VIDEO_VERTICAL_PIXELS][512];
|
||||||
|
|
|
@ -446,6 +446,7 @@ static void _GBACoreSetVideoGLTex(struct mCore* core, unsigned texid) {
|
||||||
#ifdef BUILD_GLES3
|
#ifdef BUILD_GLES3
|
||||||
struct GBACore* gbacore = (struct GBACore*) core;
|
struct GBACore* gbacore = (struct GBACore*) core;
|
||||||
gbacore->glRenderer.outputTex = texid;
|
gbacore->glRenderer.outputTex = texid;
|
||||||
|
gbacore->glRenderer.outputTexDirty = true;
|
||||||
#else
|
#else
|
||||||
UNUSED(core);
|
UNUSED(core);
|
||||||
UNUSED(texid);
|
UNUSED(texid);
|
||||||
|
|
|
@ -779,6 +779,7 @@ static void _initFramebuffers(struct GBAVideoGLRenderer* glRenderer) {
|
||||||
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, glRenderer->fbo[GBA_GL_FBO_OUTPUT]);
|
glBindFramebuffer(GL_FRAMEBUFFER, glRenderer->fbo[GBA_GL_FBO_OUTPUT]);
|
||||||
_initFramebufferTexture(glRenderer->outputTex, GL_RGB, GL_COLOR_ATTACHMENT0, glRenderer->scale);
|
_initFramebufferTexture(glRenderer->outputTex, GL_RGB, GL_COLOR_ATTACHMENT0, glRenderer->scale);
|
||||||
|
glRenderer->outputTexDirty = false;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 4; ++i) {
|
for (i = 0; i < 4; ++i) {
|
||||||
|
@ -1678,6 +1679,10 @@ static void GBAVideoGLRendererWriteBLDCNT(struct GBAVideoGLRenderer* renderer, u
|
||||||
void _finalizeLayers(struct GBAVideoGLRenderer* renderer) {
|
void _finalizeLayers(struct GBAVideoGLRenderer* renderer) {
|
||||||
const GLuint* uniforms = renderer->finalizeShader.uniforms;
|
const GLuint* uniforms = renderer->finalizeShader.uniforms;
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, renderer->fbo[GBA_GL_FBO_OUTPUT]);
|
glBindFramebuffer(GL_FRAMEBUFFER, renderer->fbo[GBA_GL_FBO_OUTPUT]);
|
||||||
|
if (renderer->outputTexDirty) {
|
||||||
|
_initFramebufferTexture(renderer->outputTex, GL_RGB, GL_COLOR_ATTACHMENT0, renderer->scale);
|
||||||
|
renderer->outputTexDirty = false;
|
||||||
|
}
|
||||||
glViewport(0, 0, GBA_VIDEO_HORIZONTAL_PIXELS * renderer->scale, GBA_VIDEO_VERTICAL_PIXELS * renderer->scale);
|
glViewport(0, 0, GBA_VIDEO_HORIZONTAL_PIXELS * renderer->scale, GBA_VIDEO_VERTICAL_PIXELS * renderer->scale);
|
||||||
glScissor(0, 0, GBA_VIDEO_HORIZONTAL_PIXELS * renderer->scale, GBA_VIDEO_VERTICAL_PIXELS * renderer->scale);
|
glScissor(0, 0, GBA_VIDEO_HORIZONTAL_PIXELS * renderer->scale, GBA_VIDEO_VERTICAL_PIXELS * renderer->scale);
|
||||||
if (GBARegisterDISPCNTIsForcedBlank(renderer->dispcnt)) {
|
if (GBARegisterDISPCNTIsForcedBlank(renderer->dispcnt)) {
|
||||||
|
|
Loading…
Reference in New Issue