diff options
-rw-r--r-- | src/gallium/auxiliary/pipe-loader/driinfo_gallium.h | 1 | ||||
-rw-r--r-- | src/gallium/frontends/dri/dri_screen.c | 2 | ||||
-rw-r--r-- | src/gallium/include/frontend/api.h | 1 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 4 | ||||
-rw-r--r-- | src/mesa/main/state.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 1 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_draw.c | 3 | ||||
-rw-r--r-- | src/util/00-mesa-defaults.conf | 2 | ||||
-rw-r--r-- | src/util/driconf.h | 4 |
9 files changed, 18 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h index 698d8e94395..4509751a1c6 100644 --- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h +++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h @@ -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() diff --git a/src/gallium/frontends/dri/dri_screen.c b/src/gallium/frontends/dri/dri_screen.c index 4de366f452a..20ee86f52b7 100644 --- a/src/gallium/frontends/dri/dri_screen.c +++ b/src/gallium/frontends/dri/dri_screen.c @@ -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"); diff --git a/src/gallium/include/frontend/api.h b/src/gallium/include/frontend/api.h index 038e21199f9..b0cafc7073c 100644 --- a/src/gallium/include/frontend/api.h +++ b/src/gallium/include/frontend/api.h @@ -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; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index f58b76236c1..bf3c6395853 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -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; diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 044c2d74bf9..6b1c5cf1fa9 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -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. */ diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 81d3000be1e..75b23ad2c7a 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -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); diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index 84b5cc30957..c867bff947b 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -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, diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf index c5f78ade8a1..6a38e9ab6eb 100644 --- a/src/util/00-mesa-defaults.conf +++ b/src/util/00-mesa-defaults.conf @@ -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. diff --git a/src/util/driconf.h b/src/util/driconf.h index 130fb1f535b..299f55f9f3a 100644 --- a/src/util/driconf.h +++ b/src/util/driconf.h @@ -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.") |