Module: Mesa Branch: main Commit: 76b751c3b1e74dd81a8167f507243a01c0e16371 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=76b751c3b1e74dd81a8167f507243a01c0e16371
Author: Alyssa Rosenzweig <aly...@rosenzweig.io> Date: Sun Nov 19 12:30:27 2023 -0400 mesa/st: use pipe_shader_from_nir Signed-off-by: Alyssa Rosenzweig <aly...@rosenzweig.io> Reviewed-by: Marek Olšák <marek.ol...@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26272> --- src/mesa/state_tracker/st_pbo_compute.c | 13 +++---------- src/mesa/state_tracker/st_program.c | 12 +++++------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/mesa/state_tracker/st_pbo_compute.c b/src/mesa/state_tracker/st_pbo_compute.c index 6e95b455a21..e1bb5fee321 100644 --- a/src/mesa/state_tracker/st_pbo_compute.c +++ b/src/mesa/state_tracker/st_pbo_compute.c @@ -28,6 +28,7 @@ #include "main/image.h" #include "main/pbo.h" +#include "nir/pipe_nir.h" #include "state_tracker/st_nir.h" #include "state_tracker/st_format.h" #include "state_tracker/st_pbo.h" @@ -941,12 +942,8 @@ download_texture_compute(struct st_context *st, if (!async->cs) { /* cs job not yet started */ assert(async->nir && !async->cs); - struct pipe_compute_state state = {0}; - state.ir_type = PIPE_SHADER_IR_NIR; - state.static_shared_mem = async->nir->info.shared_size; - state.prog = async->nir; + async->cs = pipe_shader_from_nir(pipe, async->nir); async->nir = NULL; - async->cs = pipe->create_compute_state(pipe, &state); } /* cs *may* be done */ if (screen->is_parallel_shader_compilation_finished && @@ -956,12 +953,8 @@ download_texture_compute(struct st_context *st, if (spec->uses > SPEC_USES_THRESHOLD && util_queue_fence_is_signalled(&spec->fence)) { if (spec->created) { if (!spec->cs) { - struct pipe_compute_state state = {0}; - state.ir_type = PIPE_SHADER_IR_NIR; - state.static_shared_mem = spec->nir->info.shared_size; - state.prog = spec->nir; + spec->cs = pipe_shader_from_nir(pipe, spec->nir); spec->nir = NULL; - spec->cs = pipe->create_compute_state(pipe, &state); } if (screen->is_parallel_shader_compilation_finished && screen->is_parallel_shader_compilation_finished(screen, spec->cs, MESA_SHADER_COMPUTE)) { diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 7d1f2a14074..ab3ed71acb2 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -35,6 +35,7 @@ #include "main/hash.h" #include "main/mtypes.h" +#include "nir/pipe_nir.h" #include "program/prog_parameter.h" #include "program/prog_print.h" #include "program/prog_to_nir.h" @@ -496,7 +497,6 @@ st_create_nir_shader(struct st_context *st, struct pipe_shader_state *state) assert(state->type == PIPE_SHADER_IR_NIR); nir_shader *nir = state->ir.nir; - struct shader_info info = nir->info; gl_shader_stage stage = nir->info.stage; if (ST_DEBUG & DEBUG_PRINT_IR) { @@ -522,12 +522,10 @@ st_create_nir_shader(struct st_context *st, struct pipe_shader_state *state) shader = pipe->create_fs_state(pipe, state); break; case MESA_SHADER_COMPUTE: { - struct pipe_compute_state cs = {0}; - cs.ir_type = state->type; - cs.static_shared_mem = info.shared_size; - cs.prog = state->ir.nir; - - shader = pipe->create_compute_state(pipe, &cs); + /* We'd like to use this for all stages but we need to rework streamout in + * gallium first. + */ + shader = pipe_shader_from_nir(pipe, nir); break; } default: