Skip to content

Commit

Permalink
Merge pull request #2102 from justincredible/doc-test-doc
Browse files Browse the repository at this point in the history
Fix `VertexFormat` and framebuffer docs
  • Loading branch information
est31 committed Mar 1, 2024
2 parents 4d2ac02 + 99bd76c commit b1786fe
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
14 changes: 7 additions & 7 deletions src/framebuffer/mod.rs
Expand Up @@ -134,7 +134,7 @@ impl<'a> SimpleFrameBuffer<'a> {
Some(depth.to_depth_attachment()), None, None)
}

/// Creates a `SimpleFrameBuffer` with a single color attachment and no depth
/// Creates a `SimpleFrameBuffer` with a depth buffer and no color attachment
/// nor stencil buffer.
#[inline]
pub fn depth_only<F: ?Sized, D>(facade: &F, depth: D)
Expand All @@ -160,8 +160,8 @@ impl<'a> SimpleFrameBuffer<'a> {
Some(stencil.to_stencil_attachment()), None)
}

/// Creates a `SimpleFrameBuffer` with a single color attachment and no depth
/// nor stencil buffer.
/// Creates a `SimpleFrameBuffer` with a depth buffer and a stencil buffer,
/// but no color attachment.
#[inline]
pub fn depth_and_stencil_only<F: ?Sized, D, S>(facade: &F, depth: D, stencil: S)
-> Result<SimpleFrameBuffer<'a>, ValidationError>
Expand All @@ -184,8 +184,8 @@ impl<'a> SimpleFrameBuffer<'a> {
Some(stencil.to_stencil_attachment()), None)
}

/// Creates a `SimpleFrameBuffer` with a single color attachment and a stencil
/// buffer, but no depth buffer.
/// Creates a `SimpleFrameBuffer` with a stencil buffer and no color attachment
/// nor depth buffer.
#[inline]
pub fn stencil_only<F: ?Sized, S>(facade: &F, stencil: S)
-> Result<SimpleFrameBuffer<'a>, ValidationError>
Expand All @@ -206,7 +206,7 @@ impl<'a> SimpleFrameBuffer<'a> {
Some(depthstencil.to_depth_stencil_attachment()))
}

/// Creates a `SimpleFrameBuffer` with a single color attachment and a depth-stencil buffer.
/// Creates a `SimpleFrameBuffer` with a depth-stencil buffer and no color attachment.
#[inline]
pub fn depth_stencil_only<F: ?Sized, D>(facade: &F, depthstencil: D)
-> Result<SimpleFrameBuffer<'a>, ValidationError>
Expand Down Expand Up @@ -354,7 +354,7 @@ impl<'a> FboAttachments for SimpleFrameBuffer<'a> {
}
}

/// This struct is useless for the moment.
/// A framebuffer which has multiple color attachments.
pub struct MultiOutputFrameBuffer<'a> {
context: Rc<Context>,
example_attachments: fbo::ValidatedAttachments<'a>,
Expand Down
10 changes: 5 additions & 5 deletions src/vertex/buffer.rs
Expand Up @@ -238,24 +238,24 @@ impl<T> VertexBuffer<T> where T: Copy {
/// # fn example<T>(display: glium::Display<T>) where T: SurfaceTypeTrait + ResizeableSurface {
/// use std::borrow::Cow;
///
/// let bindings = Cow::Owned(vec![(
/// Cow::Borrowed("position"), 0,
/// const BINDINGS: glium::vertex::VertexFormat = &[(
/// Cow::Borrowed("position"), 0, -1,
/// glium::vertex::AttributeType::F32F32,
/// false,
/// ), (
/// Cow::Borrowed("color"), 2 * ::std::mem::size_of::<f32>(),
/// Cow::Borrowed("color"), 2 * ::std::mem::size_of::<f32>(), -1,
/// glium::vertex::AttributeType::F32,
/// false,
/// ),
/// ]);
/// ];
///
/// let data = vec![
/// 1.0, -0.3, 409.0,
/// -0.4, 2.8, 715.0f32
/// ];
///
/// let vertex_buffer = unsafe {
/// glium::VertexBuffer::new_raw(&display, &data, bindings, 3 * ::std::mem::size_of::<f32>())
/// glium::VertexBuffer::new_raw(&display, &data, BINDINGS, 3 * ::std::mem::size_of::<f32>())
/// };
/// # }
/// ```
Expand Down
3 changes: 2 additions & 1 deletion src/vertex/format.rs
Expand Up @@ -407,7 +407,8 @@ impl AttributeType {
///
/// The first element is the name of the binding, the second element
/// is the offset from the start of each vertex to this element, the
/// third element is the type and the fourth element indicates whether
/// third element is the layout location specified in the shader, the
/// fourth element is the type and the fifth element indicates whether
/// or not the element should use fixed-point normalization when
/// binding in a VAO.
pub type VertexFormat = &'static [(Cow<'static, str>, usize, i32, AttributeType, bool)];
Expand Down

0 comments on commit b1786fe

Please sign in to comment.