nir: add nir_io_semantics::fb_fetch_output_coherent

Lowering IO should preserve this. Freedreno needs it.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32173>
This commit is contained in:
Marek Olšák 2024-11-12 19:18:28 -05:00 committed by Marge Bot
parent 5d5a7bd221
commit dacae272bf
4 changed files with 10 additions and 2 deletions

View file

@ -2025,6 +2025,7 @@ typedef struct nir_io_semantics {
unsigned num_slots : 6; /* max 32, may be pessimistic with const indexing */
unsigned dual_source_blend_index : 1;
unsigned fb_fetch_output : 1; /* for GL_KHR_blend_equation_advanced */
unsigned fb_fetch_output_coherent : 1;
unsigned gs_streams : 8; /* xxyyzzww: 2-bit stream index for each component */
unsigned medium_precision : 1; /* GLSL mediump qualifier */
unsigned per_view : 1;
@ -2042,7 +2043,6 @@ typedef struct nir_io_semantics {
unsigned no_sysval_output : 1; /* whether this system value output has no
effect due to current pipeline states */
unsigned interp_explicit_strict : 1; /* preserve original vertex order */
unsigned _pad : 1;
} nir_io_semantics;
/* Transform feedback info for 2 outputs. nir_intrinsic_store_output contains

View file

@ -389,6 +389,10 @@ emit_load(struct lower_io_state *state,
semantics.location = var->data.location;
semantics.num_slots = get_number_of_slots(state, var);
semantics.fb_fetch_output = var->data.fb_fetch_output;
if (semantics.fb_fetch_output) {
semantics.fb_fetch_output_coherent =
!!(var->data.access & ACCESS_COHERENT);
}
semantics.medium_precision = is_medium_precision(b->shader, var);
semantics.high_dvec2 = high_dvec2;
/* "per_vertex" is misnamed. It means "explicit interpolation with

View file

@ -1395,6 +1395,9 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
if (io.fb_fetch_output)
fprintf(fp, " fbfetch");
if (io.fb_fetch_output_coherent)
fprintf(fp, " coherent");
if (io.per_view)
fprintf(fp, " perview");

View file

@ -789,7 +789,8 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
state->shader->info.stage == MESA_SHADER_TESS_CTRL);
validate_assert(state,
(!sem.dual_source_blend_index &&
!sem.fb_fetch_output) ||
!sem.fb_fetch_output &&
!sem.fb_fetch_output_coherent) ||
state->shader->info.stage == MESA_SHADER_FRAGMENT);
validate_assert(state,
!sem.gs_streams ||