V-EZ icon indicating copy to clipboard operation
V-EZ copied to clipboard

Divide by zero in compressed image subdata

Open publicrepo opened this issue 2 years ago • 2 comments

There can be a divide by zero on this line when numBlocksX is zero, which occurs for small / mip textures.

VkResult Device::CompressedImageSubData(Image* pImage, const VezImageSubDataInfo* pSubDataInfo, const void* pData)
    auto maxTransferBlocksY = std::min(numBlocksY, static_cast<uint32_t>(pinnedMemoryBufferSize / (blockSize * numBlocksX)));

This can be trivially fixed by checking for zero before divide. The code otherwise appears correct as it rounds up zero block counts to one for those tiny sizes.

publicrepo avatar Aug 16 '22 23:08 publicrepo

Hi, could you contribute to this repo? V-EZ github is unmaintained for now.

manhnt9 avatar Aug 17 '22 01:08 manhnt9

@manhnt9 Maybe. I'm just playing around with VEZ and reporting some issues I found here. I notice a few other forks of this repo have recent development and maintenance effort. I don't have a repo to share, just some code I'm playing with.

publicrepo avatar Aug 17 '22 05:08 publicrepo