video_core: Use un-shifted block sizes to avoid integer divisions
Instead of storing all block width, height and depths in their shifted form: block_width = 1U << block_shift; Store them like they are provided by the emulated hardware (their block_shift form). This way we can avoid doing the costly Common::AlignUp operation to align texture sizes and drop CPU integer divisions with bitwise logic (defined in Common::AlignBits).
This commit is contained in:
parent
28d7c2f5a5
commit
345e73f2fe
10 changed files with 78 additions and 60 deletions
|
@ -19,6 +19,11 @@ constexpr T AlignDown(T value, std::size_t size) {
|
|||
return static_cast<T>(value - value % size);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr T AlignBits(T value, T align) {
|
||||
return (value + ((1 << align) - 1)) >> align << align;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr bool Is4KBAligned(T value) {
|
||||
static_assert(std::is_unsigned_v<T>, "T must be an unsigned value.");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue