driconf: add option to reuse GL names

Fix apps expecting name recycling.
https://gitlab.freedesktop.org/mesa/mesa/-/issues/3144 is an example
of such issue, SPECviewperf13 has this problem too.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2020-08-17 16:20:17 +02:00
parent a56849ddda
commit 265a3b9624
8 changed files with 28 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ DRI_CONF_SECTION_DEBUG
DRI_CONF_ALLOW_GLSL_LAYOUT_QUALIFIER_ON_FUNCTION_PARAMETERS("false")
DRI_CONF_ALLOW_DRAW_OUT_OF_ORDER("false")
DRI_CONF_FORCE_COMPAT_PROFILE("false")
DRI_CONF_FORCE_GL_NAMES_REUSE("false")
DRI_CONF_FORCE_GL_VENDOR()
DRI_CONF_OVERRIDE_VRAM_SIZE()
DRI_CONF_SECTION_END

View File

@@ -98,6 +98,8 @@ dri_fill_st_options(struct dri_screen *screen)
driQueryOptionb(optionCache, "allow_glsl_layout_qualifier_on_function_parameters");
options->allow_draw_out_of_order =
driQueryOptionb(optionCache, "allow_draw_out_of_order");
options->force_gl_names_reuse =
driQueryOptionb(optionCache, "force_gl_names_reuse");
char *vendor_str = driQueryOptionstr(optionCache, "force_gl_vendor");
/* not an empty string */

View File

@@ -233,6 +233,7 @@ struct st_config_options
bool allow_glsl_layout_qualifier_on_function_parameters;
bool allow_draw_out_of_order;
bool force_integer_tex_nearest;
bool force_gl_names_reuse;
char *force_gl_vendor;
unsigned char config_options_sha1[20];
};

View File

@@ -3890,6 +3890,11 @@ struct gl_constants
*/
GLchar GLSLZeroInit;
/**
* Force GL names reuse. Needed by SPECviewperf13.
*/
GLboolean ForceGLNamesReuse;
/**
* Treat integer textures using GL_LINEAR filters as GL_NEAREST.
*/

View File

@@ -815,6 +815,17 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
st->bitmap.cache.empty = true;
if (ctx->Const.ForceGLNamesReuse && ctx->Shared->RefCount == 1) {
_mesa_HashEnableNameReuse(ctx->Shared->TexObjects);
_mesa_HashEnableNameReuse(ctx->Shared->ShaderObjects);
_mesa_HashEnableNameReuse(ctx->Shared->BufferObjects);
_mesa_HashEnableNameReuse(ctx->Shared->SamplerObjects);
_mesa_HashEnableNameReuse(ctx->Shared->FrameBuffers);
_mesa_HashEnableNameReuse(ctx->Shared->RenderBuffers);
_mesa_HashEnableNameReuse(ctx->Shared->MemoryObjects);
_mesa_HashEnableNameReuse(ctx->Shared->SemaphoreObjects);
}
_mesa_override_extensions(ctx);
_mesa_compute_version(ctx);

View File

@@ -1221,6 +1221,8 @@ void st_init_extensions(struct pipe_screen *screen,
consts->GLSLZeroInit = screen->get_param(screen, PIPE_CAP_GLSL_ZERO_INIT);
}
consts->ForceGLNamesReuse = options->force_gl_names_reuse;
consts->ForceIntegerTexNearest = options->force_integer_tex_nearest;
consts->VendorOverride = options->force_gl_vendor;

View File

@@ -286,6 +286,7 @@ TODO: document the other workarounds.
<application name="SPECviewperf13" executable="viewperf">
<option name="allow_glsl_extension_directive_midshader" value="true" />
<option name="allow_glsl_120_subset_in_110" value="true" />
<option name="force_gl_names_reuse" value="true" />
</application>
<!-- The GL thread allowlist is below, workarounds are above.

View File

@@ -227,6 +227,11 @@ DRI_CONF_OPT_BEGIN_V(override_vram_size, int, -1, "-1:2147483647") \
DRI_CONF_DESC("Override the VRAM size advertised to the application in MiB (-1 = default)") \
DRI_CONF_OPT_END
#define DRI_CONF_FORCE_GL_NAMES_REUSE(def) \
DRI_CONF_OPT_BEGIN_B(force_gl_names_reuse, def) \
DRI_CONF_DESC("Force GL names reuse") \
DRI_CONF_OPT_END
/**
* \brief Image quality-related options
*/