Skip to content

Simulator: supersampled render scale for high-res captures - #106

Merged
GLinnik21 merged 1 commit into
mainfrom
sim-render-scale
Sep 17, 2026
Merged

GLinnik21 merged 1 commit into
mainfrom
sim-render-scale

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

PLXNATIVE_RENDER_SCALE=<1..4> (hostsim only) renders each frame into an offscreen N×1920 × N×1080 framebuffer, shown downscaled in the window, so a screenshot is a true N× render regardless of display size. Used for the 5760×3240 masters behind the landing page's glass close-up.

  • Text rasterises a second glyph texture at N× and draws it at 1/N; layout still measures the logical texture
  • gfx::snap snaps to whole physical pixels; icon masks rasterise at N×
  • Poster/backdrop requests ask PMS for N× pixels; decode limits and texture byte ceilings scale by N²
  • Backdrop blur keeps the television's authored source resolution (divisor 4N), so the glass matches a 1× frame (mean abs diff ~1/255 over the tab track)
  • The AA ramp is narrowed to one physical pixel by a hostsim-only shader rewrite; TV shader sources are untouched
  • Pointer events map through the window, not the offscreen viewport; the dev FPS counter is not drawn into a supersampled frame
  • PLXNATIVE_SHOT_ALPHA=1 writes the premultiplied RGBA framebuffer

TV builds: every return to the screen binds surface::default_fb(), which is a constant 0 on the television.

Verification

  • make check: host suite green on both feature sets (3386 and 3426 passed, 0 failed). ci/check-deps.sh fails on libm/threads lines in test files this PR doesn't touch; the same failure is already on main.
  • cargo +nightly check --no-default-features: green
  • make (ARM cross-build): green

🤖 Generated with Claude Code

https://claude.ai/code/session_01BjPget8zRrfPT7i1f11bEt

PLXNATIVE_RENDER_SCALE=<1..4> (hostsim only) renders each frame into an
offscreen N*1920 x N*1080 framebuffer, shown downscaled in the window, so a
shot is a true Nx render regardless of the display size. Every return to the
screen binds surface::default_fb() instead of a literal 0 (a constant 0 on the
television). To keep the result crisp rather than an upscale:

- text rasterises a second glyph texture at N*sz and draws it at 1/N, while
  layout keeps measuring the logical texture; font slots and the glyph cache
  grow in hostsim builds
- gfx::snap snaps to whole physical pixels; icon masks rasterise at Nx
- poster/backdrop requests ask PMS for Nx pixels; the decode limits and the
  texture/render byte ceilings scale by N^2
- the backdrop blur renders its source at the same authored resolution as a
  television (divisor 4N) and widens capture-path taps by N, so the glass
  matches a 1x frame (mean abs diff ~1/255 over the tab track)
- the coverage AA ramp smoothstep(-1,1,d) is narrowed to one physical pixel
  by a hostsim-only rewrite at shader compile; TV shader sources untouched
- pointer events map through the window, not the offscreen viewport
- the dev FPS counter is not drawn into a supersampled frame
- PLXNATIVE_SHOT_ALPHA=1 writes the premultiplied RGBA framebuffer

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01BjPget8zRrfPT7i1f11bEt
Copilot AI lite review requested due to automatic review settings September 17, 2026 00:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Supersampled blur, memory accounting, decode limits, and live capture behavior contain unresolved correctness or resource-management issues.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds hostsim-only supersampled rendering for high-resolution screenshots while preserving logical 1920×1080 layout.

Changes:

  • Adds offscreen framebuffer rendering, pointer mapping, and downscaled presentation.
  • Scales text, icons, artwork requests, blur parameters, and memory limits.
  • Adds optional premultiplied RGBA screenshot output.
File summaries
File Description
rust-modules/src/surface.rs Supersampled framebuffer and coordinate mapping
rust-modules/src/gfx.rs Scaling, blur, and framebuffer integration
rust-modules/src/text.rs High-resolution text textures and caches
rust-modules/src/ui/icons.rs Scaled icon rasterization
rust-modules/src/ui/tex.rs Scaled texture budget
rust-modules/src/ui/frame/render_set.rs Scaled render budget
rust-modules/src/img.rs Supersampled decode limits
rust-modules/src/shot.rs Optional RGBA screenshots
rust-modules/src/app/run.rs Presentation and FPS-counter integration
rust-modules/src/app/adapters/poster.rs Scaled PMS image requests
Makefile Simulator usage documentation
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread rust-modules/src/gfx.rs
// look at quarter resolution have to shrink in proportion at any finer divisor. Without
// this a scale sweep changes two variables at once and measures neither.
let tap_k = 4.0 / scale as f32;
let tap_k = 4.0 * crate::surface::render_scale() as f32 / scale as f32;
Comment thread rust-modules/src/img.rs
Comment on lines +63 to +66
if crate::surface::render_scale() > 1 {
l.max_image_width = Some(16384);
l.max_image_height = Some(16384);
l.max_alloc = Some(512 * 1024 * 1024);
a.store(v, Ordering::Relaxed);
}
WIN_SCALE_BITS.store(scale().to_bits(), Ordering::Relaxed);
SS_FBO.store(f, Ordering::Relaxed);
}
let total = self.total_bytes();
if total > RENDER_BYTES_MAX {
if total > RENDER_BYTES_MAX * crate::ui::tex::render_area() {
@GLinnik21
GLinnik21 merged commit 0d3fe88 into main Sep 17, 2026
5 of 6 checks passed
@GLinnik21
GLinnik21 deleted the sim-render-scale branch September 17, 2026 00:46
GLinnik21 added a commit that referenced this pull request Sep 17, 2026
Brings in #106 (supersampled simulator render scale) and the rewritten
beginner install guide. The one conflict, docs/install-and-verify.md, keeps
main's new guide and carries this branch's sandbox/ACG paragraph (the
storage helper's database.operation and securitykey.operation) under the
rooted-vs-Developer-Mode section.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01W3rkPgGB7xpjGgcPbfakaF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants