st/nir: Pull sampler lowering into a helper function.
This will make it easier to reuse across GLSL / ARB / built-ins. Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
@@ -846,6 +846,16 @@ st_nir_assign_varying_locations(struct st_context *st, nir_shader *nir)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
st_nir_lower_samplers(struct pipe_screen *screen, nir_shader *nir,
|
||||
struct gl_shader_program *shader_program)
|
||||
{
|
||||
if (screen->get_param(screen, PIPE_CAP_NIR_SAMPLERS_AS_DEREF))
|
||||
NIR_PASS_V(nir, gl_nir_lower_samplers_as_deref, shader_program);
|
||||
else
|
||||
NIR_PASS_V(nir, gl_nir_lower_samplers, shader_program);
|
||||
}
|
||||
|
||||
/* Last third of preparing nir from glsl, which happens after shader
|
||||
* variant lowering.
|
||||
*/
|
||||
@@ -881,10 +891,7 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog,
|
||||
NIR_PASS_V(nir, st_nir_lower_uniforms_to_ubo);
|
||||
}
|
||||
|
||||
if (screen->get_param(screen, PIPE_CAP_NIR_SAMPLERS_AS_DEREF))
|
||||
NIR_PASS_V(nir, gl_nir_lower_samplers_as_deref, shader_program);
|
||||
else
|
||||
NIR_PASS_V(nir, gl_nir_lower_samplers, shader_program);
|
||||
st_nir_lower_samplers(screen, nir, shader_program);
|
||||
}
|
||||
|
||||
} /* extern "C" */
|
||||
|
@@ -55,6 +55,9 @@ st_link_nir(struct gl_context *ctx,
|
||||
void st_nir_assign_varying_locations(struct st_context *st,
|
||||
struct nir_shader *nir);
|
||||
|
||||
void st_nir_lower_samplers(struct pipe_screen *screen, struct nir_shader *nir,
|
||||
struct gl_shader_program *shader_program);
|
||||
|
||||
struct pipe_shader_state *
|
||||
st_nir_finish_builtin_shader(struct st_context *st,
|
||||
struct nir_shader *nir,
|
||||
|
Reference in New Issue
Block a user