all repos — mgba @ 509c80abad8221564a0bfade571d868e9e8247af

mGBA Game Boy Advance Emulator

GBA Video: GL semitransparent OBJs
Vicki Pfau vi@endrift.com
Mon, 13 May 2019 01:16:35 -0700
commit

509c80abad8221564a0bfade571d868e9e8247af

parent

c15dedf3f44f76abe87a40fe02db6f9a26f80123

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

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

@@ -240,8 +240,14 @@ " pix *= blend.x;\n"

" pix += oldpix * blend.y;\n" " }\n" " } else {\n" - " pix = texelFetch(oldLayer, ivec2(texCoord * scale), 0);\n" " outflags = oflags;\n" + " vec4 oldpix = texelFetch(oldLayer, ivec2(texCoord * scale), 0);\n" + " if (oflags.z == 1 && (oflags.y & 1) == 1 && (inflags.y & 2) == 2) {\n" + " pix *= blend.y;\n" + " pix += oldpix * blend.x;\n" + " } else {\n" + " pix = oldpix;\n" + " }\n" " }\n" " color = pix;\n" " flags = outflags / flagCoeff;\n"

@@ -993,7 +999,7 @@ glUniform1i(3, 1);

glUniform1i(4, charBase); glUniform1i(5, stride); glUniform1i(6, GBAObjAttributesCGetPalette(sprite->c)); - glUniform3i(7, GBAObjAttributesCGetPriority(sprite->c) << 3, renderer->target1Obj | (renderer->target2Obj * 2), 0); + glUniform3i(7, GBAObjAttributesCGetPriority(sprite->c) << 3, (renderer->target1Obj || GBAObjAttributesAGetMode(sprite->a) == OBJ_MODE_SEMITRANSPARENT) | (renderer->target2Obj * 2), GBAObjAttributesAGetMode(sprite->a) == OBJ_MODE_SEMITRANSPARENT ? BLEND_ALPHA : renderer->blendEffect); if (GBAObjAttributesAIsTransformed(sprite->a)) { struct GBAOAMMatrix mat; LOAD_16(mat.a, 0, &renderer->d.oam->mat[GBAObjAttributesBGetMatIndex(sprite->b)].a);