driconf, glsl: Add a vs_position_always_precise option
This is basically the same workaround as in9b577f2a88
(driconf, glsl: Add a vs_position_always_invariant option) commit but for tesselation evaluation shaders. Some applications do not mark outputs as precise in tesselation evaluation shaders which can lead to different results in case some optimizations were applied. Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Signed-off-by: Vadym Shovkoplias <vadym.shovkoplias@globallogic.com> Fixes:09705747d7
("nir/algebraic: Reassociate fadd into fmul in DPH-like pattern") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13027>
This commit is contained in:

committed by
Marge Bot

parent
8276a8eb55
commit
36c241be01
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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)
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
};
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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")
|
||||
|
Reference in New Issue
Block a user