Mesa (master): nir: add two new texture ops for multisample fragment color/mask fetches

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 23 11:10:19 UTC 2020


Module: Mesa
Branch: master
Commit: 603e6ba972dae06fe0a198fc00b6aa4a0a33d479
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=603e6ba972dae06fe0a198fc00b6aa4a0a33d479

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Tue Jan  7 08:39:39 2020 +0100

nir: add two new texture ops for multisample fragment color/mask fetches

This introduces:
   - nir_texop_fragment_mask_fetch (fetch a fragment mask from a
     compressed multisampled color surface)
   - nir_texop_fragment_fetch (fetch a color fragment for a
     particular sample at corresponding fragment mask index).

These two texture operations are necessary for implementing
SPV_AMD_shader_fragment_mask.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3304>

---

 src/compiler/nir/nir.h       | 3 +++
 src/compiler/nir/nir_print.c | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index eafd6fad855..c68fef5f1cc 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1830,6 +1830,8 @@ typedef enum {
                                   * identical.
                                   */
    nir_texop_tex_prefetch,       /**< Regular texture look-up, eligible for pre-dispatch */
+   nir_texop_fragment_fetch,     /**< Multisample fragment color texture fetch */
+   nir_texop_fragment_mask_fetch,/**< Multisample fragment mask texture fetch */
 } nir_texop;
 
 typedef struct {
@@ -1926,6 +1928,7 @@ nir_tex_instr_dest_size(const nir_tex_instr *instr)
    case nir_texop_texture_samples:
    case nir_texop_query_levels:
    case nir_texop_samples_identical:
+   case nir_texop_fragment_mask_fetch:
       return 1;
 
    default:
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index aa9ee670a70..9a03f6eee70 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -1040,6 +1040,12 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
    case nir_texop_tex_prefetch:
       fprintf(fp, "tex (pre-dispatchable) ");
       break;
+   case nir_texop_fragment_fetch:
+      fprintf(fp, "fragment_fetch ");
+      break;
+   case nir_texop_fragment_mask_fetch:
+      fprintf(fp, "fragment_mask_fetch ");
+      break;
    default:
       unreachable("Invalid texture operation");
       break;



More information about the mesa-commit mailing list