feat(vk): call shapes for the acceleration-structure commands the interposer lacks

NVIDIA Streamline's interposer exports none of VK_KHR_acceleration_structure's
commands, so ray tracing looks each up per device with vkGetDeviceProcAddr and
calls it through a pointer: create (four pointers -> result), destroy (device,
handle, allocator), build sizes (device, type, info, counts, sizes), the
command-buffer build (buffer, count, infos, ranges) and the device address
(device, info -> u64). Both runtimes assemble; nothing uses them yet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-15 20:22:12 +03:00
parent 00ebd6df77
commit a868378b99
3 changed files with 71 additions and 0 deletions

View file

@ -46,3 +46,10 @@ extern function vk_sl_call_ip(fn: pointer, a: int, b: pointer) -> int = "lsl_cal
# a command-buffer command with three counts through a pointer (vkCmdDrawMeshTasksEXT, which the
# Streamline interposer does not export; looked up with vkGetDeviceProcAddr)
extern function vk_sl_call_piii(fn: pointer, a: pointer, b: int, c: int, d: int) = "lsl_call_piii"
# acceleration-structure commands through a pointer from vkGetDeviceProcAddr (the interposer exports none)
extern function vk_sl_call_pppp(fn: pointer, a: pointer, b: pointer, c: pointer, d: pointer) -> int = "lsl_call_pppp"
extern function vk_sl_call_plp(fn: pointer, a: pointer, b: long, c: pointer) = "lsl_call_plp"
extern function vk_sl_call_pippp(fn: pointer, a: pointer, b: int, c: pointer, d: pointer, e: pointer) = "lsl_call_pippp"
extern function vk_sl_call_pipp(fn: pointer, a: pointer, b: int, c: pointer, d: pointer) = "lsl_call_pipp"
extern function vk_sl_call_pp_l(fn: pointer, a: pointer, b: pointer) -> long = "lsl_call_pp_l"

View file

@ -190,3 +190,35 @@ entry:
call void %fn(ptr %a0, i32 %a1, i32 %a2, i32 %a3)
ret void
}
; ---- acceleration structures: commands the Streamline interposer does not export --------------------
; vkCreateAccelerationStructureKHR(device, info, allocator, out) -> VkResult
define i32 @lsl_call_pppp(ptr %fn, ptr %a0, ptr %a1, ptr %a2, ptr %a3) {
entry:
%r = call i32 %fn(ptr %a0, ptr %a1, ptr %a2, ptr %a3)
ret i32 %r
}
; vkDestroyAccelerationStructureKHR(device, handle, allocator)
define void @lsl_call_plp(ptr %fn, ptr %a0, i64 %a1, ptr %a2) {
entry:
call void %fn(ptr %a0, i64 %a1, ptr %a2)
ret void
}
; vkGetAccelerationStructureBuildSizesKHR(device, buildType, info, maxPrimitiveCounts, sizes)
define void @lsl_call_pippp(ptr %fn, ptr %a0, i32 %a1, ptr %a2, ptr %a3, ptr %a4) {
entry:
call void %fn(ptr %a0, i32 %a1, ptr %a2, ptr %a3, ptr %a4)
ret void
}
; vkCmdBuildAccelerationStructuresKHR(commandBuffer, infoCount, infos, buildRangeInfos)
define void @lsl_call_pipp(ptr %fn, ptr %a0, i32 %a1, ptr %a2, ptr %a3) {
entry:
call void %fn(ptr %a0, i32 %a1, ptr %a2, ptr %a3)
ret void
}
; vkGetAccelerationStructureDeviceAddressKHR(device, info) -> VkDeviceAddress
define i64 @lsl_call_pp_l(ptr %fn, ptr %a0, ptr %a1) {
entry:
%r = call i64 %fn(ptr %a0, ptr %a1)
ret i64 %r
}

View file

@ -331,3 +331,35 @@ entry:
call void %fn(ptr %a0, i32 %a1, i32 %a2, i32 %a3)
ret void
}
; ---- acceleration structures: commands the Streamline interposer does not export --------------------
; vkCreateAccelerationStructureKHR(device, info, allocator, out) -> VkResult
define i32 @lsl_call_pppp(ptr %fn, ptr %a0, ptr %a1, ptr %a2, ptr %a3) {
entry:
%r = call i32 %fn(ptr %a0, ptr %a1, ptr %a2, ptr %a3)
ret i32 %r
}
; vkDestroyAccelerationStructureKHR(device, handle, allocator)
define void @lsl_call_plp(ptr %fn, ptr %a0, i64 %a1, ptr %a2) {
entry:
call void %fn(ptr %a0, i64 %a1, ptr %a2)
ret void
}
; vkGetAccelerationStructureBuildSizesKHR(device, buildType, info, maxPrimitiveCounts, sizes)
define void @lsl_call_pippp(ptr %fn, ptr %a0, i32 %a1, ptr %a2, ptr %a3, ptr %a4) {
entry:
call void %fn(ptr %a0, i32 %a1, ptr %a2, ptr %a3, ptr %a4)
ret void
}
; vkCmdBuildAccelerationStructuresKHR(commandBuffer, infoCount, infos, buildRangeInfos)
define void @lsl_call_pipp(ptr %fn, ptr %a0, i32 %a1, ptr %a2, ptr %a3) {
entry:
call void %fn(ptr %a0, i32 %a1, ptr %a2, ptr %a3)
ret void
}
; vkGetAccelerationStructureDeviceAddressKHR(device, info) -> VkDeviceAddress
define i64 @lsl_call_pp_l(ptr %fn, ptr %a0, ptr %a1) {
entry:
%r = call i64 %fn(ptr %a0, ptr %a1)
ret i64 %r
}