Skip to content

No way to get a device address aligned to a spec-required alignment without overallocating #2802

Description

@Cyphall

vkAllocateMemory says:

Allocations returned by vkAllocateMemory are guaranteed to meet any alignment requirement of the implementation.

But in some cases, the alignments are required by the spec itself and happen to be higher than this maximum implementation alignment requirement.

An example of this is:

VUID-VkAccelerationStructureCreateInfo2KHR-addressRange-11605
addressRange.address must be a multiple of 256 bytes

If the implementation doesn't require a min alignment >= 256 for anything, the allocated memory may not be aligned to 256 bytes.
This means a simple alignment of the offset within the memory is no longer sufficient.

Currently, the only way to avoid this problem is to overallocate by alignment - 1 and manually pad the device address.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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