rsx: Fix texture depth read

This commit is contained in:
eladash 2018-10-01 09:14:52 +03:00 committed by kd-11
parent 4174d7274d
commit fa723f6dc4
4 changed files with 7 additions and 13 deletions

View file

@ -527,22 +527,18 @@ u8 get_format_block_size_in_bytes(rsx::surface_color_format format)
size_t get_placed_texture_storage_size(u16 width, u16 height, u32 depth, u8 format, u16 mipmap, bool cubemap, size_t row_pitch_alignment, size_t mipmap_alignment)
{
size_t w = width;
size_t h = height;
size_t d = std::max<u16>(depth, 1);
format &= ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
size_t block_edge = get_format_block_size_in_texel(format);
size_t block_size_in_byte = get_format_block_size_in_bytes(format);
size_t height_in_blocks = (h + block_edge - 1) / block_edge;
size_t width_in_blocks = (w + block_edge - 1) / block_edge;
size_t height_in_blocks = (height + block_edge - 1) / block_edge;
size_t width_in_blocks = (width + block_edge - 1) / block_edge;
size_t result = 0;
for (u16 i = 0; i < mipmap; ++i)
{
size_t rowPitch = align(block_size_in_byte * width_in_blocks, row_pitch_alignment);
result += align(rowPitch * height_in_blocks * d, mipmap_alignment);
result += align(rowPitch * height_in_blocks * depth, mipmap_alignment);
height_in_blocks = std::max<size_t>(height_in_blocks / 2, 1);
width_in_blocks = std::max<size_t>(width_in_blocks / 2, 1);
}