glsl: pack vertex pipeline varying linkage into a function

No functional change, prepare for add mesh pipeline varying
linking.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36405>
This commit is contained in:
Qiang Yu
2025-02-26 10:47:39 +08:00
committed by Marge Bot
parent c6b24b4cc2
commit 59f1186af2
+28 -18
View File
@@ -4361,25 +4361,15 @@ gl_assign_attribute_or_color_locations(const struct gl_constants *consts,
return true;
}
bool
gl_nir_link_varyings(const struct pipe_screen *screen,
const struct gl_constants *consts,
const struct gl_extensions *exts,
gl_api api, struct gl_shader_program *prog)
static bool
link_vertex_pipeline_varyings(const struct pipe_screen *screen,
const struct gl_constants *consts,
const struct gl_extensions *exts,
gl_api api, struct gl_shader_program *prog,
void *mem_ctx)
{
void *mem_ctx = ralloc_context(NULL);
unsigned first, last;
MESA_TRACE_FUNC();
first = MESA_SHADER_MESH_STAGES;
last = 0;
/* We need to initialise the program resource list because the varying
* packing pass my start inserting varyings onto the list.
*/
init_program_resource_list(prog);
unsigned first = MESA_SHADER_MESH_STAGES;
unsigned last = 0;
/* Determine first and last stage. */
for (unsigned i = 0; i < MESA_SHADER_MESH_STAGES; i++) {
@@ -4392,6 +4382,26 @@ gl_nir_link_varyings(const struct pipe_screen *screen,
bool r = link_varyings(screen, prog, first, last, consts, exts, api, mem_ctx);
return r;
}
bool
gl_nir_link_varyings(const struct pipe_screen *screen,
const struct gl_constants *consts,
const struct gl_extensions *exts,
gl_api api, struct gl_shader_program *prog)
{
void *mem_ctx = ralloc_context(NULL);
MESA_TRACE_FUNC();
/* We need to initialise the program resource list because the varying
* packing pass my start inserting varyings onto the list.
*/
init_program_resource_list(prog);
bool r = link_vertex_pipeline_varyings(screen, consts, exts, api, prog, mem_ctx);
ralloc_free(mem_ctx);
return r;
}