The first part of the Vulkan side of gpu.ludic, not yet reached from the renderer: gvk_init brings up the instance (portability enumeration where offered), the first discrete GPU, a graphics queue and a device with the Tier 1 floor switched on (dynamic rendering, synchronization2, descriptor indexing, timeline semaphores), and says why when it cannot so the caller stays on OpenGL. gvk_mem_type / gvk_alloc pick and allocate memory (one allocation per resource while the backend comes up), and gvk_once_begin / gvk_once_end carry uploads, bakes and read-backs through submit and wait. examples/rendering/vk_device.ludic runs it alone: VKDEVICE OK and validation-clean on the RTX 3070 Ti and on MoltenVK. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
22 lines
1 KiB
Text
22 lines
1 KiB
Text
# vk_device.ludic — render3d's Vulkan device on its own: gvk_init() brings up the instance, the
|
|
# first discrete GPU, a graphics queue and a device with the Tier 1 floor switched on, then one
|
|
# empty one-shot command buffer goes through submit and wait, and everything is torn down.
|
|
# Run it under the validation layer on each machine the backend is meant for.
|
|
# bin/ludicc examples/rendering/vk_device.ludic --headless -o build/vk_device
|
|
import "../../packages/ludic.render3d/gpu_vk.ludic"
|
|
|
|
program VkDevice {
|
|
property Marker { on: int = 1 }
|
|
model Anchor { Marker }
|
|
|
|
handler Boot phase Start {
|
|
spawn Anchor {}
|
|
if not gvk_init() { print(`VKDEVICE NONE: {gvk_why}`); quit() }
|
|
let cb = gvk_once_begin()
|
|
let ok = cb != null and gvk_once_end(cb)
|
|
print(`vulkan: family {gvk_family}, {Vk.get_i32(gvk_mp, VkPhysicalDeviceMemoryProperties_memoryTypeCount)} memory types, one-shot submit {ok}`)
|
|
gvk_shutdown()
|
|
if ok { print("VKDEVICE OK") } else { print("VKDEVICE SUBMIT FAILED") }
|
|
quit()
|
|
}
|
|
}
|