Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note about context drop requirements #293

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@ pub struct ProgramBinary {
pub format: u32,
}

/// A trait for types that can be used as a context for OpenGL, OpenGL ES, and WebGL functions.
///
/// This trait is sealed and cannot be implemented outside of this crate.
///
/// # Safety
///
/// All GL API usage must be valid. For example, each function call should follow the rules in the
/// relevant GL specification for the type of context being used. This crate doesn't enforce these
/// rules, so it is up to the caller to ensure they're followed.
///
/// The context implementing this trait must be current when it is dropped. This is necessary to
/// ensure that certain context state can be deleted on the correct thread. Usually this is only
/// a concern for desktop GL contexts that are shared between threads.
grovesNL marked this conversation as resolved.
Show resolved Hide resolved
pub trait HasContext: __private::Sealed {
type Shader: Copy + Clone + Debug + Eq + Hash + Ord + PartialEq + PartialOrd;
type Program: Copy + Clone + Debug + Eq + Hash + Ord + PartialEq + PartialOrd;
Expand Down
Loading