Repository navigation
obs-graphics: Port the sprite and texture upload geometry - #2107
Merged
Merged
Conversation
…ite.c Behaviour-neutral extraction before the Rust port, with one exception below. The geometry and the decisions of graphics.c.h move to libobs/graphics/graphics-sprite.c.h as eleven functions on values, declared in the new libobs/graphics/graphics-sprite.h without EXPORT (hidden, as -fvisibility=hidden keeps them): - gs_sprite_build(): build_sprite(), the four points of a cx by cy sprite (z and the padding lane 0) and their texture coordinates in triangle-strip order, written to the arrays the caller passes; - gs_sprite_uv_norm(), gs_sprite_uv_rect() and gs_sprite_uv_subregion(): the coordinates of build_sprite_norm() (0 to 1), build_sprite_rect() (texels) and build_subsprite_norm() (a subregion, one float division each), every axis swapped by its own GS_FLIP_U/GS_FLIP_V bit, other bits ignored; assign_sprite_uv() and assign_sprite_rect() become static helpers of the new file; - gs_sprite_subregion_is_whole(): the "whole texture" shortcut of gs_draw_sprite_subregion(); - gs_sprite_quad_refusal(), gs_sprite_quad_texture_size() and gs_sprite_quad_flipped_buffer(): gs_draw_quadf()'s two refusals (a texture that is not 2D; no texture and a size of 0), the axis that takes the texture's size (a size of 0 or -0.0), and the static buffer a flip draws (the one flipped on v for any bit set); - gs_texture_upload_plan(): gs_texture_set_image()'s copy plan, the shorter line size per row and one of: row by row from the last source row ((height - 1) * linesize), one copy of row_copy * height bytes for equal line sizes, or row by row top down; - gs_texture_is_pow2() and gs_texture_mip_plan(): is_pow2() and gs_texture_create()'s mipmap rules (mipmaps with GS_BUILD_MIPMAPS or levels other than 1; a size that is not a power of two, else GS_RENDER_TARGET, clears GS_BUILD_MIPMAPS and sets 1 level, with its warning). gs_cubetexture_create() calls gs_texture_is_pow2() too; its own rules (they also drop the data of a render target) stay in it. graphics.c.h keeps the device calls in their order, the vertex buffers, the matrix stack, gs_texture_map()/gs_texture_unmap(), every memcpy, the log lines and gs_perspective(). Each texture getter is still called only where it was: gs_get_texture_type() only with a texture, the texture's width or height in gs_draw_quadf() only for an axis of size 0, and gs_texture_get_width()/_height() of a rectangle texture after gs_vertexbuffer_get_data(), as build_sprite_rect() did. graphics_init_sprite_vbs() builds its two static buffers with gs_sprite_build() and gs_sprite_uv_norm(0) and (GS_FLIP_V), the same bytes it wrote by hand. build_sprite_norm() had no caller since upstream 7b8b51b; that is where its coordinates are used now. The one change: with a flip and a height of 0, the copy plan is "nothing" (GS_TEXTURE_UPLOAD_NONE) before it computes the flipped start row. Before, gs_texture_set_image() computed data += (height - 1) * linesize, which wraps for a height of 0 and moved the source pointer outside its buffer (undefined behaviour) before its while loop found no row to copy. No row was copied then and none is now: the texture is still mapped and unmapped, and nothing observable changes. Checked in a scratch harness (not committed) that compiles origin/master's graphics.c.h code verbatim (the helpers, gs_draw_quadf(), gs_draw_sprite(), gs_draw_sprite_subregion(), gs_texture_set_image(), is_pow2() and gs_texture_create()) next to the new callers, over stub device calls that log every call with its arguments (floats as bits) and the vertex buffer contents at each flush: 3,000,000 random draws, subregions and texture creations (bit-pattern floats and sizes, any flip, NULL and non-2D and rectangle textures) give the same logs, and 2,833,585 random uploads give the same calls and the same bytes. The 166,415 flipped uploads with a height of 0, which the old code could not run defined, map, copy nothing and unmap. graphics.c.h checks at compile time that the header's GS_SPRITE_FLIP_U, GS_SPRITE_FLIP_V, GS_SPRITE_BUILD_MIPMAPS and GS_SPRITE_RENDER_TARGET are graphics.h's and that the three enums are int-sized (they cross the Rust port as int). The new file joins libobs.graphics with libobs.pch.h, which includes the new header. source-sets.json lists the header. docs/rust-port/naming.md names the units extracted from graphics.c.h under rust/obs-graphics. The exported symbol set is unchanged (1766); the eleven functions are local. Refs obs-rust#2082
test_sprite_geometry_steps compiles libobs/graphics/graphics-sprite.c.h
(ASan and UBSan, no graphics device) and calls only its hidden functions,
so it runs on every platform. Floats are compared by their bits (+0 and -0
differ); a NaN is only asked to be a NaN, since which NaN 0 / 0 gives is
the host's. 20 cases:
- gs_sprite_build(): every lane of both arrays written over a garbage
fill, the points with z and the padding lane 0, the coordinates in
triangle-strip order; -0.0, infinities, a NaN payload and a denormal
copied bit for bit;
- the coordinates for each flip value: 0, U, V, both, and with other bits
set (bit 2 alone, U with bit 2, V with bit 31, both with the high bits,
0xfffffffc, UINT32_MAX), normalized, in texels (1920x1080, 0x0, sizes
past 2^24 and UINT32_MAX, which round to the nearest float, ties to
even), and the two static sprite buffers graphics_init_sprite_vbs()
builds;
- subregions inside the texture (a quarter in from each side, and 1/3,
2/3 rounded), at its edges (the whole texture, 1-texel rows and columns
at each side, an empty region at the far corner), larger than it and
past it (coordinates above 1; x + cx is a float sum, so 2^24 + 1 is
2^24), and of a 0-size texture, on both axes and on one;
- the whole-texture shortcut: each field one off, the size swapped,
UINT32_MAX, and a 0x0 region of a 0x0 (NULL) texture;
- gs_draw_quadf()'s refusals over every pair of nine sizes (0, -0.0, +-1,
+-inf, NaN, a denormal, 1920) with and without a texture, 2D or not; the
axis that takes the texture's size; and the flipped static buffer for
every flip value;
- the upload plan for equal line sizes (one copy, 0 bytes for a height or
line size of 0, size_t arithmetic at UINT32_MAX), unequal ones either
way and with a line size of 0, flipped (from the last row, even for
equal line sizes), and a flip with a height of 0 (nothing);
- is_pow2() over every power of two and its neighbours, 0, 1 and
UINT32_MAX;
- the mipmap rules over ten sizes (powers of two, not, 1x1, 0x0, one axis
1 or 0) x levels 0, 1 and 5 x {none, GS_BUILD_MIPMAPS, GS_RENDER_TARGET,
both} x with and without other flags (GS_DYNAMIC, GS_SHARED_TEX), and
the same rules row by row (the size warning wins over the render
target's; every other bit, unknown ones too, is kept).
Characterized, not endorsed:
- a subregion of a 0-size texture divides by 0: +inf, and NaN for 0 / 0,
reach the vertex buffer (gs_draw_sprite_subregion() of a NULL texture
does this with whatever texture is bound); nothing clamps a subregion to
the texture;
- gs_draw_quadf() draws a texture that is not a rectangle texture with the
buffer flipped on v for any flip bit, so GS_FLIP_U alone draws it upside
down instead of mirrored, and GS_FLIP_U | GS_FLIP_V is not mirrored
(since upstream 7b8b51b, "Improve sprite drawing perf"; before it
build_sprite_norm() honoured each bit, and a subregion or a rectangle
texture still does);
- a NaN or negative size passes the refusals and draws;
- GS_BUILD_MIPMAPS with 1 level on a power-of-two texture is passed on as
it is;
- a 1x1 texture with levels 0 warns that it is not a power of two.
The expectations hold for origin/master's code too: the scratch harness
of the move commit runs origin/master's graphics.c.h functions verbatim
next to the moved ones and gets the same calls, vertex data and uploaded
bytes, apart from the flipped height-0 upload the old code could not run
defined.
It is in the native test graph, in the core suite (no display, so no
suite count to bump; suite sizes are not pinned since obs-rust#1997), with libm
outside MSVC. It includes only graphics/graphics-sprite.h.
Refs obs-rust#2082
RED for the port of libobs/graphics/graphics-sprite.c.h to a new sprite
module of rust/obs-graphics. The safe core is a stub (todo!()), one
function per hidden C function, reusing the crate's Vec2 and Vec3:
sprite(cx, cy, uv) -> ([Vec3; 4], [Vec2; 4]); sprite_uv(flip),
rect_uv(width, height, flip) and subsprite_uv(x, y, cx, cy, tex_cx,
tex_cy, flip) -> SpriteUv; subregion_is_whole(); quad_refusal() ->
QuadRefusal, quad_texture_size() and quad_flipped_buffer();
upload_plan(linesize, linesize_out, height, flip) -> UploadPlan {
row_copy, whole_size, src_offset, mode }; is_pow2(); and
texture_flags(width, height, flags, levels) -> MipPlan { flags, levels,
warning }; with FLIP_U, FLIP_V, BUILD_MIPMAPS and RENDER_TARGET.
tests/render/sprite.rs ports test_sprite_geometry_steps 1:1: its 20
cases under the same names (steps_*), in the same order, with the same
inputs and expectations, floats compared by their bits and an expected
NaN only asked to be a NaN.
Edge cases (edge_*) check the rules from their other side: a flip swaps
exactly its own axis and ignores every other bit (normalized, texel and
subregion coordinates, over any u32 flip), the subregion is one f32
division per edge, a subregion of the whole texture is the plain sprite,
the texel coordinates are the size, the points never depend on the
coordinates and every float is copied bit for bit, the refusals and the
texture-size and flipped-buffer rules over bit-pattern floats, the upload
plan against u128 arithmetic reduced to usize over full-range line sizes
and heights, is_pow2() against a bit count (every shift +-3 and a
proptest), and the mipmap plan over every flag set below 2^7 and a
proptest: every flag but GS_BUILD_MIPMAPS kept, a warning exactly when
mipmaps were asked for and refused, and its own output planning no change.
The proptests run 4000 cases each over bit patterns, never a wide f32
range.
soldr cargo test -p obs-graphics --test obs-tests-graphics -- render::sprite
fails 31 of 31 with "not yet implemented".
Refs obs-rust#2082
Ports libobs/graphics/graphics-sprite.c.h, the sprite and texture upload geometry of graphics.c, to the new sprite module of rust/obs-graphics. graphics.c stays C: the device calls in their order, the vertex buffers, the matrix stack, gs_texture_map()/gs_texture_unmap(), every memcpy, the log lines and gs_perspective(). The hybrid libobs drops the C file and links the Rust shims in its place. Safe core (src/sprite.rs), reusing the crate's Vec2 and Vec3: - sprite(): the four points, (0, 0), (cx, 0), (0, cy) and (cx, cy) with z and w 0 (Vec3::new, as vec3_set), and the coordinates in triangle-strip order; every float is copied, never computed on; - sprite_uv(), rect_uv() and subsprite_uv(): 0 to 1, 0 to the size in texels, or pos / size and (pos + len) / size, each axis swapped by its own FLIP_U/FLIP_V bit, other bits ignored. Sizes convert with u32 as f32 (round to nearest, ties to even, as C's (float)uint32_t), the sum is one f32 add and each edge one f32 division, so a size of 0 gives +inf or NaN as the C does; - subregion_is_whole(), quad_refusal() (a texture must be 2D; without one neither size may be 0), quad_texture_size() (size == 0.0, so -0.0 too) and quad_flipped_buffer() (any bit); - upload_plan(): row_copy the shorter line; a flip with a height of 0 is UploadMode::None first, else Flipped with src_offset (height - 1) * linesize, Whole with row_copy * height for equal line sizes, or Rows; every product is wrapping_mul on usize, as size_t wraps; - is_pow2() and texture_flags(): the mipmap rules, MipWarning::NotPow2 before RenderTarget, GS_BUILD_MIPMAPS cleared and 1 level with either, every other flag kept. The module denies clippy's arithmetic, indexing, unwrap, expect, panic, unimplemented and unreachable lints (the f32 arithmetic and the two lossless-or-C-rounding conversions are allowed where they are), keeps no state and calls nothing in libobs. Shims (src/ffi/sprite.rs): the eleven hidden functions keep the C signatures. struct gs_sprite_uv, struct gs_texture_upload_plan and struct gs_texture_mip_plan are mirrored #[repr(C)] and cross by value; the three enums cross as int (graphics.c checks they are int-sized); gs_sprite_build() writes the vertex buffer's struct vec3 and struct vec2 arrays (the crate's ffi vec3/vec2) and reads nothing through them. Intentional difference: a null points or uvs is not written through (the C writes through it); libobs always passes a vertex buffer's arrays. Kept, characterized, not endorsed (test_sprite_geometry_steps): a subregion of a 0-size texture divides by 0; nothing clamps a subregion to the texture; any flip bit, GS_FLIP_U alone included, draws a plain texture with the buffer flipped on v; a NaN or negative size draws; GS_BUILD_MIPMAPS with 1 level is passed on; a 1x1 texture warns that it is not a power of two. C side: the file leaves libobs.graphics for its own group, libobs.ported-sprite (LIBOBS_PORTED_SOURCES), whose PCH is only graphics/graphics-sprite.h (with stdbool.h, stddef.h, stdint.h, graphics/vec2.h and graphics/vec3.h); libobs.pch.h keeps the header for graphics.c. The functions are not EXPORT, so the shims are hidden: rust-hidden.txt, the local: list of rust-exports.map and rust-unexports-macos.txt, in a graphics/graphics-sprite.c section with the names in order. libobs-rust already links the crate's ffi. The exported symbol sets are unchanged and equal: 1766 on the C backend, the hybrid and libobs-c-reference; the eleven are local in all three, and the hybrid's come from the Rust archive. ci/test_ported_sources.py checks the group on every host and that graphics.c.h stays C. test_sprite_geometry_steps still compiles the C file into itself, unchanged. The new test_sprite_geometry_steps_rust builds the same test source against libobs_rust-static, as test_effect_parser_lifecycle_rust does: obs-graphics' archive members also hold the image file, texrender and effect parser shims, which call libobs exports (linked through OBS::libobs) and the private nsgif, obs-graphics and effect parser adapters (compiled into the test, as libobs does); graphics-sprite.c is not. The real-libobs tests (test_texture_render, test_image_size_precheck, the test_graphics_alias_* tests, test_shader_sampler_convert and every render test) see the swap through the hybrid. Tier 1 render::sprite passes 31/31. Refs obs-rust#2082
Oracle (oracle/graphics_sprite.c): the original graphics-sprite.c.h,
unmodified apart from the move commit's height-0 return, with its
functions renamed to oracle_*, plus the header's constants (the flags and
every enum value), the sizes and offsets of struct gs_sprite_uv, struct
gs_texture_upload_plan and struct gs_texture_mip_plan, and the sizes of
the three enums. The renames also rename the tags of the two plan structs
and enum gs_sprite_quad_refusal, which share their names with functions,
and the include is wrapped in -Wsign-conversion / C4245 pragmas as
oracle/platform.c is: gs_texture_mip_plan() clears GS_BUILD_MIPMAPS with
flags &= ~(int), as gs_texture_create() always did, and libobs builds
without that warning.
Tier 3 (tests/render/sprite_parity.rs, 13 tests). Every float is compared
by its bits, NaN included (both sides run the same IEEE operation on the
same host); gs_sprite_build() over every byte of both arrays from the same
fill; the plans field by field, the enums as the int the C returns. Runs:
- the constants, layouts and enum sizes against the Rust mirrors;
- every flip of the low 16 bits with four high halves (0, 0xffff0000,
bit 31, a pattern): 262,144 flips through the normalized and texel
coordinates and the flipped-buffer rule, and the first 256 of each
through six subregions (inside, whole, 1/3, a 0x0 texture, an empty
region, the u32 edges) and 28 texel sizes at the float and power-of-two
edges;
- every subregion of small textures (0..5 x {0, 1, 4}, positions and
sizes 0..6, both flips each way, and regions at (0, 0) one size off the
texture's on each axis);
- every flag set of the low 9 bits (every flag graphics.h defines and two
more), alone and with high bits, over ten levels and thirteen sizes at
the power-of-two edges: 199,680 mipmap plans; is_pow2() over every
shift +-8;
- the refusals and the texture-size rule over every pair of 16 special
floats (zeros, ones, infinities, quiet, signalling, negative and payload
NaNs, denormals, the largest finite), both texture flags; gs_sprite_build()
over every pair of them; and a strided sweep of every 4093rd f32 bit
pattern (1,049,345) through the refusals and the build;
- every upload of line sizes 0..40 and heights 0..8 with both flips
(30,258), and line sizes and heights at the u32 and usize edges;
- proptests (20000 cases each) over sizes, positions and flips drawn from
u32 bit patterns, floats drawn from f32 bit patterns (never an f32
range), full-range line sizes and usize heights, and any flags and
levels, with power-of-two sizes as likely as the rest.
The parity module passed 20 runs in a row with fresh random seeds; no
regression file came up.
Mutation check (done once, not committed), with Tier 1 (31 tests) and
Tier 3 (13) in one run: 54 mutants, 47 in the core and 7 in the shim. All
54 fail; none survives:
| Mutant | Tier 1 | Tier 3 |
|---|---|---|
| flip never swaps / inverted | 5 / 5 | 2 / 2 |
| U from the V bit / V from the U bit / U on any bit | 7 / 7 / 7 | 3 / 3 / 3 |
| V ignores bit 1 with bit 2 set | 4 | 2 |
| normalized span 0.5 wide | 3 | 2 |
| rect width and height swapped | 2 | 2 |
| u32 to f32 through i32 / truncated past 2^24 | 5 / 4 | 2 / 2 |
| subregion flip branches swapped | 6 | 3 |
| subregion pos/size + len/size / reciprocal multiply | 3 / 5 | 3 / 3 |
| subregion integer sum before the conversion | 2 | 2 |
| subregion of a 0-size texture clamped to 0 | 2 | 3 |
| subregion u uses the v size | 6 | 3 |
| point 1 gets cy / point 3 w lane 1 / uv 1 and 2 swapped | 3 / 4 / 4 | 3 / 3 / 3 |
| whole shortcut ignores y / cx >= tex_cx | 1 / 1 | 1 / 1 |
| refusal || as && / not-2D draws / a 2D texture of size 0 refused | 2 / 2 / 2 | 3 / 3 / 2 |
| texture size: -0.0 a size / <= 0 / NaN takes the texture's | 3 / 3 / 3 | 2 / 3 / 3 |
| flipped buffer only for GS_FLIP_V (the fix) / never | 2 / 2 | 2 / 2 |
| upload: row_copy the longer line | 4 | 2 |
| upload: no height-0 return (the wrapped offset) | 1 | 1 |
| upload: flipped offset height * linesize / from linesize_out | 2 / 2 | 2 / 2 |
| upload: equal line sizes whole even flipped | 3 | 2 |
| upload: whole size saturating / whole for <= | 1 / 2 | 2 / 2 |
| upload: flipped reported as rows | 2 | 2 |
| pow2: 1 is one / any even size | 4 / 5 | 2 / 2 |
| mip: either axis / levels ignored / levels > 1 | 4 / 4 / 4 | 2 / 2 / 2 |
| mip: render target first / GS_BUILD_MIPMAPS kept / every flag cleared | 3 / 3 / 3 | 2 / 2 / 2 |
| mip: levels kept / render target ignored | 3 / 4 | 2 / 2 |
| shim: rect sizes swapped / subregion U only / refusal arguments swapped | 0 | 2 / 3 / 3 |
| shim: uvs not written / upload fields swapped / mip fields swapped / norm flip dropped | 0 | 3 / 2 / 2 / 2 |
The first run left one mutant to Tier 1 alone (the whole shortcut with
cx >= tex_cx); Tier 3 now also checks regions at (0, 0) one size off the
texture's, and kills it. Tier 1 does not reach the shim.
Intentional difference, not compared: a null points or uvs is not written
through by the shim; the C writes through it.
Refs obs-rust#2082
The rust/README.md crate table now names libobs/graphics/graphics-sprite.c.h among the units rust/obs-graphics holds, and its port table has a row for it: the eleven hidden functions and what each decides, what stays C in graphics.c.h (the device calls in their order, each texture getter only where it was called, the vertex buffers, the matrix stack, the texture map, every memcpy, the logs and gs_perspective()), the one change the move made (a flipped upload with a height of 0 copies nothing before the start row is computed), what the characterization pins and the port keeps, the one intentional difference (a null points or uvs is not written through), the _rust variant of the steps test, the real-libobs tests that see the swap, and what Tier 3 compares. The crate's description and lib.rs say what it holds. docs/rust-port/naming.md got its entry in the move commit. port_comparison gets its own bench file, benches/port_comparison/graphics_sprite.rs: 1024 calls over capture-like sizes, crops, flips and line sizes from a fixed generator, every output bit folded into a checksum both sides must match. On x86_64 Linux (GCC, not pinned, a heavily loaded host; median per 1024 calls): subregion_sprite 50.6 us Rust and 37.1 us C (1.36x), rect_sprite 42.5 us and 55.4 us (0.77x), upload_plan 8.73 us and 6.49 us (1.35x), mip_plan 5.99 us and 13.4 us (0.45x): tens of nanoseconds per call at most, once per draw, upload or texture creation, within this host's run-to-run spread. The full port_comparison run then stops at util's bmem/count fixture (left 16, right 0); origin/master stops there too, so it is not this change. Fixes obs-rust#2082
This was referenced Oct 24, 2026
Closed
5 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2082
What and why
Ports the sprite and texture upload geometry of
libobs/graphics/graphics.c.h(the file of our #1474) to a newspritemodule ofrust/obs-graphics, the round-6 unit 6 plan. Six commits:7c5f8de18libobs: the geometry and decisions move tolibobs/graphics/graphics-sprite.c.has eleven hidden functions on values (graphics-sprite.h, noEXPORT): the sprite points and texture coordinates (normalized, rectangle texels, subregion),gs_draw_quadf()'s refusals, texture-size choice and flipped-buffer choice, the subregion "whole texture" shortcut,gs_texture_set_image()'s copy plan, andis_pow2()withgs_texture_create()'s mipmap rules.graphics.c.hkeeps the device calls in their order (each texture getter only where it was called), the vertex buffers, the matrix stack,gs_texture_map()/_unmap(), everymemcpy, the logs andgs_perspective(). Adds thedocs/rust-port/naming.mdentry.310ae38eatest:test_sprite_geometry_stepscharacterizes it (20 cases, core suite, libm outside MSVC).2eeef0d69obs-graphics: RED, Tier 1 againsttodo!().526846358obs-graphics: GREEN, the safe core and shims in alibobs.ported-spritegroup.d21794227obs-graphics: Tier 3 against the original C, with the mutation check.8fdd014c5docs: README rows, crate description, lib.rs, and aport_comparisonbench file.The one behaviour change, in the move commit: a flipped
gs_texture_set_image()with a texture height of 0 now gets "nothing to copy" from the plan before the flipped start row is computed. Before, it computeddata += (height - 1) * linesize, which wraps for a height of 0 and moved the source pointer outside its buffer (undefined pointer arithmetic), and only then found no row to copy. No row was copied then and none is copied now: the texture is still mapped and unmapped, so nothing observable changes. Everything else is bit-identical (f32by bits). A scratch harness compiled origin/master's code word for word next to the new callers over logging stub device calls. Over 3,000,000 random draws, subregions and texture creations, and 2,833,585 uploads, the call logs, vertex data and uploaded bytes matched.Characterized, not endorsed (kept):
gs_draw_sprite_subregion(NULL, ...)does this with whatever texture is bound.GS_FLIP_Uon a plain 2D texture draws it upside down instead of mirrored.gs_draw_quadf()picks the static buffer that is flipped on v for any flip bit. This dates from upstream 7b8b51b ("Improve sprite drawing perf"); before it, each bit was honoured. A subregion or a rectangle texture still honours each bit. The one in-tree user is linux-pipewire'sget_buffer_flip(): forSPA_META_TRANSFORMATION_Flipped/Flipped180without an effective crop, the screencast comes out flipped vertically instead of mirrored, and correct once a crop is set. This is a real bug, not fixed here; see Findings below.GS_BUILD_MIPMAPSwith 1 level is passed on.Intentional difference, in the shim only:
gs_sprite_build()does not write through a nullpointsoruvs; the C writes through it. libobs always passes a vertex buffer's arrays. This is listed in the parity test header and rust/README.md.Exports are unchanged: 1766 on the C backend, the hybrid and
libobs-c-reference, with identical sets (checked withnm -D). The eleven functions are local in all three. They are listed inrust-hidden.txt, thelocal:list ofrust-exports.mapandrust-unexports-macos.txt, in agraphics/graphics-sprite.csection with the names in order.test_sprite_geometry_steps_rustruns the unchanged C test againstlibobs_rust-static, because the test calls the hidden functions directly. The obs-graphics archive objects that hold the sprite shims also hold the image-file, texrender and effect-parser shims, which need libobs exports and private adapters. So the test is wired liketest_effect_parser_lifecycle_rust: it linksOBS::libobs(which also provides the SIMDe include path, see #2018) and compiles the nsgif group,obs-graphics-adapter.c.handeffect-parser-lifecycle-adapter.c.h.graphics-sprite.cis not compiled in.The test is in the core suite, so no suite count changes. Suite sizes have not been pinned in
rust/obs-build/tests/native.rssince #1997.RED → GREEN
2eeef0d69.soldr cargo test -p obs-graphics --test obs-tests-graphics -- render::spritefails 31 of 31 with "not yet implemented".526846358, Tier 1 31/31. At0cdae268a(on origin/masterb8578dd18; the final rebase onto49f44043agives head8fdd014c5, the same tree for this unit, rechecked below):render::sprite44/44.libobs-c-reference10/10, with no skips. The set wastest_texture_render,test_image_size_precheck,test_graphics_alias_ordinary,test_graphics_alias_rest,test_shader_sampler_convert,test_darken_transparent,test_scene_rotated_scale_filter,test_scene_item_cropandtest_sprite_geometry_steps, plustest_sprite_geometry_steps_ruston hybrid and c-ref.libobs-c-referencewas built explicitly withninja libobs-c-reference(mtime checked), and each run'slibobs.sowas checked withldd.310ae38ea.Xvfb -noreset,dbus-run-session, fresh HOME,ulimit -c 0, no TMPDIR override:0d1900ab4, the same tree as head except that the C test now reports failures withfprintf+fail()instead offail_msg()(Windows cmocka): C 427/427, hybrid 438/438, 0 skipped.db3941efe: C 423/423, hybrid 433/433, 0 skipped.uv run ci/local_gate.py --test-diff origin/masterat8fdd014c5(final head) passed: 3211 run, 3211 passed, 4 skipped by nextest's default filter, none of them sprite tests. At0cdae268a: 3176/3176.--lane lintpassed at0cdae268a.--lane crosspassed, run on0d1900ab4; the only change since is in a C test file.8fdd014c5, re-run after the last rebase with the shared lists hand-diffed against origin/master: build groups, ported sources, oracle stand-ins, oracle MSVC, sorted shared lists, test graph sorted, cmocka rust-static guard, cmocka includes, cross sources, naming, cmocka Windows diagnostics.cx >= tex_cx; Tier 3 gained cases that kill it. Tier 1 does not reach the shim mutants; Tier 3 kills all 7.Checklist
master(or the description starts with a Stacked: note)docs/features.mdis added or updated (not applicable: no user-visible change)-W..., ratchets): not applicable, no warning or flag change. The oracle widens-Wsign-conversion/C4245 only around its include of the unchanged C, asoracle/platform.cdoes.Rebased once more right before posting, after #2080 and #2089 merged (no conflict);
render::sprite(44/44) and the build-group, ported-source, sorted-list and test-graph checks were re-run and pass.