Skip to main content

ez_ffmpeg/opengl/
error.rs

1//! Typed error for constructing [`OpenGLFrameFilter`].
2//!
3//! [`OpenGLFrameFilter`]: crate::opengl::opengl_frame_filter::OpenGLFrameFilter
4
5/// Errors from the [`OpenGLFrameFilter`] constructors (mirrors
6/// `WgpuFilterError` for the wgpu feature; converts into
7/// [`crate::error::Error::OpenGLFilter`]).
8///
9/// Runtime failures (shader compilation and linking, GL object creation,
10/// frame upload and readback) surface through the pipeline as
11/// [`FrameFilterError`](crate::filter::frame_filter::FrameFilterError)
12/// instead — this type covers what can go wrong before a frame flows.
13///
14/// [`OpenGLFrameFilter`]: crate::opengl::opengl_frame_filter::OpenGLFrameFilter
15#[derive(thiserror::Error, Debug)]
16#[non_exhaustive]
17pub enum OpenGLFilterError {
18    /// A constructor option is invalid: the fragment shader passed to
19    /// `new_simple` is missing the `in vec2 TexCoord;` input that the
20    /// default vertex shader feeds.
21    #[error("invalid OpenGL filter option: {0}")]
22    InvalidOption(String),
23
24    /// Surfman could not provide a GL device or context: no display
25    /// connection, no usable adapter, or the requested GL version is
26    /// unsupported.
27    #[error("OpenGL context creation failed: {0}")]
28    ContextCreation(String),
29}