Skip to content

Usability Improvements, Scaling Filters, and Memory Leak Fix#15

Open
CobaltDelta wants to merge 5 commits into
SaltedByte:mainfrom
CobaltDelta:main
Open

Usability Improvements, Scaling Filters, and Memory Leak Fix#15
CobaltDelta wants to merge 5 commits into
SaltedByte:mainfrom
CobaltDelta:main

Conversation

@CobaltDelta

Copy link
Copy Markdown

See individual commit messages for details.

This is a grab bag of tweaks and improvements. Of note:

  • Automatic cursor hiding
  • Keep display awake while in use
  • Replace the unbounded crossbeam channel with a fixed triple-buffer approach.
  • Upscaling filters (Bilinear, Bicubic, Lanczos) and integration into the wgsl fragment shader.

- build.rs now embeds the .ico into a .rc manifest
- create_window now retrieves the .ico from the exe
- the mouse cursor is hidden whenever idle for 3 seconds, unless the menu is opened
- when the window is in focus or fullscreened, ES_DISPLAY_REQUIRED is passed to
  SetThreadExecutionState to prevent display sleeping
- added a panic hook to logger to capture fatal panic information
- cargo clippy/fmt applied
Updates the wgsl shader to apply bilinear, bicubic, or lanczos filtering to the frame.
Routed through a new settings field and an enumeration.
  Replace the unbounded crossbeam channel between the capture thread and
  the render loop with a lock-free SPSC triple buffer. The unbounded
  channel allowed multi-MB frames to accumulate without bound when the
  event loop was slower than the capture rate.

  Changes:
  - Add src/triple_buffer.rs: lock-free SPSC triple buffer
  - Replace unbounded frame channel with triple buffer (3 frames max)
  - Event-driven redraws via EventLoopProxy instead of spin loop
  - Add decode_into() for zero-alloc readback via triple buffer recycling
  - Refactor dx12_interop handle lifecycle: split ephemeral NT handles
    (ImportHandleSet with Drop) from long-lived layout metadata
    (SharedBufferLayout), making handle leaks impossible by construction
  - Adaptive Lanczos shader: 2-lobe at <=2x upscale, 3-lobe at >2x;
    bypass custom filters when downscaling (ratio <= 1)
  - Fix redundant uniform write (format_mode only, not full struct)
  - Remove unnecessary Clone on CaptureSource (was forcing the handles
    into a Clone-requiring struct)
When the window is minimized or occluded, do not submit a frame to the renderer at all - consume it from the triple-buffer but discard the result. On any soft wgpu SurfaceErrors, flush any pending frames using an empty submit()

This prevents the SurfaceError::OOM panic that can occur if the display goes to sleep during a capture.
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.

1 participant