summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2020-03-08 17:43:26 -0400
committerMarge Bot <[email protected]>2020-04-27 11:56:06 +0000
commitb8223244c38ad1c433b33b37bff3f19e7a9d2cfc (patch)
treec375122a75d9aaea66eb9e8ab7e2e6289e960ddd /src/mesa
parent19eb89b0f3da8c888177da8e1a59c10ea0abfb34 (diff)
mesa: add Const.BufferCreateMapUnsynchronizedThreadSafe & MESA_MAP_THREAD_SAFE
Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4758>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/dd.h3
-rw-r--r--src/mesa/main/mtypes.h6
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.c2
-rw-r--r--src/mesa/state_tracker/st_extensions.c3
4 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 3fd47ba6f9e..b7973e1c6ae 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -70,6 +70,9 @@ struct _mesa_index_buffer;
*/
#define MESA_MAP_NOWAIT_BIT 0x4000
+/* Mapping a buffer is allowed from any thread. */
+#define MESA_MAP_THREAD_SAFE_BIT 0x8000
+
/**
* Device driver function table.
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index db55117bc08..a8b75b32f52 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4126,6 +4126,12 @@ struct gl_constants
/** When drivers are OK with mapped buffers during draw and other calls. */
bool AllowMappedBuffersDuringExecution;
+ /**
+ * Whether buffer creation, unsynchronized mapping, unmapping, and
+ * deletion is thread-safe.
+ */
+ bool BufferCreateMapUnsynchronizedThreadSafe;
+
/** GL_ARB_get_program_binary */
GLuint NumProgramBinaryFormats;
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index c95a3d4d2ac..33778df0afa 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -494,6 +494,8 @@ st_access_flags_to_transfer_flags(GLbitfield access, bool wholeBuffer)
if (access & MESA_MAP_NOWAIT_BIT)
flags |= PIPE_TRANSFER_DONTBLOCK;
+ if (access & MESA_MAP_THREAD_SAFE_BIT)
+ flags |= PIPE_TRANSFER_THREAD_SAFE;
return flags;
}
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index b0ee3e2210a..b6f6091fb3a 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -556,6 +556,9 @@ void st_init_limits(struct pipe_screen *screen,
c->AllowMappedBuffersDuringExecution =
screen->get_param(screen, PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION);
+ c->BufferCreateMapUnsynchronizedThreadSafe =
+ screen->get_param(screen, PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE);
+
c->UseSTD430AsDefaultPacking =
screen->get_param(screen, PIPE_CAP_LOAD_CONSTBUF);