Repository navigation
obs-source: port update_async_textures and its update_async_texrender and upload_raw_frame steps to Rust (Fixes #5948) - #5950
Merged
Conversation
) Move update_async_textures(), update_async_texture() and their steps update_async_texrender(), upload_raw_frame(), select_conversion_technique(), need_linear_output() and set_eparam() unchanged out of obs-source.c.h into obs-source-async-textures.c.h (live group libobs.core-source). get_convert_type() and enum convert_type stay in obs-source.c.h for set_async_texture_size() and init_gpu_conversion(), which come later in the group: the new file has a file-local copy of the function and spells the enum's tag and names as the equal obs-source-conversion-plan.h values, so the moved bodies are byte for byte the removed ones. New cmocka test_source_async_textures characterizes the upload through the real libobs, one video tick at a time: a plain BGRA frame (no texrender), its flip and linear alpha stored, I420, NV12, Y800 and I010 through the texrender, a limited range NV12 frame and the range's clamp (Cr 255 drawn as Cr 240; without the range set it draws 228, not 201). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…5948) The safe core's Host trait (the frame's flip, flags, format, range, transfer, max_luminance and colour matrix rows, async_flip, async_linear_alpha, async_gpu_conversion, async_width and async_height, the caller's texture array, the image upload, the debug marker, the texrender reset, begin and end, the conversion effect and its technique and param lookups, the framebuffer sRGB flag, blending, the technique and pass calls, the texture, float, vec4 and range sets, the HDR levels, the HLG exponent and the draw) and todo!() steps, with 16 Tier 1 tests over a recording model: a plain frame sets the first texture from plane 0 (NULL included); flip and linear alpha stored first; a converted frame without a GPU conversion uploads nothing; a GPU conversion without a texrender takes the plain route; NV12 through the texrender in the C's exact order; planes 0, 2, 3 and 7 uploaded and only the first four set as images; a limited range frame setting the range after the vectors; I010's linear output with the flag restored; the HLG peak clamp and the transfer's maximum nits; a texrender that does not begin; full-range RGB with no technique and no upload; the size read after the upload; upload_raw_frame for no conversion and for planes 0, 1 and 5; and the single-texture wrapper. The model fails a test on an end without its begin, a set or draw outside the pass, and a bracket left open. All 16 fail on the todo!() core. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ixes #5948) The safe core in obs-source::async_textures, the hidden exports update_async_textures() and update_async_texture() in obs-source::ffi::source_async_textures (rust-hidden.d), one-access adapters in libobs/obs-source-async-textures-fields.c.h (live group libobs.core-source), and the original moved to the reference-only group libobs.ported-source-async-textures. Every decision is obs-source::async_upload and obs-source::conversion_plan; the fields, the frame's planes and colour data, the effect, the HLG exponent (log10f() in the C's float operations) and every graphics call stay C. The C's two asserts are compiled out of release builds; the Rust does what those do. Tier 3 in obs-c-oracle (oracle/source_async_textures.c) runs the original C, with the oracle's original upload decisions and conversion plan, as the release builds compile it, against the Rust exports over shared stand-ins for the image upload, the debug marker, the texrender reset, begin and end, the lookups, the framebuffer flag, blending, the technique and pass calls, the sets, the levels and the draw, over a stand-in core. Clobbers grow the size, change the frame's format, transfer, range, max_luminance, matrix, flip and flags, flip async_gpu_conversion, repoint the source's textures 1 to 3 and raise the peak level mid-call. It compares the return, the log, the fields, the frame and every other byte over a grid and a proptest, checks one log call for call, and rejects fourteen mutants. oracle/source_deinterlace_links.c drops its do-nothing update_async_textures(): the deinterlace shims now reach the Rust export. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ci-Attestation: {"at":1795973492,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":77,"stamp":"5c3e9a7e0cb5e827e401fdd9315e7d1c","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973492,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":77,"stamp":"7996ea90e0532045ad996e645395cd20","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973492,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":77,"stamp":"fcd937b7348afe4f6e3a48e11db0a909","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973492,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":77,"stamp":"7da68f7e74292e8a762a9db6087acc45","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973414,"gate":"general/all/client-lint","host":"linux-x86_64","key":"949c89b4a3bed93ba5f644dc23c53aa389c4d14a363baa374de00b71a4773cb4","lane":"client-lint","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":72,"stamp":"a840d948e57298637673f4a44fdaaaa1","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973492,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":77,"stamp":"4d3c56327427e9ed33406a59ab2b3619","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973414,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"949c89b4a3bed93ba5f644dc23c53aa389c4d14a363baa374de00b71a4773cb4","lane":"client-lint","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":72,"stamp":"707c11f98abaa769851c0789add86c7d","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973414,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"949c89b4a3bed93ba5f644dc23c53aa389c4d14a363baa374de00b71a4773cb4","lane":"client-lint","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":72,"stamp":"3e2c457ec40f8fd4531e8ecb33c41f69","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973414,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"949c89b4a3bed93ba5f644dc23c53aa389c4d14a363baa374de00b71a4773cb4","lane":"client-lint","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":72,"stamp":"a909ed65c4b4dac87afbfe29a9bab1d1","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973414,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"949c89b4a3bed93ba5f644dc23c53aa389c4d14a363baa374de00b71a4773cb4","lane":"client-lint","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":72,"stamp":"3e1891ea05d7d450091aedf5e2a33e78","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973414,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"949c89b4a3bed93ba5f644dc23c53aa389c4d14a363baa374de00b71a4773cb4","lane":"client-lint","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":72,"stamp":"893ec8fd14bfc004bf207833f7ad3ef8","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973414,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"949c89b4a3bed93ba5f644dc23c53aa389c4d14a363baa374de00b71a4773cb4","lane":"client-lint","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":72,"stamp":"65614bb65a066516452094841b914e8f","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973414,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"949c89b4a3bed93ba5f644dc23c53aa389c4d14a363baa374de00b71a4773cb4","lane":"client-lint","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":72,"stamp":"e6595738844db58785794aa07ab13e9e","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973414,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"949c89b4a3bed93ba5f644dc23c53aa389c4d14a363baa374de00b71a4773cb4","lane":"client-lint","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":72,"stamp":"b2342cffd6aa77edee16ff5d49e34ed8","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973414,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"949c89b4a3bed93ba5f644dc23c53aa389c4d14a363baa374de00b71a4773cb4","lane":"client-lint","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":72,"stamp":"948ff34bcf591696b12a251129fc32a7","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973414,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"949c89b4a3bed93ba5f644dc23c53aa389c4d14a363baa374de00b71a4773cb4","lane":"client-lint","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":72,"stamp":"100821e1febd5f29d9b68a315733781d","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973414,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"949c89b4a3bed93ba5f644dc23c53aa389c4d14a363baa374de00b71a4773cb4","lane":"client-lint","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":72,"stamp":"231172fae04124e343063bee8a4a827c","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973414,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"949c89b4a3bed93ba5f644dc23c53aa389c4d14a363baa374de00b71a4773cb4","lane":"client-lint","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":72,"stamp":"8f1c172c44e58fe90546de4713b48021","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Ci-Attestation: {"at":1795973827,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"c5c513e49219414ee46f63728bc5e443a9d5950bca2664eb21fa7a975d4a238a","lane":"client-test-x86_64-unknown-linux-gnu","parents":["e1d0021b8ea8b91447e935ba5ff15787278c652e"],"secs":333,"stamp":"58c57b69f91d002d7258d1c312dd6a55","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364","v":1,"via":"run"} Client-Checks: {"checks":{"base":"38102b21b99733f54f615b896093dee3d43d2d7d","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core-source+.h.c","libobs/build/libobs.ported-source-async-textures+.h.c","libobs/build/ported-source-sets/source-async-textures.json","libobs/cmake/rust-hidden.d/obs-source-source_async_textures.txt","libobs/obs-source-async-textures-fields.c.h","libobs/obs-source-async-textures.c.h","libobs/obs-source.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_source_async_textures_swap_is_registered.rs","rust/obs-c-oracle/oracle.d/source-async-textures.list","rust/obs-c-oracle/oracle/source_async_textures.c","rust/obs-c-oracle/oracle/source_deinterlace_links.c","rust/obs-source/src/async_textures.rs","rust/obs-source/src/ffi/mod.rs","rust/obs-source/src/ffi/source_async_textures.rs","rust/obs-source/src/lib.rs","rust/obs-source/tests/source/async_textures.rs","rust/obs-source/tests/source/async_textures_parity.rs","rust/obs-source/tests/source/main.rs","test/cmocka/build/test-graph.json","test/cmocka/test_source_async_textures.c","test/cmocka/tests.d/test_source_async_textures.cmake"],"head":"f249ed0fd1fd174df36ac16b86f914ee56ee1d09","tools":{"orchestrator-python":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]","schema-dependencies":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504-GITv2.15.4\n compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ICU ISO8859X Regexps Automata RelaxNG Schemas Schematron Modules Debug Zlib"},"tracked-digest":"3610e805d4c42f357b823dc82f998dbf044e3f07bbc9e364923b8d38b0f697f1","tree":"6fb5ee2c2eb3f9a66c6fcc7e37beff0248819364"}}
zackees
reviewed
Nov 29, 2026
zackees
left a comment
Member
There was a problem hiding this comment.
Coordinator review: LGTM. It has the usual port shape:
- Base: three commits directly on master (not stacked): a verbatim extraction, then RED, then GREEN.
- Tests: a new Tier 2
test_source_async_textures.cand Tier 3async_textures_parity.rsagainst the oracle. - Export: the hidden export goes through
rust-hidden.d/obs-source-source_async_textures.txt. - Rules: a Test cost line, and no existing C test or public header edited.
- Windows (#5919): no
util_mul_div64and no wideusizeinputs. - Status: auto-merge on.
zackees
enabled auto-merge
November 29, 2026 17:50
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 29, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 29, 2026
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 #5948.
This ports
update_async_textures()andupdate_async_texture(), with their stepsupdate_async_texrender(),upload_raw_frame(),select_conversion_technique(),need_linear_output()andset_eparam(), toobs-source, in the shape of #5940 and #5943.obs_source_update_async_video()runs it to upload each async frame (media, cameras, capture cards) into the source's textures, through the GPU conversion texrender when the format needs one; the deinterlace path runs it for its previous frame. Every decision was already Rust (obs-source::async_upload,obs-source::conversion_plan). What moves now is the glue: the source's fields, the frame's planes and colour data and the graphics calls, in order.What changes
libobs: extract update_async_textures and its steps verbatim). The functions move unchanged intolibobs/obs-source-async-textures.c.h(live grouplibobs.core-source).get_convert_type()andenum convert_typestay inobs-source.c.hforset_async_texture_size()andinit_gpu_conversion(), later in the group; the new file has a file-local copy spelled with the equalobs-source-conversion-plan.hvalues, so the moved bodies are byte for byte the removed ones. The new cmockatest_source_async_texturescharacterizes the upload through the real libobs, one video tick at a time: a plain BGRA frame (no texrender), its flip and linear alpha stored, I420, NV12, Y800 and I010 through the texrender, a limited-range NV12 frame and the range's clamp (Cr 255 drawn as Cr 240; without the range set it draws 228, not 201).Hosttrait andtodo!()steps, with 16 Tier 1 tests over a recording model that fails a test on an end without its begin, a set or draw outside the pass, and a bracket left open.obs-source::async_textures, the hidden exports inobs-source::ffi::source_async_textures(rust-hidden.d), one-access adapters inlibobs/obs-source-async-textures-fields.c.h, and the original moved to the reference-only grouplibobs.ported-source-async-textures. The C's two asserts are compiled out of release builds; the Rust does what those builds do. Tier 3 inobs-c-oracle(oracle/source_async_textures.c) runs the original C as release builds compile it against the Rust exports over shared stand-ins for the image upload, debug marker, texrender reset/begin/end, lookups, framebuffer flag, blending, technique and pass calls, sets, levels and draw. Clobbers grow the size, change the frame's format, transfer, range, max_luminance, matrix, flip and flags, flipasync_gpu_conversion, repoint textures 1 to 3 and raise the peak level mid-call. It compares the return, the call log, the fields, the frame and every other byte over a grid and a proptest, and rejects fourteen mutants.oracle/source_deinterlace_links.cdrops its do-nothingupdate_async_textures(): the deinterlace shims now reach the Rust export.No intentional differences from C. The
rust/README.mdrow is added; no user-visible change, so nodocs/features.mdline.Evidence
RED, at the RED commit:
GREEN, at the head (rebased on master after #5943 merged):
Tier 2,
test_source_async_texturesbuilt and run at the head in the kept linux-validate build volume (graphics runtime dir,xvfb-run -a), against both libraries:./lintpasses.Test cost
The new Rust tests with
OBS_PARITY_CASES=reducedin debug, 20 runs of the filtered binary: longest 56 ms, peak RSS 39 MB; no threads spawned. The new cmocka test takes a few seconds per library.🤖 Generated with Claude Code