perf(render3d): the terrain's height and normal in R32F + RG16F, 128 MB where one RGBA32F was 256
The first generation pass's R32F height is kept as ter_height_tex (not copied into an RGBA32F), so every reader of the height - placement, the read-back, physics, selftest16's 9 mm - sees the same 32 bits. ternormal.frag writes the baked normal's x and z into ter_normal_tex (RG16F), and the six places that read it (terrain.frag twice, tersun.frag, grass.vert, grass.mesh, grass_cull.comp, which takes a third texture at binding 6) rebuild y. SPIR-V regenerated. Maroon Lake's play, headless Vulkan: 2793 -> 2647 MB. The camp's frame: 0.066% of pixels differ by more than 8 (mean 0.024/255), isolated grass blades at the slope gate. ludic-dev test 307/307. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f1049953c4
commit
1675eb451f
26 changed files with 77 additions and 36 deletions
|
|
@ -30,7 +30,7 @@ function gg_init(render3d_st: mut Render3dState) -> void {
|
|||
if not gpu_has_compute(render3d_st) or render3d_st.grass_prog == 0 { return }
|
||||
if r3d_env_has(render3d_st, "R3D_GRASS_GPU") and r3d_env(render3d_st, "R3D_GRASS_GPU") == "0" { return }
|
||||
render3d_st.gg_reset = gpu_compute(render3d_st, "grass_reset", 1)
|
||||
render3d_st.gg_cull = gpu_compute_tex(render3d_st, "grass_cull", 3, 2)
|
||||
render3d_st.gg_cull = gpu_compute_tex(render3d_st, "grass_cull", 3, 3)
|
||||
render3d_st.gg_prog = r3d_program(render3d_st, "grass_inst.vert", "model.frag", "#define FOLIAGE\n#define BLADE\n#define GBLADE\n#define GINST\n")
|
||||
if render3d_st.gg_reset == 0 or render3d_st.gg_cull == 0 or render3d_st.gg_prog == 0 { return }
|
||||
render3d_st.gg_tiles_buf = new []int
|
||||
|
|
@ -105,7 +105,7 @@ function gg_cull_frame(render3d_st: mut Render3dState) -> void {
|
|||
# made once: a words() a frame is a calloc nothing frees
|
||||
if render3d_st.gg_rb == null {
|
||||
render3d_st.gg_rb = words(4); render3d_st.gg_cb = words(1); render3d_st.gg_bufs = words(3)
|
||||
render3d_st.gg_texs = words(2); render3d_st.gg_pr = words(48)
|
||||
render3d_st.gg_texs = words(3); render3d_st.gg_pr = words(48)
|
||||
}
|
||||
let rb = render3d_st.gg_rb
|
||||
rb[0] = GG_BANDS; rb[1] = 0; rb[2] = 0; rb[3] = 0
|
||||
|
|
@ -120,7 +120,7 @@ function gg_cull_frame(render3d_st: mut Render3dState) -> void {
|
|||
let bufs = render3d_st.gg_bufs
|
||||
bufs[0] = tb; bufs[1] = render3d_st.gg_out; bufs[2] = render3d_st.gg_cmds
|
||||
let texs = render3d_st.gg_texs
|
||||
texs[0] = render3d_st.ter_height_tex; texs[1] = render3d_st.ter_ortho_tex
|
||||
texs[0] = render3d_st.ter_height_tex; texs[1] = render3d_st.ter_ortho_tex; texs[2] = render3d_st.ter_normal_tex
|
||||
gpu_dispatch_tex(render3d_st, render3d_st.gg_cull, data_of(pr), 192, bufs, texs, (render3d_st.gg_max + 63) / 64, render3d_st.gg_n)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue