Module: Mesa Branch: main Commit: 4e1668384d58c6fd32950a43707e9622f77bbf89 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e1668384d58c6fd32950a43707e9622f77bbf89
Author: Mike Blumenkrantz <[email protected]> Date: Wed Mar 29 08:40:14 2023 -0400 zink: store num_inlinable_uniforms separately for cs programs compute is a special case because the zink_shader itself is created in a thread, which means it cannot be accessed directly at bind time since it may not have finished creating itself yet to avoid prematurely waiting on an async fence, the one value needed at bind time can instead be stored separately Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22266> --- src/gallium/drivers/zink/zink_program.c | 3 ++- src/gallium/drivers/zink/zink_types.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index 539eaa9c672..315a72d4fae 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -1282,6 +1282,7 @@ create_compute_program(struct zink_context *ctx, nir_shader *nir) if (!comp) return NULL; comp->nir = nir; + comp->num_inlinable_uniforms = nir->info.num_inlinable_uniforms; comp->use_local_size = !(nir->info.workgroup_size[0] || nir->info.workgroup_size[1] || @@ -1837,7 +1838,7 @@ zink_bind_cs_state(struct pipe_context *pctx, { struct zink_context *ctx = zink_context(pctx); struct zink_compute_program *comp = cso; - if (comp && comp->nir->info.num_inlinable_uniforms) + if (comp && comp->num_inlinable_uniforms) ctx->shader_has_inlinable_uniforms_mask |= 1 << MESA_SHADER_COMPUTE; else ctx->shader_has_inlinable_uniforms_mask &= ~(1 << MESA_SHADER_COMPUTE); diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 1e90537a57f..9bd297053af 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -1064,6 +1064,7 @@ struct zink_compute_program { bool use_local_size; + unsigned num_inlinable_uniforms; nir_shader *nir; struct zink_shader_module *curr;
