Module: Mesa
Branch: master
Commit: 8ed874d73fafcfbcb54730dc5c20e58f24d55f5e
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8ed874d73fafcfbcb54730dc5c20e58f24d55f5e

Author: Dave Airlie <[email protected]>
Date:   Mon Feb  8 17:31:36 2021 +1000

lavapipe: reset shader constant buffers after execution

Otherwise this leads to a use-after-free
dEQP-VK.synchronization.op.single_queue.fence.write_fill_buffer_read_ssbo_vertex.buffer_16384
when run after any test using a ubo in the fragment shader.

Reviewed-by: Adam Jackson <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8912>

---

 src/gallium/frontends/lavapipe/lvp_execute.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c 
b/src/gallium/frontends/lavapipe/lvp_execute.c
index e0014d3a3d5..404f8b7903c 100644
--- a/src/gallium/frontends/lavapipe/lvp_execute.c
+++ b/src/gallium/frontends/lavapipe/lvp_execute.c
@@ -2793,6 +2793,10 @@ VkResult lvp_execute_cmds(struct lvp_device *device,
       state.pctx->bind_sampler_states(state.pctx, s, 0, PIPE_MAX_SAMPLERS, 
state.ss_cso[s]);
 
       state.pctx->set_shader_images(state.pctx, s, 0, 0, 
device->physical_device->max_images, NULL);
+
+      state.pctx->set_constant_buffer(state.pctx, s, 0, false, NULL);
+      for (unsigned idx = 0; idx < state.num_const_bufs[s]; idx++)
+         state.pctx->set_constant_buffer(state.pctx, s, idx + 1, false, NULL);
    }
 
    free(state.pending_clear_aspects);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to