Skip to content

[macOS] Subsequent SDL_CreateTexture() calls have inconsistent behavior #13271

Open
@TBCJames

Description

@TBCJames

Description

On macOS, when using scrcpy, if the Android device screen is rotated (e.g., portrait to landscape) or the scrcpy window is resized/redrawn, the displayed video suffers from color distortion (reduced color gamut, washed-out colors, incorrect contrast).

This issue seems related to how SDL handles YV12 textures after SDL_CreateTexture() is called multiple times (especially after screen rotation). The first texture renders correctly, but subsequent textures (after rotation) have incorrect colors.

SDL Version

SDL 2.32.8 (from scrcpy -v output)

Platform

macOS 15 (also occurs on 26)

Steps to Reproduce

  1. Start scrcpy (scrcpy command).
  2. Observe that the video initially renders correctly.
  3. Rotate the Android device screen.
  4. The video's color gamut / color distortion reduced
  5. Rotate again and the video keeps low color gamut.
  6. Compare with the initial video effect (left):

Image

Expected Behavior

All textures (including those created after rotation/redraw) should render with correct colors and full color gamut.

Actual Behavior

Subsequent textures (after rotation) have incorrect colors, as if the YV12 texture is not being handled correctly by SDL on macOS.

Related Code

The issue may be related to this code in scrcpy:
https://github.com/Genymobile/scrcpy/blob/0ba9d35/app/src/display.c#L130-L132

SDL_Texture *texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12,
                                         SDL_TEXTUREACCESS_STREAMING,
                                         size.width, size.height);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions