[Mesa-dev] [PATCH v2 07/23] nir/lower_load_const_to_scalar: suppport doubles and multiple bit sizes

Jason Ekstrand jason at jlekstrand.net
Fri Apr 1 19:06:37 UTC 2016


On Thu, Mar 31, 2016 at 2:59 AM, Samuel Iglesias Gonsálvez <
siglesias at igalia.com> wrote:

> From: Iago Toral Quiroga <itoral at igalia.com>
>
> ---
>  src/compiler/nir/nir_lower_load_const_to_scalar.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/compiler/nir/nir_lower_load_const_to_scalar.c
> b/src/compiler/nir/nir_lower_load_const_to_scalar.c
> index d290c30..aae2f7c 100644
> --- a/src/compiler/nir/nir_lower_load_const_to_scalar.c
> +++ b/src/compiler/nir/nir_lower_load_const_to_scalar.c
> @@ -49,8 +49,11 @@ lower_load_const_instr_scalar(nir_load_const_instr
> *lower)
>     nir_ssa_def *loads[4];
>     for (unsigned i = 0; i < lower->def.num_components; i++) {
>        nir_load_const_instr *load_comp =
> -         nir_load_const_instr_create(b.shader, 1, 32);
> -      load_comp->value.u32[0] = lower->value.u32[i];
> +         nir_load_const_instr_create(b.shader, 1, lower->def.bit_size);
> +      if (lower->def.bit_size == 64)
> +         load_comp->value.f64[0] = lower->value.f64[i];
> +      else
> +         load_comp->value.u32[0] = lower->value.u32[i];
>

Could we please throw an assert in here that it's only 32 or 64.  I want
this to be easy to find when we start supporting 16-bit floats.


>        nir_builder_instr_insert(&b, &load_comp->instr);
>        loads[i] = &load_comp->def;
>     }
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160401/9d85d3a3/attachment-0001.html>


More information about the mesa-dev mailing list