VideoBackends: Restore the framebuffer as part of the API state

It's not often we switch out to draw to the EFB anyway.
This commit is contained in:
Stenzek
2018-02-09 21:41:31 +10:00
parent ed03304ce7
commit 887e3830ba
10 changed files with 7 additions and 23 deletions

View File

@ -219,7 +219,6 @@ void OGLTexture::ScaleRectangleFromTexture(const AbstractTexture* source,
glUniform4f(TextureCache::GetInstance()->GetColorCopyPositionUniform(), float(srcrect.left),
float(srcrect.top), float(srcrect.GetWidth()), float(srcrect.GetHeight()));
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
FramebufferManager::SetFramebuffer(0);
g_renderer->RestoreAPIState();
}

View File

@ -1416,9 +1416,6 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& xfb_region
g_texture_cache->Cleanup(frameCount);
ProgramShaderCache::RetrieveAsyncShaders();
// Render to the framebuffer.
FramebufferManager::SetFramebuffer(0);
RestoreAPIState();
g_Config.iSaveTargetId = 0;
@ -1499,6 +1496,8 @@ void Renderer::ResetAPIState()
void Renderer::RestoreAPIState()
{
FramebufferManager::SetFramebuffer(0);
// Gets us back into a more game-like state.
glEnable(GL_SCISSOR_TEST);
if (g_ActiveConfig.backend_info.bSupportsDepthClamp)

View File

@ -323,7 +323,6 @@ void TextureCache::ConvertTexture(TCacheEntry* destination, TCacheEntry* source,
ProgramShaderCache::BindVertexFormat(nullptr);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
FramebufferManager::SetFramebuffer(0);
g_renderer->RestoreAPIState();
}
@ -540,7 +539,6 @@ void TextureCache::CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_copy,
ProgramShaderCache::BindVertexFormat(nullptr);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
FramebufferManager::SetFramebuffer(0);
g_renderer->RestoreAPIState();
}
}

View File

@ -133,8 +133,6 @@ static void EncodeToRamUsingShader(GLuint srcTexture, u8* destAddr, u32 dst_line
s_encoding_readback_texture->CopyFromTexture(s_encoding_render_texture.get(), copy_rect, 0, 0,
copy_rect);
s_encoding_readback_texture->ReadTexels(copy_rect, destAddr, writeStride);
FramebufferManager::SetFramebuffer(0);
}
void EncodeToRamFromTexture(u8* dest_ptr, const EFBCopyParams& params, u32 native_width,
@ -157,7 +155,6 @@ void EncodeToRamFromTexture(u8* dest_ptr, const EFBCopyParams& params, u32 nativ
EncodeToRamUsingShader(read_texture, dest_ptr, bytes_per_row, num_blocks_y, memory_stride,
scale_by_half && !params.depth, params.y_scale);
FramebufferManager::SetFramebuffer(0);
g_renderer->RestoreAPIState();
}