nir: add mediump flag to IO semantics
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6621>
This commit is contained in:
@@ -1784,7 +1784,8 @@ typedef struct {
|
||||
unsigned dual_source_blend_index:1;
|
||||
unsigned fb_fetch_output:1; /* for GL_KHR_blend_equation_advanced */
|
||||
unsigned gs_streams:8; /* xxyyzzww: 2-bit stream index for each component */
|
||||
unsigned _pad:9;
|
||||
unsigned medium_precision:1; /* GLSL mediump qualifier */
|
||||
unsigned _pad:8;
|
||||
} nir_io_semantics;
|
||||
|
||||
#define NIR_INTRINSIC_MAX_INPUTS 5
|
||||
|
@@ -309,6 +309,9 @@ 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;
|
||||
semantics.medium_precision =
|
||||
var->data.precision == GLSL_PRECISION_MEDIUM ||
|
||||
var->data.precision == GLSL_PRECISION_LOW;
|
||||
nir_intrinsic_set_io_semantics(load, semantics);
|
||||
}
|
||||
|
||||
@@ -431,6 +434,9 @@ emit_store(struct lower_io_state *state, nir_ssa_def *data,
|
||||
semantics.num_slots = get_number_of_slots(state, var);
|
||||
semantics.dual_source_blend_index = var->data.index;
|
||||
semantics.gs_streams = gs_streams;
|
||||
semantics.medium_precision =
|
||||
var->data.precision == GLSL_PRECISION_MEDIUM ||
|
||||
var->data.precision == GLSL_PRECISION_LOW;
|
||||
nir_intrinsic_set_io_semantics(store, semantics);
|
||||
|
||||
nir_builder_instr_insert(b, &store->instr);
|
||||
@@ -562,6 +568,9 @@ lower_interpolate_at(nir_intrinsic_instr *intrin, struct lower_io_state *state,
|
||||
nir_io_semantics semantics = {0};
|
||||
semantics.location = var->data.location;
|
||||
semantics.num_slots = get_number_of_slots(state, var);
|
||||
semantics.medium_precision =
|
||||
var->data.precision == GLSL_PRECISION_MEDIUM ||
|
||||
var->data.precision == GLSL_PRECISION_LOW;
|
||||
nir_intrinsic_set_io_semantics(load, semantics);
|
||||
|
||||
load->src[0] = nir_src_for_ssa(&bary_setup->dest.ssa);
|
||||
|
@@ -982,6 +982,10 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
|
||||
}
|
||||
fprintf(fp, ")");
|
||||
}
|
||||
if (state->shader->info.stage == MESA_SHADER_FRAGMENT &&
|
||||
nir_intrinsic_io_semantics(instr).medium_precision) {
|
||||
fprintf(fp, " mediump");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user