From: Matteo Bruni mbruni@codeweavers.com
None of the GL states being set by wined3d_context_gl_apply_blit_state() should matter for glReadPixels(), aside from the FBO read binding and GL_FRAMEBUFFER_SRGB. So just do that instead. --- dlls/wined3d/surface.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index fd8db9ce60d..032485af0a5 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -371,16 +371,19 @@ void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned i context_gl = wined3d_context_gl(context); gl_info = context_gl->gl_info;
- if (src_location != resource->draw_binding) + if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) { wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_READ_FRAMEBUFFER, resource, sub_resource_idx, NULL, 0, src_location); - wined3d_context_gl_check_fbo_status(context_gl, GL_READ_FRAMEBUFFER); - context_invalidate_state(context, STATE_FRAMEBUFFER); } - else + + if (src_location == resource->draw_binding) { - wined3d_context_gl_apply_blit_state(context_gl, device); + if (gl_info->supported[ARB_FRAMEBUFFER_SRGB]) + { + gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB); + context_invalidate_state(context, STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE)); + } }
/* Select the correct read buffer, and give some debug output. @@ -404,6 +407,8 @@ void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned i src_is_upside_down = FALSE; } checkGLcall("glReadBuffer"); + if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) + wined3d_context_gl_check_fbo_status(context_gl, GL_READ_FRAMEBUFFER);
if (data.buffer_object) {