[GPU] Notes about tiled offset patterns
This commit is contained in:
parent
35abd8e2e8
commit
8c2f607793
|
@ -83,6 +83,33 @@ void GetTextureTotalSize(Dimension dimension, uint32_t width, uint32_t height,
|
|||
bool packed_mips, uint32_t mip_max_level,
|
||||
uint32_t* base_size_out, uint32_t* mip_size_out);
|
||||
|
||||
// Notes about tiled addresses that can be useful for simplifying and optimizing
|
||||
// tiling/untiling:
|
||||
// - Offset2D(X * 32 + x, Y * 32 + y) ==
|
||||
// Offset2D(X * 32, Y * 32) + Offset2D(x, y)
|
||||
// (true for negative offsets too).
|
||||
// - Offset3D(X * 32 + x, Y * 32 + y, Z * 8 + z) ==
|
||||
// Offset3D(X * 32, Y * 32, Z * 8) + Offset3D(x, y, z)
|
||||
// (true for negative offsets too).
|
||||
// - Addressing of blocks that are contiguous along X (for tiling/untiling of
|
||||
// larger portions at once):
|
||||
// - 1bpb - each 8 blocks are laid out sequentially, odd 8 blocks =
|
||||
// even 8 blocks + 64 bytes (two R32G32_UINT tiled accesses for one
|
||||
// R32G32B32A32_UINT linear access).
|
||||
// - 2bpb, 4bpb, 8bpb, 16bpb - each 16 bytes contain blocks laid out
|
||||
// sequentially (can tile/untile in R32G32B32A32_UINT portions).
|
||||
// - 2bpb - odd 8 blocks = even 8 blocks + 64 bytes.
|
||||
// - 4bpb - odd 4 blocks = even 4 blocks + 32 bytes.
|
||||
// - 8bpb - odd 2 blocks = even 2 blocks + 32 bytes.
|
||||
// - 16bpb - odd block = even block + 32 bytes.
|
||||
// - Resolve granularity for both offset and size is 8x8 pixels
|
||||
// (GPU_RESOLVE_ALIGNMENT - for example, Halo 3 resolves a 24x16 region for a
|
||||
// 18x10 texture, 8x8 region for a 1x1 texture).
|
||||
// https://github.com/jmfauvel/CSGO-SDK/blob/master/game/client/view.cpp#L944
|
||||
// https://github.com/stanriders/hl2-asw-port/blob/master/src/game/client/vgui_int.cpp#L901
|
||||
// So, multiple pixels can still be loaded/stored when resolving, taking
|
||||
// contiguous storage patterns into account.
|
||||
|
||||
int32_t GetTiledOffset2D(int32_t x, int32_t y, uint32_t width,
|
||||
uint32_t bpb_log2);
|
||||
int32_t GetTiledOffset3D(int32_t x, int32_t y, int32_t z, uint32_t width,
|
||||
|
|
Loading…
Reference in New Issue