fixed typos and such

pull/1/head
Ben Hansen 5 years ago
parent 3aa711bccf
commit cd341fcdae

@ -1 +1 @@
Subproject commit 86bf16112101531159df6609e990ce7deadc2e01
Subproject commit 8a3ef7e438e918eb600b7c5f91b78a9259c0f06e

@ -1,11 +1,13 @@
# Introduction
## What is wgpu?
[Wgpu](https://github.com/gfx-rs/wgpu) is a Rust implementation of the [WebGPU API spec](https://gpuweb.github.io/gpuweb/). WebGPU is a specification published by the GPU for the Web Community Group. It aims to allow web code access to GPU functions in a safe and reliable manner. It does this by mimicking the Vulkan API, and translating that down to whatever API the host hardware is using (ie. DirectX, Metal, Vulkan, OpenGL*).
[Wgpu](https://github.com/gfx-rs/wgpu) is a Rust implementation of the [WebGPU API spec](https://gpuweb.github.io/gpuweb/). WebGPU is a specification published by the GPU for the Web Community Group. It aims to allow web code access to GPU functions in a safe and reliable manner. It does this by mimicking the Vulkan API, and translating that down to whatever API the host hardware is using (ie. DirectX, Metal, Vulkan).
Wgpu is still in development, so some of this doc is subject to change.
## Why Rust?
Wgpu actually has C bindings to allow you to write C/C++ code with it, as well as use other languages that interface with C. That being said, wgpu is written in Rust, and it has some convient Rust Bindings that don't have to jump through any hoops. On top of that, I've been enjoying writing in Rust.
You should be fairly familiar with Rust before using this tutorial as I won't go into much detail on Rust syntax. If you're not super comfortable with Rust you can review the [Rust tutorial](https://www.rust-lang.org/learn). You should also be familiar about [Cargo](https://doc.rust-lang.org/cargo/).
I'm using this project as a way to learn wgpu myself, so I might miss some important details, or explain things wrong. I'm always open to constructive feedback. That being said, let's get started!

@ -1,6 +1,4 @@
# What we're covering
## Just the basics
To make things simpler for everyone, this section of the guide will just cover things like setup wgpu with a window, creating the swapchain, using the render pipeline, creating and using buffers, basic texturing, and basic lighting.
Let's get started!
To make things simpler for everyone, this section of the guide will just cover things like setting up wgpu with a window, creating the swapchain, using the render pipeline, creating and using buffers, basic texturing, and basic lighting.

@ -1,7 +1,7 @@
# Dependencies and the window
## Boring, I know
Some of you reading this are very experienced with opening up windows in Rust and probably have your favorite windowing library, but we this guide is designed for everybody, so it's something that we need to cover. Luckily, if you don't need to read this if you know what you're doing. One thing that you do need to know is that whatever windowing solution you use needs to support the [raw-window-handle](https://github.com/rust-windowing/raw-window-handle) crate.
Some of you reading this are very experienced with opening up windows in Rust and probably have your favorite windowing library, but this guide is designed for everybody, so it's something that we need to cover. Luckily, if you don't need to read this if you know what you're doing. One thing that you do need to know is that whatever windowing solution you use needs to support the [raw-window-handle](https://github.com/rust-windowing/raw-window-handle) crate.
## What crates are we using?
For the beginner stuff, we're going to keep things very simple, we'll add things as we go, but I've listed the relevant `Cargo.toml` bits below.
@ -18,7 +18,7 @@ features = ["vulkan"]
```
## Why vulkan?
You need to specify what rendering backend you're using through [Cargo features](https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section) in order to run a program with wgpu. You can manu I'm specifying [vulkan](https://www.khronos.org/vulkan/), because I'm on [linux](https://www.linuxmint.com/). You're welcome to use [metal](https://developer.apple.com/metal/), or `DirectX 11/12` using `"metal"`, `"dx11"`, or `"dx12"` respectively.
You need to specify what rendering backend you're using through [Cargo features](https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section) in order to run a program with wgpu. I'm specifying [vulkan](https://www.khronos.org/vulkan/), because I'm on [linux](https://www.linuxmint.com/). You're welcome to use [metal](https://developer.apple.com/metal/), or `DirectX 11/12` using `"metal"`, `"dx11"`, or `"dx12"` respectively.
## What's with the "alpha" stuff?
The wgpu examples use this version of [winit](https://github.com/rust-windowing/winit), so I elected to do the same. *Note: I'll update this once the changes to winit become fully released.*

@ -124,7 +124,7 @@ We'll want to call this in our main method before we enter the event loop.
let mut state = State::new(&window);
```
## resize() and update_hidpi_factor_and_resize(...)
## resize() and update_hidpi_factor_and_resize()
If we want to support resizing in our application, we're going to need to recreate the `swap_chain` everytime the window's size changes. That's the reason we stored the `hidpi_factor`, the logical `size`, and the `sc_desc` used to create the swapchain. With all of these, the resize method is very simple.
```rust
@ -165,7 +165,7 @@ match event {
}
```
## input(...)
## input()
`input()` returns a `bool` to indicate whether an event has been fully processed. If the method returns `true`, the main loop won't process the event any further.

Loading…
Cancel
Save