Skip to content

st/mesa: Update shader constants right after shaders

Asahi Lina requested to merge asahilina/mesa:fixes/cb0-updates into main

Gallium uses constant buffer 0 for program parameters. When shaders are updated, this can free parameter buffers, leaving constant buffer 0 user pointers dangling.

Other updates (e.g. texture updates) can end up doing draws in the driver (such as via u_blitter). If this happens before cb0 has been removed, we can end up reading freed memory when we set up those draws and try to add the dangling cb0.

Move the constant buffer updates to right after the shader updates, to make sure cb0 is cleaned up/updated as soon as possible and there are no dangling pointers.

Fixes ASAN errors running dEQP-GLES3 on asahi.

Signed-off-by: Asahi Lina lina@asahilina.net

Merge request reports