Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the purpose of VkAccelerationStructureBuildRangeInfoKHR? #2478

Closed
Agrael1 opened this issue Jan 2, 2025 · 1 comment
Closed

What is the purpose of VkAccelerationStructureBuildRangeInfoKHR? #2478

Agrael1 opened this issue Jan 2, 2025 · 1 comment

Comments

@Agrael1
Copy link

Agrael1 commented Jan 2, 2025

Hi, I am doing layering API over Raytracing extension.

I have found that VkAccelerationStructureBuildRangeInfoKHR is separate from VkAccelerationStructureGeometry*DataKHR, which creates unnecessary housekeeping, since you either have to keep separate arrays of data in sync or even worse for VkAccelerationStructureBuildRangeInfoKHR it is keeping extra array of pointers.

For AABBs this could have easily been an extra uint32_t for number of AABBs in the scene. For Vertex Data it is just an extra index size.

Not all members of VkAccelerationStructureBuildRangeInfoKHR are used anyways. Most of the functionality is redundant, since you could offset into the buffer address directly by adding a constant to it, since the buffer address is virtual.

Is there an explanation why those structures are separate?

EDIT: Originally the question was about direct RTAS build. Although after investigation on indirect build, for which VkAccelerationStructureBuildRangeInfoKHR is used as an indirect argument, it is still unclear why couldn't the addresses be pushed as indirect arguments, instead of offsets.

@Agrael1 Agrael1 changed the title Why is there VkAccelerationStructureBuildRangeInfoKHR at all? What is the purpose of VkAccelerationStructureBuildRangeInfoKHR? Jan 2, 2025
@dgkoch dgkoch self-assigned this Jan 9, 2025
@dgkoch
Copy link
Contributor

dgkoch commented Jan 23, 2025

This was previously answered directly in a TSG meeting, but recording an answer here for posterity.
The exact details are getting forgotten in the annals history as that was a number of years ago at this point, but a couple of reasons that we could come up with in retrospect are:

  • we wanted to keep this parallel between direct and indirect builds
  • the VkAccelerationStructureGeometry*DataKHR need to be provided both to the build AS commands and to the vkGetAccelerationStructureBuildSizesKHR command, but the range infos aren't needed for vkGetAccelerationStructureBuildSizesKHR so we didn't want to require that info to be provided there, but otherwise didn't want to duplicate the geometry data structures.
  • something something.. complicated evolution of the specs :-)

@dgkoch dgkoch closed this as completed Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants