Add background sizes to GLSL mode 0

This commit is contained in:
Jeffrey Pfau 2013-05-07 22:21:40 -07:00
parent f278805255
commit 5b5251434f
1 changed files with 9 additions and 0 deletions

View File

@ -35,10 +35,19 @@ static const GLchar* _fragmentShader =
"vec4 backgroundMode0(int bgcnt, int hofs, int vofs) {\n" "vec4 backgroundMode0(int bgcnt, int hofs, int vofs) {\n"
" int charBase = ((bgcnt / 4) & 3) * 8192;\n" " int charBase = ((bgcnt / 4) & 3) * 8192;\n"
" int screenBase = ((bgcnt / 256) & 0x1F) * 1024;\n" " int screenBase = ((bgcnt / 256) & 0x1F) * 1024;\n"
" int size = bgcnt >> 14;\n"
" int localX = hofs + int(x);\n" " int localX = hofs + int(x);\n"
" int localY = vofs + int(y);\n" " int localY = vofs + int(y);\n"
" int xBase = localX & 0xF8;\n" " int xBase = localX & 0xF8;\n"
" int yBase = localY & 0xF8;\n" " int yBase = localY & 0xF8;\n"
" if (size == 1) {\n"
" xBase += (localX & 0x100) << 5;\n"
" } else if (size == 2) {\n"
" yBase += localY & 0x100;\n"
" } else if (size == 3) {\n"
" xBase += (localX & 0x100) << 5;\n"
" yBase += (localY & 0x100) << 1;\n"
" }\n"
" screenBase = screenBase + (xBase / 8) + (yBase * 4);\n" " screenBase = screenBase + (xBase / 8) + (yBase * 4);\n"
" int mapData = DESERIALIZE(texture2D(vram, VRAM_INDEX(screenBase)));\n" " int mapData = DESERIALIZE(texture2D(vram, VRAM_INDEX(screenBase)));\n"
" charBase = charBase + ((mapData & 0x3FF) * 16) + (localX & 0x4) / 4 + (localY & 0x7) * 2;\n" " charBase = charBase + ((mapData & 0x3FF) * 16) + (localX & 0x4) / 4 + (localY & 0x7) * 2;\n"