[D3D12] Experimental 2x resolution scale

This commit is contained in:
Triang3l
2018-12-06 10:19:07 +03:00
parent 132af3e266
commit 9427667a27
173 changed files with 16680 additions and 4985 deletions

View File

@@ -164,6 +164,41 @@ bool GetPackedMipOffset(uint32_t width, uint32_t height, uint32_t depth,
return true;
}
void GetTextureTotalSize(Dimension dimension, uint32_t width, uint32_t height,
uint32_t depth, TextureFormat format, bool is_tiled,
bool packed_mips, uint32_t mip_max_level,
uint32_t* base_size, uint32_t* mip_size) {
bool is_3d = dimension == Dimension::k3D;
uint32_t width_blocks, height_blocks, depth_blocks;
if (base_size != nullptr) {
GetGuestMipBlocks(dimension, width, height, depth, format, 0, width_blocks,
height_blocks, depth_blocks);
uint32_t size = GetGuestMipSliceStorageSize(
width_blocks, height_blocks, depth_blocks, is_tiled, format, nullptr);
if (!is_3d) {
size *= depth;
}
*base_size = size;
}
if (mip_size != nullptr) {
mip_max_level = std::min(
mip_max_level,
GetSmallestMipLevel(width, height, is_3d ? depth : 1, packed_mips));
uint32_t size = 0;
for (uint32_t i = 1; i <= mip_max_level; ++i) {
GetGuestMipBlocks(dimension, width, height, depth, format, i,
width_blocks, height_blocks, depth_blocks);
uint32_t level_size = GetGuestMipSliceStorageSize(
width_blocks, height_blocks, depth_blocks, is_tiled, format, nullptr);
if (!is_3d) {
level_size *= depth;
}
size += level_size;
}
*mip_size = size;
}
}
int32_t GetTiledOffset2D(int32_t x, int32_t y, uint32_t width,
uint32_t log2_bpb) {
// https://github.com/gildor2/UModel/blob/de8fbd3bc922427ea056b7340202dcdcc19ccff5/Unreal/UnTexture.cpp#L489