[Mesa-dev] [PATCH 12/28] nir: Add texture opcodes and source types for multisample compression
Jason Ekstrand
jason at jlekstrand.net
Tue May 10 23:16:32 UTC 2016
Intel hardware does a form of multisample compression that involves an
auxilary surface called the MCS. When an MCS is in use, you have to first
sample from the MCS with a special opcode and then pass the result of that
operation into the next sample instrucion. Normally, we just do this
ourselves in the back-end, but we want to expose that functionality to NIR
so that we can use MCS values directly in NIR-based blorp.
---
src/compiler/nir/nir.h | 6 ++++++
src/compiler/nir/nir_print.c | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 4b70a45..9c59dc4 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1068,6 +1068,7 @@ typedef enum {
nir_tex_src_bias,
nir_tex_src_lod,
nir_tex_src_ms_index, /* MSAA sample index */
+ nir_tex_src_ms_mcs, /* MSAA compression value */
nir_tex_src_ddx,
nir_tex_src_ddy,
nir_tex_src_texture_offset, /* < dynamically uniform indirect offset */
@@ -1087,6 +1088,7 @@ typedef enum {
nir_texop_txd, /**< Texture look-up with partial derivatvies */
nir_texop_txf, /**< Texel fetch with explicit LOD */
nir_texop_txf_ms, /**< Multisample texture fetch */
+ nir_texop_txf_ms_mcs, /**< Multisample compression value fetch */
nir_texop_txs, /**< Texture size */
nir_texop_lod, /**< Texture lod query */
nir_texop_tg4, /**< Texture gather */
@@ -1215,6 +1217,7 @@ nir_tex_instr_is_query(nir_tex_instr *instr)
case nir_texop_lod:
case nir_texop_texture_samples:
case nir_texop_query_levels:
+ case nir_texop_txf_ms_mcs:
return true;
case nir_texop_tex:
case nir_texop_txb:
@@ -1235,6 +1238,9 @@ nir_tex_instr_src_size(nir_tex_instr *instr, unsigned src)
if (instr->src[src].src_type == nir_tex_src_coord)
return instr->coord_components;
+ /* The MCS value is expected to be a vec4 returned by a txf_ms_mcs */
+ if (instr->src[src].src_type == nir_tex_src_ms_mcs)
+ return 4;
if (instr->src[src].src_type == nir_tex_src_offset ||
instr->src[src].src_type == nir_tex_src_ddx ||
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index a36561e..583f66c 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -626,6 +626,9 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
case nir_texop_txf_ms:
fprintf(fp, "txf_ms ");
break;
+ case nir_texop_txf_ms_mcs:
+ fprintf(fp, "txf_ms_mcs ");
+ break;
case nir_texop_txs:
fprintf(fp, "txs ");
break;
@@ -676,6 +679,9 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
case nir_tex_src_ms_index:
fprintf(fp, "(ms_index)");
break;
+ case nir_tex_src_ms_mcs:
+ fprintf(fp, "(ms_mcs)");
+ break;
case nir_tex_src_ddx:
fprintf(fp, "(ddx)");
break;
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list