diff --git a/source/blender/draw/intern/DRW_gpu_wrapper.hh b/source/blender/draw/intern/DRW_gpu_wrapper.hh index 67e7616eb04..82288a5fe86 100644 --- a/source/blender/draw/intern/DRW_gpu_wrapper.hh +++ b/source/blender/draw/intern/DRW_gpu_wrapper.hh @@ -766,12 +766,17 @@ class Texture : NonCopyable { return GPU_texture_height(tx_); } + int depth() const + { + return GPU_texture_depth(tx_); + } + int pixel_count() const { return GPU_texture_width(tx_) * GPU_texture_height(tx_); } - bool depth() const + bool is_depth() const { return GPU_texture_has_depth_format(tx_); } diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h index 0dc9485cc7c..d7a826b9a03 100644 --- a/source/blender/gpu/GPU_texture.h +++ b/source/blender/gpu/GPU_texture.h @@ -940,6 +940,12 @@ int GPU_texture_width(const GPUTexture *texture); */ int GPU_texture_height(const GPUTexture *texture); +/** + * Return the depth of \a tex . Correspond to number of layers for 2D array texture. + * NOTE: return 0 for 1D & 2D textures. + */ +int GPU_texture_depth(const GPUTexture *texture); + /** * Return the number of layers of \a tex . Return 1 if the texture is not layered. */ diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc index 9b4a23f9b39..4a3254d9feb 100644 --- a/source/blender/gpu/intern/gpu_texture.cc +++ b/source/blender/gpu/intern/gpu_texture.cc @@ -716,6 +716,11 @@ int GPU_texture_height(const GPUTexture *tex) return reinterpret_cast(tex)->height_get(); } +int GPU_texture_depth(const GPUTexture *tex) +{ + return reinterpret_cast(tex)->depth_get(); +} + int GPU_texture_layer_count(const GPUTexture *tex) { return reinterpret_cast(tex)->layer_count();