nir: add two new texture ops for multisample fragment color/mask fetches
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 7 Jan 2020 07:39:39 +0000 (08:39 +0100)
committerMarge Bot <eric+marge@anholt.net>
Thu, 23 Jan 2020 10:48:02 +0000 (10:48 +0000)
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@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3304>

src/compiler/nir/nir.h
src/compiler/nir/nir_print.c

index eafd6fad8555bb2a6e55025553693a013cdd444c..c68fef5f1ccac9748f3e31d6d35aa910cdd2521c 100644 (file)
@@ -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:
index aa9ee670a70788d3d8d513ce1697aeec08a3cbf0..9a03f6eee707f4654e5a3ef9aa69b2440bf7ac0d 100644 (file)
@@ -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;