mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 21:41:26 +12:00
rsx: Provide tile alignment utility (align to 64 * pitch blocks)
This commit is contained in:
parent
823c72bf27
commit
95f9f04612
3 changed files with 18 additions and 0 deletions
|
@ -38,4 +38,13 @@ namespace rsx
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
utils::address_range GCM_tile_reference::tile_align(const utils::address_range& range) const
|
||||||
|
{
|
||||||
|
const auto alignment = 64 * tile->pitch;
|
||||||
|
const u32 start_offset = rsx::align_down2(range.start - base_address, alignment);
|
||||||
|
const u32 end_offset = rsx::align2(range.end - base_address + 1, alignment);
|
||||||
|
|
||||||
|
return utils::address_range::start_length(start_offset + base_address, end_offset - start_offset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ namespace rsx
|
||||||
{
|
{
|
||||||
return !!tile;
|
return !!tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
utils::address_range tile_align(const rsx::address_range& range) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GCM_context
|
struct GCM_context
|
||||||
|
|
|
@ -306,6 +306,13 @@ namespace rsx
|
||||||
return ((value + alignment - 1) / alignment) * alignment;
|
return ((value + alignment - 1) / alignment) * alignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// General purpose downward alignment without power-of-2 constraint
|
||||||
|
template <typename T, typename U>
|
||||||
|
static inline T align_down2(T value, U alignment)
|
||||||
|
{
|
||||||
|
return (value / alignment) * alignment;
|
||||||
|
}
|
||||||
|
|
||||||
// Copy memory in inverse direction from source
|
// Copy memory in inverse direction from source
|
||||||
// Used to scale negatively x axis while transfering image data
|
// Used to scale negatively x axis while transfering image data
|
||||||
template <typename Ts = u8, typename Td = Ts>
|
template <typename Ts = u8, typename Td = Ts>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue