Commit Graph

391 Commits

Author SHA1 Message Date
Fabio Krapohl
6fee18f6f9 remove end pass return value and fix examples 2019-08-10 22:30:24 +02:00
Yanchi Toth
186fbeec36 Validate bind group buffer ranges (#268)
* Validate bind group buffer range

The bound buffer range must fit in the the buffer size.
2019-08-07 11:13:57 -04:00
David
074b1d7dee Use extend_from_slice instead of copy_from_slice 2019-08-05 07:40:06 +02:00
Svenn-Arne Dragly
cd45aed0f0 Add support for indirect dispatch 2019-07-31 21:04:03 +02:00
bors[bot]
734245be94 Merge #247
247: Add support for indirect drawing r=kvark a=dragly



Co-authored-by: Svenn-Arne Dragly <dragly@cognite.com>
2019-07-30 15:22:00 +00:00
Svenn-Arne Dragly
92288e2988 Add support for indirect drawing 2019-07-30 09:18:54 +02:00
Dzmitry Malyshau
e42fb0ed44 Run-time lock protection against double root 2019-07-23 23:46:32 -04:00
Dzmitry Malyshau
41d0ce14d6 Rebind with proper dynamic offsets 2019-07-22 00:16:29 -04:00
Lucas Kent
1c88c3469d Update parking_lot version 2019-07-19 18:13:07 +10:00
bors[bot]
32399cff8a Merge #245
245: Make `PresentMode` configurable. r=kvark a=Yatekii



Co-authored-by: Noah Hüsser <yatekii@yatekii.ch>
2019-07-17 00:47:08 +00:00
Noah Hüsser
c5c7092d9c Make PresentMode configurable
Disable vsync

Revert accidential hardcode of num_frames

Make the PresentMode configurable

Adapt examples
+ adjust style according to @kvrak

Adher to @kvarks wishes for style.

Examples build.

Fix unnecessary ampersand.
2019-07-11 18:58:44 +02:00
bors[bot]
183058d618 Merge #237
237: Enforce the HUB lock order r=grovesNL a=kvark

Fixes #66
cc @jrmuizel @m4b

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-07-05 03:27:11 +00:00
Dzmitry Malyshau
1ed15f94dc Add some more comments about Access and Token' 2019-07-04 23:02:22 -04:00
John W. Bruce
25834b0312 Derive Debug for All Remaining Types
With gfx-hal 0.2.1 and the various backend releases on 2019-06-28, all
of the gfx-hal types that wgpu depends on implement Debug. Thus, some
types that could not derive Debug in #216 can now derive Debug.

This patch also adds Debug implementations for a few types that were
recently added to wgpu.

Fixes #76.
2019-07-04 17:49:21 -07:00
Dzmitry Malyshau
6085dcf33b Enforce the HUB lock order 2019-07-04 14:43:54 -04:00
bors[bot]
8af0fa824b Merge #244
244: Fix bind groups set on a compute encoder r=kvark a=kvark

Fixes #243

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-07-03 14:23:42 +00:00
Dzmitry Malyshau
14d0a24f81 Fix bind groups set on a compute encoder 2019-07-02 13:11:02 -04:00
Andrew Gaspar
b47f01ea17 Address code review comments 2019-07-01 21:13:26 -06:00
Andrew Gaspar
0d555fb688 Add logic to pick highest performance GPU on DirectX 12
Always select the first GPU in Integrated-Low/Discrete-High category,
except when querying `LowPower`, in which case the last Discrete GPU
is used.
2019-06-29 16:50:41 -06:00
Paul Kernfeld
ccc0e65b03 Re-export Pod from gfx-hal
This way, Pod can be used as a trait bound in wgpu-rs
2019-06-23 19:10:03 -04:00
Rukai
194943c12c Full MSAA handling 2019-06-23 22:17:42 +10:00
Rukai
45923755ba Implement sample_count field 2019-06-18 11:55:03 +10:00
Rukai
15488dfa1e Fix descriptor sets free validation error 2019-06-17 21:01:56 +10:00
bors[bot]
a667d50d01 Merge #226
226: Tracking Rewrite r=grovesNL a=kvark

Fixes #44

The idea is to support independent tracking of sub-resources. Today, this is needed for textures, which can have individual layers and mipmap levels in different states at a time. Tomorrow, this will be needed for buffer sub-ranges.

The intent to hack it in grew into a complete rewrite of the tracker... The new approach is cleaner in a few places (e.g. `TrackPermit` is gone), but the implementation is obviously more complex. I tried to separate the levels from each other (see `ResourceState` and `RangedStates`) to fight complexity, but it requires a whole lot of testing infrastructure to be solid.

Also regresses #216 a bit, cc @arashikou : tracker is a relatively complex structure. I somehow doubt it's useful to look at it in debug spew. We may need to implement `Debug` manually for it before re-adding `Debug` derives on passes and command buffers.

TODO:
  - [x] documentation of tracking types
  - [x] unit tests for tracking logic
  - [x] actual testing with existing apps, ensure no regressions
  - [x] write a mipmap generation example

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-06-16 14:53:26 +00:00
Dzmitry Malyshau
3753309b65 Last comments and renames in the tracking module, according to the review 2019-06-16 07:25:30 -07:00
Rukai
21950386cb Update rendy to 0.3 2019-06-16 12:31:07 +10:00
Dzmitry Malyshau
57494d6394 Crucial fix to merge-replace semantics - always use the last destination state 2019-06-14 14:05:27 -04:00
Dzmitry Malyshau
917154a49d Debug tracking derives and regular optimization 2019-06-14 14:05:27 -04:00
Dzmitry Malyshau
c22d8f86cc Support depth-stencil texture transfers 2019-06-14 11:47:42 -04:00
Dzmitry Malyshau
3ed1215d2f Rewrite texture tracker to support multiple depth/stencil mips 2019-06-14 11:44:51 -04:00
Dzmitry Malyshau
3da6c9f65b Fix texture view extent, improve docs according to the review 2019-06-14 10:20:13 -04:00
Dzmitry Malyshau
7c647a7d3c Improve texture state merging 2019-06-14 10:20:13 -04:00
Dzmitry Malyshau
ef1c373887 Fix texture transfer aspects 2019-06-13 15:37:30 -04:00
Dzmitry Malyshau
965750b237 Improve texture state merging with proper error handling 2019-06-13 13:06:31 -04:00
Dzmitry Malyshau
86521abfc2 Document the tracking and adjust the API a bit to return less errors 2019-06-13 12:31:36 -04:00
Dzmitry Malyshau
e0f315801a Texture query() unit tests 2019-06-13 11:47:42 -04:00
Dzmitry Malyshau
0fb71c9fd8 Move texture tracking into a module 2019-06-13 11:30:47 -04:00
Dzmitry Malyshau
aca3f1e64d Fix compile warnings when no features are selected 2019-06-13 11:26:44 -04:00
Dzmitry Malyshau
745bebcbb5 Move buffer state tracking into a module, add unit tests 2019-06-13 11:22:54 -04:00
Dzmitry Malyshau
07ef7caddc Range merging unit tests 2019-06-13 11:08:53 -04:00
Dzmitry Malyshau
331fe55948 Check track isolation results for sanity 2019-06-13 10:20:21 -04:00
Dzmitry Malyshau
7b843f220f Move track logic into a module, fix isolate() first split 2019-06-13 10:15:24 -04:00
Dzmitry Malyshau
0e20549235 RangedState unit tests 2019-06-13 08:43:19 -04:00
Dzmitry Malyshau
30955e565c Phantom tracking state 2019-06-13 08:18:56 -04:00
Dzmitry Malyshau
d92b623bd8 Remove the old tracking code, update local feature and the headers 2019-06-12 12:29:28 -04:00
Dzmitry Malyshau
bc7b842f12 Moving the code to use the new tracker API 2019-06-12 12:27:53 -04:00
Dzmitry Malyshau
2446190a0b Finished first implementation of layer tracking 2019-06-12 12:22:58 -04:00
Dzmitry Malyshau
444220c6eb Another iteration of internal tracking 2019-06-12 12:22:19 -04:00
Dzmitry Malyshau
0dcd0c449d Parametrize Tracker by a state of a resource, add new plane tracker 2019-06-12 12:20:23 -04:00
Dzmitry Malyshau
2d5e67d6d5 Basic data structure to track mip levels and layers of a texture 2019-06-12 12:15:51 -04:00
bors[bot]
d69955b612 Merge #220
220: Free descriptor sets r=kvark a=rukai

Tested on https://github.com/rukai/brawllib_rs, wgpu examples and wgpu-rs examples.
Closes: https://github.com/gfx-rs/wgpu/issues/217

My approach was to just implement descriptor set tracking the same way textures and buffers are implemented.

Co-authored-by: Rukai <rubickent@gmail.com>
2019-06-10 17:01:45 +00:00
Rukai
59388e329f Free descriptor sets 2019-06-10 16:02:46 +10:00
John W. Bruce
057719fdf5 Add Naïve Debug Derives Where Possible
This adds #[derive(Debug)] to all public structs and enums possible.
This also required adding it to some private types that they
transitively depend on. However, the following types depend on types
from external crates that do not implement Debug:

* device::Device
* hub::Hub
* swap_chain::Surface
* swap_chain::SwapChain

To support these types, we would need to use either custom Debug impls
or something like Derivative.

This helps improve the situation in #76.
2019-06-07 14:19:05 -07:00
Joshua Groves
9e60499738 Use wider type for swapchain image epoch 2019-06-05 00:15:12 -02:30
bors[bot]
85740873d0 Merge #212
212: More consistent descriptor passing r=kvark a=porky11

also use pointer for descriptor in `wgpu_command_encoder_begin_render_pass` for consistency reasons

Co-authored-by: Fabio Krapohl <fabio.u.krapohl@fau.de>
2019-06-04 20:20:10 +00:00
Fabio Krapohl
8abc1c2668 also use pointer for descriptor in wgpu_command_encoder_begin_render_pass for consistency reasons 2019-06-04 22:13:48 +00:00
Fabio Krapohl
488367ce30 More consistent naming of pointer-size-pairs:
* always plural form without _ptr suffix for pointers
* always same name as pointer for size, but with _length suffix
* special case: single size applies to multiple pointers => only use length as name
2019-06-04 21:41:39 +00:00
Rukai
4ad3d418c2 Ensure wait_for_fences is never called on 0 fences 2019-06-03 23:07:42 +10:00
Bruce Mitchener
88463810dd Fix typos. 2019-06-03 14:31:17 +07:00
Alexis Sellier
6794333dba
Expose and validate buffer offset alignment 2019-06-01 20:25:12 +02:00
Dzmitry Malyshau
97e630f320 Fix Rendy memory selection 2019-05-31 13:53:26 -04:00
Dzmitry Malyshau
351432aae2 hook up rendy-memory 2019-05-30 13:34:43 -04:00
Dzmitry Malyshau
9c408f919c Hook up rendy-descriptor 2019-05-30 08:35:34 -04:00
Dzmitry Malyshau
d01509e9a2 Fix Storage textures/buffers support 2019-05-29 23:50:29 -04:00
Dzmitry Malyshau
2614efba7c Protect mapped buffers from early destruction 2019-05-29 23:50:29 -04:00
Dzmitry Malyshau
cb6e1dba5a Force tracking side effects on drop 2019-05-29 23:50:27 -04:00
Dzmitry Malyshau
c0c2cdf31c Clear command buffer tracker 2019-05-29 23:49:29 -04:00
Dzmitry Malyshau
a6bc4420eb Don't early out on pipeline binding 2019-05-29 23:49:29 -04:00
Dzmitry Malyshau
9621fb3021 Validate vertex/instance/index buffer ranges 2019-05-29 23:49:27 -04:00
Dzmitry Malyshau
4446b81f3e Fix compute pass barriers 2019-05-26 23:55:23 -04:00
bors[bot]
925718ff6d Merge #183
183: Add gfx-backend-gl support r=kvark a=kyren

Also adds glutin-specific support methods to wgpu-native

Co-authored-by: kyren <kerriganw@gmail.com>
2019-05-24 18:58:09 +00:00
bors[bot]
81b6f42941 Merge #186
186: Fix clear value filtering and integer support r=grovesNL a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-05-24 01:22:15 +00:00
Dzmitry Malyshau
2564332f3d Change dynamic and vertex buffer offsets to u64 2019-05-23 11:25:10 -04:00
Dzmitry Malyshau
9eddc296c3 Fix clear value filtering and integer support 2019-05-23 10:03:11 -04:00
kyren
af9aa78e3a Try to keep the API slightly closer to the standard API
by making InstanceId a type alias to SurfaceId
2019-05-21 17:40:41 -04:00
kyren
8680195c91 Add gfx-backend-gl support
Also adds glutin-specific support methods to wgpu-native
2019-05-19 15:10:52 -04:00
Dzmitry Malyshau
bd167f8fc5 Fix semaphore iteration on submit 2019-05-17 01:31:51 -04:00
Dzmitry Malyshau
a9063ce3eb Fix RenderPassColorAttachmentDescriptor 2019-05-15 22:38:59 -07:00
bors[bot]
a056d2478a Merge #175
175: API update with naming, formats, and extra fields  r=grovesNL a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-05-15 07:31:42 +00:00
Dzmitry Malyshau
1875523a6a Rust formatting pass 2019-05-14 13:00:00 -04:00
Dzmitry Malyshau
48e74e77d7 Add set_viewport 2019-05-14 12:57:03 -04:00
Dzmitry Malyshau
a6f3637c0c Debug labels 2019-05-14 12:49:10 -04:00
Dzmitry Malyshau
f024758e07 Track stencil reference 2019-05-14 11:58:10 -04:00
Dzmitry Malyshau
40ec1ac4c1 Fix command buffer and surface locking order 2019-05-14 11:13:08 -04:00
Dzmitry Malyshau
6a1dcb9565 API update with naming, formats, and extra fields 2019-05-14 10:31:25 -04:00
Dzmitry Malyshau
278016d711 Fix lock order on the identity manager 2019-05-13 11:55:19 -04:00
Dzmitry Malyshau
5597846018 Update to gfx-hal 0.2 2019-05-13 11:07:28 -04:00
Dzmitry Malyshau
540451a66d Fix cbindgen macro expansion and CI 2019-05-10 21:55:09 -04:00
Dzmitry Malyshau
6ce9cbd679 Remove Rust wrapper and examples 2019-05-10 20:40:42 -04:00
Dzmitry Malyshau
8c75f35948 Fix locking order in texture view creation and destruction 2019-05-10 15:57:25 -04:00
bors[bot]
0edf927e5b Merge #159
159: Add GPU timeout, fix active submission processing order r=kvark a=kvark

Fixes #156 

The timeouts are going to be configurable later down the road.

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-05-10 12:00:47 +00:00
Dzmitry Malyshau
664fcdc1fa Add GPU timeout, fix active submission processing order 2019-05-09 14:59:28 -04:00
Dzmitry Malyshau
3f1e9ab03b Move callbacks out of the locking path 2019-05-07 11:07:55 -04:00
Rukai
16cc03be31 Update deps + upgrade examples to rust 2018 2019-05-07 22:38:41 +10:00
bors[bot]
6b92c37fa0 Merge #151
151: Assert on swapchain output usage before presenting r=grovesNL a=kvark

Fixes #148 

There is no "fix" for the case on our side. The PR brings stronger requirements on the swapchain outputs: they have to be used and submitted before dropped.

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-05-06 11:40:18 +00:00
bors[bot]
b12b4c135e Merge #136
136: Use strongly typed Ids r=kvark a=psincf

fixes #61 

Co-authored-by: psincf <44228825+psincf@users.noreply.github.com>
2019-05-04 02:44:24 +00:00
psincf
64d1250bfa fixes hub.rs 2019-05-04 02:03:37 +02:00
psincf
2e30c611ae Make IdentityManager strongly typed 2019-05-04 01:20:56 +02:00
Dzmitry Malyshau
1c350cc4af Assert on swapchain output usage before presenting 2019-05-03 10:45:39 -04:00
Atul Bhosale
3330509678
Remove wgpu_buffer_set_sub_data function 2019-05-03 07:01:59 +05:30
psincf
10547b937f add serde into scope and fix wgpu-remote 2019-05-01 13:31:56 +02:00
psincf
565e5fdfeb make trait TypedId:From<Id> 2019-05-01 12:15:23 +02:00
psincf
f7794fd82b change PhantomData syntax 2019-05-01 12:11:20 +02:00
psincf
bbef2b7622 Put new_id! in define_id! 2019-05-01 11:55:28 +02:00
psincf
bfc983a8cc Clean code 2019-05-01 11:55:28 +02:00
psincf
44cf64495a Use strong type 2019-05-01 11:55:28 +02:00
Dzmitry Malyshau
6ac666a5aa Introduce ClientFactory 2019-04-30 15:37:46 -04:00
Dzmitry Malyshau
61fca00f34 Remove wgpu-bindings in favor of configuration scripts 2019-04-30 12:45:05 -04:00
Dzmitry Malyshau
0011d9f4ff Global manager for instance names on the remote client 2019-04-30 09:19:40 -04:00
Dzmitry Malyshau
52ee3e019c Remote example and improved header, tested on CI 2019-04-29 22:41:09 -04:00
bors[bot]
5ec6f35368 Merge #139
139: Scissors test r=kvark a=snuk182

Closes #138 

Co-authored-by: Serhii Plyhun <snuk188@gmail.com>
2019-04-28 02:28:16 +00:00
Serhii Plyhun
092bcc4afb Scissor test 2019-04-28 00:45:37 +02:00
Alexis Sellier
c468840eee
Support dynamic offsets
Closes #125

* Add support for dynamic offsets when setting a bind group.
* Add new binding types: `UniformBufferDynamic` and `StorageBufferDynamic`
2019-04-26 22:20:54 +02:00
Atul Bhosale
af38d79d79
Format code using 'cargo fmt' 2019-04-26 22:01:47 +05:30
bors[bot]
993293f709 Merge #127
127: Track async mapping properly r=grovesNL,swiftcoder a=kvark

Fixes #117, fixes #95, fixes #132 

The change can be logically split into 3 parts:
  1. when `ActiveSubmission` is retired, we now move the mapped buffers into the "ready to map" vector. This was the missing bit that caused mapping to not work previously.
  2. mapping callbacks in Rust wrapper are refactored and they `unmap()` automatically now on users behalf
  3. we wait for idle before destroying the device, which allows us to process all the pending callbacks. This fix gets rid of the dummy submission our compute example used to do.

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-04-25 13:36:59 +00:00
Dzmitry Malyshau
8578643f38 Rename DestroyedResources to PendingResources 2019-04-25 08:29:40 -04:00
Dzmitry Malyshau
41141b1ae0 Wait for fences instead of device idle 2019-04-24 22:42:49 -04:00
Dzmitry Malyshau
aa1f876de3 Assert on a mapping buffer being used 2019-04-23 17:26:31 -04:00
Dzmitry Malyshau
326af8cce6 Do mapping transitions earlier. 2019-04-23 17:22:53 -04:00
Dzmitry Malyshau
7200f727e2 Expose device polling 2019-04-23 16:56:17 -04:00
Dzmitry Malyshau
e2dcac91d2 Round up mappable buffer size to non-coherent atom, if needed 2019-04-23 16:27:39 -04:00
Dzmitry Malyshau
1f4d67aeb2 Track async mapping properly 2019-04-22 13:57:35 -04:00
Markus Ginthör
89c5564133 Configure Swapchain with supported composite_alpha 2019-04-12 17:44:44 +02:00
Joshua Groves
7f7bdd1ba1 Implement index formats 2019-04-07 08:15:05 -02:30
Dzmitry Malyshau
83a83f33e7 Track epochs of the frame semaphores to wait for 2019-04-03 17:48:26 -04:00
Dzmitry Malyshau
c283a8b115 Update changelog and versions 2019-03-31 20:04:39 -04:00
Dzmitry Malyshau
a8a6b45c9a Rename expectation to LayoutChange 2019-03-31 20:00:52 -04:00
Dzmitry Malyshau
5e041ab239 Validate resource types against the bind group layout 2019-03-31 19:59:34 -04:00
Dzmitry Malyshau
b96983a56b Fix submission tracking 2019-03-31 19:59:21 -04:00
Dzmitry Malyshau
006d40a4b5 Track bind group compatibility across the whole pipeline 2019-03-31 16:04:37 -04:00
Dzmitry Malyshau
5923deff6e Validate bind group compatibility 2019-03-31 16:03:08 -04:00
Dzmitry Malyshau
332305012c Blend color and the first bits of validation 2019-03-31 15:52:32 -04:00
bors[bot]
dfa126cf47 Merge #112
112: Correctness fixes from 0.2, plus a lot of goodies r=kvark a=kvark

These are changes from #110 back-ported to master.

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2019-03-24 00:56:28 +00:00
bors[bot]
cf521d6074 Merge #96
96: Add the static lifetime bound to async buffer mapping callbacks r=kvark a=aloucks

These callbacks are executed outside of the mapping function and could previously reference data that had been dropped. Related #95.

Co-authored-by: Aaron Loucks <aloucks@cofront.net>
2019-03-23 02:21:03 +00:00
Dzmitry Malyshau
0b51c8a9d2 Clean up use statements.
Use copyless::VecHelper and ArrayVec for some things.
Refactor map_buffer internals.
2019-03-21 12:05:53 -04:00
Dzmitry Malyshau
dc31e4bdd0 Fix descriptor size, bump versions 2019-03-20 14:52:59 -04:00
Dzmitry Malyshau
81114a8ca2 Bump the descriptor pool size 2019-03-20 14:52:38 -04:00
Dzmitry Malyshau
451489025c Validate uniform buffer alignments, enforce map alignment 2019-03-20 14:43:25 -04:00
Dzmitry Malyshau
485894ca81 Enable windows in Travis 2019-03-19 10:49:30 -04:00
Dzmitry Malyshau
508b724dd7 Helpful error message on empty backend 2019-03-19 09:20:34 -04:00
Aaron Loucks
e0811db8d4 Triage buffers prior to overwriting the submission index
This allows async buffer mapping to function when a renderpass
is also submitted on the queue. The state transition and fencing
still needs work, however.
2019-03-12 22:15:37 -04:00
Lain-dono
c0b84b3e15
Fix vertex format mapping 2019-03-11 04:44:54 +03:00
Joshua Groves
e921b59298 Use repr(C) for Id 2019-03-07 19:04:01 -07:00
Joshua Groves
a55502c1e2 Remove winit from bindings generation 2019-03-07 12:37:50 -07:00
Dzmitry Malyshau
0bb4daa696 Version bumps to 0.2.0 2019-03-06 10:02:43 -05:00
Tristam MacDonald
1fe59e71db run cargo fmt 2019-03-05 20:41:24 -08:00
Tristam MacDonald
6ef53d7705 Convert shadow sample to map_async 2019-03-05 19:04:21 -08:00
Dzmitry Malyshau
ecaacfa20e Force wait for GPU before releasing the old swapchain 2019-03-05 14:14:28 -05:00
Dzmitry Malyshau
650bbaeb42 Basic render pipeline compatibility check 2019-03-03 22:09:20 -05:00
bors[bot]
152fad43c3 Merge #84 #85
84: Create buffer mapped r=kvark a=swiftcoder

I haven't really taken a swing at error handling here, posting it up early for feedback on the API.

85: Unpin nightly date for bindings generation r=kvark a=grovesNL

rust-lang/rust#57915 allows us to run bindings generation with nightly again, so we shouldn't have to pin to an older nightly date anymore (assuming everyone has a recent nightly).

Co-authored-by: Tristam MacDonald <tristam@trist.am>
Co-authored-by: Joshua Groves <josh@joshgroves.com>
2019-03-01 18:42:35 +00:00