Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-03-16 11:08:29 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-03-18 22:59:40 +0300
commitc509a12fd843c2bbd141807402cb38fd526240d9 (patch)
tree3edb98793bc7028ae63408fb592df476d060cbbe /source
parentdaa26ac0f5e473eef2a05458cb6502691cd95589 (diff)
DRW: Expose stencil view in gpu_wrapper
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/intern/DRW_gpu_wrapper.hh12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/draw/intern/DRW_gpu_wrapper.hh b/source/blender/draw/intern/DRW_gpu_wrapper.hh
index 3ff22f61500..46d4b651330 100644
--- a/source/blender/draw/intern/DRW_gpu_wrapper.hh
+++ b/source/blender/draw/intern/DRW_gpu_wrapper.hh
@@ -358,6 +358,7 @@ class StorageBuffer : public T, public detail::StorageCommon<T, 1, device_only>
class Texture : NonCopyable {
protected:
GPUTexture *tx_ = nullptr;
+ GPUTexture *stencil_view_ = nullptr;
Vector<GPUTexture *, 0> mip_views_;
Vector<GPUTexture *, 0> layer_views_;
const char *name_;
@@ -559,6 +560,16 @@ class Texture : NonCopyable {
return layer_views_[layer];
}
+ GPUTexture *stencil_view()
+ {
+ if (stencil_view_ == nullptr) {
+ eGPUTextureFormat format = GPU_texture_format(tx_);
+ stencil_view_ = GPU_texture_create_view(name_, tx_, format, 0, 9999, 0, 9999);
+ GPU_texture_stencil_texture_mode_set(stencil_view_, true);
+ }
+ return stencil_view_;
+ }
+
/**
* Returns true if the texture has been allocated or acquired from the pool.
*/
@@ -659,6 +670,7 @@ class Texture : NonCopyable {
for (GPUTexture *&view : layer_views_) {
GPU_TEXTURE_FREE_SAFE(view);
}
+ GPU_TEXTURE_FREE_SAFE(stencil_view_);
mip_views_.clear();
}