[Mesa-dev] [PATCH 11/11] i965/nir: Simplify uniform setup
Iago Toral
itoral at igalia.com
Fri Oct 2 04:19:07 PDT 2015
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
On Wed, 2015-09-30 at 18:41 -0700, Jason Ekstrand wrote:
> ---
> 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 829c663..eb0fe7b 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 36bb35f..8274d48 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);
> }
> }
>
More information about the mesa-dev
mailing list