[Mesa-dev] [PATCH 8/8 v2] i965: Enable EXT_shader_samples_identical

Jason Ekstrand jason at jlekstrand.net
Wed Nov 18 21:43:54 PST 2015


On Nov 18, 2015 6:38 PM, "Ian Romanick" <idr at freedesktop.org> wrote:
>
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> v2: Handle immediate value for MCS smarter.  Rebase on changes to
> nir_texop_sampels_identical (missing second parameter).  Suggested by
> Jason.  This still doesn't handle the 16x MSAA case.

We could always just enable it on IVB-BDW for now.

The last three are

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

> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_fs_nir.cpp       |  4 +++-
>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   | 16 ++++++++++++++++
>  src/mesa/drivers/dri/i965/brw_vec4_nir.cpp     |  4 +++-
>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 11 +++++++++++
>  src/mesa/drivers/dri/i965/intel_extensions.c   |  1 +
>  5 files changed, 34 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> index 80315fe..c85c9fc 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> @@ -2624,6 +2624,7 @@ fs_visitor::nir_emit_texture(const fs_builder &bld,
nir_tex_instr *instr)
>           switch (instr->op) {
>           case nir_texop_txf:
>           case nir_texop_txf_ms:
> +         case nir_texop_samples_identical:
>              coordinate = retype(src, BRW_REGISTER_TYPE_D);
>              break;
>           default:
> @@ -2686,7 +2687,8 @@ fs_visitor::nir_emit_texture(const fs_builder &bld,
nir_tex_instr *instr)
>        }
>     }
>
> -   if (instr->op == nir_texop_txf_ms) {
> +   if (instr->op == nir_texop_txf_ms ||
> +       instr->op == nir_texop_samples_identical) {
>        if (devinfo->gen >= 7 &&
>            key_tex->compressed_multisample_layout_mask & (1 << sampler)) {
>           mcs = emit_mcs_fetch(coordinate, instr->coord_components,
sampler_reg);
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> index a7bd9ce..66cbbd2 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> @@ -259,6 +259,22 @@ fs_visitor::emit_texture(ir_texture_opcode op,
>        lod = fs_reg(0u);
>     }
>
> +   if (op == ir_samples_identical) {
> +      fs_reg dst = vgrf(glsl_type::get_instance(dest_type->base_type, 1,
1));
> +
> +      /* If mcs is an immediate value, it means there is no MCS.  In
that case
> +       * just return false.
> +       */
> +      if (mcs.file == BRW_IMMEDIATE_VALUE) {
> +         bld.MOV(dst, fs_reg(0));
> +      } else {
> +         bld.CMP(dst, mcs, src_reg(0u), BRW_CONDITIONAL_EQ);
> +      }
> +
> +      this->result = dst;
> +      return;
> +   }
> +
>     if (coordinate.file != BAD_FILE) {
>        /* FINISHME: Texture coordinate rescaling doesn't work with
non-constant
>         * samplers.  This should only be a problem with GL_CLAMP on Gen7.
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> index c93227c..98a4d3b 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> @@ -1615,6 +1615,7 @@ vec4_visitor::nir_emit_texture(nir_tex_instr *instr)
>           switch (instr->op) {
>           case nir_texop_txf:
>           case nir_texop_txf_ms:
> +         case nir_texop_samples_identical:
>              coordinate = get_nir_src(instr->src[i].src,
BRW_REGISTER_TYPE_D,
>                                       src_size);
>              coord_type = glsl_type::ivec(src_size);
> @@ -1695,7 +1696,8 @@ vec4_visitor::nir_emit_texture(nir_tex_instr *instr)
>        }
>     }
>
> -   if (instr->op == nir_texop_txf_ms) {
> +   if (instr->op == nir_texop_txf_ms ||
> +       instr->op == nir_texop_samples_identical) {
>        assert(coord_type != NULL);
>        if (devinfo->gen >= 7 &&
>            key_tex->compressed_multisample_layout_mask & (1 << sampler)) {
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> index fda3d7c..d8a0f22 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> @@ -909,6 +909,17 @@ vec4_visitor::emit_texture(ir_texture_opcode op,
>        unreachable("TXB is not valid for vertex shaders.");
>     case ir_lod:
>        unreachable("LOD is not valid for vertex shaders.");
> +   case ir_samples_identical: {
> +      /* If mcs is an immediate value, it means there is no MCS.  In
that case
> +       * just return false.
> +       */
> +      if (mcs.file == BRW_IMMEDIATE_VALUE) {
> +         emit(MOV(dest, src_reg(0u)));
> +      } else {
> +         emit(CMP(dest, mcs, src_reg(0u), BRW_CONDITIONAL_EQ));
> +      }
> +      return;
> +   }
>     default:
>        unreachable("Unrecognized tex op");
>     }
> diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c
b/src/mesa/drivers/dri/i965/intel_extensions.c
> index 386b63c..2e2459c 100644
> --- a/src/mesa/drivers/dri/i965/intel_extensions.c
> +++ b/src/mesa/drivers/dri/i965/intel_extensions.c
> @@ -333,6 +333,7 @@ intelInitExtensions(struct gl_context *ctx)
>        ctx->Extensions.ARB_texture_compression_bptc = true;
>        ctx->Extensions.ARB_texture_view = true;
>        ctx->Extensions.ARB_shader_storage_buffer_object = true;
> +      ctx->Extensions.EXT_shader_samples_identical = true;
>
>        if (can_do_pipelined_register_writes(brw)) {
>           ctx->Extensions.ARB_draw_indirect = true;
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151118/7ca29f84/attachment.html>


More information about the mesa-dev mailing list