Skip to content

Commit

Permalink
Autoformat README and fix new manual slice size calculation lint
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Aug 16, 2023
1 parent 9ecb39c commit a273383
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 28 deletions.
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# 馃搾 gpu-allocator


[![Actions Status](https://img.shields.io/github/actions/workflow/status/Traverse-Research/gpu-allocator/ci.yml?branch=main&logo=github)](https://github.com/Traverse-Research/gpu-allocator/actions)
[![Latest version](https://img.shields.io/crates/v/gpu-allocator.svg?logo=rust)](https://crates.io/crates/gpu-allocator)
[![Docs](https://img.shields.io/docsrs/gpu-allocator?logo=docs.rs)](https://docs.rs/gpu-allocator/)
Expand All @@ -17,14 +16,14 @@ gpu-allocator = "0.22.0"

This crate provides a fully written in Rust memory allocator for Vulkan and DirectX 12.

### [Windows-rs] and [winapi]
## [Windows-rs] and [winapi]

`gpu-allocator` recently migrated from [winapi] to [windows-rs] but still provides convenient helpers to convert to and from [winapi] types, enabled when compiling with the `public-winapi` crate feature.

[Windows-rs]: https://github.com/microsoft/windows-rs
[winapi]: https://github.com/retep998/winapi-rs

### Setting up the Vulkan memory allocator
## Setting up the Vulkan memory allocator

```rust
use gpu_allocator::vulkan::*;
Expand All @@ -39,13 +38,12 @@ let mut allocator = Allocator::new(&AllocatorCreateDesc {
});
```

### Simple Vulkan allocation example
## Simple Vulkan allocation example

```rust
use gpu_allocator::vulkan::*;
use gpu_allocator::MemoryLocation;


// Setup vulkan info
let vk_info = vk::BufferCreateInfo::builder()
.size(512)
Expand All @@ -71,7 +69,7 @@ allocator.free(allocation).unwrap();
unsafe { device.destroy_buffer(buffer, None) };
```

### Setting up the D3D12 memory allocator
## Setting up the D3D12 memory allocator

```rust
use gpu_allocator::d3d12::*;
Expand All @@ -83,7 +81,7 @@ let mut allocator = Allocator::new(&AllocatorCreateDesc {
});
```

### Simple d3d12 allocation example
## Simple d3d12 allocation example

```rust
use gpu_allocator::d3d12::*;
Expand Down Expand Up @@ -129,19 +127,20 @@ drop(resource);
allocator.free(allocation).unwrap();
```

### License
## License

Licensed under either of

* Apache License, Version 2.0, ([LICENSE-APACHE](../master/LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](../master/LICENSE-MIT) or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0, ([LICENSE-APACHE](../master/LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](../master/LICENSE-MIT) or http://opensource.org/licenses/MIT)

at your option.

### Alternative libraries
* [vk-mem-rs](https://github.com/gwihlidal/vk-mem-rs)
## Alternative libraries

- [vk-mem-rs](https://github.com/gwihlidal/vk-mem-rs)

### Contribution
## Contribution

Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
Expand Down
14 changes: 7 additions & 7 deletions README.tpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# 馃搾 gpu-allocator


[![Actions Status](https://img.shields.io/github/actions/workflow/status/Traverse-Research/gpu-allocator/ci.yml?branch=main&logo=github)](https://github.com/Traverse-Research/gpu-allocator/actions)
[![Latest version](https://img.shields.io/crates/v/gpu-allocator.svg?logo=rust)](https://crates.io/crates/gpu-allocator)
[![Docs](https://img.shields.io/docsrs/gpu-allocator?logo=docs.rs)](https://docs.rs/gpu-allocator/)
Expand All @@ -17,19 +16,20 @@ gpu-allocator = "0.22.0"

{{readme}}

### License
## License

Licensed under either of

* Apache License, Version 2.0, ([LICENSE-APACHE](../master/LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](../master/LICENSE-MIT) or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0, ([LICENSE-APACHE](../master/LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](../master/LICENSE-MIT) or http://opensource.org/licenses/MIT)

at your option.

### Alternative libraries
* [vk-mem-rs](https://github.com/gwihlidal/vk-mem-rs)
## Alternative libraries

- [vk-mem-rs](https://github.com/gwihlidal/vk-mem-rs)

### Contribution
## Contribution

Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
Expand Down
4 changes: 2 additions & 2 deletions examples/d3d12-visualization/imgui_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ impl ImGuiRenderer {

D3D12_VERTEX_BUFFER_VIEW {
BufferLocation: address,
SizeInBytes: (vertices.len() * stride) as u32,
SizeInBytes: std::mem::size_of_val(vertices) as u32,
StrideInBytes: stride as u32,
}
};
Expand All @@ -802,7 +802,7 @@ impl ImGuiRenderer {

D3D12_INDEX_BUFFER_VIEW {
BufferLocation: address,
SizeInBytes: (indices.len() * stride) as u32,
SizeInBytes: std::mem::size_of_val(indices) as u32,
Format: all_dxgi::DXGI_FORMAT_R16_UINT,
}
};
Expand Down
11 changes: 5 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//! This crate provides a fully written in Rust memory allocator for Vulkan and DirectX 12.
//!
//! ## [Windows-rs] and [winapi]
//! # [Windows-rs] and [winapi]
//!
//! `gpu-allocator` recently migrated from [winapi] to [windows-rs] but still provides convenient helpers to convert to and from [winapi] types, enabled when compiling with the `public-winapi` crate feature.
//!
//! [Windows-rs]: https://github.com/microsoft/windows-rs
//! [winapi]: https://github.com/retep998/winapi-rs
//!
//! ## Setting up the Vulkan memory allocator
//! # Setting up the Vulkan memory allocator
//!
//! ```no_run
//! # #[cfg(feature = "vulkan")]
Expand All @@ -31,7 +31,7 @@
//! # fn main() {}
//! ```
//!
//! ## Simple Vulkan allocation example
//! # Simple Vulkan allocation example
//!
//! ```no_run
//! # #[cfg(feature = "vulkan")]
Expand All @@ -42,7 +42,6 @@
//! # let device = todo!();
//! # let instance = todo!();
//! # let physical_device = todo!();
//!
//! # let mut allocator = Allocator::new(&AllocatorCreateDesc {
//! # instance,
//! # device,
Expand Down Expand Up @@ -80,7 +79,7 @@
//! # fn main() {}
//! ```
//!
//! ## Setting up the D3D12 memory allocator
//! # Setting up the D3D12 memory allocator
//!
//! ```no_run
//! # #[cfg(feature = "d3d12")]
Expand All @@ -98,7 +97,7 @@
//! # fn main() {}
//! ```
//!
//! ## Simple d3d12 allocation example
//! # Simple d3d12 allocation example
//!
//! ```no_run
//! # #[cfg(feature = "d3d12")]
Expand Down

0 comments on commit a273383

Please sign in to comment.