diff options
Diffstat (limited to 'source/blender/draw/intern/DRW_gpu_wrapper.hh')
-rw-r--r-- | source/blender/draw/intern/DRW_gpu_wrapper.hh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/draw/intern/DRW_gpu_wrapper.hh b/source/blender/draw/intern/DRW_gpu_wrapper.hh index 8ed6594c31e..d9122657144 100644 --- a/source/blender/draw/intern/DRW_gpu_wrapper.hh +++ b/source/blender/draw/intern/DRW_gpu_wrapper.hh @@ -238,6 +238,11 @@ class StorageCommon : public DataBuffer<T, len, false>, NonMovable, NonCopyable GPU_storagebuf_clear_to_zero(ssbo_); } + void read() + { + GPU_storagebuf_read(ssbo_, this->data_); + } + operator GPUStorageBuf *() const { return ssbo_; @@ -850,6 +855,32 @@ class TextureFromPool : public Texture, NonMovable { GPUTexture *stencil_view() = delete; }; +/** + * Dummy type to bind texture as image. + * It is just a GPUTexture in disguise. + */ +class Image {}; + +static inline Image *as_image(GPUTexture *tex) +{ + return reinterpret_cast<Image *>(tex); +} + +static inline Image **as_image(GPUTexture **tex) +{ + return reinterpret_cast<Image **>(tex); +} + +static inline GPUTexture *as_texture(Image *img) +{ + return reinterpret_cast<GPUTexture *>(img); +} + +static inline GPUTexture **as_texture(Image **img) +{ + return reinterpret_cast<GPUTexture **>(img); +} + /** \} */ /* -------------------------------------------------------------------- */ |