From cdf314cb21377ee7caca05bd1abab6a2b921d213 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 30 Sep 2015 17:37:36 -0700 Subject: [PATCH] i965/nir: Simplify uniform setup Reviewed-by: Iago Toral Quiroga --- src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 19 ++++++++----------- src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 21 ++++++++------------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 829c663ec1d..eb0fe7b2856 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -185,20 +185,17 @@ fs_visitor::nir_setup_uniforms(nir_shader *shader) if (shader_prog) { brw_nir_setup_glsl_uniforms(shader, shader_prog, prog, stage_prog_data, true); - - foreach_list_typed(nir_variable, var, node, &shader->uniforms) { - /* UBO's and atomics don't take up space in the uniform file */ - if (var->interface_type != NULL || var->type->contains_atomic()) - continue; - - if(type_size_scalar(var->type) > 0) - param_size[var->data.driver_location] = type_size_scalar(var->type); - } } else { brw_nir_setup_arb_uniforms(shader, prog, stage_prog_data); + } + + foreach_list_typed(nir_variable, var, node, &shader->uniforms) { + /* UBO's and atomics don't take up space in the uniform file */ + if (var->interface_type != NULL || var->type->contains_atomic()) + continue; - if(prog->Parameters->NumParameters > 0) - param_size[0] = prog->Parameters->NumParameters * 4; + if (type_size_scalar(var->type) > 0) + param_size[var->data.driver_location] = type_size_scalar(var->type); } } diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp index 36bb35f91f4..8274d4842e8 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp @@ -139,22 +139,17 @@ vec4_visitor::nir_setup_uniforms(nir_shader *shader) if (shader_prog) { brw_nir_setup_glsl_uniforms(shader, shader_prog, prog, stage_prog_data, false); - - foreach_list_typed(nir_variable, var, node, &shader->uniforms) { - /* UBO's, atomics and samplers don't take up space in the - uniform file */ - if (var->interface_type != NULL || var->type->contains_atomic() || - type_size_vec4(var->type) == 0) { - continue; - } - - uniform_size[var->data.driver_location] = type_size_vec4(var->type); - } } else { brw_nir_setup_arb_uniforms(shader, prog, stage_prog_data); + } + + foreach_list_typed(nir_variable, var, node, &shader->uniforms) { + /* UBO's and atomics don't take up space in the uniform file */ + if (var->interface_type != NULL || var->type->contains_atomic()) + continue; - if(prog->Parameters->NumParameters > 0) - uniform_size[0] = prog->Parameters->NumParameters; + if (type_size_vec4(var->type) > 0) + uniform_size[var->data.driver_location] = type_size_vec4(var->type); } } -- 2.30.2