From 03fbb3de2436d805766db9371ed17963348fce17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Fri, 4 Feb 2022 19:46:40 +0100 Subject: GPUState: Add more barrier types This will be useful when compute shader will be used more. Refer to the opengl documentation for their meaning. https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glMemoryBarrier.xhtml --- source/blender/gpu/GPU_state.h | 13 ++++++++----- source/blender/gpu/opengl/gl_state.hh | 13 +++++++++++-- 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'source/blender') diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h index 22cd7eab927..bd52b8321bb 100644 --- a/source/blender/gpu/GPU_state.h +++ b/source/blender/gpu/GPU_state.h @@ -37,11 +37,14 @@ ENUM_OPERATORS(eGPUWriteMask, GPU_WRITE_COLOR) typedef enum eGPUBarrier { GPU_BARRIER_NONE = 0, - GPU_BARRIER_SHADER_IMAGE_ACCESS = (1 << 0), - GPU_BARRIER_TEXTURE_FETCH = (1 << 1), - GPU_BARRIER_SHADER_STORAGE = (1 << 2), - GPU_BARRIER_VERTEX_ATTRIB_ARRAY = (1 << 3), - GPU_BARRIER_ELEMENT_ARRAY = (1 << 4), + GPU_BARRIER_COMMAND = (1 << 0), + GPU_BARRIER_FRAMEBUFFER = (1 << 1), + GPU_BARRIER_SHADER_IMAGE_ACCESS = (1 << 2), + GPU_BARRIER_SHADER_STORAGE = (1 << 3), + GPU_BARRIER_TEXTURE_FETCH = (1 << 4), + GPU_BARRIER_TEXTURE_UPDATE = (1 << 5), + GPU_BARRIER_VERTEX_ATTRIB_ARRAY = (1 << 6), + GPU_BARRIER_ELEMENT_ARRAY = (1 << 7), } eGPUBarrier; ENUM_OPERATORS(eGPUBarrier, GPU_BARRIER_ELEMENT_ARRAY) diff --git a/source/blender/gpu/opengl/gl_state.hh b/source/blender/gpu/opengl/gl_state.hh index 83ff3ffc9e9..5985f1583f2 100644 --- a/source/blender/gpu/opengl/gl_state.hh +++ b/source/blender/gpu/opengl/gl_state.hh @@ -124,11 +124,20 @@ static inline GLbitfield to_gl(eGPUBarrier barrier_bits) if (barrier_bits & GPU_BARRIER_SHADER_IMAGE_ACCESS) { barrier |= GL_SHADER_IMAGE_ACCESS_BARRIER_BIT; } + if (barrier_bits & GPU_BARRIER_SHADER_STORAGE) { + barrier |= GL_SHADER_STORAGE_BARRIER_BIT; + } if (barrier_bits & GPU_BARRIER_TEXTURE_FETCH) { barrier |= GL_TEXTURE_FETCH_BARRIER_BIT; } - if (barrier_bits & GPU_BARRIER_SHADER_STORAGE) { - barrier |= GL_SHADER_STORAGE_BARRIER_BIT; + if (barrier_bits & GPU_BARRIER_TEXTURE_UPDATE) { + barrier |= GL_TEXTURE_UPDATE_BARRIER_BIT; + } + if (barrier_bits & GPU_BARRIER_COMMAND) { + barrier |= GL_COMMAND_BARRIER_BIT; + } + if (barrier_bits & GPU_BARRIER_FRAMEBUFFER) { + barrier |= GL_FRAMEBUFFER_BARRIER_BIT; } if (barrier_bits & GPU_BARRIER_VERTEX_ATTRIB_ARRAY) { barrier |= GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT; -- cgit v1.2.3