From: Timothy Arceri Date: Wed, 5 Jul 2023 02:35:51 +0000 (+1000) Subject: st/glsl: merge st_link_glsl_to_nir() into st_link_nir() X-Git-Tag: upstream/23.3.3~5988 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c6fe8b7cba031a0b694dc304e76b58b55ac72b8a;p=platform%2Fupstream%2Fmesa.git st/glsl: merge st_link_glsl_to_nir() into st_link_nir() Reviewed-by: Marek Olšák Part-of: --- diff --git a/src/mesa/state_tracker/st_glsl_to_ir.cpp b/src/mesa/state_tracker/st_glsl_to_ir.cpp index 2f1fe54..6b8a1d5 100644 --- a/src/mesa/state_tracker/st_glsl_to_ir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_ir.cpp @@ -41,39 +41,6 @@ extern "C" { /** - * Link a shader. - */ -static bool -st_link_glsl_to_nir(struct gl_context *ctx, struct gl_shader_program *prog) -{ - struct pipe_context *pctx = st_context(ctx)->pipe; - - MESA_TRACE_FUNC(); - - GLboolean ret = st_link_nir(ctx, prog); - - if (pctx->link_shader) { - void *driver_handles[PIPE_SHADER_TYPES]; - memset(driver_handles, 0, sizeof(driver_handles)); - - for (uint32_t i = 0; i < MESA_SHADER_STAGES; ++i) { - struct gl_linked_shader *shader = prog->_LinkedShaders[i]; - if (shader) { - struct gl_program *p = shader->Program; - if (p && p->variants) { - enum pipe_shader_type type = pipe_shader_type_from_mesa(shader->Stage); - driver_handles[type] = p->variants->driver_shader; - } - } - } - - pctx->link_shader(pctx, driver_handles); - } - - return ret; -} - -/** * Link a GLSL shader program. Called via glLinkProgram(). */ void @@ -127,7 +94,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) prog->SamplersValidated = GL_TRUE; } - if (prog->data->LinkStatus && !st_link_glsl_to_nir(ctx, prog)) { + if (prog->data->LinkStatus && !st_link_nir(ctx, prog)) { prog->data->LinkStatus = LINKING_FAILURE; } diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index f7ccf6b..712ee04 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -753,6 +753,25 @@ st_link_nir(struct gl_context *ctx, st_finalize_program(st, prog); } + struct pipe_context *pctx = st_context(ctx)->pipe; + if (pctx->link_shader) { + void *driver_handles[PIPE_SHADER_TYPES]; + memset(driver_handles, 0, sizeof(driver_handles)); + + for (uint32_t i = 0; i < MESA_SHADER_STAGES; ++i) { + struct gl_linked_shader *shader = shader_program->_LinkedShaders[i]; + if (shader) { + struct gl_program *p = shader->Program; + if (p && p->variants) { + enum pipe_shader_type type = pipe_shader_type_from_mesa(shader->Stage); + driver_handles[type] = p->variants->driver_shader; + } + } + } + + pctx->link_shader(pctx, driver_handles); + } + return true; }