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
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-03-16 10:36:42 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-03-18 22:54:42 +0300
commit93bf17d9521025fe849bf705773de7bacc1dc01d (patch)
treeb453ac58905391133b423902fbdde609ec81ab14 /source/blender/gpu/intern
parent054957659f671910e1967fec83768affbbff060c (diff)
GPU: Add support for stencil buffer texturing mode.
This adds the possibility to read the stencil buffer inside shaders. This is only available on GL 4.3 so use it accordingly.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_texture.cc6
-rw-r--r--source/blender/gpu/intern/gpu_texture_private.hh1
2 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc
index 1aebf2ff112..0d2ec43533f 100644
--- a/source/blender/gpu/intern/gpu_texture.cc
+++ b/source/blender/gpu/intern/gpu_texture.cc
@@ -550,6 +550,12 @@ void GPU_texture_swizzle_set(GPUTexture *tex, const char swizzle[4])
reinterpret_cast<Texture *>(tex)->swizzle_set(swizzle);
}
+void GPU_texture_stencil_texture_mode_set(GPUTexture *tex, bool use_stencil)
+{
+ BLI_assert(GPU_texture_stencil(tex) || !use_stencil);
+ reinterpret_cast<Texture *>(tex)->stencil_texture_mode_set(use_stencil);
+}
+
void GPU_texture_free(GPUTexture *tex_)
{
Texture *tex = reinterpret_cast<Texture *>(tex_);
diff --git a/source/blender/gpu/intern/gpu_texture_private.hh b/source/blender/gpu/intern/gpu_texture_private.hh
index 2a7fc074046..1e81980e95f 100644
--- a/source/blender/gpu/intern/gpu_texture_private.hh
+++ b/source/blender/gpu/intern/gpu_texture_private.hh
@@ -117,6 +117,7 @@ class Texture {
virtual void copy_to(Texture *tex) = 0;
virtual void clear(eGPUDataFormat format, const void *data) = 0;
virtual void swizzle_set(const char swizzle_mask[4]) = 0;
+ virtual void stencil_texture_mode_set(bool use_stencil) = 0;
virtual void mip_range_set(int min, int max) = 0;
virtual void *read(int mip, eGPUDataFormat format) = 0;