driconf: add allow_incorrect_primitive_id option

And enable it for SPECviewperf.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7078>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2020-11-04 10:19:18 +01:00
parent ebb228bec5
commit 34b08a298d
9 changed files with 18 additions and 2 deletions

View file

@ -30,6 +30,7 @@ DRI_CONF_SECTION_DEBUG
DRI_CONF_FORCE_GLSL_ABS_SQRT(false)
DRI_CONF_GLSL_CORRECT_DERIVATIVES_AFTER_DISCARD(false)
DRI_CONF_ALLOW_DRAW_OUT_OF_ORDER(false)
DRI_CONF_ALLOW_INCORRECT_PRIMITIVE_ID(false)
DRI_CONF_FORCE_COMPAT_PROFILE(false)
DRI_CONF_FORCE_GL_NAMES_REUSE(false)
DRI_CONF_FORCE_GL_VENDOR()

View file

@ -97,6 +97,8 @@ dri_fill_st_options(struct dri_screen *screen)
driQueryOptionb(optionCache, "allow_glsl_cross_stage_interpolation_mismatch");
options->allow_draw_out_of_order =
driQueryOptionb(optionCache, "allow_draw_out_of_order");
options->allow_incorrect_primitive_id =
driQueryOptionb(optionCache, "allow_incorrect_primitive_id");
options->force_gl_names_reuse =
driQueryOptionb(optionCache, "force_gl_names_reuse");

View file

@ -232,6 +232,7 @@ struct st_config_options
bool force_glsl_abs_sqrt;
bool allow_glsl_cross_stage_interpolation_mismatch;
bool allow_draw_out_of_order;
bool allow_incorrect_primitive_id;
bool force_integer_tex_nearest;
bool force_gl_names_reuse;
char *force_gl_vendor;

View file

@ -4232,6 +4232,10 @@ struct gl_constants
/** Whether out-of-order draw (Begin/End) optimizations are allowed. */
bool AllowDrawOutOfOrder;
/** Whether draw merging optimizations are allowed (might cause
* incorrect results). */
bool AllowIncorrectPrimitiveId;
/** Whether to allow the fast path for frequently updated VAOs. */
bool AllowDynamicVAOFastPath;

View file

@ -151,7 +151,7 @@ void
_mesa_update_primitive_id_is_unused(struct gl_context *ctx)
{
/* Only the compatibility profile with display lists needs this. */
if (ctx->API != API_OPENGL_COMPAT)
if (ctx->API != API_OPENGL_COMPAT || ctx->Const.AllowIncorrectPrimitiveId)
return;
/* If all of these are NULL, GLSL is disabled. */

View file

@ -1770,6 +1770,7 @@ void st_init_extensions(struct pipe_screen *screen,
}
consts->AllowDrawOutOfOrder = options->allow_draw_out_of_order;
consts->AllowIncorrectPrimitiveId = options->allow_incorrect_primitive_id;
bool prefer_nir = PIPE_SHADER_IR_NIR ==
screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_PREFERRED_IR);

View file

@ -211,7 +211,8 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
assert(ctx->NewState == 0);
if (node->vertex_count > 0) {
bool draw_using_merged_prim = ctx->_PrimitiveIDIsUnused &&
bool draw_using_merged_prim = (ctx->Const.AllowIncorrectPrimitiveId ||
ctx->_PrimitiveIDIsUnused) &&
node->merged.prims;
if (!draw_using_merged_prim) {
ctx->Driver.Draw(ctx, node->prims, node->prim_count,

View file

@ -292,6 +292,8 @@ TODO: document the other workarounds.
<option name="force_gl_vendor" value="NVIDIA Corporation" />
<!-- creo-02 doesn't enable GL_EXT_shader_image_load_store in GLSL -->
<option name="force_glsl_extensions_warn" value="true" />
<!-- Enable draw merging inside display list for snx-03 -->
<option name="allow_incorrect_primitive_id" value="true" />
</application>
<!-- The GL thread allowlist is below, workarounds are above.

View file

@ -203,6 +203,10 @@
DRI_CONF_OPT_B(allow_draw_out_of_order, def, \
"Allow out-of-order draw optimizations. Set when Z fighting doesn't have to be accurate.")
#define DRI_CONF_ALLOW_INCORRECT_PRIMITIVE_ID(def) \
DRI_CONF_OPT_B(allow_incorrect_primitive_id, def, \
"Allows drawing display list using merged draws (might cause invalid gl_PrimitiveID values).")
#define DRI_CONF_FORCE_GL_VENDOR(def) \
DRI_CONF_OPT_S(force_gl_vendor, def, "Override GPU vendor string.")