Skip to content

Divide by zero in compressed image subdata #83

@publicrepo

Description

@publicrepo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions