Skip to content

Commit 67e9a9b

Browse files
Add ComputeMipLevelsCount overload taking a texture descriptor
1 parent ca40403 commit 67e9a9b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Graphics/GraphicsAccessories/interface/GraphicsAccessories.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,9 @@ Uint32 ComputeMipLevelsCount(Uint32 Width, Uint32 Height);
530530
/// Returns the number of mip levels for the specified texture dimensions
531531
Uint32 ComputeMipLevelsCount(Uint32 Width, Uint32 Height, Uint32 Depth);
532532

533+
/// Returns the number of mip levels for the specified texture description
534+
Uint32 ComputeMipLevelsCount(const TextureDesc& TexDesc);
535+
533536
/// Checks if the specified filter type is a point filter
534537
inline bool IsComparisonFilter(FILTER_TYPE FilterType)
535538
{

Graphics/GraphicsAccessories/src/GraphicsAccessories.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,6 +2028,11 @@ Uint32 ComputeMipLevelsCount(Uint32 Width, Uint32 Height, Uint32 Depth)
20282028
return ComputeMipLevelsCount(std::max(std::max(Width, Height), Depth));
20292029
}
20302030

2031+
Uint32 ComputeMipLevelsCount(const TextureDesc& TexDesc)
2032+
{
2033+
return ComputeMipLevelsCount(TexDesc.GetWidth(), TexDesc.GetHeight(), TexDesc.GetDepth());
2034+
}
2035+
20312036
bool VerifyResourceStates(RESOURCE_STATE State, bool IsTexture)
20322037
{
20332038
static_assert(RESOURCE_STATE_MAX_BIT == (1u << 21), "Please update this function to handle the new resource state");

0 commit comments

Comments
 (0)