Viewport restore only for Adreno GPU

This commit is contained in:
raven02 2014-01-02 12:17:41 +08:00
parent e2ac7cab92
commit e84a7b1586

View File

@ -762,7 +762,8 @@ void FramebufferManager::SetRenderFrameBuffer() {
vfb->fbo = fbo_create(vfb->renderWidth, vfb->renderHeight, 1, true, vfb->colorDepth);
if (vfb->fbo) {
fbo_bind_as_render_target(vfb->fbo);
glstate.viewport.restore();
if (gl_extensions.gpuVendor == GPU_VENDOR_ADRENO)
glstate.viewport.restore();
} else {
ERROR_LOG(SCEGE, "Error creating FBO! %i x %i", vfb->renderWidth, vfb->renderHeight);
}
@ -829,7 +830,8 @@ void FramebufferManager::SetRenderFrameBuffer() {
if (vfb->fbo) {
fbo_bind_as_render_target(vfb->fbo);
// adreno needs us to reset the viewport after switching render targets.
glstate.viewport.restore();
if (gl_extensions.gpuVendor == GPU_VENDOR_ADRENO)
glstate.viewport.restore();
} else {
// wtf? This should only happen very briefly when toggling bBufferedRendering
fbo_unbind();
@ -958,7 +960,8 @@ void FramebufferManager::CopyDisplayToOutput() {
} else if (usePostShader_ && extraFBOs_.size() == 1 && !postShaderAtOutputResolution_) {
// An additional pass, post-processing shader to the extra FBO.
fbo_bind_as_render_target(extraFBOs_[0]);
glstate.viewport.restore();
if (gl_extensions.gpuVendor == GPU_VENDOR_ADRENO)
glstate.viewport.restore();
int fbo_w, fbo_h;
fbo_get_dimensions(extraFBOs_[0], &fbo_w, &fbo_h);
glstate.viewport.set(0, 0, fbo_w, fbo_h);
@ -1058,7 +1061,8 @@ void FramebufferManager::ReadFramebufferToMemory(VirtualFramebuffer *vfb, bool s
nvfb->last_frame_render = gpuStats.numFlips;
bvfbs_.push_back(nvfb);
fbo_bind_as_render_target(nvfb->fbo);
glstate.viewport.restore();
if (gl_extensions.gpuVendor == GPU_VENDOR_ADRENO)
glstate.viewport.restore();
ClearBuffer();
glEnable(GL_DITHER);
} else {
@ -1070,7 +1074,8 @@ void FramebufferManager::ReadFramebufferToMemory(VirtualFramebuffer *vfb, bool s
#ifdef USING_GLES2
if (nvfb->fbo) {
fbo_bind_as_render_target(nvfb->fbo);
glstate.viewport.restore();
if (gl_extensions.gpuVendor == GPU_VENDOR_ADRENO)
glstate.viewport.restore();
}
// Some tiled mobile GPUs benefit IMMENSELY from clearing an FBO before rendering
@ -1103,7 +1108,8 @@ void FramebufferManager::ReadFramebufferToMemory(VirtualFramebuffer *vfb, bool s
void FramebufferManager::BlitFramebuffer_(VirtualFramebuffer *src, VirtualFramebuffer *dst, bool flip, float upscale, float vscale) {
if (dst->fbo) {
fbo_bind_as_render_target(dst->fbo);
glstate.viewport.restore();
if (gl_extensions.gpuVendor == GPU_VENDOR_ADRENO)
glstate.viewport.restore();
} else {
ERROR_LOG_REPORT_ONCE(dstfbozero, SCEGE, "BlitFramebuffer_: dst->fbo == 0");
fbo_unbind();
@ -1546,7 +1552,8 @@ void FramebufferManager::UpdateFromMemory(u32 addr, int size, bool safe) {
DisableState();
glstate.viewport.set(0, 0, vfb->renderWidth, vfb->renderHeight);
fbo_bind_as_render_target(vfb->fbo);
glstate.viewport.restore();
if (gl_extensions.gpuVendor == GPU_VENDOR_ADRENO)
glstate.viewport.restore();
needUnbind = true;
DrawPixels(Memory::GetPointer(addr | 0x04000000), vfb->format, vfb->fb_stride);
} else {