mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-11-22 02:59:39 +08:00
41 lines
1.5 KiB
Rust
41 lines
1.5 KiB
Rust
mod context;
|
|
mod effect_pipeline;
|
|
mod mask_feather;
|
|
mod sdf_pipeline;
|
|
mod shader_registry;
|
|
|
|
use thiserror::Error;
|
|
|
|
pub use wgpu;
|
|
pub use context::GpuContext;
|
|
pub use effect_pipeline::{ApplyEffectsOptions, EffectPass, UniformValue};
|
|
pub use mask_feather::ApplyMaskFeatherOptions;
|
|
|
|
pub const GPU_TEXTURE_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Bgra8Unorm;
|
|
|
|
#[derive(Debug, Error)]
|
|
pub enum GpuError {
|
|
#[error("No WebGPU adapter is available")]
|
|
AdapterUnavailable,
|
|
#[error("Failed to request a WebGPU device: {0}")]
|
|
RequestDevice(#[from] wgpu::RequestDeviceError),
|
|
#[error("Failed to create a WebGPU surface: {0}")]
|
|
CreateSurface(#[from] wgpu::CreateSurfaceError),
|
|
#[error("The output surface does not support the required texture format")]
|
|
UnsupportedSurfaceFormat,
|
|
#[error("Unknown effect shader '{shader}'")]
|
|
UnknownEffectShader { shader: String },
|
|
#[error("Missing uniform '{uniform}' for shader '{shader}'")]
|
|
MissingUniform { shader: String, uniform: String },
|
|
#[error("Uniform '{uniform}' for shader '{shader}' must be a number")]
|
|
InvalidNumberUniform { shader: String, uniform: String },
|
|
#[error("Uniform '{uniform}' for shader '{shader}' must be a vector of length {expected_length}")]
|
|
InvalidVectorUniform {
|
|
shader: String,
|
|
uniform: String,
|
|
expected_length: usize,
|
|
},
|
|
#[error("Shader '{shader}' does not support uniform '{uniform}'")]
|
|
UnsupportedUniform { shader: String, uniform: String },
|
|
}
|