diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 23bd1172559..5eda51c30f6 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -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; diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index fa451c33389..be4144ade86 100644 --- a/src/compiler/nir/nir_linking_helpers.c +++ b/src/compiler/nir/nir_linking_helpers.c @@ -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; }