diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h index b5e4c1a6c03..a99b9dafbc9 100644 --- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h +++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h @@ -37,6 +37,7 @@ DRI_CONF_SECTION_DEBUG DRI_CONF_FORCE_COMPAT_PROFILE(false) DRI_CONF_FORCE_COMPAT_SHADERS(false) DRI_CONF_FORCE_GL_NAMES_REUSE(false) + DRI_CONF_FORCE_GL_MAP_BUFFER_SYNCHRONIZED(false) DRI_CONF_TRANSCODE_ETC(false) DRI_CONF_TRANSCODE_ASTC(false) DRI_CONF_FORCE_GL_VENDOR() diff --git a/src/gallium/auxiliary/util/u_driconf.c b/src/gallium/auxiliary/util/u_driconf.c index 893c3b69aaf..8b9d8a72987 100644 --- a/src/gallium/auxiliary/util/u_driconf.c +++ b/src/gallium/auxiliary/util/u_driconf.c @@ -64,6 +64,7 @@ u_driconf_fill_st_options(struct st_config_options *options, query_bool_option(glthread_nop_check_framebuffer_status); query_bool_option(ignore_map_unsynchronized); query_bool_option(force_gl_names_reuse); + query_bool_option(force_gl_map_buffer_synchronized); query_bool_option(transcode_etc); query_bool_option(transcode_astc); query_string_option(force_gl_vendor); diff --git a/src/gallium/include/frontend/api.h b/src/gallium/include/frontend/api.h index 57a6a453e1f..8fc425b351b 100644 --- a/src/gallium/include/frontend/api.h +++ b/src/gallium/include/frontend/api.h @@ -247,6 +247,7 @@ struct st_config_options bool ignore_map_unsynchronized; bool force_integer_tex_nearest; bool force_gl_names_reuse; + bool force_gl_map_buffer_synchronized; bool transcode_etc; bool transcode_astc; char *force_gl_vendor; diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 67079f4fd86..4f528cef5ca 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -493,6 +493,9 @@ _mesa_bufferobj_map_range(struct gl_context *ctx, transfer_flags &= ~PIPE_MAP_UNSYNCHRONIZED; } + if (ctx->Const.ForceMapBufferSynchronized) + transfer_flags &= ~PIPE_MAP_UNSYNCHRONIZED; + obj->Mappings[index].Pointer = pipe_buffer_map_range(pipe, obj->buffer, offset, length, diff --git a/src/mesa/main/consts_exts.h b/src/mesa/main/consts_exts.h index c33242862a8..f8572683eb4 100644 --- a/src/mesa/main/consts_exts.h +++ b/src/mesa/main/consts_exts.h @@ -932,6 +932,9 @@ struct gl_constants */ bool BufferCreateMapUnsynchronizedThreadSafe; + /** Override GL_MAP_UNSYNCHRONIZED_BIT */ + bool ForceMapBufferSynchronized; + /** GL_ARB_get_program_binary */ GLuint NumProgramBinaryFormats; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 8eaed354bb2..4280866d762 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -1156,6 +1156,8 @@ void st_init_extensions(struct pipe_screen *screen, consts->GLSLIgnoreWriteToReadonlyVar = options->glsl_ignore_write_to_readonly_var; + consts->ForceMapBufferSynchronized = options->force_gl_map_buffer_synchronized; + consts->PrimitiveRestartFixedIndex = screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX); diff --git a/src/util/driconf.h b/src/util/driconf.h index 1bc31edd413..a80ad910a5f 100644 --- a/src/util/driconf.h +++ b/src/util/driconf.h @@ -261,6 +261,9 @@ #define DRI_CONF_FORCE_GL_NAMES_REUSE(def) \ DRI_CONF_OPT_B(force_gl_names_reuse, def, "Force GL names reuse") +#define DRI_CONF_FORCE_GL_MAP_BUFFER_SYNCHRONIZED(def) \ + DRI_CONF_OPT_B(force_gl_map_buffer_synchronized, def, "Override GL_MAP_UNSYNCHRONIZED_BIT.") + #define DRI_CONF_TRANSCODE_ETC(def) \ DRI_CONF_OPT_B(transcode_etc, def, "Transcode ETC formats to DXTC if unsupported")