[PATCH v2] wined3d: Unbind the FBOs before dispatching compute shader

Fabian Maurer dark.shadow4 at web.de
Fri Dec 1 11:31:07 CST 2017


v2
Move changes into context_apply_compute_state and
use proper helper functions


Fixes Bug 43406

Unbinding the FBO before executing the compute shader
makes sure that it doesn't read garbage from it.
This only an issue on open source drivers, since the
proprietary drivers play safe and synchronize.
But since this is undefined behavior, wine should avoid relying on that.

Many thanks to Matias N. Goldberg and Philip Rebohle
for investigating and solving the bug!

Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
---
 dlls/wined3d/context.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 92c026c6cd..eb2497a942 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -4016,6 +4016,10 @@ void context_apply_compute_state(struct wined3d_context *context,
         context->update_unordered_access_view_bindings = 1;
     }
 
+    /* Unbind the FBOs to avoid undefined behavior when reading data from it inside the shader */
+    context_bind_fbo(context, GL_FRAMEBUFFER, 0);
+    context_invalidate_state(context, STATE_FRAMEBUFFER);
+
     context->last_was_blit = FALSE;
 }
 
-- 
2.15.1




More information about the wine-devel mailing list