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@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3304>
This commit is contained in:
Samuel Pitoiset
2020-01-07 08:39:39 +01:00
committed by Marge Bot
parent dea29b3818
commit 603e6ba972
2 changed files with 9 additions and 0 deletions

View File

@@ -1830,6 +1830,8 @@ typedef enum {
* identical. * identical.
*/ */
nir_texop_tex_prefetch, /**< Regular texture look-up, eligible for pre-dispatch */ 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; } nir_texop;
typedef struct { typedef struct {
@@ -1926,6 +1928,7 @@ nir_tex_instr_dest_size(const nir_tex_instr *instr)
case nir_texop_texture_samples: case nir_texop_texture_samples:
case nir_texop_query_levels: case nir_texop_query_levels:
case nir_texop_samples_identical: case nir_texop_samples_identical:
case nir_texop_fragment_mask_fetch:
return 1; return 1;
default: default:

View File

@@ -1040,6 +1040,12 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
case nir_texop_tex_prefetch: case nir_texop_tex_prefetch:
fprintf(fp, "tex (pre-dispatchable) "); fprintf(fp, "tex (pre-dispatchable) ");
break; break;
case nir_texop_fragment_fetch:
fprintf(fp, "fragment_fetch ");
break;
case nir_texop_fragment_mask_fetch:
fprintf(fp, "fragment_mask_fetch ");
break;
default: default:
unreachable("Invalid texture operation"); unreachable("Invalid texture operation");
break; break;