Enable color and depth buffer write before clearing.

This commit is contained in:
Henrik Rydgard 2013-02-22 22:14:17 +01:00
parent 9ab790ca8f
commit 94bb98d477
5 changed files with 21 additions and 2 deletions

View File

@ -202,8 +202,9 @@ void GLES_GPU::DeviceLost() {
void GLES_GPU::InitClear() {
if (!g_Config.bBufferedRendering) {
glstate.depthWrite.set(GL_TRUE);
glstate.colorMask.set(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClearColor(0,0,0,1);
// glClearColor(1,0,1,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
glstate.viewport.set(0, 0, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);

View File

@ -125,6 +125,8 @@ FramebufferManager::FramebufferManager() :
// And an initial clear. We don't clear per frame as the games are supposed to handle that
// by themselves.
glstate.depthWrite.set(GL_TRUE);
glstate.colorMask.set(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
@ -352,6 +354,8 @@ void FramebufferManager::SetRenderFrameBuffer() {
glEnable(GL_DITHER);
glstate.viewport.set(0, 0, vfb->renderWidth, vfb->renderHeight);
currentRenderVfb_ = vfb;
glstate.depthWrite.set(GL_TRUE);
glstate.colorMask.set(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
INFO_LOG(HLE, "Creating FBO for %08x : %i x %i x %i", vfb->fb_address, vfb->width, vfb->height, vfb->format);
return;
@ -376,7 +380,11 @@ void FramebufferManager::SetRenderFrameBuffer() {
// FBO in a frame. This means that some games won't be able to avoid the on-some-GPUs
// performance-crushing framebuffer reloads from RAM, but we'll have to live with that.
if (vfb->last_frame_used != gpuStats.numFrames)
{
glstate.depthWrite.set(GL_TRUE);
glstate.colorMask.set(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
#endif
glstate.viewport.set(0, 0, vfb->renderWidth, vfb->renderHeight);
currentRenderVfb_ = vfb;
@ -391,6 +399,8 @@ void FramebufferManager::CopyDisplayToOutput() {
if (!vfb) {
DEBUG_LOG(HLE, "Found no FBO! displayFBPtr = %08x", displayFramebufPtr_);
// No framebuffer to display! Clear to black.
glstate.depthWrite.set(GL_TRUE);
glstate.colorMask.set(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
return;
@ -413,6 +423,8 @@ void FramebufferManager::CopyDisplayToOutput() {
fbo_bind_color_as_texture(vfb->fbo, 0);
if (resized_) {
glstate.depthWrite.set(GL_TRUE);
glstate.colorMask.set(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}

View File

@ -24,6 +24,7 @@
#include "base/timeutil.h"
#include "base/NativeApp.h"
#include "gfx_es2/glsl_program.h"
#include "gfx_es2/gl_state.h"
#include "input/input_state.h"
#include "math/curves.h"
#include "ui/ui.h"
@ -83,6 +84,8 @@ static void DrawBackground(float alpha) {
ybase[i] = rng.F() * dp_yres;
}
}
glstate.depthWrite.set(GL_TRUE);
glstate.colorMask.set(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClearColor(0.1f,0.2f,0.43f,1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
ui_draw2d.DrawImageStretch(I_BG, 0, 0, dp_xres, dp_yres);

View File

@ -318,6 +318,9 @@ void NativeInitGraphics()
void NativeRender()
{
EnableFZ();
glstate.depthWrite.set(GL_TRUE);
glstate.colorMask.set(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
// Clearing the screen at the start of the frame is an optimization for tiled mobile GPUs, as it then doesn't need to keep it around between frames.
glClearColor(0,0,0,1);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

2
native

@ -1 +1 @@
Subproject commit f4cc78cbfdb5c9d9c3d83353e66625db43cf54b5
Subproject commit a9a067ef8473628f170dfdab1f7692b53a5f130b