render3d: to its floor - messages in declared helpers, post and DLSS set up at start, lists sized

Seventeen inline messages (allocation failures, missing conversions, the no-pipeline and compressed-
target warnings, resize and swapchain lines, the test-frame camera line, DLSS evaluate, shadow memory,
stream and terrain debug, the water test) are each a function of their own under @alloc_ok, taking
numbers, so the paths that say them hold no site. post_measure's two 1x1 exposure targets are made in
post_init and DLSS's evaluate structs in gsl_init; DLSS's camera up is a state field. The lists play
pushes into (retired, free ranges, spare ids, the per-buffer gpu flags, the stage and the actor spares)
get their room at start-up (gvk_room_*, actor_room), so a push fits. Compiled (steady).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 16:36:44 +03:00
parent 629579123a
commit 958a262ba1
12 changed files with 120 additions and 26 deletions

View file

@ -68,6 +68,8 @@ function gsl_boot(render3d_st: mut Render3dState) -> void {
# After Vk.open(), before vkCreateInstance.
@alloc_ok("start-up: the device, its tables, the programs, the passes and the world's first textures are made once, before play")
function gsl_init(render3d_st: mut Render3dState) -> void {
# the evaluate call's structs, made once with DLSS rather than by the first frame it drew
if render3d_st.gsl_res == null { render3d_st.gsl_res = gsl_struct(4 * 112); render3d_st.gsl_tags = gsl_struct(4 * 64); render3d_st.gsl_inputs = bytes(8) }
if render3d_st.gsl_on or Vk.sl_active() == 0 { return }
render3d_st.gsl_feats = gsl_struct(20)
Vk.put_i32(render3d_st.gsl_feats, 0, GSL_DLSS); Vk.put_i32(render3d_st.gsl_feats, 4, GSL_REFLEX); Vk.put_i32(render3d_st.gsl_feats, 8, GSL_PCL)
@ -383,7 +385,7 @@ function gsl_constants(render3d_st: mut Render3dState) -> void {
Vk.put_i32(k, 360, float_bits(1.0)) # mvecScale
Vk.put_i32(k, 364, float_bits(1.0))
gsl_put_v3(k, 376, render3d_st.cam_pos)
let up = floats(3)
let up = render3d_st.gsl_up # made with the state
v3_cross(up, render3d_st.cam_right, render3d_st.cam_fwd)
gsl_put_v3(k, 388, up)
gsl_put_v3(k, 400, render3d_st.cam_right)
@ -397,7 +399,7 @@ function gsl_constants(render3d_st: mut Render3dState) -> void {
# not dilated, not jittered
if render3d_st.gsl_reset { Vk.put_i32(k, 444, 256 * 256 * 256) }
Vk.put_i32(k, 452, float_bits(40.0)) # minRelativeLinearDepthObjectSeparation
free(fix); free(proj); free(v2c); free(c2v); free(cur); free(prev); free(inv_cur); free(c2p); free(p2c); free(ident); free(up)
free(fix); free(proj); free(v2c); free(c2v); free(cur); free(prev); free(inv_cur); free(c2p); free(p2c); free(ident)
}
# make the DLSS targets at this frame's sizes
@ -418,7 +420,6 @@ function gsl_targets(render3d_st: mut Render3dState) -> void {
render3d_st.post_ldr = target_new(render3d_st, gl_width(), gl_height(), post_ldr_fmt(render3d_st), GL_RGBA, GL_UNSIGNED_BYTE, false, GL_LINEAR)
render3d_st.post_ldr_hdr = gpu_hdr_active(render3d_st)
}
if render3d_st.gsl_res == null { render3d_st.gsl_res = gsl_struct(4 * 112); render3d_st.gsl_tags = gsl_struct(4 * 64); render3d_st.gsl_inputs = bytes(8) }
}
# Upscale post_hdr into gsl_out; the colour the rest of post reads (post_hdr's own if it failed).
@ -450,10 +451,14 @@ function gsl_dlss_eval(render3d_st: mut Render3dState) -> int {
# forgetting, because every gvk_draw binds its pipeline, view and set afresh
render3d_st.gsl_eval_ok = r == 0
if r != 0 {
if not render3d_st.gsl_said { print(`r3d: streamline: DLSS evaluate failed ({r}); drawing without it`); render3d_st.gsl_said = true }
if not render3d_st.gsl_said { gsl_say_eval_failed(r); render3d_st.gsl_said = true }
render3d_st.post_color_w = render3d_st.post_w; render3d_st.post_color_h = render3d_st.post_h
return render3d_st.post_hdr.color
}
render3d_st.post_color_w = gl_width(); render3d_st.post_color_h = gl_height()
return render3d_st.gsl_out.color
}
# messages, each built in a function of its own so the path that says it holds no allocation
@alloc_ok("a message, built only when it is said: a failure, a warning or a debug switch")
function gsl_say_eval_failed(r: int) -> void { print(`r3d: streamline: DLSS evaluate failed ({r}); drawing without it`) }