Skip to content

Commit

Permalink
helper methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mrDIMAS committed Feb 16, 2025
1 parent 45ff3e3 commit 8b7e036
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions fyrox-graphics/src/framebuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ pub enum BufferLocation {
},
}

impl BufferLocation {
/// Creates a new explicit binding point.
pub fn new(binding: usize) -> Self {
Self::Explicit { binding }
}
}

/// A resource binding defines where to bind specific GPU resources.
pub enum ResourceBinding {
/// Texture binding.
Expand Down Expand Up @@ -144,6 +151,19 @@ impl ResourceBinding {
shader_location: TextureShaderLocation::ExplicitBinding(binding),
}
}

/// Creates a new explicit buffer binding. See [`BufferLocation::Explicit`] for more info.
pub fn buffer_with_binding(
buffer: &GpuBuffer,
binding: usize,
data_usage: BufferDataUsage,
) -> Self {
Self::Buffer {
buffer: buffer.clone(),
binding: BufferLocation::new(binding),
data_usage,
}
}
}

/// Resource binding group defines a set of bindings.
Expand Down

0 comments on commit 8b7e036

Please sign in to comment.