[Mesa-dev] [PATCH 2/9] i965/vec4: Initialize LOD to 0.0f.

Matt Turner mattst88 at gmail.com
Mon Oct 19 23:11:36 PDT 2015


On Mon, Oct 19, 2015 at 9:09 PM, Matt Turner <mattst88 at gmail.com> wrote:
> We implement textureQueryLevels (which takes no arguments, save the
> sampler) using the resinfo message (which takes an argument of LOD).
> Without initializing it, we'd generate a MOV from the null register to
> load the LOD argument.
> ---
>  src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> index ea1e3e7..c942c80 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> @@ -1579,7 +1579,7 @@ vec4_visitor::nir_emit_texture(nir_tex_instr *instr)
>     const glsl_type *coord_type = NULL;
>     src_reg shadow_comparitor;
>     src_reg offset_value;
> -   src_reg lod, lod2;
> +   src_reg lod(0.0f), lod2;
>     src_reg sample_index;
>     src_reg mcs;

The fs backend handles this differently --

   if (op == ir_query_levels) {
      /* textureQueryLevels() is implemented in terms of TXS so we need to
       * pass a valid LOD argument.
       */
      assert(lod.file == BAD_FILE);
      lod = fs_reg(0u);
   }

That kinda seems worse -- but it does indicate that I should probably
initialize lod with 0u instead, though it doesn't seem to matter...

mov(8)          g10<1>F         [0F, 0F, 0F, 0F]VF
send(8)         g3<1>UW         g10<8,8,1>F
                 sampler resinfo SIMD8 Surface = 1 Sampler = 0 mlen 1 rlen 4

Opinions?


More information about the mesa-dev mailing list