diff --git a/src/gallium/auxiliary/driver_ddebug/dd_screen.c b/src/gallium/auxiliary/driver_ddebug/dd_screen.c index abe9fa8c692..215f1662c3f 100644 --- a/src/gallium/auxiliary/driver_ddebug/dd_screen.c +++ b/src/gallium/auxiliary/driver_ddebug/dd_screen.c @@ -466,12 +466,12 @@ dd_screen_memobj_destroy(struct pipe_screen *_screen, * screen */ -static char * +static void dd_screen_finalize_nir(struct pipe_screen *_screen, struct nir_shader *nir) { struct pipe_screen *screen = dd_screen(_screen)->screen; - return screen->finalize_nir(screen, nir); + screen->finalize_nir(screen, nir); } static void diff --git a/src/gallium/auxiliary/driver_noop/noop_pipe.c b/src/gallium/auxiliary/driver_noop/noop_pipe.c index 07e8956921b..46878d9179b 100644 --- a/src/gallium/auxiliary/driver_noop/noop_pipe.c +++ b/src/gallium/auxiliary/driver_noop/noop_pipe.c @@ -579,11 +579,11 @@ static const struct nir_shader_compiler_options *noop_get_compiler_options( return screen->get_compiler_options(screen, shader); } -static char *noop_finalize_nir(struct pipe_screen *pscreen, struct nir_shader *nir) +static void noop_finalize_nir(struct pipe_screen *pscreen, struct nir_shader *nir) { struct pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen; - return screen->finalize_nir(screen, nir); + screen->finalize_nir(screen, nir); } static bool noop_check_resource_capability(struct pipe_screen *screen, diff --git a/src/gallium/auxiliary/driver_trace/tr_screen.c b/src/gallium/auxiliary/driver_trace/tr_screen.c index 7ba74b9a99e..16e931a6e58 100644 --- a/src/gallium/auxiliary/driver_trace/tr_screen.c +++ b/src/gallium/auxiliary/driver_trace/tr_screen.c @@ -1097,12 +1097,12 @@ trace_screen_get_timestamp(struct pipe_screen *_screen) return result; } -static char * +static void trace_screen_finalize_nir(struct pipe_screen *_screen, struct nir_shader *nir) { struct pipe_screen *screen = trace_screen(_screen)->screen; - return screen->finalize_nir(screen, nir); + screen->finalize_nir(screen, nir); } static void diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c index 7c162b8affa..d8befefdae4 100644 --- a/src/gallium/auxiliary/nir/tgsi_to_nir.c +++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c @@ -2566,8 +2566,7 @@ ttn_finalize_nir(struct ttn_compile *c, struct pipe_screen *screen) NIR_PASS(_, nir, nir_lower_samplers); if (screen->finalize_nir) { - char *msg = screen->finalize_nir(screen, nir); - free(msg); + screen->finalize_nir(screen, nir); } else { ttn_optimize_nir(nir); } diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c index e1b3170f89c..ccec262e886 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c @@ -480,7 +480,7 @@ ir3_fixup_shader_state(struct pipe_context *pctx, struct ir3_shader_key *key) } } -static char * +static void ir3_screen_finalize_nir(struct pipe_screen *pscreen, struct nir_shader *nir) { struct fd_screen *screen = fd_screen(pscreen); @@ -491,8 +491,6 @@ ir3_screen_finalize_nir(struct pipe_screen *pscreen, struct nir_shader *nir) ir3_nir_lower_io_vars_to_temporaries(nir); ir3_finalize_nir(screen->compiler, &options, nir); - - return NULL; } static void diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 60c6c697c06..20b48ec1430 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -235,7 +235,7 @@ i915_optimize_nir(struct nir_shader *s) NIR_PASS(_, s, nir_group_loads, nir_group_all, ~0); } -static char * +static void i915_finalize_nir(struct pipe_screen *pscreen, struct nir_shader *s) { if (s->info.stage == MESA_SHADER_FRAGMENT) @@ -258,7 +258,6 @@ i915_finalize_nir(struct pipe_screen *pscreen, struct nir_shader *s) nir_validate_shader(s, "after uniform var removal"); nir_sweep(s); - return NULL; } static void diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index a53b98251e3..a3e05775b6a 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -3769,7 +3769,7 @@ iris_bind_cs_state(struct pipe_context *ctx, void *state) bind_shader_state((void *) ctx, state, MESA_SHADER_COMPUTE); } -static char * +static void iris_finalize_nir(struct pipe_screen *_screen, struct nir_shader *nir) { struct iris_screen *screen = (struct iris_screen *)_screen; @@ -3813,8 +3813,6 @@ iris_finalize_nir(struct pipe_screen *_screen, struct nir_shader *nir) NIR_PASS(_, nir, iris_lower_storage_image_derefs); nir_sweep(nir); - - return NULL; } static void diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 52bd21302eb..fd697e2ab07 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -473,12 +473,11 @@ static const struct nir_shader_compiler_options gallivm_nir_options = { }; -static char * +static void llvmpipe_finalize_nir(struct pipe_screen *screen, struct nir_shader *nir) { lp_build_opt_nir(nir); - return NULL; } diff --git a/src/gallium/drivers/r600/r600_sfn.cpp b/src/gallium/drivers/r600/r600_sfn.cpp index 37eca1fef4f..0fa85fbdbc3 100644 --- a/src/gallium/drivers/r600/r600_sfn.cpp +++ b/src/gallium/drivers/r600/r600_sfn.cpp @@ -24,12 +24,11 @@ #include #include -char * +void r600_finalize_nir(pipe_screen *screen, struct nir_shader *nir) { auto rs = container_of(screen, r600_screen, b.b); r600_finalize_nir_common(nir, rs->b.gfx_level); - return nullptr; } class MallocPoolRelease { diff --git a/src/gallium/drivers/r600/r600_sfn.h b/src/gallium/drivers/r600/r600_sfn.h index 0309bbb19b4..097730b8a2c 100644 --- a/src/gallium/drivers/r600/r600_sfn.h +++ b/src/gallium/drivers/r600/r600_sfn.h @@ -15,7 +15,7 @@ extern "C" { #endif -char * +void r600_finalize_nir(struct pipe_screen *screen, struct nir_shader *nir); int diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 4a2cb6900b4..c68a9d62215 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -925,7 +925,7 @@ void si_lower_mediump_io_option(struct nir_shader *nir); bool si_alu_to_scalar_packed_math_filter(const struct nir_instr *instr, const void *data); void si_nir_opts(struct si_screen *sscreen, struct nir_shader *nir, bool has_array_temps); void si_nir_late_opts(struct nir_shader *nir); -char *si_finalize_nir(struct pipe_screen *screen, struct nir_shader *nir); +void si_finalize_nir(struct pipe_screen *screen, struct nir_shader *nir); /* si_state_shaders.cpp */ unsigned si_shader_num_alloc_param_exports(struct si_shader *shader); diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index 9a11c159356..ee614efea9c 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -377,7 +377,7 @@ static void si_lower_nir(struct si_screen *sscreen, struct nir_shader *nir) NIR_PASS(_, nir, nir_lower_fp16_casts, nir_lower_fp16_split_fp64); } -char *si_finalize_nir(struct pipe_screen *screen, struct nir_shader *nir) +void si_finalize_nir(struct pipe_screen *screen, struct nir_shader *nir) { struct si_screen *sscreen = (struct si_screen *)screen; @@ -439,6 +439,4 @@ char *si_finalize_nir(struct pipe_screen *screen, struct nir_shader *nir) /* Require divergence analysis to identify divergent loops. */ nir_metadata_require(nir_shader_get_entrypoint(nir), nir_metadata_divergence); - - return NULL; } diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index e148b71ece7..e6dd5029964 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -6383,7 +6383,7 @@ zink_shader_init(struct zink_screen *screen, struct zink_shader *zs) memcpy(&zs->info, &nir->info, sizeof(nir->info)); } -char * +void zink_shader_finalize(struct pipe_screen *pscreen, struct nir_shader *nir) { struct zink_screen *screen = zink_screen(pscreen); @@ -6408,8 +6408,6 @@ zink_shader_finalize(struct pipe_screen *pscreen, struct nir_shader *nir) nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir)); if (screen->driconf.inline_uniforms) nir_find_inlinable_uniforms(nir); - - return NULL; } void diff --git a/src/gallium/drivers/zink/zink_compiler.h b/src/gallium/drivers/zink/zink_compiler.h index c20cbeaac5d..ef68dcc0c32 100644 --- a/src/gallium/drivers/zink/zink_compiler.h +++ b/src/gallium/drivers/zink/zink_compiler.h @@ -77,7 +77,7 @@ zink_shader_create(struct zink_screen *screen, struct nir_shader *nir); void zink_shader_init(struct zink_screen *screen, struct zink_shader *zs); -char * +void zink_shader_finalize(struct pipe_screen *pscreen, struct nir_shader *nir); void diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 8423e127fcc..cac3c7304f7 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -619,11 +619,8 @@ struct pipe_screen { * * gallium frontends should call this before passing shaders to drivers, * and ideally also before shader caching. - * - * The driver may return a non-NULL string to trigger GLSL link failure - * and logging of that message in the GLSL linker log. */ - char *(*finalize_nir)(struct pipe_screen *screen, struct nir_shader *nir); + void (*finalize_nir)(struct pipe_screen *screen, struct nir_shader *nir); /*Separated memory/resource allocations interfaces for Vulkan */ diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index 694b264eff7..2b2096e04ac 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -206,7 +206,7 @@ filter_64_bit_instr(const nir_instr *const_instr, UNUSED const void *data) /* Second third of converting glsl_to_nir. This creates uniforms, gathers * info on varyings, etc after NIR link time opts have been applied. */ -static char * +static void st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog, struct gl_shader_program *shader_program) { @@ -316,13 +316,12 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog, st_set_prog_affected_state_flags(prog); nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir)); - char *msg = NULL; if (st->allow_st_finalize_nir_twice) { st_serialize_base_nir(prog, nir); st_finalize_nir(st, prog, shader_program, nir, true, false); if (screen->finalize_nir) - msg = screen->finalize_nir(screen, nir); + screen->finalize_nir(screen, nir); } if (st->ctx->_Shader->Flags & GLSL_DUMP) { @@ -333,8 +332,6 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog, nir_print_shader(nir, mesa_log_get_file()); _mesa_log("\n\n"); } - - return msg; } extern "C" { @@ -515,11 +512,7 @@ st_link_glsl_to_nir(struct gl_context *ctx, struct gl_linked_shader *shader = linked_shader[i]; struct shader_info *info = &shader->Program->nir->info; - char *msg = st_glsl_to_nir_post_opts(st, shader->Program, shader_program); - if (msg) { - linker_error(shader_program, msg); - return false; - } + st_glsl_to_nir_post_opts(st, shader->Program, shader_program); if (prev_info && ctx->Const.ShaderCompilerOptions[shader->Stage].NirOptions->unify_interfaces) { diff --git a/src/mesa/state_tracker/st_nir_builtins.c b/src/mesa/state_tracker/st_nir_builtins.c index 257e5853977..f4c013f2481 100644 --- a/src/mesa/state_tracker/st_nir_builtins.c +++ b/src/mesa/state_tracker/st_nir_builtins.c @@ -69,8 +69,7 @@ st_nir_finish_builtin_nir(struct st_context *st, nir_shader *nir) } if (screen->finalize_nir) { - char *msg = screen->finalize_nir(screen, nir); - free(msg); + screen->finalize_nir(screen, nir); } else { gl_nir_opts(nir); } diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 03b9c55d67f..c6137e29692 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -373,10 +373,8 @@ st_prog_to_nir_postprocess(struct st_context *st, nir_shader *nir, st_serialize_base_nir(prog, nir); st_finalize_nir(st, prog, NULL, nir, true, false); - if (screen->finalize_nir) { - char *msg = screen->finalize_nir(screen, nir); - free(msg); - } + if (screen->finalize_nir) + screen->finalize_nir(screen, nir); } nir_validate_shader(nir, "after st/glsl finalize_nir"); @@ -846,10 +844,8 @@ st_create_common_variant(struct st_context *st, if (finalize || !st->allow_st_finalize_nir_twice || key->is_draw_shader) { struct pipe_screen *screen = st->screen; - if (!key->is_draw_shader && screen->finalize_nir) { - char *msg = screen->finalize_nir(screen, state.ir.nir); - free(msg); - } + if (!key->is_draw_shader && screen->finalize_nir) + screen->finalize_nir(screen, state.ir.nir); /* Clip lowering and edgeflags may have introduced new varyings, so * update the inputs_read/outputs_written. However, with @@ -1232,10 +1228,8 @@ st_create_fp_variant(struct st_context *st, nir_shader_get_entrypoint(state.ir.nir)); struct pipe_screen *screen = st->screen; - if (screen->finalize_nir) { - char *msg = screen->finalize_nir(screen, state.ir.nir); - free(msg); - } + if (screen->finalize_nir) + screen->finalize_nir(screen, state.ir.nir); } variant->base.driver_shader = st_create_nir_shader(st, &state);