GPU: Texture: Expose depth dimension extent

This function was not exposed outside of internal GPU module.

Renaming `draw::Texture::depth()` to `is_depth` for consistency
and removing the ambiguity.
This commit is contained in:
2023-04-13 14:06:41 +02:00
parent aa6e95281f
commit 7e764ec692
3 changed files with 17 additions and 1 deletions

View File

@@ -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_);
}

View File

@@ -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.
*/

View File

@@ -716,6 +716,11 @@ int GPU_texture_height(const GPUTexture *tex)
return reinterpret_cast<const Texture *>(tex)->height_get();
}
int GPU_texture_depth(const GPUTexture *tex)
{
return reinterpret_cast<const Texture *>(tex)->depth_get();
}
int GPU_texture_layer_count(const GPUTexture *tex)
{
return reinterpret_cast<const Texture *>(tex)->layer_count();