[Mesa-dev,11/21] i965/fs: Translate nir_intrinsic_load_output on a fragment output.

Submitted by Francisco Jerez on July 23, 2016, 3:59 a.m.

Details

Message ID 20160723035915.25202-12-currojerez@riseup.net
State New
Headers show
Series "i965: Implement non-coherent framebuffer fetch." ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Francisco Jerez July 23, 2016, 3:59 a.m.
This gets the non-coherent framebuffer fetch path hooked up to the NIR
front-end.
---
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 281c704..d547366 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -3312,6 +3312,25 @@  fs_visitor::nir_emit_fs_intrinsic(const fs_builder &bld,
       break;
    }
 
+   case nir_intrinsic_load_output: {
+      const unsigned l = GET_FIELD(nir_intrinsic_base(instr),
+                                   BRW_NIR_FRAG_OUTPUT_LOCATION);
+      assert(l >= FRAG_RESULT_DATA0);
+      nir_const_value *const_offset = nir_src_as_const_value(instr->src[0]);
+      assert(const_offset && "Indirect output loads not allowed");
+      const unsigned target = l - FRAG_RESULT_DATA0 + const_offset->u32[0];
+      const fs_reg tmp = bld.vgrf(dest.type, 4);
+
+      assert(!reinterpret_cast<const brw_wm_prog_key *>(key)->coherent_fb_fetch);
+      emit_non_coherent_fb_read(this, tmp, target);
+
+      for (unsigned j = 0; j < instr->num_components; j++)
+         bld.MOV(offset(dest, bld, j),
+                 offset(tmp, bld, nir_intrinsic_component(instr) + j));
+
+      break;
+   }
+
    case nir_intrinsic_discard:
    case nir_intrinsic_discard_if: {
       /* We track our discarded pixels in f0.1.  By predicating on it, we can

Comments

On Friday, July 22, 2016 8:59:05 PM PDT Francisco Jerez wrote:
> This gets the non-coherent framebuffer fetch path hooked up to the NIR
> front-end.
> ---
>  src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> index 281c704..d547366 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> @@ -3312,6 +3312,25 @@ fs_visitor::nir_emit_fs_intrinsic(const fs_builder &bld,
>        break;
>     }
>  
> +   case nir_intrinsic_load_output: {
> +      const unsigned l = GET_FIELD(nir_intrinsic_base(instr),
> +                                   BRW_NIR_FRAG_OUTPUT_LOCATION);
> +      assert(l >= FRAG_RESULT_DATA0);
> +      nir_const_value *const_offset = nir_src_as_const_value(instr->src[0]);
> +      assert(const_offset && "Indirect output loads not allowed");
> +      const unsigned target = l - FRAG_RESULT_DATA0 + const_offset->u32[0];
> +      const fs_reg tmp = bld.vgrf(dest.type, 4);
> +
> +      assert(!reinterpret_cast<const brw_wm_prog_key *>(key)->coherent_fb_fetch);
> +      emit_non_coherent_fb_read(this, tmp, target);
> +
> +      for (unsigned j = 0; j < instr->num_components; j++)
> +         bld.MOV(offset(dest, bld, j),
> +                 offset(tmp, bld, nir_intrinsic_component(instr) + j));

Please use braces around loop bodies or then/else clauses that span more
than one textual line (even if they're a single statement).

> +
> +      break;
> +   }
> +
>     case nir_intrinsic_discard:
>     case nir_intrinsic_discard_if: {
>        /* We track our discarded pixels in f0.1.  By predicating on it, we can
>