Repository navigation
window: offscreen captures keep the requested size under an OS clamp - #5186
Conversation
In offscreen mode the window, not the OS, owns the surface size. IRGLFWWindow records the requested extent in window points and the framebuffer/window ratio measured once at creation; getWindowSize and getFramebufferSize return the extent and extent x ratio, so a request Windows clamps to the desktop work area (2560x1440 -> 2560x1421) still renders and captures at the requested size, and a 1280x720-point macOS request stays a 2560x1440 retina target. - IRWindow::setWindowSize(points) is the resize API. Offscreen, it fires the backend's framebuffer-size callback synchronously; the hidden OS window's framebuffer events never reach that callback. shape_debug's --framebuffer-size fixture moves to it from raw glfwSetWindowSize. - The GL offscreen target exits non-zero naming the size and the limit when a request exceeds GL_MAX_TEXTURE_SIZE, GL_MAX_FRAMEBUFFER_* or GL_MAX_VIEWPORT_DIMS, instead of handing back a smaller frame. - Presented modes keep the OS surface and WARN with both sizes when the OS gave less than the request (fullscreen exempt). Closes #4852 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jakildev
left a comment
There was a problem hiding this comment.
Review — window: offscreen captures keep the requested size under an OS clamp
Verdict: approve
The window-owned offscreen extent, one-time backing-scale measurement, callback gating, and explicit OpenGL limit failure form a coherent implementation of the plan without changing presented-mode sizing.
Acceptance (issue #4852)
5 of 5 criteria met. The Windows evidence distinguishes the requested-size path, presented clamp warning, and over-limit failure from master; the scale/resize suite includes a mutation control; render-verify rows match their same-session controls; and the native 2560×1440 #4813 follow-up recorded its two non-zero sub-pixel readings as the non-blocking renderer finding the plan anticipated.
Praise
OpenGLRenderDevice::exitIfBeyondTargetLimitskeeps the release-build failure path explicit and emits the complete diagnostic before_Exit, while checking every allocation/raster limit named by the plan.- The real-window tests cover both offscreen callback isolation and presented callback registration, not only the pure scale helpers.
Checked
- Reviewed head
ac7c4649d0c16a6c434c954b309047d0cebc923b, the complete PR/issue thread, all changed files, and the Metal resize counterpart. fleet-jobs wait --timeout 540 20261118T072445Z-build-1458ca:fleet-jobs: 20261118T072445Z-build-1458ca succeeded exit=0forIrredenEngineTeston macOS.fleet-run IrredenEngineTest '--gtest_filter=WindowMode*:WindowFramebufferScale*:WindowOffscreenSurface*': 12 tests passed, none skipped.git diff --check origin/master...HEAD: clean. Live overlap audit found only clean shared-file merges; #4921's conflict is inherited from master.- Current CI has format, header, comment, whitespace, closes, instruction, and fleet gates passing. Linux build, perf gate, and aggregate status remain pending and are not claimed green here.
🤖 Reviewed by Codex GPT-5 (runtime: codex; review-pr skill)
Opus recheck not required (reviewed at opus class).
|
Cross-host smoke OK on macos (fresh checkout + IRShapeDebug --auto-screenshot 10 — build clean, exit 0, no log warnings). |
Perf gateHead host slug: perf comparison: b309c9f → daedb4e-cibaseline: host calibration
thresholds: regress ≥ 10%, improve ≥ 5% voxel cull effectiveness
frame timing (ms)
GPU frame timing (ms; separate from stage samples)
GPU stage timing (avg ms per sampled invocation)
top CPU systems by avg ms (head)
|
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
221.593 → 219.033 (-1.2%) |
| RENDER | ComputeLightVolume |
26.250 → 26.396 (+0.6%) |
| RENDER | CanvasToFramebuffer |
14.773 → 14.662 (-0.8%) |
| RENDER | ComputeSunShadow |
13.119 → 12.793 (-2.5%) |
| UPDATE | FogRevealEval |
8.618 → 8.908 (+3.4%) |
| RENDER | BakeSunShadowMap |
6.145 → 6.100 (-0.7%) |
| UPDATE | PropagateTransform |
3.668 → 3.797 (+3.5%) |
| RENDER | UpdateVoxelSetChildren |
3.194 → 2.951 (-7.6%) ↓ |
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
729.250 → 723.129 (-0.8%) |
| RENDER | ComputeSunShadow |
26.492 → 25.985 (-1.9%) |
| RENDER | ComputeLightVolume |
22.641 → 22.371 (-1.2%) |
| RENDER | CanvasToFramebuffer |
14.167 → 13.772 (-2.8%) |
| UPDATE | FogRevealEval |
7.354 → 8.066 (+9.7%) |
| RENDER | ComputeVoxelAO |
6.886 → 6.905 (+0.3%) |
| RENDER | BakeSunShadowMap |
5.002 → 5.196 (+3.9%) |
| RENDER | LightingToTrixel |
5.192 → 5.092 (-1.9%) |
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
235.817 → 237.522 (+0.7%) |
| RENDER | ComputeSunShadow |
34.222 → 35.841 (+4.7%) |
| RENDER | ComputeLightVolume |
23.624 → 24.191 (+2.4%) |
| RENDER | LightingToTrixel |
18.734 → 19.224 (+2.6%) |
| RENDER | CanvasToFramebuffer |
14.799 → 14.957 (+1.1%) |
| RENDER | BakeSunShadowMap |
8.113 → 8.308 (+2.4%) |
| UPDATE | FogRevealEval |
7.265 → 7.260 (-0.1%) |
| UPDATE | PropagateTransform |
4.769 → 5.924 (+24.2%) ⚠ |
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1101.999 → 1098.691 (-0.3%) |
| RENDER | ComputeSunShadow |
34.622 → 35.071 (+1.3%) |
| RENDER | ComputeLightVolume |
24.498 → 25.321 (+3.4%) |
| RENDER | CanvasToFramebuffer |
13.496 → 13.492 (-0.0%) |
| UPDATE | FogRevealEval |
7.735 → 7.955 (+2.8%) |
| RENDER | ComputeVoxelAO |
5.662 → 5.675 (+0.2%) |
| RENDER | BakeSunShadowMap |
5.175 → 5.162 (-0.3%) |
| UPDATE | PropagateTransform |
4.747 → 4.876 (+2.7%) |
Summary
In
offscreenmode the engine now owns the capture size.IRGLFWWindowkeeps the requested extent and a framebuffer/window ratio it measures at creation, so a Windows/OpenGL capture whose request exceeds the desktop work area renders at the requested size instead of the OS-clamped one (2560×1440, not 2560×1421).IRWindow::setWindowSizeis the resize path; inoffscreenit resizes the screen target synchronously. A GL target beyond the driver limits ends the run non-zero, and a presented mode the OS clamped logs a WARN naming both sizes.Screenshots
No visual change at master's configs: render-verify on IRShapeDebug and IRCanvasStress shows the same pass/fail rows as a same-session master control (table below).
Acceptance evidence
fleet-run IRCanvasStress --config-preset <init_window 2560×1440, game 1280×720> --auto-screenshot 10The OS clamped the hidden window to 2560x1421; the offscreen surface keeps the requested 2560x1440., thenOpenGL offscreen screen target attached (2560x1440).12/12 PNGs have IHDR 2560×1440.RESULT=CLEAN44955ae9fscreen target attached (2560x1421), 12/12 PNGs 2560×1421--window-mode hidden[warning] Requested a 2560x1440 window but the OS gave 2560x1421; …. 12/12 PNGs 2560×1421.RESULT=CLEANinit_window_width = 40000FATAL: OpenGL offscreen screen target 40000x1440 exceeds the GL limit 32768x32768 (GL_MAX_TEXTURE_SIZE 32768, GL_MAX_FRAMEBUFFER_WIDTH/HEIGHT 32768x32768, GL_MAX_VIEWPORT_DIMS 32768x32768). …RESULT=CLEAN,screen target attached (7684x1421), 12 PNGs 7684×1421fleet-run IrredenEngineTest --gtest_filter='WindowMode*:WindowFramebufferScale*:WindowOffscreenSurface*'[ PASSED ] 12 tests., none skippedgetFramebufferSizereturnsglfwGetFramebufferSize(master's behaviour)ExtentIsTheRequestNotTheOsWindowFAILED (1421 vs 4000);SetWindowSizeResizesSynchronouslyFAILEDpython3 scripts/render-verify.py --target IRShapeDebug, PR vs master24 of 103 checks FAIL (83 skipped — references pending); the 24 failing rows are the same set (zoom4_yaw180/yaw270/yaw45_inter_cardinal,zoom8_yaw180,zoom4_pan16_yaw180/yaw45_pivotacross the default,glitch_standard_off,glitch_subject_standard_offandpost_effects_standard_offpasses);text_scale1_legibilityPASS on bothpython3 scripts/render-verify.py --target IRCanvasStress, PR vs master8 of 31 checks FAIL (28 skipped): the same 8 rows (so3_*×5,revoxelize_solids,compare_yaw0,compare_yaw_q) with identical max_delta / match%--framebuffer-sizefixture under offscreenfleet-run IRShapeDebug --config-preset configs/gui_text_scale1.lua --framebuffer-size 1280 960 --text-size-sample --auto-screenshot 10OpenGL offscreen screen target attached (640x480), thenFramebuffer fixture size: 1280x960 (window 1280x960).RESULT=CLEANcap.py/grade.pywith a 2560×1440 window, upscale path removed (a non-2560×1440 frame is an error), fog16, opt-in onsubpos-yaw0.6andsubneg-yaw0.621/26/0 (Metal 0/0/0). Every frame is 2560×1440,fog=compose fogComposed=1,RESULT=CLEAN--sun-ambient 0.15subpos/subneg21/26/0Reviewer notes
Plan departures
d72f88820and parked on a full host disk. This PR rebases it onto44955ae9f. Two conflicts:ir_glfw_window.hpp(master addedCloseGuard m_closeGuard;beside the newmeasureSurface()declaration; both kept) andengine/window/CLAUDE.md(master reworded the Metal pacing sentence; the new offscreen-size paragraph follows it).--sun-ambient 0.15. The0.55and local-light palettes were not run: GPU-lock contention on the host stretched single captures past an hour. The criterion asks for the fog-composed arms of the 10 placements; the default palette is that set.Notes for reviewer
44955ae9f. The branch was then rebased onto18a91f694; none of the commits in between read the window or framebuffer size. At the new head the build is clean, the criterion 3 suite passes again (12/12), criterion 1 holds (2560x1440, 12/12 PNGs), and the--framebuffer-sizefixture row was captured there.RESULT=LOCK-FAILEDunder GPU-lock contention, so they were re-run withIR_QUEUE_TIMEOUT=6600.subpos/subnegreading is a renderer finding, not a sizing one. Eligible/inside/outside/boundary counts equal Metal's exactly, and both sub-pixel signs give the same 21 missing / 26 excess, so 47 receiver samples shade differently on GL under a sub-pixel camera residual. Posted on render: run the fog-composing surface-lighting programs on Windows/OpenGL #4813 per the plan; it does not block this PR.fwriteto stdout, then_Exit.IR_ASSERTdrops its condition underIR_RELEASE, and the logger macros compile out there._Exitskips static destruction because a resize can arrive with the world alive.getFramebufferSize; the measured ratio keeps a 1280×720-point macOS request at 2560×1440. Not run on macOS here.fleet-pr-overlap --base master:VERDICT: overlap. Every trial merge is clean except#4921 creations/demos/shape_debug/main.cpp base-conflict(render: configure LOD zoom thresholds and hysteresis per camera #4921 already conflicts with master18a91f694alone). input: deliver files dropped on the window to creations #5172 (window file drop) sharesir_glfw_window.{hpp,cpp}andengine/window/CLAUDE.mdbut adds a drop callback, nothing size-related. Clean rows on shared files: render: prototype event-cursor picks from completed images #5135shape_debug/main.cpp; render: bound Metal frame overlap and pace input [WIP] #5161, render: add a composite draw witness and attribute the gl query cost #5183opengl_render_impl.cpp; render: configure LOD zoom thresholds and hysteresis per camera #4921, engine/voxel: gate set pose writes on stored bounds or current transform #5081, render/metal: draw consecutive draws to one target in one render pass (#4994) #5100, render: bound Metal frame overlap and pace input [WIP] #5161, editor: grade face_pick's spatial rows on the depth-tested owner #5164, input: deliver files dropped on the window to creations #5172test/CMakeLists.txt.clang-formatis not installed on this host; CI's format-check is the gate.Closes #4852
🤖 Generated with Claude Code