diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index 27bed9b51d..f394398829 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -376,7 +376,7 @@ void GLES_GPU::SetRenderFrameBuffer() { VirtualFramebuffer *vfb = 0; for (auto iter = vfbs_.begin(); iter != vfbs_.end(); ++iter) { VirtualFramebuffer *v = *iter; - if (v->fb_address == fb_address && v->width == drawing_width && v->height == drawing_height) { + if (v->fb_address == fb_address && v->width == drawing_width && v->height == drawing_height && v->format == fmt) { // Let's not be so picky for now. Let's say this is the one. vfb = v; // Update fb stride in case it changed @@ -397,10 +397,24 @@ void GLES_GPU::SetRenderFrameBuffer() { vfb->width = drawing_width; vfb->height = drawing_height; vfb->format = fmt; - vfb->fbo = fbo_create(vfb->width * renderWidthFactor_, vfb->height * renderHeightFactor_, 1, true); + + //vfb->colorDepth = FBO_8888; + switch (gstate.framebufpixformat & 0x3) { + case GE_FORMAT_4444: vfb->colorDepth = FBO_4444; + case GE_FORMAT_5551: vfb->colorDepth = FBO_5551; + case GE_FORMAT_565: vfb->colorDepth = FBO_565; + case GE_FORMAT_8888: vfb->colorDepth = FBO_8888; + } +//#ifdef ANDROID +// vfb->colorDepth = FBO_5551; +//#endif + + vfb->fbo = fbo_create(vfb->width * renderWidthFactor_, vfb->height * renderHeightFactor_, 1, true, vfb->colorDepth); + vfb->last_frame_used = gpuStats.numFrames; vfbs_.push_back(vfb); fbo_bind_as_render_target(vfb->fbo); + glEnable(GL_DITHER); glstate.viewport.set(0, 0, renderWidth_, renderHeight_); currentRenderVfb_ = vfb; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); diff --git a/GPU/GLES/DisplayListInterpreter.h b/GPU/GLES/DisplayListInterpreter.h index 9586acf392..41fc422ebc 100644 --- a/GPU/GLES/DisplayListInterpreter.h +++ b/GPU/GLES/DisplayListInterpreter.h @@ -103,6 +103,7 @@ private: int height; int format; // virtual, right now they are all RGBA8888 + FBOColorDepth colorDepth; FBO *fbo; }; diff --git a/GPU/GLES/StateMapping.cpp b/GPU/GLES/StateMapping.cpp index 1b2a90f72f..2636b461f8 100644 --- a/GPU/GLES/StateMapping.cpp +++ b/GPU/GLES/StateMapping.cpp @@ -202,6 +202,9 @@ void ApplyDrawState(int prim) { glstate.stencilTest.disable(); } + // Dither + glstate.dither.set(gstate.ditherEnable & 1); + bool wantDepthWrite = gstate.isModeClear() || gstate.isDepthWriteEnabled(); glstate.depthWrite.set(wantDepthWrite ? GL_TRUE : GL_FALSE); diff --git a/native b/native index 464240f703..f315424c42 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 464240f7034b8defe5a60513c1e88bf6dc1c94c2 +Subproject commit f315424c42b1fa5a8d08a702b435c0c7deb5dd00