doc: update opengl example

This commit is contained in:
chyyran 2024-08-10 23:45:55 -04:00 committed by Ronny Chan
parent 2f9df143cf
commit e6d23f1d8f
3 changed files with 2 additions and 10 deletions

View file

@ -33,15 +33,9 @@ libra_gl_filter_chain_t load_gl_filter_chain(libra_gl_loader_t opengl, const cha
std::cout << "Could not load preset\n"; std::cout << "Could not load preset\n";
return NULL; return NULL;
} }
// OpenGL runtime needs to be initialized.
if (librashader.gl_init_context(opengl) != NULL) {
std::cout << "Could not initialize OpenGL context\n";
return NULL;
}
libra_gl_filter_chain_t chain; libra_gl_filter_chain_t chain;
if (librashader.gl_filter_chain_create(&preset, NULL, &chain) { if (librashader.gl_filter_chain_create(&preset, opengl, NULL, &chain) {
std::cout << "Could not create OpenGL filter chain\n"; std::cout << "Could not create OpenGL filter chain\n";
} }
return chain; return chain;

View file

@ -305,6 +305,7 @@ extern_fn! {
/// The resulting value in `chain` then becomes null. /// The resulting value in `chain` then becomes null.
/// ## Safety /// ## Safety
/// - `chain` must be either null or a valid and aligned pointer to an initialized `libra_gl_filter_chain_t`. /// - `chain` must be either null or a valid and aligned pointer to an initialized `libra_gl_filter_chain_t`.
/// - The context that the filter chain was initialized with **must be current** before freeing the filter chain.
fn libra_gl_filter_chain_free( fn libra_gl_filter_chain_free(
chain: *mut libra_gl_filter_chain_t chain: *mut libra_gl_filter_chain_t
) { ) {

View file

@ -259,9 +259,6 @@ pub mod runtime {
/// Shader runtime for OpenGL 3.3+. /// Shader runtime for OpenGL 3.3+.
/// ///
/// DSA support requires OpenGL 4.6. /// DSA support requires OpenGL 4.6.
///
/// The OpenGL runtime requires `gl` to be
/// initialized with [`gl::load_with`](https://docs.rs/gl/0.14.0/gl/fn.load_with.html).
pub mod gl { pub mod gl {
pub use librashader_runtime_gl::{ pub use librashader_runtime_gl::{
error, error,