Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2021-12-18 02:55:22 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2021-12-18 02:55:54 +0300
commit214a56ce8c67bb7a3af45aaafca8aa4a5ec85129 (patch)
tree442f85a7070eea078c5b1d995972f56c010e24ca /source/blender/gpu/opengl
parent8e31e53aa0ee9693582ad5b72cfe5732b57c72fd (diff)
GPU: add memory barriers for vertex and index buffers
This adds memory barriers to use with `GPU_memory_barrier` to ensure that writes to a vertex or index buffer issued before the barrier are completed after it, so they can be safely read later by another shader. `GPU_BARRIER_VERTEX_ATTRIB_ARRAY` should be used for vertex buffers (`GPUVertBuf`), and `GPU_BARRIER_ELEMENT_ARRAY` should be used for index buffers (`GPUIndexBuf`). Reviewed By: fclem Differential Revision: https://developer.blender.org/D13595
Diffstat (limited to 'source/blender/gpu/opengl')
-rw-r--r--source/blender/gpu/opengl/gl_state.hh6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/gpu/opengl/gl_state.hh b/source/blender/gpu/opengl/gl_state.hh
index 979644b41c9..f5c38a33628 100644
--- a/source/blender/gpu/opengl/gl_state.hh
+++ b/source/blender/gpu/opengl/gl_state.hh
@@ -130,6 +130,12 @@ static inline GLbitfield to_gl(eGPUBarrier barrier_bits)
if (barrier_bits & GPU_BARRIER_SHADER_STORAGE) {
barrier |= GL_SHADER_STORAGE_BARRIER_BIT;
}
+ if (barrier_bits & GPU_BARRIER_VERTEX_ATTRIB_ARRAY) {
+ barrier |= GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT;
+ }
+ if (barrier_bits & GPU_BARRIER_ELEMENT_ARRAY) {
+ barrier |= GL_ELEMENT_ARRAY_BARRIER_BIT;
+ }
return barrier;
}