ludic/examples/rendering/vk_device.ludic
Orkuncakilkaya 19fcf60599 wip(0.S3): packages and examples migrated again from their pre-0.S sources in one run
ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic
  1804 vars into 126 states, 64 into lets; 23498 edits in 460 files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 15:31:34 +03:00

22 lines
1.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(render3d_st: mut Render3dState) phase Start {
spawn Anchor {}
if not gvk_init(render3d_st) { print(`VKDEVICE NONE: {render3d_st.gvk_why}`); quit() }
let cb = gvk_once_begin(render3d_st)
let ok = cb != null and gvk_once_end(render3d_st, cb)
print(`vulkan: family {render3d_st.gvk_family}, {Vk.get_i32(render3d_st.gvk_mp, VkPhysicalDeviceMemoryProperties_memoryTypeCount)} memory types, one-shot submit {ok}`)
gvk_shutdown(render3d_st)
if ok { print("VKDEVICE OK") } else { print("VKDEVICE SUBMIT FAILED") }
quit()
}
}