diff --git a/Cargo.lock b/Cargo.lock index bed557929..f3f6c4988 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3863,18 +3863,18 @@ checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" [[package]] name = "pvm-gpu-wire" -version = "0.1.8" -source = "git+https://github.com/paritytech/pvm-host-runtime.git?rev=530885a9d6dbf5a2742d4f2ff9f5c71b05f2a762#530885a9d6dbf5a2742d4f2ff9f5c71b05f2a762" +version = "0.1.10" +source = "git+https://github.com/paritytech/pvm-host-runtime.git?rev=5d7b86b46842a31c6ca8de2d23c2c7926b12f14e#5d7b86b46842a31c6ca8de2d23c2c7926b12f14e" [[package]] name = "pvm-motion-wire" -version = "0.1.8" -source = "git+https://github.com/paritytech/pvm-host-runtime.git?rev=530885a9d6dbf5a2742d4f2ff9f5c71b05f2a762#530885a9d6dbf5a2742d4f2ff9f5c71b05f2a762" +version = "0.1.10" +source = "git+https://github.com/paritytech/pvm-host-runtime.git?rev=5d7b86b46842a31c6ca8de2d23c2c7926b12f14e#5d7b86b46842a31c6ca8de2d23c2c7926b12f14e" [[package]] name = "pvm-runtime" -version = "0.1.8" -source = "git+https://github.com/paritytech/pvm-host-runtime.git?rev=530885a9d6dbf5a2742d4f2ff9f5c71b05f2a762#530885a9d6dbf5a2742d4f2ff9f5c71b05f2a762" +version = "0.1.10" +source = "git+https://github.com/paritytech/pvm-host-runtime.git?rev=5d7b86b46842a31c6ca8de2d23c2c7926b12f14e#5d7b86b46842a31c6ca8de2d23c2c7926b12f14e" dependencies = [ "anyhow", "log", @@ -3883,6 +3883,7 @@ dependencies = [ "pollster", "pvm-gpu-wire", "pvm-motion-wire", + "pvm-ui-wire", "serde", "serde_json", "thiserror 1.0.69", @@ -3893,8 +3894,13 @@ dependencies = [ [[package]] name = "pvm-runtime-assets" -version = "0.1.8" -source = "git+https://github.com/paritytech/pvm-host-runtime.git?rev=530885a9d6dbf5a2742d4f2ff9f5c71b05f2a762#530885a9d6dbf5a2742d4f2ff9f5c71b05f2a762" +version = "0.1.10" +source = "git+https://github.com/paritytech/pvm-host-runtime.git?rev=5d7b86b46842a31c6ca8de2d23c2c7926b12f14e#5d7b86b46842a31c6ca8de2d23c2c7926b12f14e" + +[[package]] +name = "pvm-ui-wire" +version = "0.1.10" +source = "git+https://github.com/paritytech/pvm-host-runtime.git?rev=5d7b86b46842a31c6ca8de2d23c2c7926b12f14e#5d7b86b46842a31c6ca8de2d23c2c7926b12f14e" [[package]] name = "pxfm" diff --git a/README.md b/README.md index 5fdd6ecc9..59956c1bd 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ scripts/codegen.sh Regenerate the TS client from the Rust source scripts/battery.sh Run the generated battery against both headless CLI host roles ``` -The PolkaVM application runtime, GPU wire contract, browser workers, and +The PolkaVM application runtime, GPU/UI wire contracts, browser workers, and reproducible browser assets live in [`paritytech/pvm-host-runtime`](https://github.com/paritytech/pvm-host-runtime). Hosts integrate through `truapi-pvm-host`, which pins one reviewed runtime diff --git a/deny.toml b/deny.toml index b2f4d849d..40e814e85 100644 --- a/deny.toml +++ b/deny.toml @@ -45,6 +45,7 @@ exceptions = [ # so their Rust and browser implementations retain file-level copyleft. { name = "pvm-gpu-wire", allow = ["MPL-2.0"] }, { name = "pvm-motion-wire", allow = ["MPL-2.0"] }, + { name = "pvm-ui-wire", allow = ["MPL-2.0"] }, { name = "pvm-runtime", allow = ["MPL-2.0"] }, { name = "pvm-runtime-assets", allow = ["MPL-2.0"] }, { name = "uniffi", allow = ["MPL-2.0"] }, diff --git a/ios/truapi-host/Sources/TrUAPIHost/pvm_runtime.swift b/ios/truapi-host/Sources/TrUAPIHost/pvm_runtime.swift index a108675f9..7d0ccf5f9 100644 --- a/ios/truapi-host/Sources/TrUAPIHost/pvm_runtime.swift +++ b/ios/truapi-host/Sources/TrUAPIHost/pvm_runtime.swift @@ -677,6 +677,8 @@ public protocol NativePvmRuntimeProtocol: AnyObject, Sendable { func takeTri2d() throws -> NativePvmTri2dFrame? + func takeUiOutput() throws -> NativePvmUiOutputFrame? + func takeUiSemantics() throws -> NativePvmUiSemanticsFrame? func update() throws @@ -944,6 +946,15 @@ open func takeTri2d()throws -> NativePvmTri2dFrame? { }) } +open func takeUiOutput()throws -> NativePvmUiOutputFrame? { + return try FfiConverterOptionTypeNativePvmUiOutputFrame.lift(try rustCallWithError(FfiConverterTypeNativePvmError_lift) { + uniffiCallStatus in + uniffi_pvm_runtime_fn_method_nativepvmruntime_take_ui_output( + self.uniffiCloneHandle(),uniffiCallStatus + ) +}) +} + open func takeUiSemantics()throws -> NativePvmUiSemanticsFrame? { return try FfiConverterOptionTypeNativePvmUiSemanticsFrame.lift(try rustCallWithError(FfiConverterTypeNativePvmError_lift) { uniffiCallStatus in @@ -1366,6 +1377,56 @@ public func FfiConverterTypeNativePvmTri2dFrame_lower(_ value: NativePvmTri2dFra } +public struct NativePvmUiOutputFrame: Equatable, Hashable { + public var bytes: Data + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(bytes: Data) { + self.bytes = bytes + } + + + + +} + +#if compiler(>=6) +extension NativePvmUiOutputFrame: Sendable {} +#endif + +#if swift(>=5.8) +@_documentation(visibility: private) +#endif +public struct FfiConverterTypeNativePvmUiOutputFrame: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NativePvmUiOutputFrame { + return + try NativePvmUiOutputFrame( + bytes: FfiConverterData.read(from: &buf) + ) + } + + public static func write(_ value: NativePvmUiOutputFrame, into buf: inout [UInt8]) { + FfiConverterData.write(value.bytes, into: &buf) + } +} + + +#if swift(>=5.8) +@_documentation(visibility: private) +#endif +public func FfiConverterTypeNativePvmUiOutputFrame_lift(_ buf: RustBuffer) throws -> NativePvmUiOutputFrame { + return try FfiConverterTypeNativePvmUiOutputFrame.lift(buf) +} + +#if swift(>=5.8) +@_documentation(visibility: private) +#endif +public func FfiConverterTypeNativePvmUiOutputFrame_lower(_ value: NativePvmUiOutputFrame) -> RustBuffer { + return FfiConverterTypeNativePvmUiOutputFrame.lower(value) +} + + public struct NativePvmUiSemanticsFrame: Equatable, Hashable { public var bytes: Data @@ -1994,6 +2055,30 @@ fileprivate struct FfiConverterOptionTypeNativePvmTri2dFrame: FfiConverterRustBu } } +#if swift(>=5.8) +@_documentation(visibility: private) +#endif +fileprivate struct FfiConverterOptionTypeNativePvmUiOutputFrame: FfiConverterRustBuffer { + typealias SwiftType = NativePvmUiOutputFrame? + + public static func write(_ value: SwiftType, into buf: inout [UInt8]) { + guard let value = value else { + writeInt(&buf, Int8(0)) + return + } + writeInt(&buf, Int8(1)) + FfiConverterTypeNativePvmUiOutputFrame.write(value, into: &buf) + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { + switch try readInt(&buf) as Int8 { + case 0: return nil + case 1: return try FfiConverterTypeNativePvmUiOutputFrame.read(from: &buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + #if swift(>=5.8) @_documentation(visibility: private) #endif @@ -2146,6 +2231,9 @@ private let initializationResult: InitializationResult = { if (uniffi_pvm_runtime_checksum_method_nativepvmruntime_take_tri2d() != 20193) { return InitializationResult.apiChecksumMismatch } + if (uniffi_pvm_runtime_checksum_method_nativepvmruntime_take_ui_output() != 44263) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_pvm_runtime_checksum_method_nativepvmruntime_take_ui_semantics() != 2159) { return InitializationResult.apiChecksumMismatch } diff --git a/ios/truapi-host/Sources/pvm_runtimeFFI/include/pvm_runtimeFFI.h b/ios/truapi-host/Sources/pvm_runtimeFFI/include/pvm_runtimeFFI.h index cdcdf941e..084caa62f 100644 --- a/ios/truapi-host/Sources/pvm_runtimeFFI/include/pvm_runtimeFFI.h +++ b/ios/truapi-host/Sources/pvm_runtimeFFI/include/pvm_runtimeFFI.h @@ -363,6 +363,11 @@ RustBuffer uniffi_pvm_runtime_fn_method_nativepvmruntime_take_save(uint64_t ptr, RustBuffer uniffi_pvm_runtime_fn_method_nativepvmruntime_take_tri2d(uint64_t ptr, RustCallStatus *_Nonnull out_status ); #endif +#ifndef UNIFFI_FFIDEF_UNIFFI_PVM_RUNTIME_FN_METHOD_NATIVEPVMRUNTIME_TAKE_UI_OUTPUT +#define UNIFFI_FFIDEF_UNIFFI_PVM_RUNTIME_FN_METHOD_NATIVEPVMRUNTIME_TAKE_UI_OUTPUT +RustBuffer uniffi_pvm_runtime_fn_method_nativepvmruntime_take_ui_output(uint64_t ptr, RustCallStatus *_Nonnull out_status +); +#endif #ifndef UNIFFI_FFIDEF_UNIFFI_PVM_RUNTIME_FN_METHOD_NATIVEPVMRUNTIME_TAKE_UI_SEMANTICS #define UNIFFI_FFIDEF_UNIFFI_PVM_RUNTIME_FN_METHOD_NATIVEPVMRUNTIME_TAKE_UI_SEMANTICS RustBuffer uniffi_pvm_runtime_fn_method_nativepvmruntime_take_ui_semantics(uint64_t ptr, RustCallStatus *_Nonnull out_status @@ -762,6 +767,12 @@ uint16_t uniffi_pvm_runtime_checksum_method_nativepvmruntime_take_save(void #define UNIFFI_FFIDEF_UNIFFI_PVM_RUNTIME_CHECKSUM_METHOD_NATIVEPVMRUNTIME_TAKE_TRI2D uint16_t uniffi_pvm_runtime_checksum_method_nativepvmruntime_take_tri2d(void +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_PVM_RUNTIME_CHECKSUM_METHOD_NATIVEPVMRUNTIME_TAKE_UI_OUTPUT +#define UNIFFI_FFIDEF_UNIFFI_PVM_RUNTIME_CHECKSUM_METHOD_NATIVEPVMRUNTIME_TAKE_UI_OUTPUT +uint16_t uniffi_pvm_runtime_checksum_method_nativepvmruntime_take_ui_output(void + ); #endif #ifndef UNIFFI_FFIDEF_UNIFFI_PVM_RUNTIME_CHECKSUM_METHOD_NATIVEPVMRUNTIME_TAKE_UI_SEMANTICS diff --git a/rust/crates/truapi-pvm-host/Cargo.toml b/rust/crates/truapi-pvm-host/Cargo.toml index ad95f6c41..938965cf0 100644 --- a/rust/crates/truapi-pvm-host/Cargo.toml +++ b/rust/crates/truapi-pvm-host/Cargo.toml @@ -14,8 +14,8 @@ browser-assets = ["dep:pvm-runtime-assets"] native-gpu = ["pvm-runtime/native-gpu"] [dependencies] -pvm-runtime = { git = "https://github.com/paritytech/pvm-host-runtime.git", rev = "530885a9d6dbf5a2742d4f2ff9f5c71b05f2a762" } -pvm-runtime-assets = { git = "https://github.com/paritytech/pvm-host-runtime.git", rev = "530885a9d6dbf5a2742d4f2ff9f5c71b05f2a762", optional = true } +pvm-runtime = { git = "https://github.com/paritytech/pvm-host-runtime.git", rev = "5d7b86b46842a31c6ca8de2d23c2c7926b12f14e" } +pvm-runtime-assets = { git = "https://github.com/paritytech/pvm-host-runtime.git", rev = "5d7b86b46842a31c6ca8de2d23c2c7926b12f14e", optional = true } [lints] workspace = true diff --git a/rust/crates/truapi-pvm-host/src/lib.rs b/rust/crates/truapi-pvm-host/src/lib.rs index 01a8e833a..cc3cf10ca 100644 --- a/rust/crates/truapi-pvm-host/src/lib.rs +++ b/rust/crates/truapi-pvm-host/src/lib.rs @@ -10,7 +10,7 @@ pub use pvm_runtime::*; pub use pvm_runtime_assets::{BrowserAsset, RUNTIME_VERSION, browser_assets}; /// Immutable standalone runtime source consumed by this bridge release. -pub const RUNTIME_SOURCE_REVISION: &str = "530885a9d6dbf5a2742d4f2ff9f5c71b05f2a762"; +pub const RUNTIME_SOURCE_REVISION: &str = "5d7b86b46842a31c6ca8de2d23c2c7926b12f14e"; #[cfg(test)] mod tests { @@ -29,7 +29,7 @@ mod tests { #[cfg(feature = "browser-assets")] #[test] fn browser_assets_are_complete_and_source_identified() { - assert_eq!(RUNTIME_VERSION, "0.1.8"); + assert_eq!(RUNTIME_VERSION, "0.1.10"); assert_eq!(browser_assets().len(), 7); assert!( browser_assets()