[Mesa-dev] [PATCH 4/4] i965: Use the tex projector lowering pass instead of hand-rolling it.

Jason Ekstrand jason at jlekstrand.net
Thu Apr 2 16:18:01 PDT 2015


I'm going to kick this off to Jenkins now.  Assuming it gives a green
light, the series is

Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>

I'm going to write a NIR variant of the i965 cube clamping pass so I
want the builder stuff for that.
--Jason

On Wed, Apr 1, 2015 at 3:11 PM, Eric Anholt <eric at anholt.net> wrote:
> This only impacts the ARB_fp path.  We can't quite disable the GLSL-level
> lowering pass, because it needs to apply before
> brw_do_lower_unnormalized_offset().
> ---
>
> Note: I haven't fully piglited this.  It sounds like there are nice
> automated systems for regression testing now.
>
> src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> index 4dfb4d6..0f1659d 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> @@ -101,6 +101,9 @@ fs_visitor::emit_nir_code()
>     nir_lower_global_vars_to_local(nir);
>     nir_validate_shader(nir);
>
> +   nir_lower_tex_projector(nir);
> +   nir_validate_shader(nir);
> +
>     nir_split_var_copies(nir);
>     nir_validate_shader(nir);
>
> @@ -1782,7 +1785,6 @@ fs_visitor::nir_emit_texture(nir_tex_instr *instr)
>     int lod_components = 0, offset_components = 0;
>
>     fs_reg coordinate, shadow_comparitor, lod, lod2, sample_index, mcs, tex_offset;
> -   fs_reg projector;
>
>     for (unsigned i = 0; i < instr->num_srcs; i++) {
>        fs_reg src = get_nir_src(instr->src[i].src);
> @@ -1835,8 +1837,7 @@ fs_visitor::nir_emit_texture(nir_tex_instr *instr)
>              offset_components = instr->coord_components;
>           break;
>        case nir_tex_src_projector:
> -         projector = retype(src, BRW_REGISTER_TYPE_F);
> -         break;
> +         unreachable("should be lowered");
>
>        case nir_tex_src_sampler_offset: {
>           /* Figure out the highest possible sampler index and mark it as used */
> @@ -1860,13 +1861,6 @@ fs_visitor::nir_emit_texture(nir_tex_instr *instr)
>        }
>     }
>
> -   if (projector.file != BAD_FILE) {
> -      fs_reg invproj = vgrf(glsl_type::float_type);
> -      emit_math(SHADER_OPCODE_RCP, invproj, projector);
> -      for (int i = 0; i < 3; i++)
> -         emit(MUL(offset(coordinate, i), offset(coordinate, i), invproj));
> -   }
> -
>     if (instr->op == nir_texop_txf_ms) {
>        if (brw->gen >= 7 &&
>            key_tex->compressed_multisample_layout_mask & (1 << sampler)) {
> --
> 2.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list