mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
gallium: make pipe_screen::finalize_nir return void
The returned message was replaced by create_xx_state returning the message. Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36094>
This commit is contained in:
parent
5afcf93a59
commit
a30f1fa7f0
18 changed files with 28 additions and 57 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,12 +24,11 @@
|
|||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
char *
|
||||
void
|
||||
r600_finalize_nir(struct pipe_screen *screen, struct nir_shader *nir);
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue