fix(render3d): the overlay draws into the screen, and R3D_GLCHECK says what GL did
The overlay flushed into whatever framebuffer was bound last, which raised GL error 1286 on every run: ov_flush now binds the screen and its viewport before it draws. R3D_GLCHECK=1 checks each draw, clear, blit, upload and attachment for a pending error or an incomplete framebuffer and names the target, and each sampler bind for a texture with no image or a mipmap filter without mipmaps. Off, it costs one flag test. Still open: an intermittent 1286 reported at "terrain shadow bake" after the self-tests (about half the runs), and one macOS "unloadable" texture warning at shutdown while the post targets are freed. No frame samples a bad texture. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
51d82063aa
commit
447acc11bd
2 changed files with 69 additions and 6 deletions
|
|
@ -189,6 +189,12 @@ function ov_close_range() -> void {
|
|||
function ov_flush() -> void {
|
||||
ov_close_range()
|
||||
if ov_n == 0 { ov_nr = 0; ov_range_start = 0; return }
|
||||
# The overlay draws onto the screen, whatever was bound since ov_begin: a render-scale change
|
||||
# rebuilds the scene targets mid-frame and leaves framebuffer 0 bound, and on a headless run
|
||||
# (where the screen is an offscreen framebuffer) every overlay draw after it was an invalid
|
||||
# framebuffer operation. Saying the target at each flush is what a render pass says anyway.
|
||||
gpu_fb_bind(gpu_screen_fb())
|
||||
gpu_viewport(0, 0, gl_w, gl_h)
|
||||
gl_use_program(ov_prog)
|
||||
gpu_mesh_bind(ov_mesh)
|
||||
gpu_buffer_upload(ov_vbo, gl_bytes_of(ov_n * 6 * OV_FLOATS), ov_buf, GPU_STREAM)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue