Commit Graph

166 Commits

Author SHA1 Message Date
Joshua Groves
3d98457eb9 Add support for GLFW on Windows 2019-01-24 12:08:32 -05:00
Joshua Groves
26f965cfbb Use CMake and update triangle example 2019-01-24 12:08:32 -05:00
Joshua Groves
05b5ee42e7 Regenerate bindings 2019-01-24 12:08:32 -05:00
Joshua Groves
af1e240655 Add macOS surface creation 2019-01-24 12:08:32 -05:00
Dzmitry Malyshau
8547b591ad Dependencies and Cargo configurations update for 0.1 2019-01-24 07:39:51 -08:00
bors[bot]
5acbf75fb8 Merge #45
45: Remove non-winit from the example r=grovesNL a=kvark

This are the follow-up fixes to #38 as suggested by the review

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2019-01-23 03:06:54 +00:00
Dzmitry Malyshau
edf269dbed Remove the non-winit path from the example 2019-01-22 17:10:08 -08:00
bors[bot]
742fee7e41 Merge #38
38: Draw the first triangle r=grovesNL a=kvark

- [x] vertex/index buffers
- [x] draws
- [x] bind groups
  - [x] creation
  - [x] binding
  - [x] Rust side
- [x] triangle


Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2019-01-22 20:07:34 +00:00
Dzmitry Malyshau
2ec9d05074 Triangle example, minor corrections 2019-01-21 19:20:09 -05:00
Dzmitry Malyshau
32f7ae4f28 Basic buffer creation 2019-01-21 16:18:56 -05:00
Dzmitry Malyshau
4f939bc32f Bind group resource transitions 2019-01-21 16:18:56 -05:00
Dzmitry Malyshau
dee685aa0c native: bind groups for both compute and graphics 2019-01-21 16:18:56 -05:00
Dzmitry Malyshau
6699f4bed1 native: Abstract the binding tracker into a separate module 2019-01-21 16:18:56 -05:00
Dzmitry Malyshau
3ed4620c1f Bind compute groups if layout is matching 2019-01-21 16:18:56 -05:00
Dzmitry Malyshau
fb6a91589e native: simple bind group creation 2019-01-21 16:18:56 -05:00
Dzmitry Malyshau
64fb727bad draw methods 2019-01-21 16:18:56 -05:00
Dzmitry Malyshau
bb7fee796d get_with_usage helper 2019-01-21 16:18:56 -05:00
Dzmitry Malyshau
08cd75f38c Set vertex and index buffers 2019-01-21 16:18:56 -05:00
bors[bot]
eff92d3427 Merge #42
42: Remove glfw submodule r=nobody a=grovesNL

Fixes #41

I temporarily added a glfw submodule as part of #40 but it looks like it was mistakenly added as part of #39

Co-authored-by: Joshua Groves <josh@joshgroves.com>
2019-01-21 10:15:24 +00:00
Joshua Groves
6cb9806408 Remove glfw submodule 2019-01-21 02:57:04 -07:00
bors[bot]
8f312af8e6 Merge #39
39: Remove generic and option from render pass descriptor r=kvark a=grovesNL

- Temporarily lock cbindgen to known working revision until a new version is published
- Remove generic and `Option` from `RenderPassDescriptor`, map between wgpu/wgpu-native types like other descriptors, and add a missing length field (this appears necessary to generate bindings)
- Regenerate bindings (using `a7be40c65 2018-12-26`, earlier versions should work too)
- Remove `+nightly` for bindings generation from Makefile, because newer nightlies won't work at the moment
- Fix typo in Makefile `clean`

Co-authored-by: Joshua Groves <josh@joshgroves.com>
2019-01-21 03:08:18 +00:00
Joshua Groves
558681fddc Don't specify nightly for bindings generation 2019-01-20 16:46:02 -07:00
Joshua Groves
f647fd8030 Regenerate bindings 2019-01-20 16:25:49 -07:00
Joshua Groves
c7f2425b98 Remove generic from render pass descriptor 2019-01-20 16:24:37 -07:00
Joshua Groves
e51cce7e5d Lock cbindgen to working revision 2019-01-20 15:47:54 -07:00
bors[bot]
0f592b4443 Merge #34
34: Basic windowing and presentation r=grovesNL a=kvark

- [x] native swapchain creation
- [x] native use of frames and presentation
- [x] native semaphore waits
- [x] rust wrapping
- [x] working examples

~~I may or may not bite the bullet and update gfx-rs here. Probably not :)~~

## Architecture

There is a bit of complexity here to manage all the synchronization and lifetimes properly. Essentially, presentation is exposed in Vulkan/gfx-rs as a separate hidden queue, so we inevitably run into the territory of using semaphores for synchronization, where previously we could ignore them for workloads on a single queue.

A swapchain has a fixed (at creation) number of frames, each represented by a texture plus view pair. When `get_next_texture` is called we acquire the next image index and return this pair. We wait for the associated fence to make sure the frame is no image used. We then associate a semaphore with this index for image availability.

The texture has extra information to link back to an image of the swapchain (which is `None` for regular textures). Whenever it's used, the command buffer collects that link to be used on submission, where it's just resolved to a semaphore that we wait on actual submission.

Presenting on a swapchain creates a temporary command buffer that we only use for transiting the swapchain image into presentable state. This small submission is useful for establishing a "ready" semaphore as well as a fence (waited in `get_next_image`). The "ready" semaphore is used immediately for native `present` call.

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-01-19 13:31:35 +00:00
Dzmitry Malyshau
5deb6e2047 DX11 support 2019-01-17 23:03:11 -05:00
Dzmitry Malyshau
2221b112c7 Fix command buffer recycling 2019-01-17 21:11:01 -05:00
Dzmitry Malyshau
c868db2cc7 Windowing in the triangle example, more presentation bits 2019-01-17 09:42:59 -05:00
Dzmitry Malyshau
e32112a89a Swapchain exposed on Rust side 2019-01-16 09:15:56 -05:00
Dzmitry Malyshau
90154fb6f5 Wait for swapchain semaphores 2019-01-16 08:56:35 -05:00
Dzmitry Malyshau
ba8828eb5b Refactor includes, collect swapchain links on RP begin 2019-01-15 09:09:29 -05:00
Dzmitry Malyshau
b67a0bee0d Prenentation logic and bits of frame synchronization 2019-01-14 16:41:14 -05:00
Dzmitry Malyshau
630e86f120 Link textures to swap chains 2019-01-14 16:09:29 -05:00
Dzmitry Malyshau
1859141a99 Rename ActiveFrame to ActiveSubmission, progress with swapchain images 2019-01-14 16:05:55 -05:00
Dzmitry Malyshau
68cacd4829 native: basic surface and swapchain creation 2019-01-14 16:03:51 -05:00
bors[bot]
2d6bc1762b Merge #35
35: Update to current version of gfx-hal r=kvark a=porky11

I'll also push the transition to rust 2018 and some cleanup soon

Co-authored-by: porky11 <krapohl.f@gmx.de>
2019-01-13 03:51:26 +00:00
porky11
1c52a10c54 remove remaining unnecessary extern crate 2019-01-12 20:19:08 +01:00
porky11
4acd1edbc3 use macro explicitly instead of using macro_use 2019-01-12 20:17:04 +01:00
porky11
b61298a884 remove some unnecessary and 2019-01-12 20:11:27 +01:00
porky11
6f3499ecae port to 2018 edition 2019-01-12 19:58:24 +01:00
porky11
a5a5b88014 use rustfmt for formatting after edits 2019-01-12 19:15:48 +01:00
porky11
6675a4d3e4 update to current version of gfx 2019-01-12 19:03:17 +01:00
bors[bot]
fa37cdc9c2 Merge #33
33: Add `repr(transparent)` to buffer usage flags r=kvark a=grovesNL



Co-authored-by: Joshua Groves <josh@joshgroves.com>
2018-12-04 18:59:26 +00:00
Joshua Groves
446fdad33e Add repr(transparent) to buffer usage flags 2018-12-03 21:21:19 -07:00
bors[bot]
1144834ba8 Merge #32
32: Improve locking safety for Registry r=grovesNL a=kvark

This isn't ideal: we shouldn't be mutably locking anything for adding/removing objects in `local` path. But at least it makes it safe, for now.

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2018-12-02 03:54:19 +00:00
Dzmitry Malyshau
f4bb1903bf Fix deadlock in barrier insertion 2018-12-01 22:53:21 -05:00
Dzmitry Malyshau
d4c415f666 Improve locking safety for Registry 2018-11-27 11:06:22 -05:00
bors[bot]
c440791ab2 Merge #30
30: Fix TextureId r=kvark a=Michael-Lfx



Co-authored-by: Michael-Lai fx <cihv2@163.com>
2018-11-12 13:53:43 +00:00
Michael-Lai fx
860e68b59b
Fix TextureId 2018-11-12 21:52:36 +08:00