LWJGL / lwjgl3

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan, bgfx), audio (OpenAL, Opus), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR, OpenXR) applications.
https://www.lwjgl.org
BSD 3-Clause "New" or "Revised" License
4.76k stars 636 forks source link

feat(core) add MemoryStack.pointersOfElements(CustomBuffer) #741

Closed httpdigest closed 2 years ago

httpdigest commented 2 years ago

Primary use-case is the argument ppBuildRangeInfos of the vkCmdBuildAccelerationStructuresKHR function. It takes a const VkAccelerationStructureBuildRangeInfoKHR* const* which in LWJGL is a PointerBuffer which should hold the addresses of VkAccelerationStructureBuildRangeInfoKHR struct values. Those values can be created by VkAccelerationStructureBuildRangeInfoKHR.malloc/calloc(N, stack) but there needs to be a way to convert that into a PointerBuffer of all struct addresses (simply offset by the StructBuffer's base address).