On Tue, 26 Nov 2019 at 15:04, Conor McCarthy cmccarthy@codeweavers.com wrote:
November 26, 2019 6:07 AM, "Henri Verbeet" hverbeet@gmail.com wrote:
On Mon, 25 Nov 2019 at 10:30, Conor McCarthy cmccarthy@codeweavers.com wrote:
- estimated_size = vkd3d_format_is_compressed(format)
- ? desc->Width * desc->Height * format->block_byte_count / (format->block_width *
format->block_height)
- : desc->Width * desc->Height * format->byte_count;
That's not how size calculations for block-based formats work. See e.g. vkd3d_format_copy_data(). It also seems this is a separate change.
How about this: estimated_size = (desc->Height / format->block_height) * (desc->Width / format->block_width) * format->byte_count * format->block_byte_count;
That will result in a 0 estimated size for textures with any dimension smaller than the block size. That would be fine for e.g. a 1x1 texture since the total size would be smaller than D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT anyway, but note that that would also affect textures that are e.g. very wide but only 1 pixel tall.