mesa/st: use pipe_shader_from_nir

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26272>
This commit is contained in:
Alyssa Rosenzweig
2023-11-19 12:30:27 -04:00
committed by Marge Bot
parent 0abf4af443
commit 76b751c3b1
2 changed files with 8 additions and 17 deletions

View File

@@ -28,6 +28,7 @@
#include "main/image.h" #include "main/image.h"
#include "main/pbo.h" #include "main/pbo.h"
#include "nir/pipe_nir.h"
#include "state_tracker/st_nir.h" #include "state_tracker/st_nir.h"
#include "state_tracker/st_format.h" #include "state_tracker/st_format.h"
#include "state_tracker/st_pbo.h" #include "state_tracker/st_pbo.h"
@@ -941,12 +942,8 @@ download_texture_compute(struct st_context *st,
if (!async->cs) { if (!async->cs) {
/* cs job not yet started */ /* cs job not yet started */
assert(async->nir && !async->cs); assert(async->nir && !async->cs);
struct pipe_compute_state state = {0}; async->cs = pipe_shader_from_nir(pipe, async->nir);
state.ir_type = PIPE_SHADER_IR_NIR;
state.static_shared_mem = async->nir->info.shared_size;
state.prog = async->nir;
async->nir = NULL; async->nir = NULL;
async->cs = pipe->create_compute_state(pipe, &state);
} }
/* cs *may* be done */ /* cs *may* be done */
if (screen->is_parallel_shader_compilation_finished && 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->uses > SPEC_USES_THRESHOLD && util_queue_fence_is_signalled(&spec->fence)) {
if (spec->created) { if (spec->created) {
if (!spec->cs) { if (!spec->cs) {
struct pipe_compute_state state = {0}; spec->cs = pipe_shader_from_nir(pipe, spec->nir);
state.ir_type = PIPE_SHADER_IR_NIR;
state.static_shared_mem = spec->nir->info.shared_size;
state.prog = spec->nir;
spec->nir = NULL; spec->nir = NULL;
spec->cs = pipe->create_compute_state(pipe, &state);
} }
if (screen->is_parallel_shader_compilation_finished && if (screen->is_parallel_shader_compilation_finished &&
screen->is_parallel_shader_compilation_finished(screen, spec->cs, MESA_SHADER_COMPUTE)) { screen->is_parallel_shader_compilation_finished(screen, spec->cs, MESA_SHADER_COMPUTE)) {

View File

@@ -35,6 +35,7 @@
#include "main/hash.h" #include "main/hash.h"
#include "main/mtypes.h" #include "main/mtypes.h"
#include "nir/pipe_nir.h"
#include "program/prog_parameter.h" #include "program/prog_parameter.h"
#include "program/prog_print.h" #include "program/prog_print.h"
#include "program/prog_to_nir.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); assert(state->type == PIPE_SHADER_IR_NIR);
nir_shader *nir = state->ir.nir; nir_shader *nir = state->ir.nir;
struct shader_info info = nir->info;
gl_shader_stage stage = nir->info.stage; gl_shader_stage stage = nir->info.stage;
if (ST_DEBUG & DEBUG_PRINT_IR) { 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); shader = pipe->create_fs_state(pipe, state);
break; break;
case MESA_SHADER_COMPUTE: { case MESA_SHADER_COMPUTE: {
struct pipe_compute_state cs = {0}; /* We'd like to use this for all stages but we need to rework streamout in
cs.ir_type = state->type; * gallium first.
cs.static_shared_mem = info.shared_size; */
cs.prog = state->ir.nir; shader = pipe_shader_from_nir(pipe, nir);
shader = pipe->create_compute_state(pipe, &cs);
break; break;
} }
default: default: