GBA Video: Use interpolation not extrapolation for first few scanlines (fixes #1431)
Vicki Pfau vi@endrift.com
Wed, 29 May 2019 12:58:59 -0700
1 files changed,
18 insertions(+),
43 deletions(-)
jump to
M
src/gba/renderers/gl.c
→
src/gba/renderers/gl.c
@@ -214,7 +214,6 @@ "}\n"
"void loadAffine(int y, out ivec2 mat[4], out ivec2 aff[4]) {\n" " int start = max(range.x, y - 3);\n" - " mat[0] = transform[start + 0].xy;\n" " aff[0] = transform[start + 0].zw;\n" " mat[1] = transform[start + 1].xy;\n"@@ -223,45 +222,6 @@ " mat[2] = transform[start + 2].xy;\n"
" aff[2] = transform[start + 2].zw;\n" " mat[3] = transform[start + 3].xy;\n" " aff[3] = transform[start + 3].zw;\n" - - " if (y - 3 < range.x) {\n" - " ivec2 tempMat[3];\n" - " ivec2 tempAff[3];\n" - " tempMat[0] = ivec2(interpolate(mat, -0.75));\n" - " tempMat[1] = ivec2(interpolate(mat, -0.5));\n" - " tempMat[2] = ivec2(interpolate(mat, -0.25));\n" - " tempAff[0] = ivec2(interpolate(aff, -0.75));\n" - " tempAff[1] = ivec2(interpolate(aff, -0.5));\n" - " tempAff[2] = ivec2(interpolate(aff, -0.25));\n" - " if (range.x == y) {\n" - " mat[3] = mat[0];\n" - " mat[2] = tempMat[2];\n" - " mat[1] = tempMat[1];\n" - " mat[0] = tempMat[0];\n" - " aff[3] = aff[0];\n" - " aff[2] = tempAff[2];\n" - " aff[1] = tempAff[1];\n" - " aff[0] = tempAff[0];\n" - " } else if (range.x == y - 1) {\n" - " mat[3] = mat[1];\n" - " mat[2] = mat[0];\n" - " mat[1] = tempMat[2];\n" - " mat[0] = tempMat[1];\n" - " aff[3] = aff[1];\n" - " aff[2] = aff[0];\n" - " aff[1] = tempAff[2];\n" - " aff[0] = tempAff[1];\n" - " } else if (range.x == y - 2) {\n" - " mat[3] = mat[2];\n" - " mat[2] = mat[1];\n" - " mat[1] = mat[0];\n" - " mat[0] = tempMat[0];\n" - " aff[3] = aff[2];\n" - " aff[2] = aff[1];\n" - " aff[1] = aff[0];\n" - " aff[0] = tempAff[0];\n" - " }\n" - " }\n" "}\n"; static const char* const _renderMode2 =@@ -311,7 +271,12 @@ " incoord.y = float(int(incoord.y) % mosaic.y);\n"
" }\n" " loadAffine(int(incoord.y), mat, offset);\n" " float y = fract(incoord.y);\n" - " float lin = 0.75 + y * 0.25;\n" + " float start = 0.75;\n" + " if (int(incoord.y) - range.x < 4) {\n" + " y = incoord.y - float(range.x);\n" + " start = 0.;\n" + " }\n" + " float lin = start + y * 0.25;\n" " vec2 mixedTransform = interpolate(mat, lin);\n" " vec2 mixedOffset = interpolate(offset, lin);\n" " color = fetchTile(ivec2(mixedTransform * incoord.x + mixedOffset));\n"@@ -359,7 +324,12 @@ " incoord.y = float(int(incoord.y) % mosaic.y);\n"
" }\n" " loadAffine(int(incoord.y), mat, offset);\n" " float y = fract(incoord.y);\n" - " float lin = 0.75 + y * 0.25;\n" + " float start = 0.75;\n" + " if (int(incoord.y) - range.x < 4) {\n" + " y = incoord.y - float(range.x);\n" + " start = 0.;\n" + " }\n" + " float lin = start + y * 0.25;\n" " vec2 mixedTransform = interpolate(mat, lin);\n" " vec2 mixedOffset = interpolate(offset, lin);\n" " ivec2 coord = ivec2(mixedTransform * incoord.x + mixedOffset);\n"@@ -419,7 +389,12 @@ " incoord.y = float(int(incoord.y) % mosaic.y);\n"
" }\n" " loadAffine(int(incoord.y), mat, offset);\n" " float y = fract(incoord.y);\n" - " float lin = 0.75 + y * 0.25;\n" + " float start = 0.75;\n" + " if (int(incoord.y) - range.x < 4) {\n" + " y = incoord.y - float(range.x);\n" + " start = 0.;\n" + " }\n" + " float lin = start + y * 0.25;\n" " vec2 mixedTransform = interpolate(mat, lin);\n" " vec2 mixedOffset = interpolate(offset, lin);\n" " ivec2 coord = ivec2(mixedTransform * incoord.x + mixedOffset);\n"