Mesa (main): intel/fs: Implement the sample_pos_or_center system value

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 17 16:32:41 UTC 2021


Module: Mesa
Branch: main
Commit: 3c89dbdbfea5b5797756782045d0c53206ebf7fa
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c89dbdbfea5b5797756782045d0c53206ebf7fa

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Thu Dec  2 14:16:02 2021 -0600

intel/fs: Implement the sample_pos_or_center system value

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14198>

---

 src/intel/compiler/brw_fs.cpp     | 5 ++++-
 src/intel/compiler/brw_fs_nir.cpp | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp
index 4c6c5c70244..65c0f2df1e4 100644
--- a/src/intel/compiler/brw_fs.cpp
+++ b/src/intel/compiler/brw_fs.cpp
@@ -9480,7 +9480,10 @@ brw_nir_populate_wm_prog_data(const nir_shader *shader,
        * persample dispatch, we hard-code it to 0.5.
        */
       prog_data->uses_pos_offset = prog_data->persample_dispatch &&
-         BITSET_TEST(shader->info.system_values_read, SYSTEM_VALUE_SAMPLE_POS);
+         (BITSET_TEST(shader->info.system_values_read,
+                      SYSTEM_VALUE_SAMPLE_POS) ||
+          BITSET_TEST(shader->info.system_values_read,
+                      SYSTEM_VALUE_SAMPLE_POS_OR_CENTER));
    }
 
    prog_data->has_render_target_reads = shader->info.outputs_read != 0ull;
diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp
index 917dbdc745c..6b87bf92af1 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -179,6 +179,7 @@ emit_system_values_block(nir_block *block, fs_visitor *v)
          break;
 
       case nir_intrinsic_load_sample_pos:
+      case nir_intrinsic_load_sample_pos_or_center:
          assert(v->stage == MESA_SHADER_FRAGMENT);
          reg = &v->nir_system_values[SYSTEM_VALUE_SAMPLE_POS];
          if (reg->file == BAD_FILE)
@@ -3444,7 +3445,8 @@ fs_visitor::nir_emit_fs_intrinsic(const fs_builder &bld,
               emit_frontfacing_interpolation());
       break;
 
-   case nir_intrinsic_load_sample_pos: {
+   case nir_intrinsic_load_sample_pos:
+   case nir_intrinsic_load_sample_pos_or_center: {
       fs_reg sample_pos = nir_system_values[SYSTEM_VALUE_SAMPLE_POS];
       assert(sample_pos.file != BAD_FILE);
       dest.type = sample_pos.type;



More information about the mesa-commit mailing list