diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp index 3a8ec615c13..d2d9d177026 100644 --- a/src/compiler/glsl/builtin_variables.cpp +++ b/src/compiler/glsl/builtin_variables.cpp @@ -1630,6 +1630,9 @@ builtin_variable_generator::generate_varyings() var->data.invariant = fields[i].location == VARYING_SLOT_POS && options->PositionAlwaysInvariant; + + var->data.precise = fields[i].location == VARYING_SLOT_POS && + options->PositionAlwaysPrecise; } } } diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h index 051d74a381f..fe23c0af65f 100644 --- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h +++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h @@ -48,6 +48,7 @@ DRI_CONF_SECTION_MISCELLANEOUS DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER(false) DRI_CONF_GLSL_ZERO_INIT(false) DRI_CONF_VS_POSITION_ALWAYS_INVARIANT(false) + DRI_CONF_VS_POSITION_ALWAYS_PRECISE(false) DRI_CONF_ALLOW_RGB10_CONFIGS(true) DRI_CONF_ALLOW_FP16_CONFIGS(false) DRI_CONF_FORCE_INTEGER_TEX_NEAREST(false) diff --git a/src/gallium/auxiliary/util/u_driconf.c b/src/gallium/auxiliary/util/u_driconf.c index 3098ade81aa..8ace8474766 100644 --- a/src/gallium/auxiliary/util/u_driconf.c +++ b/src/gallium/auxiliary/util/u_driconf.c @@ -54,6 +54,7 @@ u_driconf_fill_st_options(struct st_config_options *options, query_bool_option(glsl_zero_init); query_bool_option(force_integer_tex_nearest); query_bool_option(vs_position_always_invariant); + query_bool_option(vs_position_always_precise); query_bool_option(force_glsl_abs_sqrt); query_bool_option(allow_glsl_cross_stage_interpolation_mismatch); query_bool_option(allow_draw_out_of_order); diff --git a/src/gallium/include/frontend/api.h b/src/gallium/include/frontend/api.h index 1b131367119..5b9f9c63d6d 100644 --- a/src/gallium/include/frontend/api.h +++ b/src/gallium/include/frontend/api.h @@ -230,6 +230,7 @@ struct st_config_options bool glsl_ignore_write_to_readonly_var; bool glsl_zero_init; bool vs_position_always_invariant; + bool vs_position_always_precise; bool force_glsl_abs_sqrt; bool allow_glsl_cross_stage_interpolation_mismatch; bool allow_draw_out_of_order; diff --git a/src/mesa/drivers/dri/i965/brw_screen.c b/src/mesa/drivers/dri/i965/brw_screen.c index 23f31f37917..9e00819b338 100644 --- a/src/mesa/drivers/dri/i965/brw_screen.c +++ b/src/mesa/drivers/dri/i965/brw_screen.c @@ -95,6 +95,7 @@ static const driOptionDescription brw_driconf[] = { DRI_CONF_SECTION_MISCELLANEOUS DRI_CONF_GLSL_ZERO_INIT(false) DRI_CONF_VS_POSITION_ALWAYS_INVARIANT(false) + DRI_CONF_VS_POSITION_ALWAYS_PRECISE(false) DRI_CONF_ALLOW_RGB10_CONFIGS(false) DRI_CONF_ALLOW_RGB565_CONFIGS(true) DRI_CONF_ALLOW_FP16_CONFIGS(false) @@ -2803,6 +2804,7 @@ __DRIconfig **brw_init_screen(__DRIscreen *dri_screen) !(screen->kernel_features & KERNEL_ALLOWS_CONTEXT_ISOLATION); screen->compiler->glsl_compiler_options[MESA_SHADER_VERTEX].PositionAlwaysInvariant = driQueryOptionb(&screen->optionCache, "vs_position_always_invariant"); + screen->compiler->glsl_compiler_options[MESA_SHADER_TESS_EVAL].PositionAlwaysPrecise = driQueryOptionb(&screen->optionCache, "vs_position_always_precise"); screen->compiler->supports_pull_constants = true; screen->compiler->compact_params = true; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 29ec5c3e5f7..989d652bb15 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3295,6 +3295,9 @@ struct gl_shader_compiler_options /** (driconf) Force gl_Position to be considered invariant */ GLboolean PositionAlwaysInvariant; + /** (driconf) Force gl_Position to be considered precise */ + GLboolean PositionAlwaysPrecise; + const struct nir_shader_compiler_options *NirOptions; }; diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index b2a1b68b686..1c53045175b 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -796,6 +796,8 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe, ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].PositionAlwaysInvariant = options->vs_position_always_invariant; + ctx->Const.ShaderCompilerOptions[MESA_SHADER_TESS_EVAL].PositionAlwaysPrecise = options->vs_position_always_precise; + enum pipe_shader_ir preferred_ir = (enum pipe_shader_ir) screen->get_shader_param(screen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_PREFERRED_IR); diff --git a/src/util/driconf.h b/src/util/driconf.h index 6248957df25..973ba8a39cd 100644 --- a/src/util/driconf.h +++ b/src/util/driconf.h @@ -359,6 +359,10 @@ DRI_CONF_OPT_B(vs_position_always_invariant, def, \ "Force the vertex shader's gl_Position output to be considered 'invariant'") +#define DRI_CONF_VS_POSITION_ALWAYS_PRECISE(def) \ + DRI_CONF_OPT_B(vs_position_always_precise, def, \ + "Force the vertex shader's gl_Position output to be considered 'precise'") + #define DRI_CONF_ALLOW_RGB10_CONFIGS(def) \ DRI_CONF_OPT_B(allow_rgb10_configs, def, \ "Allow exposure of visuals and fbconfigs with rgb10a2 formats")