mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-23 05:59:17 +01:00
Round up when calculating size of compressed texture in bytes
This commit is contained in:
parent
d889550e84
commit
43879e2476
@ -105,6 +105,15 @@ namespace skyline::util {
|
|||||||
return IsAligned(value, WORD_BIT / 8);
|
return IsAligned(value, WORD_BIT / 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The value of division rounded up to the next integral
|
||||||
|
*/
|
||||||
|
template<typename Type>
|
||||||
|
requires std::is_integral_v<Type>
|
||||||
|
constexpr Type DivideCeil(Type dividend, Type divisor) {
|
||||||
|
return (dividend + divisor - 1) / divisor;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string The string to create a magic from
|
* @param string The string to create a magic from
|
||||||
* @return The magic of the supplied string
|
* @return The magic of the supplied string
|
||||||
|
@ -80,7 +80,7 @@ namespace skyline::gpu {
|
|||||||
* @return The size of the texture in bytes
|
* @return The size of the texture in bytes
|
||||||
*/
|
*/
|
||||||
constexpr size_t GetSize(u32 width, u32 height, u32 depth = 1) const {
|
constexpr size_t GetSize(u32 width, u32 height, u32 depth = 1) const {
|
||||||
return (((width / blockWidth) * (height / blockHeight)) * bpb) * depth;
|
return util::DivideCeil(width, u32{blockWidth}) * util::DivideCeil(height, u32{blockHeight}) * bpb * depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr size_t GetSize(Dimensions dimensions) const {
|
constexpr size_t GetSize(Dimensions dimensions) const {
|
||||||
|
Loading…
Reference in New Issue
Block a user