diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-07-30 14:29:02 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-08-02 22:53:17 +0300 |
commit | 04160ffd12fe0cd3e2241ea9c9e683b40ba5219e (patch) | |
tree | c468ef565b2cbd3c5a2c548a332a1db5274aca38 /source/blender/draw | |
parent | 1e5ab041d79224a634268e0b80f114b5566387c4 (diff) |
DRW: GPU wrappers: Expose more ease of use functions and cleanup style
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/intern/DRW_gpu_wrapper.hh | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/draw/intern/DRW_gpu_wrapper.hh b/source/blender/draw/intern/DRW_gpu_wrapper.hh index 954d8c49f4c..210b18c1234 100644 --- a/source/blender/draw/intern/DRW_gpu_wrapper.hh +++ b/source/blender/draw/intern/DRW_gpu_wrapper.hh @@ -183,7 +183,7 @@ class UniformCommon : public DataBuffer<T, len, false>, NonMovable, NonCopyable GPU_uniformbuf_free(ubo_); } - void push_update(void) + void push_update() { GPU_uniformbuf_update(ubo_, this->data_); } @@ -228,12 +228,17 @@ class StorageCommon : public DataBuffer<T, len, false>, NonMovable, NonCopyable GPU_storagebuf_free(ssbo_); } - void push_update(void) + void push_update() { BLI_assert(device_only == false); GPU_storagebuf_update(ssbo_, this->data_); } + void clear_to_zero() + { + GPU_storagebuf_clear_to_zero(ssbo_); + } + operator GPUStorageBuf *() const { return ssbo_; @@ -320,6 +325,7 @@ class StorageArrayBuffer : public detail::StorageCommon<T, len, device_only> { MEM_freeN(this->data_); } + /* Resize to \a new_size elements. */ void resize(int64_t new_size) { BLI_assert(new_size > 0); @@ -611,6 +617,11 @@ class Texture : NonCopyable { return GPU_texture_height(tx_); } + int pixel_count() const + { + return GPU_texture_width(tx_) * GPU_texture_height(tx_); + } + bool depth(void) const { return GPU_texture_depth(tx_); |