core: merge oak-common into oak-core
CI / Build & test (Linux) (push) Successful in 24m6s
CI / Build & test (Windows) (push) Successful in 31m14s

oak-common is gone; its modules (configstore, xmlutils, ocioutils,
oiioutils, colormath, colortransform, videoparams, ffmpegutils, ...)
now live in oak-core alongside the value types. The render value/GPU
types moved too: backend (wgpu context + DisplayRenderer), color
(ColorProcessor over ocio-rs), texture, frame, and the commonutil
config helpers.

Fix-ups to make the merged tree build and pass tests:

- oak-core Cargo.toml: wgpu back to 25 (the moved backend code is
  written against that API generation); add the toml/quick-xml/image
  deps oak-common carried.
- lib.rs: drop the duplicate 'pub mod error;'.
- error.rs: unified OAKCORE_* codes; restore Error::new() and
  From<OcioError> from oak-common's error type.
- backend.rs/color.rs: oak_core::/oak_render:: self-references
  rewritten to crate::; the shaderfx-dependent GPU effect test moved
  to oak-render's shaderfx tests (shaderfx depends on oak-node and
  cannot live in oak-core).
- oak-render's error module re-exports oak_core::error::{Error,
  Result}; the OAKRENDER_* codes stay as the public-code contract.
- oak-node jobs.rs: ColorProcessor imported from oak_core::color.
- Integration tests repointed at oak_core::{texture, frame, backend,
  color, colormath}.
- the display-ICC regression test treats an empty OAK_DISPLAY_ICC as
  unset, matching displayicc::env_override_icc.
This commit is contained in:
2026-09-03 17:42:20 +08:00
parent 49fed365a4
commit 4babbf5de8
150 changed files with 3052 additions and 4030 deletions
+8 -45
View File
@@ -16,6 +16,13 @@
//! Error codes, mirroring `include/render/error.h` verbatim; project-wide
//! -MMCCCC scheme (module registry in include/common/error.h), pass-through untranslated.
//!
//! With the oak-common/oak-core merge the render value/GPU types moved into
//! `oak-core`, so this crate no longer carries its own error enum:
//! [`Error`]/[`Result`] are re-exported from [`oak_core::error`] (identical
//! variant shape and messages). The `OAKRENDER_*` codes below remain as the
//! module's public-code contract; `Error::code()` reports the unified
//! `OAKCORE_*` values.
/// Success.
pub const OAKRENDER_OK: i32 = 0;
@@ -30,41 +37,7 @@ pub const OAKRENDER_E_NOT_FOUND: i32 = -70004;
/// Allocation failed.
pub const OAKRENDER_E_NOMEM: i32 = -70005;
/// Crate-internal result type.
pub type Result<T> = std::result::Result<T, Error>;
/// Crate-internal error.
#[derive(Clone, Debug, thiserror::Error)]
pub enum Error {
/// Null handle or invalid argument.
#[error("render: invalid argument")]
Invalid,
/// Wrong state.
#[error("render: invalid state")]
State,
/// Operation failed (context string is log-only).
#[error("render: operation failed: {0}")]
Failed(String),
/// Not found.
#[error("render: not found")]
NotFound,
/// Out of memory.
#[error("render: out of memory")]
NoMem,
}
impl Error {
/// Map to the public error code.
pub fn code(&self) -> i32 {
match self {
Error::Invalid => OAKRENDER_E_INVALID,
Error::State => OAKRENDER_E_STATE,
Error::Failed(_) => OAKRENDER_E_FAILED,
Error::NotFound => OAKRENDER_E_NOT_FOUND,
Error::NoMem => OAKRENDER_E_NOMEM,
}
}
}
pub use oak_core::error::{Error, Result};
#[cfg(test)]
mod tests {
@@ -108,14 +81,4 @@ mod tests {
fn source_is_none() {
assert!(std::error::Error::source(&Error::Failed("context".into())).is_none());
}
/// The `code()` mapping must be unchanged by the `Error` trait impl.
#[test]
fn code_mapping_unchanged() {
assert_eq!(Error::Invalid.code(), OAKRENDER_E_INVALID);
assert_eq!(Error::State.code(), OAKRENDER_E_STATE);
assert_eq!(Error::Failed("context".into()).code(), OAKRENDER_E_FAILED);
assert_eq!(Error::NotFound.code(), OAKRENDER_E_NOT_FOUND);
assert_eq!(Error::NoMem.code(), OAKRENDER_E_NOMEM);
}
}