[Vulkan] Add logging to certain error conditions.

[Vulkan] Track both texture block height and texture block vertical pitch.
[Vulkan] Only convert the necessary visible height on texture uploads.
[Vulkan] Fix write watch on texture data so it properly only covers mip 0 data.
This commit is contained in:
gibbed
2018-05-30 19:38:36 -05:00
parent 7068d0a5a9
commit bbebfd49c8
5 changed files with 78 additions and 44 deletions

View File

@@ -27,29 +27,30 @@ static TextureMemoryUsage CalculateMemoryUsage(const FormatInfo* format_info,
usage.pitch = pitch;
usage.height = height;
usage.block_pitch = xe::round_up(usage.pitch, format_info->block_width) /
format_info->block_width;
usage.block_pitch_h = xe::round_up(usage.pitch, format_info->block_width) /
format_info->block_width;
usage.block_height = xe::round_up(usage.height, format_info->block_height) /
format_info->block_height;
usage.block_pitch_v = usage.block_height;
usage.depth = depth;
if (is_guest) {
// Texture dimensions must be a multiple of tile
// dimensions (32x32 blocks).
usage.block_pitch = xe::round_up(usage.block_pitch, 32);
usage.block_height = xe::round_up(usage.block_height, 32);
usage.block_pitch_h = xe::round_up(usage.block_pitch_h, 32);
usage.block_pitch_v = xe::round_up(usage.block_pitch_v, 32);
usage.pitch = usage.block_pitch * format_info->block_width;
usage.height = usage.block_height * format_info->block_height;
usage.pitch = usage.block_pitch_h * format_info->block_width;
usage.height = usage.block_pitch_v * format_info->block_height;
uint32_t bytes_per_block = format_info->bytes_per_block();
uint32_t byte_pitch = usage.block_pitch * bytes_per_block;
uint32_t byte_pitch = usage.block_pitch_h * bytes_per_block;
if (!is_tiled) {
// Each row must be a multiple of 256 bytes in linear textures.
byte_pitch = xe::round_up(byte_pitch, 256);
usage.block_pitch = byte_pitch / bytes_per_block;
usage.pitch = usage.block_pitch * format_info->block_width;
usage.block_pitch_h = byte_pitch / bytes_per_block;
usage.pitch = usage.block_pitch_h * format_info->block_width;
}
// Is depth special?