feat(render3d): load steps for a loading screen, four quality switches, and the ring's uniform usage

- r3d_open opens the window with nothing baked; r3d_load_count / r3d_load_step run the rest (sky
  and light, terrain, shadow and screen targets, cover and actors, grass) so a game can present a
  loading frame between them. r3d_init is the same calls in a row.
- sky_set_quality(width): the prefiltered sky light at 256 / 512 / 1024, baked again.
- post_set_msaa(samples): multisampling on OpenGL, remade in place (post_msaa_live is false on
  Vulkan); post_free frees the multisampled framebuffer too.
- STREAM_BUDGET_US is a variable; r3d_fog_scale multiplies the fog the day sets.
- Vulkan buffers carry UNIFORM_BUFFER usage: the frame's ring is bound as uniform buffers and was
  created without it (VUID-VkWriteDescriptorSet-descriptorType-00330, found on MoltenVK).

OpenGL frames at the five viewpoints unchanged; the game's 59 self-tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-15 14:46:55 +03:00
parent b9eda646fc
commit f2b976c976
8 changed files with 89 additions and 21 deletions

View file

@ -50,11 +50,28 @@ var post_grain: int = 0
# the screen-sized targets go away before post_init makes them at a new size
function post_free() -> void {
if post_hdr == null { return }
if post_ms_fbo != 0 { gpu_fb_free(post_ms_fbo); post_ms_fbo = 0 }
target_free(post_hdr); target_free(post_ao); target_free(post_ao_blur); target_free(post_ldr)
target_free(post_depth_copy); target_free(post_prev); target_free(post_scene)
for i in 0 .. len(post_bloom) { target_free(post_bloom[i]) }
post_hdr = null
}
# Multisampled scene: 1 (temporal AA alone), 2 or 4. OpenGL remakes the scene targets at once;
# the Vulkan backend has no sample counts yet and keeps drawing single-sampled (post_msaa_live says so).
function post_msaa_live() -> bool { return gpu_is_gl() }
function post_set_msaa(n: int) -> void {
var want = n
if want < 1 { want = 1 }
if not post_msaa_live() { want = 1 }
if want == post_ms_samples { return }
post_ms_samples = want
if post_hdr != null {
let w = post_w; let h = post_h
post_free()
post_init(w, h)
}
}
function post_init(w: int, h: int) -> void {
post_w = w; post_h = h
post_hdr = target_new(w, h, GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, true, GL_LINEAR)