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-02-16 00:20:25 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-02-16 00:20:49 +0300
commitd3b1cce4000b4b530d3ac8e2aa6b86b79b94cca0 (patch)
treef905a28a8d4c3683a1a42d88d047bf2c9bd567a8 /source/blender/gpu/intern
parentcbdd57864049f6f300494d56b623934a4134fa2b (diff)
GPUTexture: Add dimensions getter
Pretty straight forward. Returns the texture dimensions count. This is different from the size.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_texture.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc
index 19c7c5d78ff..da5f08f003e 100644
--- a/source/blender/gpu/intern/gpu_texture.cc
+++ b/source/blender/gpu/intern/gpu_texture.cc
@@ -507,6 +507,25 @@ void GPU_texture_ref(GPUTexture *tex)
reinterpret_cast<Texture *>(tex)->refcount++;
}
+int GPU_texture_dimensions(const GPUTexture *tex_)
+{
+ eGPUTextureType type = reinterpret_cast<const Texture *>(tex_)->type_get();
+ if (type & GPU_TEXTURE_1D) {
+ return 1;
+ }
+ else if (type & GPU_TEXTURE_2D) {
+ return 2;
+ }
+ else if (type & GPU_TEXTURE_3D) {
+ return 3;
+ }
+ else if (type & GPU_TEXTURE_CUBE) {
+ return 2;
+ }
+ /* GPU_TEXTURE_BUFFER */
+ return 1;
+}
+
int GPU_texture_width(const GPUTexture *tex)
{
return reinterpret_cast<const Texture *>(tex)->width_get();