nir/linker: add option to ignore the IO precisions for better varying packing

Backends that don't handle IO component precision can pack more varyings
into one slot if the linker ignores the precision. If the IO is vectorized
then this can save IO instructions.

Related: 165a69d2f7
    nir: handle mediump varyings in varying compaction helpers

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10722>
This commit is contained in:
Gert Wollny
2021-05-10 08:54:50 +02:00
parent 629e8347ad
commit 4c045ad11e
2 changed files with 11 additions and 6 deletions
+5
View File
@@ -3445,6 +3445,11 @@ typedef struct nir_shader_compiler_options {
bool lower_uniforms_to_ubo;
/* If the precision is ignored, backends that don't handle
* different precisions when passing data between stages and use
* vectorized IO can pack more varyings when linking. */
bool linker_ignore_precision;
nir_lower_int64_options lower_int64_options;
nir_lower_doubles_options lower_doubles_options;
nir_divergence_options divergence_analysis_options;
+6 -6
View File
@@ -582,9 +582,9 @@ gather_varying_component_info(nir_shader *producer, nir_shader *consumer,
vc_info->interp_loc = get_interp_loc(in_var);
vc_info->is_32bit = glsl_type_is_32bit(type);
vc_info->is_patch = in_var->data.patch;
vc_info->is_mediump =
in_var->data.precision == GLSL_PRECISION_MEDIUM ||
in_var->data.precision == GLSL_PRECISION_LOW;
vc_info->is_mediump = !producer->options->linker_ignore_precision &&
(in_var->data.precision == GLSL_PRECISION_MEDIUM ||
in_var->data.precision == GLSL_PRECISION_LOW);
vc_info->is_intra_stage_only = false;
vc_info->initialised = true;
}
@@ -647,9 +647,9 @@ gather_varying_component_info(nir_shader *producer, nir_shader *consumer,
vc_info->interp_loc = get_interp_loc(out_var);
vc_info->is_32bit = glsl_type_is_32bit(type);
vc_info->is_patch = out_var->data.patch;
vc_info->is_mediump =
out_var->data.precision == GLSL_PRECISION_MEDIUM ||
out_var->data.precision == GLSL_PRECISION_LOW;
vc_info->is_mediump = !producer->options->linker_ignore_precision &&
(out_var->data.precision == GLSL_PRECISION_MEDIUM ||
out_var->data.precision == GLSL_PRECISION_LOW);
vc_info->is_intra_stage_only = true;
vc_info->initialised = true;
}