nir: Add a data pointer to the callback in nir_remove_dead_variables

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8706>
This commit is contained in:
Caio Marcelo de Oliveira Filho
2021-01-21 08:41:15 -08:00
committed by Marge Bot
parent f1cffe2394
commit cb7352ae95
3 changed files with 23 additions and 9 deletions

View File

@@ -35,7 +35,7 @@
*/
static bool
can_remove_uniform(nir_variable *var)
can_remove_uniform(nir_variable *var, UNUSED void *data)
{
/* Section 2.11.6 (Uniform Variables) of the OpenGL ES 3.0.3 spec
* says:
@@ -603,8 +603,11 @@ gl_nir_link_spirv(struct gl_context *ctx, struct gl_shader_program *prog,
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
struct gl_linked_shader *shader = prog->_LinkedShaders[i];
if (shader) {
const nir_remove_dead_variables_options opts = {
.can_remove_var = can_remove_uniform,
};
nir_remove_dead_variables(shader->Program->nir, nir_var_uniform,
&can_remove_uniform);
&opts);
}
}
@@ -664,8 +667,11 @@ gl_nir_link_glsl(struct gl_context *ctx, struct gl_shader_program *prog)
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
struct gl_linked_shader *shader = prog->_LinkedShaders[i];
if (shader) {
const nir_remove_dead_variables_options opts = {
.can_remove_var = can_remove_uniform,
};
nir_remove_dead_variables(shader->Program->nir, nir_var_uniform,
&can_remove_uniform);
&opts);
}
}