From d556394aa59411e944ab7c8fb2496b2b9e1396d6 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 02:08:25 -0800 Subject: [PATCH 1/2] test(graphics): mirror planar capability queries against Rust stub (RED) Refs #5218. Mirror the unchanged fake-device characterization in the existing Graphics category binary before implementing the swap. --- rust/obs-graphics/src/lib.rs | 1 + .../src/planar_capability_queries.rs | 28 +++++ rust/obs-graphics/tests/render/main.rs | 1 + .../tests/render/planar_capability_queries.rs | 108 ++++++++++++++++++ 4 files changed, 138 insertions(+) create mode 100644 rust/obs-graphics/src/planar_capability_queries.rs create mode 100644 rust/obs-graphics/tests/render/planar_capability_queries.rs diff --git a/rust/obs-graphics/src/lib.rs b/rust/obs-graphics/src/lib.rs index db35083044..e26131afb7 100644 --- a/rust/obs-graphics/src/lib.rs +++ b/rust/obs-graphics/src/lib.rs @@ -84,6 +84,7 @@ pub mod matrix4; pub mod matrix_entrypoints; pub mod perspective; pub mod plane; +pub mod planar_capability_queries; mod platform; pub mod present_entrypoints; pub mod quat; diff --git a/rust/obs-graphics/src/planar_capability_queries.rs b/rust/obs-graphics/src/planar_capability_queries.rs new file mode 100644 index 0000000000..8534e553c0 --- /dev/null +++ b/rust/obs-graphics/src/planar_capability_queries.rs @@ -0,0 +1,28 @@ +//! Optional planar capability queries over a caller-owned graphics context. + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Entry { + Nv12, + P010, +} + +impl Entry { + pub const fn name(self) -> &'static str { + match self { + Self::Nv12 => "gs_nv12_available", + Self::P010 => "gs_p010_available", + } + } +} + +/// Field access and dispatch are reached only after the corresponding checks. +pub trait Host { + fn has_context(&self) -> bool; + fn debug(&mut self, entry: Entry); + fn has_callback(&self, entry: Entry) -> bool; + fn dispatch(&mut self, entry: Entry) -> bool; +} + +pub fn available(_host: &mut H, _entry: Entry) -> bool { + todo!("planar capability query swap") +} diff --git a/rust/obs-graphics/tests/render/main.rs b/rust/obs-graphics/tests/render/main.rs index 8946e06083..a0ec694ab5 100644 --- a/rust/obs-graphics/tests/render/main.rs +++ b/rust/obs-graphics/tests/render/main.rs @@ -51,6 +51,7 @@ mod matrix_entrypoints; mod matrix_entrypoints_parity; mod perspective; mod perspective_parity; +mod planar_capability_queries; mod present_entrypoints; mod present_entrypoints_parity; mod raster_entrypoints; diff --git a/rust/obs-graphics/tests/render/planar_capability_queries.rs b/rust/obs-graphics/tests/render/planar_capability_queries.rs new file mode 100644 index 0000000000..b277467fc6 --- /dev/null +++ b/rust/obs-graphics/tests/render/planar_capability_queries.rs @@ -0,0 +1,108 @@ +//! Tier 1 mirrors test_graphics_planar_capability_queries.c, using fake devices. +use obs_graphics::planar_capability_queries::{Entry, Host, available}; + +#[derive(Default)] +struct Fake { + context: bool, + callbacks: [bool; 2], + results: [bool; 2], + device: usize, + calls: [usize; 2], + devices: Vec, + logs: Vec, +} + +fn index(entry: Entry) -> usize { + match entry { + Entry::Nv12 => 0, + Entry::P010 => 1, + } +} + +impl Host for Fake { + fn has_context(&self) -> bool { + self.context + } + fn debug(&mut self, entry: Entry) { + self.logs.push(format!( + "{}: called while not in a graphics context", + entry.name() + )); + } + fn has_callback(&self, entry: Entry) -> bool { + assert!(self.context, "no projections without a context"); + self.callbacks[index(entry)] + } + fn dispatch(&mut self, entry: Entry) -> bool { + assert!(self.context); + assert!(self.callbacks[index(entry)]); + self.calls[index(entry)] += 1; + self.devices.push(self.device); + self.results[index(entry)] + } +} + +#[test] +fn test_graphics_planar_capability_queries_no_context() { + let mut host = Fake { + callbacks: [true; 2], + ..Fake::default() + }; + for i in 0..2 { + assert!(!available(&mut host, Entry::Nv12)); + assert_eq!(host.logs.last().unwrap(), "gs_nv12_available: called while not in a graphics context"); + assert_eq!(host.logs.len(), 2 * i + 1); + assert!(!available(&mut host, Entry::P010)); + assert_eq!(host.logs.last().unwrap(), "gs_p010_available: called while not in a graphics context"); + assert_eq!(host.logs.len(), 2 * i + 2); + assert_eq!(host.calls, [0, 0]); + assert!(host.devices.is_empty()); + host.callbacks = [false; 2]; + } +} + +#[test] +fn test_graphics_planar_capability_queries_optional_callbacks_are_independent() { + let mut host = Fake { + context: true, + callbacks: [false, true], + results: [true; 2], + ..Fake::default() + }; + assert!(!available(&mut host, Entry::Nv12)); + assert!(available(&mut host, Entry::P010)); + assert_eq!(host.calls, [0, 1]); + host.callbacks = [true, false]; + assert!(!available(&mut host, Entry::P010)); + assert!(available(&mut host, Entry::Nv12)); + assert_eq!(host.calls, [1, 1]); + host.callbacks = [false; 2]; + assert!(!available(&mut host, Entry::Nv12)); + assert!(!available(&mut host, Entry::P010)); + assert_eq!(host.calls, [1, 1]); + assert!(host.logs.is_empty()); +} + +#[test] +fn test_graphics_planar_capability_queries_callback_results_and_device_routing() { + let mut host = Fake { + callbacks: [true; 2], + ..Fake::default() + }; + for device in 0..2 { + host.device = device; + host.context = true; + for results in 0..4 { + host.results = [results & 1 != 0, results & 2 != 0]; + let calls = device * 4 + results; + assert_eq!(available(&mut host, Entry::Nv12), host.results[0]); + assert_eq!(host.calls, [calls + 1, calls]); + assert_eq!(available(&mut host, Entry::P010), host.results[1]); + assert_eq!(host.calls, [calls + 1, calls + 1]); + assert_eq!(&host.devices[2 * calls..], &[device, device]); + assert!(host.logs.is_empty()); + } + host.context = false; + assert!(!host.has_context()); + } +} From e0692e8d1540f4a7eeb6cb9244c539feb34332c9 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 02:16:20 -0800 Subject: [PATCH 2/2] graphics: swap planar capability queries to safe Rust (Refs #5218) Reuse the existing device-query context, logging and demand-linked adapter seam. Preserve the frozen C characterization and original oracle bodies; cover every fake-device/callback/result combination and bounded query sequences. The inverted-callback mutation fails both differential tests. Ci-Attestation: {"at":1795085856,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":111,"stamp":"db8898d9e524e7ed3a7e69a47fd1c7f5","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085856,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":111,"stamp":"b23abb311e26701cfde86bf97206fce9","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085856,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":111,"stamp":"671ca01fff32806af391f66944d714ed","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085856,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":111,"stamp":"161ea8f5fccc9b3afa868571c3e2bec1","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085742,"gate":"general/all/client-lint","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"abddbb3a29b4f7f61fb2b0c21bd4f470","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085856,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":111,"stamp":"531a92504ca123f17be3b31fc037996c","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085743,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"56ad2a4742ace71afe2bb5a157273d36","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085743,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"6f6dc864ecb0657242d97e20776acfc8","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085742,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"3a8027210998fce2d610193c66276b70","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085742,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"1cc4fa24b171beb9b2a87049431f66f1","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085742,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"f5f4080c37131cb910b89f50084384f0","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085742,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"60169cf33aa6a22f907be83948df7282","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085742,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"00c182afdc2d9d5f1ab2b7fe8a1ba0ee","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085743,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"ef0578d4edf29656ab9f841e9c603d69","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085742,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"d97201dd09a83da7311f3bc936206062","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085742,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"0d5fb05d3e3423c368325dfa79bfb5b8","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085742,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"31162d12b27d5757d82440943f93e27e","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795085742,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"9bf13bc4d13b26d5acf2e23a57d632a791671fc0455d711085185347bfd4276a","lane":"client-lint","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":165,"stamp":"1b54412ef7df28dc829fa2d0e71b47ec","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Ci-Attestation: {"at":1795086579,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"5a103e8c0d14fc05ad18500f25f96e30a2ce0345c6a0a27ba178974464af911d","lane":"client-test-x86_64-unknown-linux-gnu","parents":["d556394aa59411e944ab7c8fb2496b2b9e1396d6"],"secs":721,"stamp":"3235240423fbd61c503bb630fbfe3089","tree":"a176f618e07f56d4b173df8303b18797915f7e1a","v":1,"via":"run"} Client-Checks: {"checks":{"base":"d8f5045f0882951a2806b9decaf82b97cac656b6","coverage":"all-tracked-applicable-files","diff":[".github/workflows/build-project.yaml","ci/test_ci_job_timeouts.py","ci/test_tier2_apt_cache.py","libobs/build/libobs.core+.h.c","libobs/build/libobs.graphics+.h.c","libobs/build/libobs.graphics-image-max-size+.h.c","libobs/build/libobs.media+.h.c","libobs/build/libobs.media-image-orientation-fields+.h.c","libobs/build/libobs.media-texture-file-data-convert+.h.c","libobs/build/libobs.media-texture-file-data-session+.h.c","libobs/build/libobs.ported-graphics-planar-capability-queries+.h.c","libobs/build/libobs.ported-hotkey-unregister-entry+.h.c","libobs/build/libobs.ported-video-level-queries+.h.c","libobs/build/modules.d/graphics.json","libobs/build/modules.d/media.json","libobs/build/ported-source-sets/graphics-planar-capability-queries.json","libobs/build/ported-source-sets/hotkey-unregister-entry.json","libobs/build/ported-source-sets/video-level-queries.json","libobs/build/source-sets.d/LIBOBS_SOURCES.json","libobs/cmake/rust-exports.d/obs-core-video_level_queries.txt","libobs/cmake/rust-exports.d/obs-graphics-planar_capability_queries.txt","libobs/cmake/rust-exports.d/obs-hotkey-unregister_entry.txt","libobs/cmake/rust-hidden.d/obs-core-video_level_queries.txt","libobs/cmake/rust-hidden.d/obs-hotkey-unregister_entry.txt","libobs/graphics/graphics-device-queries-fields.c.h","libobs/graphics/graphics-ffmpeg.c.h","libobs/graphics/graphics-image-max-size.c.h","libobs/graphics/graphics-planar-capability-queries.c.h","libobs/graphics/graphics-texture-file-data-adapter.c.h","libobs/graphics/graphics-texture-file-data-convert.c.h","libobs/graphics/graphics.c.h","libobs/obs-hotkey-unregister-entry-fields.c.h","libobs/obs-video-level-queries-fields.c.h","rust/README.md","rust/obs-build/tests/native/registration/headless_characterizations_expected.json","rust/obs-build/tests/native/registration/portal_output_expected.json","rust/obs-build/tests/native/registration/rust-static/cases/core-relinked/test_video_level_queries.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_enum.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_press.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_trigger.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_binding_press_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_getters_characterization.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_load.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_pair_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_press_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_unregister_entry.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_portal_shortcuts.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_wayland_hotkeys.json","rust/obs-build/tests/native/registration/rust_static_entries.rs","rust/obs-c-oracle/legacy/graphics-planar-capability-queries.c","rust/obs-c-oracle/oracle.d/graphics-planar-capability-queries.list","rust/obs-c-oracle/oracle.d/hotkey_unregister_entry.list","rust/obs-c-oracle/oracle/device_queries.c","rust/obs-c-oracle/oracle/hotkey_unregister_entry.c","rust/obs-c-oracle/oracle/hotkey_unregister_entry_links.c","rust/obs-c-oracle/oracle/source_deinterlace_links.c","rust/obs-c-oracle/oracle/video_level_queries.c","rust/obs-core/src/ffi/mod.rs","rust/obs-core/src/ffi/video_level_queries.rs","rust/obs-core/src/lib.rs","rust/obs-core/src/video_level_queries.rs","rust/obs-core/tests/obs_core/main.rs","rust/obs-core/tests/obs_core/video_level_queries.rs","rust/obs-core/tests/obs_core/video_level_queries_parity.rs","rust/obs-graphics/src/ffi/mod.rs","rust/obs-graphics/src/ffi/planar_capability_queries.rs","rust/obs-graphics/src/lib.rs","rust/obs-graphics/src/planar_capability_queries.rs","rust/obs-graphics/tests/render/main.rs","rust/obs-graphics/tests/render/planar_capability_queries.rs","rust/obs-graphics/tests/render/planar_capability_queries_parity.rs","rust/obs-hotkey/src/ffi/mod.rs","rust/obs-hotkey/src/ffi/unregister_entry.rs","rust/obs-hotkey/src/lib.rs","rust/obs-hotkey/src/unregister_entry.rs","rust/obs-hotkey/tests/hotkey/main.rs","rust/obs-hotkey/tests/hotkey/unregister_entry.rs","rust/obs-hotkey/tests/hotkey/unregister_entry_parity.rs","test/cmocka/build/test-graph.json","test/cmocka/test_image_max_texture_size.c","test/cmocka/tests.d/test_image_max_texture_size.cmake","test/cmocka/tests.d/video_level_queries_link_support.cmake"],"head":"f0d86d0f152b3e5f553ce3f94132523493e8f1e2","tools":{"orchestrator-python":"3.14.7 (main, Aug 14 2026, 15:35:28) [Clang 22.1.3 ]","schema-dependencies":"3.14.7 (main, Aug 14 2026, 15:35:28) [Clang 22.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\n compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ISO8859X Regexps Automata RelaxNG Schemas Modules Debug"},"tracked-digest":"18cc6c540ba8517cd11d3a27d79e777bae9b7a97157a036f75937e978b4dbc6f","tree":"a176f618e07f56d4b173df8303b18797915f7e1a"}} --- libobs/build/libobs.graphics+.h.c | 1 - ...ed-graphics-planar-capability-queries+.h.c | 4 + .../graphics-planar-capability-queries.json | 5 + ...obs-graphics-planar_capability_queries.txt | 2 + .../graphics-device-queries-fields.c.h | 24 +++ .../graphics-planar-capability-queries.c.h | 20 ++- rust/README.md | 1 + .../graphics-planar-capability-queries.c | 27 ++++ .../graphics-planar-capability-queries.list | 1 + rust/obs-c-oracle/oracle/device_queries.c | 59 +++++++ rust/obs-graphics/src/ffi/mod.rs | 1 + .../src/ffi/planar_capability_queries.rs | 67 ++++++++ rust/obs-graphics/src/lib.rs | 2 +- .../src/planar_capability_queries.rs | 8 +- rust/obs-graphics/tests/render/main.rs | 1 + .../tests/render/planar_capability_queries.rs | 10 +- .../planar_capability_queries_parity.rs | 145 ++++++++++++++++++ 17 files changed, 369 insertions(+), 9 deletions(-) create mode 100644 libobs/build/libobs.ported-graphics-planar-capability-queries+.h.c create mode 100644 libobs/build/ported-source-sets/graphics-planar-capability-queries.json create mode 100644 libobs/cmake/rust-exports.d/obs-graphics-planar_capability_queries.txt create mode 100644 rust/obs-c-oracle/legacy/graphics-planar-capability-queries.c create mode 100644 rust/obs-c-oracle/oracle.d/graphics-planar-capability-queries.list create mode 100644 rust/obs-graphics/src/ffi/planar_capability_queries.rs create mode 100644 rust/obs-graphics/tests/render/planar_capability_queries_parity.rs diff --git a/libobs/build/libobs.graphics+.h.c b/libobs/build/libobs.graphics+.h.c index 852403d661..8c40f13883 100644 --- a/libobs/build/libobs.graphics+.h.c +++ b/libobs/build/libobs.graphics+.h.c @@ -9,7 +9,6 @@ #include "libobs/graphics/graphics-device-queries-fields.c.h" #include "libobs/graphics/graphics-imports.c.h" #include "libobs/graphics/graphics-indexbuffer-maintenance-fields.c.h" -#include "libobs/graphics/graphics-planar-capability-queries.c.h" #include "libobs/graphics/graphics-render-target-setters-fields.c.h" #include "libobs/graphics/graphics-samplerstate-lifecycle-fields.c.h" #include "libobs/graphics/graphics-shader-matrix-queries-fields.c.h" diff --git a/libobs/build/libobs.ported-graphics-planar-capability-queries+.h.c b/libobs/build/libobs.ported-graphics-planar-capability-queries+.h.c new file mode 100644 index 0000000000..fb2ad987d7 --- /dev/null +++ b/libobs/build/libobs.ported-graphics-planar-capability-queries+.h.c @@ -0,0 +1,4 @@ +/* Unity group (BUILD.md): original planar capability queries for the C reference. */ +#include "libobs/build/libobs-graphics.pch.h" + +#include "libobs/graphics/graphics-planar-capability-queries.c.h" diff --git a/libobs/build/ported-source-sets/graphics-planar-capability-queries.json b/libobs/build/ported-source-sets/graphics-planar-capability-queries.json new file mode 100644 index 0000000000..603c57ffb7 --- /dev/null +++ b/libobs/build/ported-source-sets/graphics-planar-capability-queries.json @@ -0,0 +1,5 @@ +{ + "LIBOBS_PORTED_SOURCES": [ + "build/libobs.ported-graphics-planar-capability-queries+.h.c" + ] +} diff --git a/libobs/cmake/rust-exports.d/obs-graphics-planar_capability_queries.txt b/libobs/cmake/rust-exports.d/obs-graphics-planar_capability_queries.txt new file mode 100644 index 0000000000..1484ff3a9e --- /dev/null +++ b/libobs/cmake/rust-exports.d/obs-graphics-planar_capability_queries.txt @@ -0,0 +1,2 @@ +gs_nv12_available +gs_p010_available diff --git a/libobs/graphics/graphics-device-queries-fields.c.h b/libobs/graphics/graphics-device-queries-fields.c.h index bc48545c65..7aac244912 100644 --- a/libobs/graphics/graphics-device-queries-fields.c.h +++ b/libobs/graphics/graphics-device-queries-fields.c.h @@ -30,3 +30,27 @@ uint32_t obs_graphics_device_queries_count(graphics_t *graphics) { return graphics->exports.gs_get_adapter_count(); } + +bool obs_graphics_device_queries_has_nv12(graphics_t *graphics); +bool obs_graphics_device_queries_has_nv12(graphics_t *graphics) +{ + return graphics->exports.device_nv12_available != NULL; +} + +bool obs_graphics_device_queries_nv12(graphics_t *graphics); +bool obs_graphics_device_queries_nv12(graphics_t *graphics) +{ + return graphics->exports.device_nv12_available(graphics->device); +} + +bool obs_graphics_device_queries_has_p010(graphics_t *graphics); +bool obs_graphics_device_queries_has_p010(graphics_t *graphics) +{ + return graphics->exports.device_p010_available != NULL; +} + +bool obs_graphics_device_queries_p010(graphics_t *graphics); +bool obs_graphics_device_queries_p010(graphics_t *graphics) +{ + return graphics->exports.device_p010_available(graphics->device); +} diff --git a/libobs/graphics/graphics-planar-capability-queries.c.h b/libobs/graphics/graphics-planar-capability-queries.c.h index 239aa04951..8b757c48b4 100644 --- a/libobs/graphics/graphics-planar-capability-queries.c.h +++ b/libobs/graphics/graphics-planar-capability-queries.c.h @@ -1,8 +1,19 @@ #include "libobs/build/libobs-graphics.pch.h" -/* Private dependencies defined in graphics.c.h, later in the unity group. */ -static THREAD_LOCAL graphics_t *thread_graphics; -static inline bool gs_valid(const char *f); +/* Reference-only: read the existing TLS context without owning another one. */ +#define thread_graphics gs_get_context() + +static inline bool planar_capability_ref_valid(const char *f) +{ + if (!thread_graphics) { + blog(LOG_DEBUG, "%s: called while not in a graphics context", f); + return false; + } + + return true; +} + +#define gs_valid planar_capability_ref_valid bool gs_nv12_available(void) { @@ -25,3 +36,6 @@ bool gs_p010_available(void) return thread_graphics->exports.device_p010_available(thread_graphics->device); } + +#undef gs_valid +#undef thread_graphics diff --git a/rust/README.md b/rust/README.md index 140c83098f..4906cab00e 100644 --- a/rust/README.md +++ b/rust/README.md @@ -155,6 +155,7 @@ and compares their exported symbols. `OBS_LIBOBS_BACKEND=C` is temporary rollbac | `libobs/graphics/graphics-indexbuffer-maintenance.c.h` | `obs-graphics::indexbuffer_maintenance` | Swapped in hybrid `libobs` (#5049; prerequisite #5046, Refs #5039). The four maintenance entry points preserve context-before-pointer guards, silent NULL destroy in context, direct-data rejection order, exact diagnostics, pointer identity and full `size_t` forwarding. Safe Rust owns validation; private C adapters own layout and dispatch. Original C remains in a reference-only group and a verbatim legacy oracle copy. Tier 1 mirrors unchanged `test_graphics_indexbuffer_maintenance`; Tier 3 compares boundary matrices and bounded random inputs through the Rust ABI in the existing Graphics category binary. No intentional differences; Tier 4 does not apply. | | `libobs/graphics/graphics-render-target-setters.c.h` | `obs-graphics::render_target_setters` | Swapped in hybrid `libobs` (#5076; prerequisite #5058 / #5048). Safe Rust guards the context before private C layout/dispatch adapters; both nullable target/depth handles and every cube face value reach the backend unchanged. Exact diagnostics, device/pointer identity and single dispatch are preserved. Original C remains reference-only and in a verbatim legacy oracle. Tier 1 mirrors unchanged `test_graphics_render_target_setters`; Tier 3 compares boundary matrices and bounded random sequences through the Rust ABI in the existing Graphics category binary. No intentional differences; Tier 4 does not apply. | | `libobs/graphics/graphics-samplerstate-lifecycle.c.h` | `obs-graphics::samplerstate_lifecycle` | Swapped in hybrid `libobs` (Refs #5149; prerequisite #5128/#5148). Safe Rust preserves context-before-argument validation, exact LOG_DEBUG diagnostics, silent NULL destruction in context, settings/opaque-handle identity and backend failure returns. Private C adapters retain TLS, native layouts and exact device-vtable dispatch; sampler objects stay backend-owned without wrapper allocation or tracking. Tier 1 mirrors all four unchanged C characterization cases; Tier 3 compares the original C and real Rust ABI/adapters over boundary and bounded random sequences in the Graphics category. No intentional differences; Tier 4 does not apply. | +| `libobs/graphics/graphics-planar-capability-queries.c.h` | `obs-graphics::planar_capability_queries` | Swapped in hybrid `libobs` (Refs #5218; prerequisite #5217). Safe Rust checks context and optional NV12/P010 callbacks before dispatch through the existing device-query seam and shared demand-linked support archive. Unchanged fake-device Tier 2 characterization, Tier 1 mirrors and Tier 3 original-C differential sequences preserve exact diagnostics, independent dispatch, results and device identity. No host GPU assumptions or intentional differences; Tier 4 does not apply. | | `libobs/graphics/graphics-shader-matrix-queries.c.h` | `obs-graphics::shader_matrix_queries` | Swapped in hybrid `libobs` (Refs #5185; prerequisite #5132/#5184). Safe Rust checks context before shader, then private C adapters dispatch the viewproj/world callback with the exact shader pointer and return the borrowed parameter unchanged, NULL included. Exact LOG_DEBUG messages and single dispatch agree with the reference-only C and a verbatim legacy oracle. Tier 1 mirrors unchanged `test_shader_matrix_queries`; Tier 3 compares boundary matrices and bounded random sequences through the real ABI and adapters in the existing Graphics category binary. No intentional differences; Tier 4 does not apply. | | `libobs/graphics/graphics-target-size.c.h` | `obs-graphics::target_size` | Swapped in hybrid `libobs` (Refs #5100; prerequisite #5087/#5107). Safe Rust checks context before private C layout/dispatch adapters, preserves zero scalar defaults and untouched outputs without context, and forwards nullable/aliased outputs unchanged. Exact LOG_DEBUG messages, device/output identities and single matching callbacks agree with the reference-only C and verbatim legacy oracle. Tier 1 mirrors unchanged `test_graphics_target_size`; Tier 3 covers boundary and bounded random queries in the existing Graphics category binary. No intentional differences; Tier 4 does not apply. | | `libobs/graphics/graphics-texture-copy.c.h` | `obs-graphics::texture_copy` | Swapped in hybrid `libobs` (Refs #5062; prerequisite #5074/#5059). Safe Rust preserves context-before-pointer validation, whole-copy destination-then-source guards and region-copy destination-only validation, including NULL sources, aliasing and all six unchanged offsets/extents. Private C adapters own layout and backend dispatch. Exact LOG_DEBUG messages, device and texture identity match the reference-only original C and verbatim Tier 3 legacy oracle. Tier 1 mirrors unchanged `test_graphics_texture_copy`; Tier 3 compares boundary matrices and bounded random inputs through the real ABI and adapters in the existing Graphics category binary. No intentional differences; Tier 4 does not apply. | diff --git a/rust/obs-c-oracle/legacy/graphics-planar-capability-queries.c b/rust/obs-c-oracle/legacy/graphics-planar-capability-queries.c new file mode 100644 index 0000000000..239aa04951 --- /dev/null +++ b/rust/obs-c-oracle/legacy/graphics-planar-capability-queries.c @@ -0,0 +1,27 @@ +#include "libobs/build/libobs-graphics.pch.h" + +/* Private dependencies defined in graphics.c.h, later in the unity group. */ +static THREAD_LOCAL graphics_t *thread_graphics; +static inline bool gs_valid(const char *f); + +bool gs_nv12_available(void) +{ + if (!gs_valid("gs_nv12_available")) + return false; + + if (!thread_graphics->exports.device_nv12_available) + return false; + + return thread_graphics->exports.device_nv12_available(thread_graphics->device); +} + +bool gs_p010_available(void) +{ + if (!gs_valid("gs_p010_available")) + return false; + + if (!thread_graphics->exports.device_p010_available) + return false; + + return thread_graphics->exports.device_p010_available(thread_graphics->device); +} diff --git a/rust/obs-c-oracle/oracle.d/graphics-planar-capability-queries.list b/rust/obs-c-oracle/oracle.d/graphics-planar-capability-queries.list new file mode 100644 index 0000000000..bae3cbf0c9 --- /dev/null +++ b/rust/obs-c-oracle/oracle.d/graphics-planar-capability-queries.list @@ -0,0 +1 @@ +graphics-planar-capability-queries.inc|rust/obs-c-oracle/legacy/graphics-planar-capability-queries.c|auto diff --git a/rust/obs-c-oracle/oracle/device_queries.c b/rust/obs-c-oracle/oracle/device_queries.c index bd868e07ae..efb773e210 100644 --- a/rust/obs-c-oracle/oracle/device_queries.c +++ b/rust/obs-c-oracle/oracle/device_queries.c @@ -34,6 +34,14 @@ static void dq_blog(int level, const char *format, ...) #define blog dq_blog #include "graphics-device-queries.inc" +#define gs_nv12_available oracle_gs_nv12_available +#define gs_p010_available oracle_gs_p010_available +bool oracle_gs_nv12_available(void); +bool oracle_gs_p010_available(void); +#include "graphics-planar-capability-queries.inc" +#undef gs_p010_available +#undef gs_nv12_available + /* Original graphics.c.h context validator, verbatim. */ static inline bool gs_valid(const char *f) { @@ -114,3 +122,54 @@ const char *oracle_device_queries_log(void) #undef gs_get_adapter_count #undef gs_get_device_type + +/* Planar queries share the real device-query TLS/logging adapters above. */ +static THREAD_LOCAL int dq_planar_devices[2]; +static THREAD_LOCAL bool dq_planar_results[2]; +static THREAD_LOCAL unsigned dq_planar_calls[2], dq_planar_last_device; + +static bool dq_planar_nv12(gs_device_t *device) +{ + assert(thread_graphics == &dq_graphics); + assert(device == dq_graphics.device); + assert(device == (gs_device_t *)&dq_planar_devices[0] || device == (gs_device_t *)&dq_planar_devices[1]); + dq_planar_last_device = device == (gs_device_t *)&dq_planar_devices[1] ? 1u : 0u; + dq_planar_calls[0]++; + return dq_planar_results[0]; +} + +static bool dq_planar_p010(gs_device_t *device) +{ + assert(thread_graphics == &dq_graphics); + assert(device == dq_graphics.device); + assert(device == (gs_device_t *)&dq_planar_devices[0] || device == (gs_device_t *)&dq_planar_devices[1]); + dq_planar_last_device = device == (gs_device_t *)&dq_planar_devices[1] ? 1u : 0u; + dq_planar_calls[1]++; + return dq_planar_results[1]; +} + +void oracle_planar_capability_reset(bool context, bool nv12, bool p010, bool nv12_result, bool p010_result, + bool device); +void oracle_planar_capability_reset(bool context, bool nv12, bool p010, bool nv12_result, bool p010_result, bool device) +{ + oracle_device_queries_reset(context, false, false, 0, 0); + dq_graphics.device = (gs_device_t *)&dq_planar_devices[device ? 1 : 0]; + dq_graphics.exports.device_nv12_available = nv12 ? dq_planar_nv12 : NULL; + dq_graphics.exports.device_p010_available = p010 ? dq_planar_p010 : NULL; + dq_planar_results[0] = nv12_result; + dq_planar_results[1] = p010_result; + dq_planar_calls[0] = dq_planar_calls[1] = 0; + dq_planar_last_device = 2; +} + +unsigned oracle_planar_capability_calls(bool p010); +unsigned oracle_planar_capability_calls(bool p010) +{ + return dq_planar_calls[p010 ? 1 : 0]; +} + +unsigned oracle_planar_capability_last_device(void); +unsigned oracle_planar_capability_last_device(void) +{ + return dq_planar_last_device; +} diff --git a/rust/obs-graphics/src/ffi/mod.rs b/rust/obs-graphics/src/ffi/mod.rs index 6b31718c58..3116f1bfb8 100644 --- a/rust/obs-graphics/src/ffi/mod.rs +++ b/rust/obs-graphics/src/ffi/mod.rs @@ -39,6 +39,7 @@ pub mod matrix3; pub mod matrix4; pub mod matrix_entrypoints; pub mod perspective; +pub mod planar_capability_queries; pub mod plane; pub mod present_entrypoints; pub mod quat; diff --git a/rust/obs-graphics/src/ffi/planar_capability_queries.rs b/rust/obs-graphics/src/ffi/planar_capability_queries.rs new file mode 100644 index 0000000000..43a752b8cb --- /dev/null +++ b/rust/obs-graphics/src/ffi/planar_capability_queries.rs @@ -0,0 +1,67 @@ +//! Thin ABI shims using the existing device-query TLS/logging/field seam. +use crate::planar_capability_queries::{self as core, Entry, Host}; +use std::ffi::{c_char, c_void}; + +unsafe extern "C" { + fn obs_graphics_device_queries_context() -> *mut c_void; + fn obs_graphics_device_queries_debug(function: *const c_char); + fn obs_graphics_device_queries_has_nv12(context: *mut c_void) -> bool; + fn obs_graphics_device_queries_nv12(context: *mut c_void) -> bool; + fn obs_graphics_device_queries_has_p010(context: *mut c_void) -> bool; + fn obs_graphics_device_queries_p010(context: *mut c_void) -> bool; +} + +struct Context(*mut c_void); + +fn current() -> Context { + // SAFETY: reads the calling thread's context without dereferencing it. + Context(unsafe { obs_graphics_device_queries_context() }) +} + +impl Host for Context { + fn has_context(&self) -> bool { + !self.0.is_null() + } + fn debug(&mut self, entry: Entry) { + let name = match entry { + Entry::Nv12 => c"gs_nv12_available", + Entry::P010 => c"gs_p010_available", + }; + // SAFETY: the function name is static and NUL-terminated. + unsafe { obs_graphics_device_queries_debug(name.as_ptr()) } + } + fn has_callback(&self, entry: Entry) -> bool { + // SAFETY: the core checked the context before any field projection. + unsafe { + match entry { + Entry::Nv12 => obs_graphics_device_queries_has_nv12(self.0), + Entry::P010 => obs_graphics_device_queries_has_p010(self.0), + } + } + } + fn dispatch(&mut self, entry: Entry) -> bool { + // SAFETY: the core checked context and the matching callback first. + unsafe { + match entry { + Entry::Nv12 => obs_graphics_device_queries_nv12(self.0), + Entry::P010 => obs_graphics_device_queries_p010(self.0), + } + } + } +} + +/// Query the optional NV12 backend capability. +/// # Safety +/// A current context and any supplied backend callback must be live. +#[unsafe(no_mangle)] +pub unsafe extern "C" fn gs_nv12_available() -> bool { + core::available(&mut current(), Entry::Nv12) +} + +/// Query the optional P010 backend capability. +/// # Safety +/// A current context and any supplied backend callback must be live. +#[unsafe(no_mangle)] +pub unsafe extern "C" fn gs_p010_available() -> bool { + core::available(&mut current(), Entry::P010) +} diff --git a/rust/obs-graphics/src/lib.rs b/rust/obs-graphics/src/lib.rs index e26131afb7..63106af02a 100644 --- a/rust/obs-graphics/src/lib.rs +++ b/rust/obs-graphics/src/lib.rs @@ -83,8 +83,8 @@ pub mod matrix3; pub mod matrix4; pub mod matrix_entrypoints; pub mod perspective; -pub mod plane; pub mod planar_capability_queries; +pub mod plane; mod platform; pub mod present_entrypoints; pub mod quat; diff --git a/rust/obs-graphics/src/planar_capability_queries.rs b/rust/obs-graphics/src/planar_capability_queries.rs index 8534e553c0..9348dd5e39 100644 --- a/rust/obs-graphics/src/planar_capability_queries.rs +++ b/rust/obs-graphics/src/planar_capability_queries.rs @@ -23,6 +23,10 @@ pub trait Host { fn dispatch(&mut self, entry: Entry) -> bool; } -pub fn available(_host: &mut H, _entry: Entry) -> bool { - todo!("planar capability query swap") +pub fn available(host: &mut H, entry: Entry) -> bool { + if !host.has_context() { + host.debug(entry); + return false; + } + host.has_callback(entry) && host.dispatch(entry) } diff --git a/rust/obs-graphics/tests/render/main.rs b/rust/obs-graphics/tests/render/main.rs index a0ec694ab5..87f2ff6753 100644 --- a/rust/obs-graphics/tests/render/main.rs +++ b/rust/obs-graphics/tests/render/main.rs @@ -52,6 +52,7 @@ mod matrix_entrypoints_parity; mod perspective; mod perspective_parity; mod planar_capability_queries; +mod planar_capability_queries_parity; mod present_entrypoints; mod present_entrypoints_parity; mod raster_entrypoints; diff --git a/rust/obs-graphics/tests/render/planar_capability_queries.rs b/rust/obs-graphics/tests/render/planar_capability_queries.rs index b277467fc6..fe58d45fdf 100644 --- a/rust/obs-graphics/tests/render/planar_capability_queries.rs +++ b/rust/obs-graphics/tests/render/planar_capability_queries.rs @@ -50,10 +50,16 @@ fn test_graphics_planar_capability_queries_no_context() { }; for i in 0..2 { assert!(!available(&mut host, Entry::Nv12)); - assert_eq!(host.logs.last().unwrap(), "gs_nv12_available: called while not in a graphics context"); + assert_eq!( + host.logs.last().unwrap(), + "gs_nv12_available: called while not in a graphics context" + ); assert_eq!(host.logs.len(), 2 * i + 1); assert!(!available(&mut host, Entry::P010)); - assert_eq!(host.logs.last().unwrap(), "gs_p010_available: called while not in a graphics context"); + assert_eq!( + host.logs.last().unwrap(), + "gs_p010_available: called while not in a graphics context" + ); assert_eq!(host.logs.len(), 2 * i + 2); assert_eq!(host.calls, [0, 0]); assert!(host.devices.is_empty()); diff --git a/rust/obs-graphics/tests/render/planar_capability_queries_parity.rs b/rust/obs-graphics/tests/render/planar_capability_queries_parity.rs new file mode 100644 index 0000000000..0879d5ec34 --- /dev/null +++ b/rust/obs-graphics/tests/render/planar_capability_queries_parity.rs @@ -0,0 +1,145 @@ +//! Tier 3: original C and the Rust ABI use real adapters over fake TLS devices. +//! No intentional differences; no host capability or GPU is queried. +use obs_c_oracle as _; +use obs_graphics::ffi::planar_capability_queries as rust; +use proptest::prelude::*; +use std::ffi::{CStr, c_char}; + +unsafe extern "C" { + fn oracle_gs_nv12_available() -> bool; + fn oracle_gs_p010_available() -> bool; + fn oracle_planar_capability_reset( + context: bool, + nv12: bool, + p010: bool, + nv12_result: bool, + p010_result: bool, + device: bool, + ); + fn oracle_planar_capability_calls(p010: bool) -> u32; + fn oracle_planar_capability_last_device() -> u32; + fn oracle_device_queries_logs() -> u32; + fn oracle_device_queries_level() -> i32; + fn oracle_device_queries_log() -> *const c_char; +} + +#[derive(Clone, Copy, Debug)] +struct State { + context: bool, + callbacks: [bool; 2], + results: [bool; 2], + device: bool, +} + +#[derive(Debug, PartialEq, Eq)] +struct Observed { + value: bool, + calls: [u32; 2], + last_device: u32, + logs: u32, + level: i32, + message: Vec, +} + +fn run(ported: bool, state: State, queries: &[bool]) -> Vec { + // SAFETY: all fixture state, devices, logging and callbacks are thread-local + // and live throughout the sequence. The C headers supply the real layouts. + unsafe { + oracle_planar_capability_reset( + state.context, + state.callbacks[0], + state.callbacks[1], + state.results[0], + state.results[1], + state.device, + ); + queries + .iter() + .map(|p010| { + let value = match (ported, p010) { + (true, false) => rust::gs_nv12_available(), + (true, true) => rust::gs_p010_available(), + (false, false) => oracle_gs_nv12_available(), + (false, true) => oracle_gs_p010_available(), + }; + Observed { + value, + calls: [ + oracle_planar_capability_calls(false), + oracle_planar_capability_calls(true), + ], + last_device: oracle_planar_capability_last_device(), + logs: oracle_device_queries_logs(), + level: oracle_device_queries_level(), + message: CStr::from_ptr(oracle_device_queries_log()) + .to_bytes() + .to_vec(), + } + }) + .collect() + } +} + +fn compare(state: State, queries: &[bool]) { + let original = run(false, state, queries); + let ported = run(true, state, queries); + assert_eq!(ported, original, "{state:?}, {queries:?}"); + let mut calls = [0; 2]; + let mut device = 2; + for (i, (&p010, observed)) in queries.iter().zip(ported).enumerate() { + let index = usize::from(p010); + let dispatch = state.context && state.callbacks[index]; + assert_eq!(observed.value, dispatch && state.results[index]); + if dispatch { + calls[index] += 1; + device = u32::from(state.device); + } + assert_eq!(observed.calls, calls); + assert_eq!(observed.last_device, device); + if state.context { + assert_eq!((observed.logs, observed.level), (0, 0)); + assert!(observed.message.is_empty()); + } else { + assert_eq!(observed.logs as usize, i + 1); + assert_eq!(observed.level, 400); + let function = if p010 { + "gs_p010_available" + } else { + "gs_nv12_available" + }; + assert_eq!( + observed.message, + format!("{function}: called while not in a graphics context").as_bytes() + ); + } + } +} + +#[test] +fn all_fake_device_callback_and_result_combinations_match_c() { + for bits in 0..64 { + compare( + State { + context: bits & 1 != 0, + callbacks: [bits & 2 != 0, bits & 4 != 0], + results: [bits & 8 != 0, bits & 16 != 0], + device: bits & 32 != 0, + }, + &[false, true, true, false], + ); + } +} + +proptest! { + #![proptest_config(ProptestConfig { + cases: obs_c_oracle::parity::cases(128), failure_persistence: None, ..ProptestConfig::default() + })] + #[test] + fn bounded_query_sequences_match_c( + context in any::(), callbacks in any::<[bool; 2]>(), + results in any::<[bool; 2]>(), device in any::(), + queries in prop::collection::vec(any::(), 0..=16), + ) { + compare(State { context, callbacks, results, device }, &queries); + } +}