For the series:

Reviewed-by: Marek Olšák <marek.ol...@amd.com>

Marek

On Tue, May 23, 2017 at 2:01 PM, Timothy Arceri <tarc...@itsqueeze.com> wrote:
> type_size() will already handle this correctly for us.
> ---
>  src/mesa/program/ir_to_mesa.cpp | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
> index 8ae5193..b3e2239 100644
> --- a/src/mesa/program/ir_to_mesa.cpp
> +++ b/src/mesa/program/ir_to_mesa.cpp
> @@ -2438,43 +2438,35 @@ private:
>
>  } /* anonymous namespace */
>
>  void
>  add_uniform_to_shader::visit_field(const glsl_type *type, const char *name,
>                                     bool /* row_major */,
>                                     const glsl_type * /* record_type */,
>                                     const enum glsl_interface_packing,
>                                     bool /* last_field */)
>  {
> -   unsigned int size;
> -
>     /* atomics don't get real storage */
>     if (type->contains_atomic())
>        return;
>
> -   if (type->is_vector() || type->is_scalar()) {
> -      size = type->vector_elements;
> -      if (type->is_64bit())
> -         size *= 2;
> -   } else {
> -      size = type_size(type) * 4;
> -   }
> -
>     gl_register_file file;
>     if (type->without_array()->is_sampler()) {
>        file = PROGRAM_SAMPLER;
>     } else {
>        file = PROGRAM_UNIFORM;
>     }
>
>     int index = _mesa_lookup_parameter_index(params, name);
>     if (index < 0) {
> +      unsigned size = type_size(type) * 4;
> +
>        index = _mesa_add_parameter(params, file, name, size, type->gl_type,
>                                   NULL, NULL);
>
>        /* Sampler uniform values are stored in prog->SamplerUnits,
>         * and the entry in that array is selected by this index we
>         * store in ParameterValues[].
>         */
>        if (file == PROGRAM_SAMPLER) {
>          unsigned location;
>          const bool found =
> --
> 2.9.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to