Module: wine Branch: master Commit: 1e3ee36a7187eb56507947674629dc7917cfc00c URL: https://gitlab.winehq.org/wine/wine/-/commit/1e3ee36a7187eb56507947674629dc7...
Author: Matteo Bruni mbruni@codeweavers.com Date: Thu Jul 6 14:06:11 2023 +0200
wined3d: Don't call wined3d_context_gl_apply_blit_state() from texture2d_read_from_framebuffer().
None of the GL states set by wined3d_context_gl_apply_blit_state() should matter for glReadPixels(), aside from the FBO read binding. So just do that instead.
Some wined3d git archaeology suggests that the wined3d_context_gl_apply_blit_state() call was added right before Wine 1.2 to workaround various driver issues with glReadPixels() that in practice was erroneously affected by some GL states. If those kind of issues are still a thing, it might be necessary to reintroduce some limited state reset, possibly tied to a quirk.
---
dlls/wined3d/surface.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 11b1da829d7..6850e984efb 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -372,16 +372,10 @@ 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 - { - wined3d_context_gl_apply_blit_state(context_gl, device); }
/* Select the correct read buffer, and give some debug output. @@ -405,6 +399,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) {