diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index 4d3567048a..143ac18aa8 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -131,7 +131,7 @@ void GLES_GPU::CopyDisplayToOutput() DEBUG_LOG(HLE, "Found no FBO! displayFBPtr = %08x", displayFramebufPtr_); // No framebuffer to display! Clear to black. glClearColor(0,0,0,1); - glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Let's not add STENCIL_BUFFER_BIT until we have a stencil buffer (GL ES) return; } diff --git a/GPU/GLES/FragmentShaderGenerator.cpp b/GPU/GLES/FragmentShaderGenerator.cpp index f5a3dee058..f304e4e39b 100644 --- a/GPU/GLES/FragmentShaderGenerator.cpp +++ b/GPU/GLES/FragmentShaderGenerator.cpp @@ -85,12 +85,12 @@ char *GenerateFragmentShader() WRITE(p, "varying vec4 v_color1;\n"); WRITE(p, "varying vec2 v_texcoord;\n"); - WRITE(p, "void main() {"); + WRITE(p, "void main() {\n"); WRITE(p, " vec4 v;\n"); if (gstate.clearmode & 1) { - WRITE(p, "v = v_color0;\n"); + WRITE(p, " v = v_color0;\n"); } else { @@ -126,6 +126,8 @@ char *GenerateFragmentShader() WRITE(p, " v = t%s;\n", secondary); break; case GE_TEXFUNC_ADD: WRITE(p, " v = vec4(t.rgb + p.rgb, p.a * t.a)%s;\n", secondary); break; + default: + WRITE(p, " v = p;\n"); break; } } else { // texfmt == RGB switch (gstate.texfunc & 0x7) { @@ -139,25 +141,28 @@ char *GenerateFragmentShader() WRITE(p, " v = vec4(t.rgb, p.a)%s;\n", secondary); break; case GE_TEXFUNC_ADD: WRITE(p, " v = vec4(t.rgb + p.rgb, p.a)%s;\n", secondary); break; + default: + WRITE(p, " v = p;\n"); break; } } - // Color doubling if (gstate.texfunc & 0x10000) { - WRITE(p, " gl_FragColor = v * vec4(2.0, 2.0, 2.0, 1.0);"); - } else { - WRITE(p, " gl_FragColor = v;\n"); + WRITE(p, " v = v * vec4(2.0, 2.0, 2.0, 1.0);"); } - -/* + + if (gstate.alphaTestEnable & 1) { int alphaTestFunc = gstate.alphatest & 7; const char *alphaTestFuncs[] = { "#", "#", " == ", " != ", " < ", " <= ", " > ", " >= " }; // never/always don't make sense - WRITE(p, "if (!(gl_FragColor.a %s u_alpharef.x)) discard;", alphaTestFuncs[alphaTestFunc]); - }*/ + if (alphaTestFuncs[alphaTestFunc][0] != '#') + WRITE(p, "if (!(v.a %s u_alpharef.x)) discard;", alphaTestFuncs[alphaTestFunc]); + } // Fogging should be added here - and disabled during clear mode } + + WRITE(p, " gl_FragColor = v;\n"); + //WRITE(p, " gl_FragColor = vec4(1,0,1,1);"); WRITE(p, "}\n"); diff --git a/GPU/GLES/Framebuffer.cpp b/GPU/GLES/Framebuffer.cpp index c831a474c3..d312645a22 100644 --- a/GPU/GLES/Framebuffer.cpp +++ b/GPU/GLES/Framebuffer.cpp @@ -196,8 +196,8 @@ void DisplayDrawer_DrawFramebuffer(u8 *framebuf, int pixelFormat, int linesize) void DrawActiveTexture(float w, float h, bool flip) { float u2 = 1.0f; - float v1 = flip ? 1.0 : 0.0f; - float v2 = flip ? 0.0 : 1.0f; + float v1 = flip ? 1.0f : 0.0f; + float v2 = flip ? 0.0f : 1.0f; const float pos[12] = {0,0,0, w,0,0, w,h,0, 0,h,0}; const float texCoords[8] = {0, v1, u2, v1, u2, v2, 0, v2}; diff --git a/GPU/GLES/TextureCache.cpp b/GPU/GLES/TextureCache.cpp index 99a21f7a48..ca1a532d35 100644 --- a/GPU/GLES/TextureCache.cpp +++ b/GPU/GLES/TextureCache.cpp @@ -43,7 +43,7 @@ struct TexCacheEntry { u32 addr; u32 hash; - u32 frameCounter; + int frameCounter; u32 numMips; u32 format; u32 clutaddr;