all repos — mgba @ 91cd47ee0e6c710d6f59ac3a7a5639fcd48f23e2

mGBA Game Boy Advance Emulator

GBA Video: Fix OBJWIN in GL renderer
Vicki Pfau vi@endrift.com
Sat, 18 May 2019 10:38:23 -0700
commit

91cd47ee0e6c710d6f59ac3a7a5639fcd48f23e2

parent

71b6066d4f6aecc85dc1dafc92cecaf6154f8f4a

1 files changed, 6 insertions(+), 5 deletions(-)

jump to
M src/gba/renderers/gl.csrc/gba/renderers/gl.c

@@ -250,10 +250,10 @@ "uniform int localPalette;\n"

"uniform ivec4 inflags;\n" "uniform mat2x2 transform;\n" "uniform ivec4 dims;\n" - "uniform vec3 objwin;\n" + "uniform vec4 objwin;\n" "out vec4 color;\n" "out vec4 flags;\n" - "out vec2 window;\n" + "out vec3 window;\n" "const vec4 flagCoeff = vec4(32., 32., 16., 16.);\n" "vec4 renderTile(int tile, int paletteId, ivec2 localCoord);\n"

@@ -269,7 +269,7 @@ " pix.a = 0;\n"

" }\n" " color = pix;\n" " flags = inflags / flagCoeff;\n" - " window = objwin.yz;\n" + " window = objwin.yzw;\n" "}"; static const struct GBAVideoGLUniform _uniformsFinalize[] = {

@@ -462,6 +462,7 @@

glBindFramebuffer(GL_FRAMEBUFFER, glRenderer->fbo[GBA_GL_FBO_OBJ]); _initFramebufferTexture(glRenderer->layers[GBA_GL_TEX_OBJ_COLOR], GL_RGBA, GL_COLOR_ATTACHMENT0, glRenderer->scale); _initFramebufferTexture(glRenderer->layers[GBA_GL_TEX_OBJ_FLAGS], GL_RGBA, GL_COLOR_ATTACHMENT1, glRenderer->scale); + _initFramebufferTexture(glRenderer->layers[GBA_GL_TEX_WINDOW], GL_RGBA, GL_COLOR_ATTACHMENT2, glRenderer->scale); glBindFramebuffer(GL_FRAMEBUFFER, glRenderer->fbo[GBA_GL_FBO_WINDOW]); _initFramebufferTexture(glRenderer->layers[GBA_GL_TEX_WINDOW], GL_RGB, GL_COLOR_ATTACHMENT0, glRenderer->scale);

@@ -1152,10 +1153,10 @@ }

glUniform4i(uniforms[GBA_GL_OBJ_DIMS], width, height, totalWidth, totalHeight); if (GBAObjAttributesAGetMode(sprite->a) == OBJ_MODE_OBJWIN) { int window = ~renderer->objwin & 0xFF; - glUniform3f(uniforms[GBA_GL_OBJ_OBJWIN], 1, (window & 0xF) / 32.f, (window >> 4) / 32.f); + glUniform4f(uniforms[GBA_GL_OBJ_OBJWIN], 1, (window & 0xF) / 32.f, (window >> 4) / 32.f, renderer->bldy / 16.f); glDrawBuffers(3, (GLenum[]) { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 }); } else { - glUniform3f(uniforms[GBA_GL_OBJ_OBJWIN], 0, 0, 0); + glUniform4f(uniforms[GBA_GL_OBJ_OBJWIN], 0, 0, 0, 0); glDrawBuffers(2, (GLenum[]) { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 }); } glEnableVertexAttribArray(0);