nir: Add NV-specific texture opcodes
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Mon, 10 Apr 2023 22:23:32 +0000 (17:23 -0500)
committerMarge Bot <emma+marge@anholt.net>
Tue, 24 Oct 2023 22:21:18 +0000 (22:21 +0000)
These are for implementing various texture queries.

Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25000>

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

index 745c162..9ceed74 100644 (file)
@@ -3087,6 +3087,10 @@ nir_tex_instr_result_size(const nir_tex_instr *instr)
    case nir_texop_sampler_descriptor_amd:
       return 4;
 
+   case nir_texop_hdr_dim_nv:
+   case nir_texop_tex_type_nv:
+      return 4;
+
    default:
       if (instr->is_shadow && instr->is_new_style_shadow)
          return 1;
index 39f3865..436f0bd 100644 (file)
@@ -2283,6 +2283,8 @@ typedef enum {
    nir_texop_descriptor_amd,          /**< Returns a buffer or image descriptor. */
    nir_texop_sampler_descriptor_amd,  /**< Returns a sampler descriptor. */
    nir_texop_lod_bias_agx,            /**< Returns the sampler's LOD bias */
+   nir_texop_hdr_dim_nv,              /**< Maps to TXQ.DIMENSION */
+   nir_texop_tex_type_nv,             /**< Maps to TXQ.TEXTURE_TYPE */
 } nir_texop;
 
 /** Represents a texture instruction */
index 6ca711b..989cdd7 100644 (file)
@@ -1709,6 +1709,12 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
    case nir_texop_lod_bias_agx:
       fprintf(fp, "lod_bias_agx ");
       break;
+   case nir_texop_hdr_dim_nv:
+      fprintf(fp, "hdr_dim_nv ");
+      break;
+   case nir_texop_tex_type_nv:
+      fprintf(fp, "tex_type_nv ");
+      break;
    default:
       unreachable("Invalid texture operation");
       break;
index 068daea..2587c86 100644 (file)
@@ -3045,6 +3045,10 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
    case nir_texop_lod_bias_agx:
       vtn_fail("unexpected nir_texop_lod_bias_agx");
       break;
+   case nir_texop_hdr_dim_nv:
+   case nir_texop_tex_type_nv:
+      vtn_fail("unexpected nir_texop_*_nv");
+      break;
    }
 
    unsigned idx = 4;