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/intern | |
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/intern')
-rw-r--r-- | source/blender/gpu/intern/gpu_capabilities.cc | 5 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_capabilities_private.hh | 3 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_shader_interface.hh | 1 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_state.cc | 12 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_state_private.hh | 6 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_texture.cc | 15 |
6 files changed, 40 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_capabilities.cc b/source/blender/gpu/intern/gpu_capabilities.cc index a79ce27ba63..63e29654e1c 100644 --- a/source/blender/gpu/intern/gpu_capabilities.cc +++ b/source/blender/gpu/intern/gpu_capabilities.cc @@ -102,6 +102,11 @@ bool GPU_crappy_amd_driver(void) return GCaps.broken_amd_driver; } +bool GPU_shader_image_load_store_support(void) +{ + return GCaps.shader_image_load_store_support; +} + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/gpu/intern/gpu_capabilities_private.hh b/source/blender/gpu/intern/gpu_capabilities_private.hh index a51525fa932..abe5b706a7d 100644 --- a/source/blender/gpu/intern/gpu_capabilities_private.hh +++ b/source/blender/gpu/intern/gpu_capabilities_private.hh @@ -42,6 +42,7 @@ struct GPUCapabilities { int max_textures_geom = 0; int max_textures_frag = 0; bool mem_stats_support = false; + bool shader_image_load_store_support = false; /* OpenGL related workarounds. */ bool mip_render_workaround = false; bool depth_blitting_workaround = false; @@ -52,4 +53,4 @@ struct GPUCapabilities { extern GPUCapabilities GCaps; -} // namespace blender::gpu
\ No newline at end of file +} // namespace blender::gpu diff --git a/source/blender/gpu/intern/gpu_shader_interface.hh b/source/blender/gpu/intern/gpu_shader_interface.hh index f76339d3adb..fce6fda5f14 100644 --- a/source/blender/gpu/intern/gpu_shader_interface.hh +++ b/source/blender/gpu/intern/gpu_shader_interface.hh @@ -63,6 +63,7 @@ class ShaderInterface { /** Enabled bindpoints that needs to be fed with data. */ uint16_t enabled_attr_mask_ = 0; uint16_t enabled_ubo_mask_ = 0; + uint8_t enabled_ima_mask_ = 0; uint64_t enabled_tex_mask_ = 0; /** Location of builtin uniforms. Fast access, no lookup needed. */ int32_t builtins_[GPU_NUM_UNIFORMS]; diff --git a/source/blender/gpu/intern/gpu_state.cc b/source/blender/gpu/intern/gpu_state.cc index be523020e8a..01a07ee3e4f 100644 --- a/source/blender/gpu/intern/gpu_state.cc +++ b/source/blender/gpu/intern/gpu_state.cc @@ -30,7 +30,6 @@ #include "BKE_global.h" -#include "GPU_glew.h" #include "GPU_state.h" #include "gpu_context_private.hh" @@ -309,6 +308,17 @@ void GPU_finish(void) /** \} */ /* -------------------------------------------------------------------- */ +/** \name Synchronisation Utils + * \{ */ + +void GPU_memory_barrier(eGPUBarrier barrier) +{ + Context::get()->state_manager->issue_barrier(barrier); +} + +/** \} */ + +/* -------------------------------------------------------------------- */ /** \name Default OpenGL State * * This is called on startup, for opengl offscreen render. diff --git a/source/blender/gpu/intern/gpu_state_private.hh b/source/blender/gpu/intern/gpu_state_private.hh index 9fee45e7bd4..a21093f00a2 100644 --- a/source/blender/gpu/intern/gpu_state_private.hh +++ b/source/blender/gpu/intern/gpu_state_private.hh @@ -163,10 +163,16 @@ class GPUStateManager { virtual void apply_state(void) = 0; + virtual void issue_barrier(eGPUBarrier barrier_bits) = 0; + virtual void texture_bind(Texture *tex, eGPUSamplerState sampler, int unit) = 0; virtual void texture_unbind(Texture *tex) = 0; virtual void texture_unbind_all(void) = 0; + virtual void image_bind(Texture *tex, int unit) = 0; + virtual void image_unbind(Texture *tex) = 0; + virtual void image_unbind_all(void) = 0; + virtual void texture_unpack_row_length_set(uint len) = 0; }; diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc index b22fd53f0f6..09dbf04210a 100644 --- a/source/blender/gpu/intern/gpu_texture.cc +++ b/source/blender/gpu/intern/gpu_texture.cc @@ -418,6 +418,21 @@ void GPU_texture_unbind_all(void) Context::get()->state_manager->texture_unbind_all(); } +void GPU_texture_image_bind(GPUTexture *tex, int unit) +{ + Context::get()->state_manager->image_bind(unwrap(tex), unit); +} + +void GPU_texture_image_unbind(GPUTexture *tex) +{ + Context::get()->state_manager->image_unbind(unwrap(tex)); +} + +void GPU_texture_image_unbind_all(void) +{ + Context::get()->state_manager->image_unbind_all(); +} + void GPU_texture_generate_mipmap(GPUTexture *tex) { reinterpret_cast<Texture *>(tex)->generate_mipmap(); |