render3d: start-up declared, ov_nine and the caster test on buffers made once - 362 frame sites to 122

The renderer starts itself from the first frame (gpu_select), so the device, its tables, the
manifest and programs, grass, shadows, sky, terrain textures and the actor pool read as frame
allocations: each is @alloc_ok as start-up, with gvk_fail (a failure) and the actor census and
texture dump (debug switches). ov_nine's four corner/uv arrays are one floats(16) made in
gvk_startup_state; ac_in_light's four points are made there too. Compiled (steady, and ludic deps
over main 4316ff97).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 16:21:51 +03:00
parent 8dfcccad41
commit 9f233104a3
17 changed files with 37 additions and 8 deletions

View file

@ -8,6 +8,7 @@
# ---- the device ---------------------------------------------------------------------------
@alloc_ok("a failure, said once: the message is built only when something is already wrong")
function gvk_fail(render3d_st: mut Render3dState, what: string, r: int) -> bool {
render3d_st.gvk_why = `{what} failed (VkResult {r})`
gvk_note(render3d_st, `r3d: vulkan: {render3d_st.gvk_why}`)
@ -57,6 +58,7 @@ function gvk_no_command_pooling() -> void {
Os.set_env("MVK_CONFIG_USE_COMMAND_POOLING", "0")
}
@alloc_ok("start-up: the device, its tables, the programs, the passes and the world's first textures are made once, before play")
function gvk_init(render3d_st: mut Render3dState) -> bool {
if render3d_st.gvk_ready { return true }
gvk_no_command_pooling()
@ -514,6 +516,7 @@ function gvk_mem_id(x: long) -> int { return int(x) }
# ---- one-shot commands --------------------------------------------------------------------
# Uploads, bakes and read-backs record into a command buffer, submit it and wait. The frame
# itself does not go through here.
@alloc_ok("start-up: the device, its tables, the programs, the passes and the world's first textures are made once, before play")
function gvk_cmd_init(render3d_st: mut Render3dState) -> bool {
let cpi = bytes(VkCommandPoolCreateInfo_sizeof)
Vk.zero(cpi, VkCommandPoolCreateInfo_sizeof)
@ -730,6 +733,7 @@ function gvk_labels_close(render3d_st: mut Render3dState) -> void {
# Everything a frame's draws use as scratch or as a table, made once the device is up: each was made
# on the first draw that needed it, which put an allocation in whichever frame that was (plan 25.2)
const GVK_PROGS_MAX: int = 4096
@alloc_ok("start-up: the device, its tables, the programs, the passes and the world's first textures are made once, before play")
function gvk_startup_state(render3d_st: mut Render3dState) -> void {
let zero: long = 0
render3d_st.gvk_tmp_buf = bytes(GVK_TMP_BYTES)
@ -765,4 +769,6 @@ function gvk_startup_state(render3d_st: mut Render3dState) -> void {
for i in 0 .. 32 { render3d_st.gpu_unit_2d[i] = -1 }
}
if render3d_st.cam_planes == null { render3d_st.cam_planes = floats(16) }
if render3d_st.ov_nine_buf == null { render3d_st.ov_nine_buf = floats(16) }
if render3d_st.ac_lp0 == null { render3d_st.ac_lp0 = floats(3); render3d_st.ac_lpx = floats(3); render3d_st.ac_lpy = floats(3); render3d_st.ac_lpz = floats(3) }
}