}
}
+void
+st_nir_lower_uniforms(struct st_context *st, nir_shader *nir)
+{
+ if (st->ctx->Const.PackedDriverUniformStorage) {
+ NIR_PASS_V(nir, nir_lower_io, nir_var_uniform, st_glsl_type_dword_size,
+ (nir_lower_io_options)0);
+ NIR_PASS_V(nir, nir_lower_uniforms_to_ubo, 4);
+ } else {
+ NIR_PASS_V(nir, nir_lower_io, nir_var_uniform, st_glsl_uniforms_type_size,
+ (nir_lower_io_options)0);
+ }
+}
+
/* Last third of preparing nir from glsl, which happens after shader
* variant lowering.
*/
/* Set num_uniforms in number of attribute slots (vec4s) */
nir->num_uniforms = DIV_ROUND_UP(prog->Parameters->NumParameterValues, 4);
- if (st->ctx->Const.PackedDriverUniformStorage) {
- NIR_PASS_V(nir, nir_lower_io, nir_var_uniform, st_glsl_type_dword_size,
- (nir_lower_io_options)0);
- NIR_PASS_V(nir, nir_lower_uniforms_to_ubo, 4);
- } else {
- NIR_PASS_V(nir, nir_lower_io, nir_var_uniform, st_glsl_uniforms_type_size,
- (nir_lower_io_options)0);
- }
-
+ st_nir_lower_uniforms(st, nir);
st_nir_lower_samplers(screen, nir, shader_program, prog);
if (finalize_by_driver && screen->finalize_nir)
void st_nir_lower_samplers(struct pipe_screen *screen, struct nir_shader *nir,
struct gl_shader_program *shader_program,
struct gl_program *prog);
+void st_nir_lower_uniforms(struct st_context *st, struct nir_shader *nir);
struct pipe_shader_state *
st_nir_finish_builtin_shader(struct st_context *st,
st_nir_assign_varying_locations(st, nir);
st_nir_lower_samplers(screen, nir, NULL, NULL);
-
- if (st->ctx->Const.PackedDriverUniformStorage) {
- NIR_PASS_V(nir, nir_lower_io, nir_var_uniform, st_glsl_type_dword_size,
- (nir_lower_io_options)0);
- NIR_PASS_V(nir, nir_lower_uniforms_to_ubo, 4);
- } else {
- NIR_PASS_V(nir, nir_lower_io, nir_var_uniform, st_glsl_uniforms_type_size,
- (nir_lower_io_options)0);
- }
+ st_nir_lower_uniforms(st, nir);
if (screen->finalize_nir)
screen->finalize_nir(screen, nir, true);