void GLES_GPU::CopyDisplayToOutput() {
	transformDraw_.Flush();
	if (!g_Config.bBufferedRendering)
		return;

	EndDebugDraw();

	VirtualFramebuffer *vfb = GetDisplayFBO();
	fbo_unbind();

	glstate.viewport.set(0, 0, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);

	currentRenderVfb_ = 0;

	if (!vfb) {
		DEBUG_LOG(HLE, "Found no FBO! displayFBPtr = %08x", displayFramebufPtr_);
		// No framebuffer to display! Clear to black.
		glClearColor(0,0,0,1);
		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;
	}

	DEBUG_LOG(HLE, "Displaying FBO %08x", vfb->fb_address);
	glstate.blend.disable();
	glstate.cullFace.disable();
	glstate.depthTest.disable();
	glstate.scissorTest.disable();

	fbo_bind_color_as_texture(vfb->fbo, 0);

	// These are in the output display coordinates
	framebufferManager.DrawActiveTexture(480, 272, true);

	shaderManager_->DirtyShader();
	shaderManager_->DirtyUniform(DIRTY_ALL);
	gstate_c.textureChanged = true;

	BeginDebugDraw();
}
void GLES_GPU::CopyDisplayToOutput()
{
	if (!g_Config.bBufferedRendering)
		return;

	VirtualFramebuffer *vfb = GetDisplayFBO();
	fbo_unbind();

	glViewport(0, 0, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);

	currentRenderVfb_ = 0;

	if (!vfb) {
		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);
		return;
	}

	DEBUG_LOG(HLE, "Displaying FBO %08x", vfb->fb_address);
	glDisable(GL_BLEND);
	glDisable(GL_CULL_FACE);
	glDisable(GL_DEPTH_TEST);

	fbo_bind_color_as_texture(vfb->fbo, 0);

	// These are in the output pixel coordinates
	DrawActiveTexture(480, 272, true);

	shaderManager.DirtyShader();
	shaderManager.DirtyUniform(DIRTY_ALL);
	gstate_c.textureChanged = true;

	// Restore some state
	ExecuteOp(gstate.cmdmem[GE_CMD_ALPHABLENDENABLE], 0xFFFFFFFF);		
	ExecuteOp(gstate.cmdmem[GE_CMD_CULLFACEENABLE], 0xFFFFFFFF);		
	ExecuteOp(gstate.cmdmem[GE_CMD_ZTESTENABLE], 0xFFFFFFFF);		
}