Skip to content

Commit c90ba3a

Browse files
committed
[add] documentation.
1 parent dce03c9 commit c90ba3a

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

crates/lambda-platform/src/gfx/buffer.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ impl BufferBuilder {
4545
return self;
4646
}
4747

48+
/// Builds & binds a buffer of memory to the GPU. If the buffer cannot be
49+
/// bound to the GPU, the buffer memory is freed before the error is returned.
4850
pub fn build<RenderBackend: super::internal::Backend>(
4951
self,
5052
gpu: &mut Gpu<RenderBackend>,
@@ -57,8 +59,9 @@ impl BufferBuilder {
5759
let logical_device = super::internal::logical_device_for(gpu);
5860
let physical_device = super::internal::physical_device_for(gpu);
5961

60-
// Allocate buffer
61-
let mut buffer_result = unsafe {
62+
// TODO(vmarcella): Add the ability for the user to specify the memory
63+
// properties (I.E. SparseFlags::SPARSE_MEMORY).
64+
let buffer_result = unsafe {
6265
logical_device.create_buffer(
6366
self.buffer_length as u64,
6467
self.usage,
@@ -87,6 +90,7 @@ impl BufferBuilder {
8790
.map(|(id, _)| MemoryTypeId(id))
8891
.unwrap();
8992

93+
// Allocates the memory on the GPU for the buffer.
9094
let buffer_memory_allocation =
9195
unsafe { logical_device.allocate_memory(memory_type, requirements.size) };
9296

@@ -96,6 +100,7 @@ impl BufferBuilder {
96100

97101
let buffer_memory = buffer_memory_allocation.unwrap();
98102

103+
// Bind the buffer to the GPU memory
99104
let buffer_binding = unsafe {
100105
logical_device.bind_buffer_memory(&buffer_memory, 0, &mut buffer)
101106
};

lambda/src/math/matrix.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ where
289289
return result;
290290
}
291291

292+
/// Transposes the matrix, swapping the rows and columns.
292293
fn transpose(&self) -> Self {
293294
let mut result = Self::default();
294295
for (i, a) in self.as_ref().iter().enumerate() {

0 commit comments

Comments
 (0)