Skip to content

Refactor: Move rendering to sc_screen and introduce sc_texture - #6651

Merged
rom1v merged 10 commits into
devfrom
sc-texture
Feb 9, 2026
Merged

rom1v merged 10 commits into
devfrom
sc-texture

Conversation

@rom1v

@rom1v rom1v commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

Three components are involved in displaying device content on screen:

  • a window
  • a renderer
  • a texture

Originally, all three were handled by sc_screen.

Commit 051b74c later extracted the renderer and texture into a separate component, sc_display.

However, the split was a bit awkward because the window size and rendering location were managed by separate components.

Move rendering back to sc_screen, keeping only texture management separated in sc_texture.

BEFORE:

            / +----------+
 sc_screen |  |  window  |
            \ +----------+
            / +----------+
           |  | renderer |
sc_display |  +----------+
           |  | texture  |
            \ +----------+

AFTER:

            / +----------+
           |  |  window  |
 sc_screen |  +----------+
           |  | renderer |
            \ +----------+
            / +----------+
sc_texture |  | texture  |
            \ +----------+

rom1v added 10 commits February 9, 2026 18:33
When the scrcpy window is minimized on Windows with D3D9, texture
creation and updates fail.

As a workaround, a mechanism was implemented to reattempt applying the
requested changes.

Since SDL3 defaults to the D3D11 backend, remove this workaround,
which adds a lot of complexity for a backend that should almost never
be used.

However, do not close scrcpy when texture creation or updates fail; only
that specific rendering should fail.

Refs SDL/#7651 <libsdl-org/SDL#7651>
Refs #3947 <#3947>
Refs 6298ef0
PR #6651 <#6651>
Make sc_screen the owner of both the SDL window and the SDL renderer.
This is the first step toward limiting the role of sc_display to texture
management.

PR #6651 <#6651>
Three components are involved in displaying device content on screen:
 - a window
 - a renderer
 - a texture

Originally, all three were handled by sc_screen.

Commit 051b74c later extracted the
renderer and texture into a separate component, sc_display.

However, the split was a bit awkward because the window size and
rendering location were managed by separate components.

Move rendering back to sc_screen, keeping only texture management
separated.

PR #6651 <#6651>
The coordinates of the content to render depend on the render output
size, not the window size in pixels. In theory, the two could differ.

PR #6651 <#6651>
Replace SDL "logical rendering" with explicit computation of icon
location, and unify rendering of video frames and icons using the same
common code.

PR #6651 <#6651>
In SDL3, texture rendering uses SDL_FRect, unlike SDL2 which used
SDL_Rect.

Compute content location using floating-point coordinates from the
start.

PR #6651 <#6651>
Add a function to set a texture from a surface on a sc_display.

PR #6651 <#6651>
Add a function to set a texture from an AVFrame on a sc_display.

PR #6651 <#6651>
The sc_display component now only handles a texture. Rendering has been
moved to sc_screen.

PR #6651 <#6651>
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