gallium: add PIPE_CAP_ALLOW_DRAW_OUT_OF_ORDER

This way we can make allow_draw_out_of_order true by default for all
apps, iff the driver allows it.

And allow_draw_out_of_order=false can still be used in drirc, for
apps that need this optim to be turned off.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16139>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2022-04-25 14:19:02 +02:00 committed by Marge Bot
parent 7df2cc42e7
commit bd88bed855
7 changed files with 11 additions and 4 deletions

View file

@ -641,6 +641,7 @@ The integer capabilities:
* ``PIPE_CAP_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS``: TRUE if there are no restrictions on the allocation of mipmaps in sparse textures and FALSE otherwise. See SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB description in ARB_sparse_texture extension spec.
* ``PIPE_CAP_QUERY_SPARSE_TEXTURE_RESIDENCY``: TRUE if shader sparse texture sample instruction could also return the residency information.
* ``PIPE_CAP_CLAMP_SPARSE_TEXTURE_LOD``: TRUE if shader sparse texture sample instruction support clamp the minimal lod to prevent read from un-committed pages.
* ``PIPE_CAP_ALLOW_DRAW_OUT_OF_ORDER``: TRUE if the driver allows the "draw out of order" optimization to be enabled. See _mesa_update_allow_draw_out_of_order for more details.
.. _pipe_capf:

View file

@ -32,7 +32,7 @@ DRI_CONF_SECTION_DEBUG
DRI_CONF_FORCE_GLSL_ABS_SQRT(false)
DRI_CONF_GLSL_CORRECT_DERIVATIVES_AFTER_DISCARD(false)
DRI_CONF_GLSL_IGNORE_WRITE_TO_READONLY_VAR(false)
DRI_CONF_ALLOW_DRAW_OUT_OF_ORDER(false)
DRI_CONF_ALLOW_DRAW_OUT_OF_ORDER(true)
DRI_CONF_GLTHREAD_NOP_CHECK_FRAMEBUFFER_STATUS(false)
DRI_CONF_FORCE_COMPAT_PROFILE(false)
DRI_CONF_FORCE_COMPAT_SHADERS(false)

View file

@ -372,6 +372,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
case PIPE_CAP_IMAGE_ATOMIC_INC_WRAP:
case PIPE_CAP_TGSI_TG4_COMPONENT_IN_SWIZZLE:
case PIPE_CAP_GLSL_ZERO_INIT:
case PIPE_CAP_ALLOW_DRAW_OUT_OF_ORDER:
return 0;
case PIPE_CAP_MAX_GS_INVOCATIONS:

View file

@ -1009,6 +1009,7 @@ enum pipe_cap
PIPE_CAP_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS,
PIPE_CAP_QUERY_SPARSE_TEXTURE_RESIDENCY,
PIPE_CAP_CLAMP_SPARSE_TEXTURE_LOD,
PIPE_CAP_ALLOW_DRAW_OUT_OF_ORDER,
PIPE_CAP_LAST,
/* XXX do not add caps after PIPE_CAP_LAST! */

View file

@ -90,9 +90,11 @@ _mesa_update_allow_draw_out_of_order(struct gl_context *ctx)
* for driver-internal reasons.
*/
/* Only the compatibility profile with immediate mode needs this. */
if (ctx->API != API_OPENGL_COMPAT || !ctx->Const.AllowDrawOutOfOrder)
if (!ctx->Const.AllowDrawOutOfOrder)
return;
assert(ctx->API == API_OPENGL_COMPAT);
/* If all of these are NULL, GLSL is disabled. */
struct gl_program *vs =
ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];

View file

@ -1812,7 +1812,10 @@ void st_init_extensions(struct pipe_screen *screen,
_mesa_fill_supported_spirv_extensions(consts->SpirVExtensions, spirv_caps);
}
consts->AllowDrawOutOfOrder = options->allow_draw_out_of_order;
consts->AllowDrawOutOfOrder =
api == API_OPENGL_COMPAT &&
options->allow_draw_out_of_order &&
screen->get_param(screen, PIPE_CAP_ALLOW_DRAW_OUT_OF_ORDER);
consts->GLThreadNopCheckFramebufferStatus = options->glthread_nop_check_framebuffer_status;
bool prefer_nir = PIPE_SHADER_IR_NIR ==

View file

@ -334,7 +334,6 @@ 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" />
<option name="allow_draw_out_of_order" value="true" />
<option name="mesa_glthread" value="true" />
<option name="mesa_no_error" value="true" />
<!-- Creating 10-bit pbuffers fails in the X server and returns BadAlloc. -->