diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-09-12 07:10:11 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-09-12 16:29:54 +0300 |
commit | 136bdb561b4ce05788e7b654c7e734cc35664b91 (patch) | |
tree | 7b1dd88c0e36f02498a66f107b99252f6f1c76d5 /source/blender/gpu/opengl/gl_state.hh | |
parent | a442da62dc6ea14c43a7aba04a600c9ba7cd7f1b (diff) |
GPU: Add Image Load Store extension support
This wraps the functionality used to speedup EEVEE volumetrics.
This touches the rendering code of EEVEE as it should fix a mis-usage of
the GL barrier. The barrier changed type and location, removing an
unused barrier.
Diffstat (limited to 'source/blender/gpu/opengl/gl_state.hh')
-rw-r--r-- | source/blender/gpu/opengl/gl_state.hh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/gpu/opengl/gl_state.hh b/source/blender/gpu/opengl/gl_state.hh index fb2ed3403f7..b636c08ec0d 100644 --- a/source/blender/gpu/opengl/gl_state.hh +++ b/source/blender/gpu/opengl/gl_state.hh @@ -64,19 +64,30 @@ class GLStateManager : public GPUStateManager { GLuint samplers_[64] = {0}; uint64_t dirty_texture_binds_ = 0; + GLuint images_[8] = {0}; + GLenum formats_[8] = {0}; + uint8_t dirty_image_binds_ = 0; + public: GLStateManager(); void apply_state(void) override; + void issue_barrier(eGPUBarrier barrier_bits) override; + void texture_bind(Texture *tex, eGPUSamplerState sampler, int unit) override; void texture_bind_temp(GLTexture *tex); void texture_unbind(Texture *tex) override; void texture_unbind_all(void) override; + void image_bind(Texture *tex, int unit) override; + void image_unbind(Texture *tex) override; + void image_unbind_all(void) override; + void texture_unpack_row_length_set(uint len) override; uint64_t bound_texture_slots(void); + uint8_t bound_image_slots(void); private: static void set_write_mask(const eGPUWriteMask value); @@ -95,9 +106,22 @@ class GLStateManager : public GPUStateManager { void set_mutable_state(const GPUStateMutable &state); void texture_bind_apply(void); + void image_bind_apply(void); MEM_CXX_CLASS_ALLOC_FUNCS("GLStateManager") }; +static inline GLbitfield to_gl(eGPUBarrier barrier_bits) +{ + GLbitfield barrier = 0; + if (barrier_bits & GPU_BARRIER_SHADER_IMAGE_ACCESS) { + barrier |= GL_SHADER_IMAGE_ACCESS_BARRIER_BIT; + } + if (barrier_bits & GPU_BARRIER_TEXTURE_FETCH) { + barrier |= GL_TEXTURE_FETCH_BARRIER_BIT; + } + return barrier; +} + } // namespace gpu } // namespace blender |