[GPU] TextureInfo::GetMaxMipLevels

This commit is contained in:
DrChat 2018-04-30 11:01:46 -05:00
parent 62bee78edd
commit f7c7cc54ed
2 changed files with 7 additions and 0 deletions

View File

@ -204,6 +204,11 @@ void TextureInfo::CalculateTextureSizesCube(uint32_t width, uint32_t height,
input_length = size_cube.input_face_length * 6; input_length = size_cube.input_face_length * 6;
} }
uint32_t TextureInfo::GetMaxMipLevels(uint32_t width, uint32_t height,
uint32_t depth) {
return 1 + xe::log2_floor(std::max({width, height, depth}));
}
bool TextureInfo::GetPackedTileOffset(const TextureInfo& texture_info, bool TextureInfo::GetPackedTileOffset(const TextureInfo& texture_info,
uint32_t* out_offset_x, uint32_t* out_offset_x,
uint32_t* out_offset_y) { uint32_t* out_offset_y) {

View File

@ -304,6 +304,8 @@ struct TextureInfo {
uint32_t width, uint32_t height, uint32_t width, uint32_t height,
TextureInfo* out_info); TextureInfo* out_info);
static uint32_t GetMaxMipLevels(uint32_t width, uint32_t height,
uint32_t depth);
static bool GetPackedTileOffset(const TextureInfo& texture_info, static bool GetPackedTileOffset(const TextureInfo& texture_info,
uint32_t* out_offset_x, uint32_t* out_offset_x,
uint32_t* out_offset_y); uint32_t* out_offset_y);