You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
libobs: GS_FLIP_U draws a texture upside down instead of mirrored (PipeWire flipped capture) #2124
gs_draw_sprite() and gs_draw_quadf() with GS_FLIP_U draw a 2D texture upside down instead of mirroring it left to right.
Since upstream 7b8b51b ("libobs/graphics: Improve sprite drawing perf"), a 2D texture is drawn from one of two static vertex buffers: plain or flipped on v. The choice is flip ? flipped_sprite_buffer : sprite_buffer, so any flip bit selects the v-flipped buffer.
GS_FLIP_V draws correctly.
GS_FLIP_U alone draws flipped on v (upside down) and not on u.
GS_FLIP_U | GS_FLIP_V draws flipped on v only.
Before that commit, the sprite was built per draw and each axis followed its own bit. Rectangle textures and partial subregions still do that, so the same flip draws differently depending on the texture type and the crop.
Who sees it: PipeWire screen and window capture (plugins/linux-pipewire). For a stream with the Flipped or Flipped180 transform, get_buffer_flip() passes GS_FLIP_U.
With no effective crop, the capture is drawn upside down instead of mirrored.
With a crop, gs_draw_sprite_subregion() builds the sprite per draw, and it is correct.
A full-size subregion takes the gs_draw_sprite() shortcut, so it is wrong too.
Upstream has the same code.
Plan
RED: a real-libobs render test that draws a 2D texture with distinct corner colours through gs_draw_sprite() with each of the four flip values, plus a full-size and a partial gs_draw_sprite_subregion(). It reads back the corners. Update the pinned rows in test_sprite_geometry_steps and the Rust quad_flipped_buffer tests, marked for maintainer sign-off.
GREEN: pick the static buffer by both bits (plain, u, v, uv), so each axis follows its own bit again. The plain and GS_FLIP_V draws stay exactly as they are; only GS_FLIP_U and GS_FLIP_U | GS_FLIP_V change, back to what they drew before 7b8b51b.
Decision needed: may this fix change the pinned rows of the existing C test test/cmocka/test_sprite_geometry_steps.c (from #2107, marked "characterized, not endorsed")? AGENTS.md says never to edit existing C tests to make a port pass. Recommendation: yes for a deliberate fix of upstream behavior, if (1) only the not-endorsed rows change and the PR lists each one, (2) a new render test proves the corrected output on its own, and (3) the C oracle copy stays upstream's, with the differential test recording the divergence as intended.
Yes from our side, with your three conditions. Those rows were pinned only to make the port exact ("characterized, not endorsed"), and the plan above already called for changing them with a sign-off note. The rows that should change are only the GS_FLIP_U and GS_FLIP_U | GS_FLIP_V cases of the flipped-buffer choice (and anything derived from it). The plain and GS_FLIP_V rows, the rectangle-texture rows and the subregion rows should stay exactly as they are.
Decided: yes, the fix may change those rows, under zackees's three conditions and rdoupe's scope.
AGENTS.md forbids editing C tests to make a port pass. That isn't what this is. test_sprite_geometry_steps.c is our own characterization test from #2107, not an upstream test, and its rows say "characterized, not endorsed". This is a deliberate fix of an upstream bug, like the ones under Fixed upstream bugs in docs/features.md.
The conditions:
Change only the GS_FLIP_U and GS_FLIP_U | GS_FLIP_V flipped-buffer rows and anything derived from them, and list each one in the PR. The plain, GS_FLIP_V, rectangle-texture and subregion rows stay as they are.
The new render test proves the corrected corners on its own: RED before the fix, GREEN after.
The C oracle stays upstream's code, and the differential test records the divergence as intended.
Also add the features-ledger line under Fixed upstream bugs. (Coordinator decision.)
Decision needed: #2135 fixes this, but it edits an existing C test, test/cmocka/test_sprite_geometry_steps.c. That test pinned the upstream "any flip bit selects the v-flipped buffer" behaviour ("characterized, not endorsed"). AGENTS.md says never edit existing C tests to make a port pass. Here the edit records a deliberate upstream-bug fix, not a port, and the issue's plan asked for it. I've turned auto-merge off on #2135 until this is signed off.
Options:
Accept the edit (recommended): the pinned rows were characterization only, and the new test_sprite_flip_render checks real pixels.
Keep the old test unchanged: then the fix can't land, because the old test asserts the bug.
For the record: this was already settled earlier in this thread. The Decided: comment said yes to editing those pinned rows, under the three conditions and limited to the GS_FLIP_U and GS_FLIP_U | GS_FLIP_V flipped-buffer rows. As the issue author, option 1 is fine with us, as long as #2135 changes only those rows.
Decided: option 1. Accept the edit in #2135. This was already decided earlier in this thread; this records it again for the new question.
I checked #2135's diff to test_sprite_geometry_steps.c. The changed assertions are only the flipped-buffer choice, now quad_buffer, and new build cases for the FLIP_U and FLIP_U | FLIP_V buffers. The existing plain and v-flipped build rows are untouched. Each changed spot cites #2124. That is inside the agreed scope. I've turned auto-merge back on for #2135. (Coordinator decision.)
Activity
zackees commentedon Oct 24, 2026
Claiming: this issue. Following the plan above (four static buffers chosen by both bits).
zackees commentedon Oct 24, 2026
Decision needed: may this fix change the pinned rows of the existing C test
test/cmocka/test_sprite_geometry_steps.c(from #2107, marked "characterized, not endorsed")? AGENTS.md says never to edit existing C tests to make a port pass. Recommendation: yes for a deliberate fix of upstream behavior, if (1) only the not-endorsed rows change and the PR lists each one, (2) a new render test proves the corrected output on its own, and (3) the C oracle copy stays upstream's, with the differential test recording the divergence as intended.rdoupe commentedon Oct 24, 2026
Yes from our side, with your three conditions. Those rows were pinned only to make the port exact ("characterized, not endorsed"), and the plan above already called for changing them with a sign-off note. The rows that should change are only the
GS_FLIP_UandGS_FLIP_U | GS_FLIP_Vcases of the flipped-buffer choice (and anything derived from it). The plain andGS_FLIP_Vrows, the rectangle-texture rows and the subregion rows should stay exactly as they are.zackees commentedon Oct 24, 2026
Decided: yes, the fix may change those rows, under zackees's three conditions and rdoupe's scope.
AGENTS.md forbids editing C tests to make a port pass. That isn't what this is.
test_sprite_geometry_steps.cis our own characterization test from #2107, not an upstream test, and its rows say "characterized, not endorsed". This is a deliberate fix of an upstream bug, like the ones under Fixed upstream bugs indocs/features.md.The conditions:
GS_FLIP_UandGS_FLIP_U | GS_FLIP_Vflipped-buffer rows and anything derived from them, and list each one in the PR. The plain,GS_FLIP_V, rectangle-texture and subregion rows stay as they are.Also add the features-ledger line under Fixed upstream bugs. (Coordinator decision.)
zackees commentedon Oct 24, 2026
it appears that claim-blocked was not removed.
Coordinator please file an issue then admin merge correction to the rule to handle this
zackees commentedon Oct 24, 2026
Decision needed: #2135 fixes this, but it edits an existing C test,
test/cmocka/test_sprite_geometry_steps.c. That test pinned the upstream "any flip bit selects the v-flipped buffer" behaviour ("characterized, not endorsed"). AGENTS.md says never edit existing C tests to make a port pass. Here the edit records a deliberate upstream-bug fix, not a port, and the issue's plan asked for it. I've turned auto-merge off on #2135 until this is signed off.Options:
test_sprite_flip_renderchecks real pixels.rdoupe commentedon Oct 24, 2026
For the record: this was already settled earlier in this thread. The
Decided:comment said yes to editing those pinned rows, under the three conditions and limited to theGS_FLIP_UandGS_FLIP_U | GS_FLIP_Vflipped-buffer rows. As the issue author, option 1 is fine with us, as long as #2135 changes only those rows.zackees commentedon Oct 24, 2026
Decided: option 1. Accept the edit in #2135. This was already decided earlier in this thread; this records it again for the new question.
I checked #2135's diff to
test_sprite_geometry_steps.c. The changed assertions are only the flipped-buffer choice, nowquad_buffer, and new build cases for theFLIP_UandFLIP_U | FLIP_Vbuffers. The existing plain and v-flipped build rows are untouched. Each changed spot cites #2124. That is inside the agreed scope. I've turned auto-merge back on for #2135. (Coordinator decision.)Keep upstream's sprite buffer for unknown flip bits; oracle keeps ups…
test_sprite_flip_render: wait for a settled device instead of one war…
RED: GS_FLIP_U must mirror a 2D sprite, not flip it on v (#2124)
GREEN: pick the static sprite buffer by both flip bits (#2124)
Keep upstream's sprite buffer for unknown flip bits; oracle keeps ups…
test_sprite_flip_render: wait for a settled device instead of one war…
RED: GS_FLIP_U must mirror a 2D sprite, not flip it on v (#2124)
GREEN: pick the static sprite buffer by both flip bits (#2124)
Keep upstream's sprite buffer for unknown flip bits; oracle keeps ups…
test_sprite_flip_render: wait for a settled device instead of one war…
libobs: GS_FLIP_U mirrors a sprite instead of drawing it upside down (o…