all repos — mgba @ b532a214cdffde7ad45989ac1418bf5b28e2a9aa

mGBA Game Boy Advance Emulator

GBA Video: Simplify priority
Vicki Pfau vi@endrift.com
Sun, 26 May 2019 18:44:57 -0700
commit

b532a214cdffde7ad45989ac1418bf5b28e2a9aa

parent

1f2bd30b14a9b957951397571ccb237c6df02ed6

1 files changed, 8 insertions(+), 8 deletions(-)

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

@@ -13,7 +13,7 @@ #include <mgba/internal/gba/io.h>

#include <mgba/internal/gba/renderers/cache-set.h> #include <mgba-util/memory.h> -#define FLAG_CONST "const vec4 flagCoeff = vec4(64., 32., 16., 1.);\n" +#define FLAG_CONST "const vec4 flagCoeff = vec4(32., 32., 16., 1.);\n" static void GBAVideoGLRendererInit(struct GBAVideoRenderer* renderer); static void GBAVideoGLRendererDeinit(struct GBAVideoRenderer* renderer);

@@ -549,6 +549,11 @@ " ivec4 topFlags = ivec4(texelFetch(backdropFlags, ivec2(0, texCoord.y), 0) * flagCoeff);\n"

" ivec4 bottomFlags = topFlags;\n" " vec4 windowFlags = texelFetch(window, ivec2(texCoord * float(scale)), 0);\n" " int layerWindow = int(windowFlags.x * 128.);\n" + " if ((layerWindow & 16) == 0) {\n" + " vec4 pix = texelFetch(layers[4], ivec2(texCoord * float(scale)), 0);\n" + " ivec4 inflags = ivec4(texelFetch(flags[4], ivec2(texCoord * float(scale)), 0) * flagCoeff);\n" + " composite(pix, inflags, topPixel, topFlags, bottomPixel, bottomFlags);\n" + " }\n" " if ((layerWindow & 1) == 0) {\n" " vec4 pix = texelFetch(layers[0], ivec2(texCoord * float(scale)), 0);\n" " ivec4 inflags = ivec4(texelFetch(flags[0], ivec2(texCoord * float(scale)), 0).xyz * flagCoeff.xyz, 0);\n"

@@ -567,11 +572,6 @@ " }\n"

" if ((layerWindow & 8) == 0) {\n" " vec4 pix = texelFetch(layers[3], ivec2(texCoord * float(scale)), 0);\n" " ivec4 inflags = ivec4(texelFetch(flags[3], ivec2(texCoord * float(scale)), 0).xyz * flagCoeff.xyz, 0);\n" - " composite(pix, inflags, topPixel, topFlags, bottomPixel, bottomFlags);\n" - " }\n" - " if ((layerWindow & 16) == 0) {\n" - " vec4 pix = texelFetch(layers[4], ivec2(texCoord * float(scale)), 0);\n" - " ivec4 inflags = ivec4(texelFetch(flags[4], ivec2(texCoord * float(scale)), 0) * flagCoeff);\n" " composite(pix, inflags, topPixel, topFlags, bottomPixel, bottomFlags);\n" " }\n" " if ((layerWindow & 32) != 0) {\n"

@@ -1608,7 +1608,7 @@ glUniform1i(uniforms[GBA_GL_OBJ_PALETTE], 1);

glUniform1i(uniforms[GBA_GL_OBJ_CHARBASE], charBase); glUniform1i(uniforms[GBA_GL_OBJ_STRIDE], stride); glUniform1i(uniforms[GBA_GL_OBJ_LOCALPALETTE], GBAObjAttributesCGetPalette(sprite->c)); - glUniform4i(uniforms[GBA_GL_OBJ_INFLAGS], GBAObjAttributesCGetPriority(sprite->c) << 3, + glUniform4i(uniforms[GBA_GL_OBJ_INFLAGS], GBAObjAttributesCGetPriority(sprite->c), (renderer->target1Obj || GBAObjAttributesAGetMode(sprite->a) == OBJ_MODE_SEMITRANSPARENT) | (renderer->target2Obj * 2) | (renderer->blendEffect * 4), renderer->blda, GBAObjAttributesAGetMode(sprite->a) == OBJ_MODE_SEMITRANSPARENT); if (GBAObjAttributesAIsTransformed(sprite->a)) {

@@ -1667,7 +1667,7 @@ glUniform2i(uniforms[GBA_GL_BG_MOSAIC], GBAMosaicControlGetBgV(renderer->mosaic) + 1, GBAMosaicControlGetBgH(renderer->mosaic) + 1);

} else { glUniform2i(uniforms[GBA_GL_BG_MOSAIC], 0, 0); } - glUniform4i(uniforms[GBA_GL_BG_INFLAGS], (background->priority << 3) + (background->index << 1) + 1, + glUniform4i(uniforms[GBA_GL_BG_INFLAGS], background->priority, background->target1 | (background->target2 * 2) | (renderer->blendEffect * 4), renderer->blda, 0); glDrawBuffers(2, (GLenum[]) { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 });