Conor McCarthy : wined3d: Do not bind buffers in state_cb() if the shader is not set.

Alexandre Julliard julliard at winehq.org
Wed Dec 15 14:25:58 CST 2021


Module: wine
Branch: master
Commit: d61c9998d921b7e4268275b0bed865f37be2bc42
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d61c9998d921b7e4268275b0bed865f37be2bc42

Author: Conor McCarthy <cmccarthy at codeweavers.com>
Date:   Thu Dec 16 00:16:25 2021 +1000

wined3d: Do not bind buffers in state_cb() if the shader is not set.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52020
Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/cs.c    | 3 +++
 dlls/wined3d/state.c | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index bb629d9b27f..009ad561be7 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -1768,6 +1768,9 @@ static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data)
 {
     const struct wined3d_cs_set_shader *op = data;
 
+    /* CB binding may have been skipped earlier if the shader wasn't set, so make it happen. */
+    if (!cs->state.shader[op->type] && op->shader)
+        device_invalidate_state(cs->c.device, STATE_CONSTANT_BUFFER(op->type));
     cs->state.shader[op->type] = op->shader;
     device_invalidate_state(cs->c.device, STATE_SHADER(op->type));
     if (op->type != WINED3D_SHADER_TYPE_COMPUTE)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 865c60d189e..208014e2073 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -4579,6 +4579,10 @@ static void state_cb(struct wined3d_context *context, const struct wined3d_state
     else
         shader_type = WINED3D_SHADER_TYPE_COMPUTE;
 
+    /* If a shader has not been set, buffer objects are not yet initialised. */
+    if (!state->shader[shader_type])
+        return;
+
     wined3d_gl_limits_get_uniform_block_range(&gl_info->limits, shader_type, &base, &count);
     for (i = 0; i < count; ++i)
     {




More information about the wine-cvs mailing list