README progress
This commit is contained in:
parent
d42707c554
commit
c49013e6a3
18
README.md
18
README.md
|
@ -52,6 +52,15 @@ Ash always uses slices in functions.
|
||||||
&[],
|
&[],
|
||||||
&[],
|
&[],
|
||||||
&[layout_transition_barrier]);
|
&[layout_transition_barrier]);
|
||||||
|
|
||||||
|
// or
|
||||||
|
|
||||||
|
let slice = device.map_memory::<Vertex>(vertex_input_buffer_memory,
|
||||||
|
0,
|
||||||
|
vertex_input_buffer_info.size,
|
||||||
|
vk::MemoryMapFlags::empty())
|
||||||
|
.unwrap();
|
||||||
|
slice.copy_from_slice(&vertices);
|
||||||
```
|
```
|
||||||
Ash still uses raw Vulkan structs. The only difference is type safety. Everything that can be an enum is an enum like `vk::StructureType`, flags are implemented similar to the `Bitflags` crate. Ash also follows the Rust style guide. The reason that Ash uses raw Vulkan structs is to be extensible, just like the Vulkan spec.
|
Ash still uses raw Vulkan structs. The only difference is type safety. Everything that can be an enum is an enum like `vk::StructureType`, flags are implemented similar to the `Bitflags` crate. Ash also follows the Rust style guide. The reason that Ash uses raw Vulkan structs is to be extensible, just like the Vulkan spec.
|
||||||
```Rust
|
```Rust
|
||||||
|
@ -91,6 +100,15 @@ You don't have to pass an Instance or Device handle anymore, this is done implic
|
||||||
```
|
```
|
||||||
```Rust
|
```Rust
|
||||||
```
|
```
|
||||||
|
## Example
|
||||||
|
You can find the examples [here](https://github.com/MaikKlein/ash/tree/master/examples).
|
||||||
|
### [Triangle](https://github.com/MaikKlein/ash/blob/master/examples/src/main.rs)
|
||||||
|
Currently only runs under Linux (x11) and requires GLFW, the LunarG Validation layers, a Vulkan library. Ports for other operating systems are in progress. (Currently the GLFW wrapper only wraps the low level x11 bindings)
|
||||||
|
|
||||||
|
The triangle example is written from top to bottom without many helper functions and external dependencies. It renders a color triangle.
|
||||||
|
|
||||||
|
[screenshot here]()
|
||||||
|
|
||||||
## Complete
|
## Complete
|
||||||
|
|
||||||
## In progress
|
## In progress
|
||||||
|
|
|
@ -573,11 +573,6 @@ fn main() {
|
||||||
memory_type_index: vertex_input_buffer_memory_index,
|
memory_type_index: vertex_input_buffer_memory_index,
|
||||||
};
|
};
|
||||||
let vertex_input_buffer_memory = device.allocate_memory(&vertex_buffer_allocate_info).unwrap();
|
let vertex_input_buffer_memory = device.allocate_memory(&vertex_buffer_allocate_info).unwrap();
|
||||||
let slice = device.map_memory::<Vertex>(vertex_input_buffer_memory,
|
|
||||||
0,
|
|
||||||
vertex_input_buffer_info.size,
|
|
||||||
vk::MemoryMapFlags::empty())
|
|
||||||
.unwrap();
|
|
||||||
let vertices = [Vertex {
|
let vertices = [Vertex {
|
||||||
pos: [-1.0, 1.0, 0.0, 1.0],
|
pos: [-1.0, 1.0, 0.0, 1.0],
|
||||||
color: [0.0, 1.0, 0.0, 1.0],
|
color: [0.0, 1.0, 0.0, 1.0],
|
||||||
|
@ -590,7 +585,11 @@ fn main() {
|
||||||
pos: [0.0, -1.0, 0.0, 1.0],
|
pos: [0.0, -1.0, 0.0, 1.0],
|
||||||
color: [1.0, 0.0, 0.0, 1.0],
|
color: [1.0, 0.0, 0.0, 1.0],
|
||||||
}];
|
}];
|
||||||
|
let slice = device.map_memory::<Vertex>(vertex_input_buffer_memory,
|
||||||
|
0,
|
||||||
|
vertex_input_buffer_info.size,
|
||||||
|
vk::MemoryMapFlags::empty())
|
||||||
|
.unwrap();
|
||||||
slice.copy_from_slice(&vertices);
|
slice.copy_from_slice(&vertices);
|
||||||
device.unmap_memory(vertex_input_buffer_memory);
|
device.unmap_memory(vertex_input_buffer_memory);
|
||||||
device.bind_buffer_memory(vertex_input_buffer, vertex_input_buffer_memory, 0).unwrap();
|
device.bind_buffer_memory(vertex_input_buffer, vertex_input_buffer_memory, 0).unwrap();
|
||||||
|
|
Loading…
Reference in a new issue