Commit Graph

903 Commits

Author SHA1 Message Date
Dzmitry Malyshau
58b83f3ff6 Add extern-C on wgpu_render_pass_execute_bundles 2021-05-11 15:00:49 -04:00
Dzmitry Malyshau
f861e83df1 Fix wgpu_render_bundle_draw_indexed_indirect 2021-05-11 15:00:49 -04:00
Jonathan Behrens
c64618abb8 Include shader label in log message if validation fails 2021-05-08 14:07:56 -04:00
Luca Casonato
751aa714f4 fix: zeroable buffer_get_mapped_range size
According to spec, size can be Some(0).
2021-05-06 22:03:43 -04:00
Dzmitry Malyshau
3bd0e8b050 Validate storage class 2021-05-06 13:25:34 -04:00
Dzmitry Malyshau
de5907d938 Explicitly list output spirv capabilities 2021-05-06 13:25:21 -04:00
Dzmitry Malyshau
e5ddb94be0 Version bump to 0.8 2021-04-29 11:57:22 -04:00
Dzmitry Malyshau
ffd47fbc0e Remove Vulkan Portability support 2021-04-29 11:42:26 -04:00
Dzmitry Malyshau
6ff618aafb Big refactor of the profiling usage 2021-04-29 02:06:58 -04:00
Chandler Newman
904ec7a5ee Add uniform and storage buffer arrays 2021-04-29 00:38:04 -04:00
Dzmitry Malyshau
087bd07f55 Add shader compile markers 2021-04-27 12:23:28 -04:00
Dzmitry Malyshau
6c7f2b917f Update profiling to 1.0 2021-04-26 11:59:15 -04:00
Dzmitry Malyshau
03c4e0969e Update naga to gfx-23 2021-04-26 11:10:22 -04:00
Dzmitry Malyshau
525efda7b2 Hard error on SPIRV parsing failure when VALIDATION is requested 2021-04-22 17:18:16 -04:00
Dzmitry Malyshau
bc4c5c8f03 Change error type for the backend shader 2021-04-21 17:06:58 -04:00
Dzmitry Malyshau
8505a39f6a Make implicit ids actually errors to start with 2021-04-20 17:32:40 -04:00
Dzmitry Malyshau
cc2e547d48 Update gfx to the new image view API 2021-04-20 10:16:30 -04:00
Dzmitry Malyshau
cac643507b Validate min/max blending factors 2021-04-20 09:37:07 -04:00
Dzmitry Malyshau
de86f2a72f Mark unused implicit BGL ids as vacant 2021-04-19 23:35:33 -04:00
Dzmitry Malyshau
27f51ca252 Update naga to gfx-22, add interpolation sampling validation 2021-04-19 13:33:36 -04:00
Dzmitry Malyshau
280ba30c6c Don't compare booleans 2021-04-18 10:25:54 -04:00
Dzmitry Malyshau
92886b4995 Validate filtering samplers at BG creation 2021-04-18 10:25:54 -04:00
Dzmitry Malyshau
6d7ef8b8fd Validate filtered sampling 2021-04-18 10:25:54 -04:00
bors[bot]
a749f09bbf
Merge #1325
1325: Relax and imporve vertex attribute validation r=cwfitzgerald a=kvark

**Connections**
None

**Description**
Improves our validation of vertex attributes in the following ways:
  1. Relaxes the size matching, so that we allow the shaders to default some of the values we don't provide
  2. Require interpolation to match
  3. Make the error messages more detailed:

>     In Device::create_render_pipeline
    error in stage VERTEX
    error matching the stage input at 1 (Uint32x2 interpolated as None) against the previous stage outputs
    input type is not compatible with the provided Float32x2

**Testing**
Tested on wgpu-rs examples.

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-04-18 07:37:54 +00:00
Dzmitry Malyshau
c744582052 Update blending API names 2021-04-15 11:25:04 -04:00
Dzmitry Malyshau
c0478c707d Address clippy issues on copying things 2021-04-14 15:23:20 -04:00
adamnemecek
6d3a514c43
updated gfx (#1327)
* updated gfx

* use long rev
2021-04-14 14:37:13 -04:00
Dzmitry Malyshau
78652e93f4 Make input stage errors more detailed 2021-04-13 23:01:02 -04:00
Dzmitry Malyshau
b7a0410e09 Relax vertex attribute matching, also check interpolation 2021-04-13 22:19:44 -04:00
Ashley
ff75948848
Allow non-storage textures to be able to be queried in validation (#1324)
* Improve the WrongUsage error and allow textures to use query

* Run cargo fmt

* Further improve the error

* Add more QUERY flags
2021-04-13 10:12:17 -04:00
Aaron Housh
c820cc8e73
Add Map Alignment type (#1322)
* Add Map Alignment type

* Fix clippy warnings

* Make buffer_map_async compare range start to MAP_ALIGNMENT
2021-04-12 13:28:46 -04:00
Dzmitry Malyshau
1ba95585ba Update naga to gfx-21 2021-04-11 01:07:46 -04:00
Dzmitry Malyshau
191f33871b Don't panic on change_extend errors 2021-04-08 12:03:46 -04:00
Dzmitry Malyshau
02442bcb5e Update gfx with the cmd buf freeing fix 2021-04-06 10:28:51 -04:00
Franz
7a37f07ea0 Updated gpu-alloc to rev 2cd1ad6 2021-04-06 11:16:49 +02:00
Dzmitry Malyshau
4d324bc38d Move depth clamping to primitive state 2021-04-05 16:01:23 -04:00
Dzmitry Malyshau
2e9d9d8267 Update gfx with fixed Metal cross feature 2021-04-05 00:48:17 -04:00
Dzmitry Malyshau
1dddfa6234 Don't flip SPIR-V coordinate space on input 2021-04-04 18:38:56 -04:00
Dzmitry Malyshau
0bd8526239 Update naga to gfx-20 2021-04-04 11:25:10 -04:00
adamnemecek
d91ad13482 framecapture 2021-04-01 12:51:50 -07:00
Connor Fitzgerald
3073a454ff Update to flag-based downlevel bools 2021-04-01 11:48:09 -04:00
Connor Fitzgerald
fca72f54f9 Validate compute shader's presence 2021-03-31 01:08:53 -04:00
Connor Fitzgerald
4db9a4522e Add downlevel infrastructure 2021-03-31 01:08:48 -04:00
Dzmitry Malyshau
49c59ec063 Update gfx to the MSL entry point fix 2021-03-30 21:25:40 -04:00
Gordon-F
7fc70bf349 Force-enable EXPERIMENTAL_TRANSLATION flag when running without cross feature 2021-03-31 02:01:43 +03:00
Gordon-F
124d5e3a7c Update naga to gfx-19 2021-03-31 02:00:48 +03:00
Igor Shaposhnik
6097421647 Update to latest gpu-alloc 2021-03-29 09:33:40 +00:00
Gordon-F
c1f8203f3c Update naga to gfx-18 2021-03-25 16:59:16 +03:00
Joshua Groves
9885bdf320 Rename level_count to mip_level_count
This follows the naming in the specification, located at
https://gpuweb.github.io/gpuweb/#texture-view-creation
2021-03-24 09:14:30 -02:30
Dzmitry Malyshau
f953266bbe Align create_swap_chain function signature 2021-03-23 10:39:13 -04:00
Joshua Groves
a5693ab2a3 Rename color/depth attachments to match spec
- Rename `ColorAttachmentDescriptor` to `RenderPassColorAttachment`
- Rename `DepthStencilAttachmentDescriptor` to `RenderPassDepthStencilAttachment`
- Rename `attachment` fields on both attachments to `view`
2021-03-23 09:31:59 -02:30
bors[bot]
fb0288a377
Merge #1279
1279: Fix some typos r=kvark a=grovesNL

**Description**
Fix a few small typos in doc comments

**Testing**
None

Co-authored-by: Joshua Groves <josh@joshgroves.com>
2021-03-23 06:44:11 +00:00
Joshua Groves
306eaf3969 Fix some typos 2021-03-23 01:01:32 -02:30
Joshua Groves
9058f3ba62 Rename copy views and layout to match spec 2021-03-23 00:48:42 -02:30
Andreas Reich
720c73fa9c Review feedback / fix validate_linear_texture_data 2021-03-21 09:01:31 +01:00
Andreas Reich
50043875e5 rows_per_image & rows_per_image are now optional
Fixes #988
2021-03-20 12:33:28 +01:00
Gordon-F
d20c0199d7 Properly return native shader module errors to users 2021-03-19 21:09:54 +03:00
Dzmitry Malyshau
c52dad9d47 Update naga to gfx-17 2021-03-19 13:43:11 -04:00
Dzmitry Malyshau
9673635125 Add sample count to framebuffer key 2021-03-17 12:13:11 -04:00
Dzmitry Malyshau
b97f5a5b24 Update naga to gfx-16 2021-03-17 09:07:08 -04:00
Connor Fitzgerald
cf6f9c3ca8 Move from tracing to log + profiling 2021-03-17 01:22:30 -04:00
bors[bot]
5d993efc85
Merge #1267
1267: Update naga to gfx-15 r=kvark a=kvark

**Connections**
Fixes #1228 (huge DX12 leak in command allocation)
Includes https://github.com/gfx-rs/gfx/pull/3676, https://github.com/gfx-rs/gfx/pull/3679, https://github.com/gfx-rs/gfx/pull/3680, https://github.com/gfx-rs/gfx/pull/3681, and the relevant Naga stuff.

**Description**
Updates Naga and gfx.

**Testing**
Tested on wgpu-rs examplse

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-03-16 17:07:20 +00:00
Luca Casonato
82932d1f59
chore: validate offset + size in get_mapped_range (#1266)
* chore: validate offset + size in get_mapped_range

This commit introduces out of bounds & offset validation for
buffer_get_mapped_range, like described in the WebGPU spec. See
https://gpuweb.github.io/gpuweb/#dom-gpubuffer-getmappedrange.

Closes #818

* review comments

* fmt

* fix test

* fix tests

* update error message

* review comment

* use wgt::BufferAddress

* clippy
2021-03-16 13:00:44 -04:00
Dzmitry Malyshau
3b1b11f441 Update naga to gfx-15 2021-03-16 12:52:32 -04:00
Wumpf
717c2d73e7
Add CONSERVATIVE_RASTERIZATION native feature (#1263)
* Add CONSERVATIVE_RASTERIZATION native feature

* update gfx to cd3042d8c02d9dc7fc74ac8c292099c9789f6d43

* error for polygon mode not fill +conservative raster
2021-03-14 20:43:02 -04:00
Dzmitry Malyshau
280c066e65 Update to naga-14 2021-03-14 00:27:57 -05:00
Dzmitry Malyshau
231bba03a1 Lint all the things 2021-03-12 12:39:04 -05:00
Dzmitry Malyshau
80fe0d8fdd Fix Vulkan Portability check 2021-03-10 00:23:09 -05:00
Anthony Cowley
f01feacc2e
Update gfx and naga to gfx-13 tag (#1248)
* wgpu-core: update gfx-hal usage related to sparse resources

* wgpu-core: support naga gfx-13

* Update gfx and naga dependencies to gfx-13 tag

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-03-10 00:04:16 -05:00
Dzmitry Malyshau
4f7cd45ea7 Don't panic on pipeline creation errors 2021-03-09 22:24:57 -05:00
bors[bot]
37dbe5e32e
Merge #1247
1247: Add license to the memory init tracker r=kvark a=kvark

**Connections**
Gecko's code lints complain...

**Description**
Add a license header like all the other files

**Testing**
should work!

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2021-03-04 15:43:42 +00:00
Dzmitry Malyshau
11af3d1286 Add license to the memory init tracker 2021-03-04 10:42:18 -05:00
Dzmitry Malyshau
10245cece9 Early tracing of swapchain-related things, clean up the hub API 2021-03-03 19:59:29 -05:00
Dzmitry Malyshau
fb1b98ebb1 Early tracing of the other device things 2021-03-03 17:24:09 -05:00
Dzmitry Malyshau
20bcb44c85 Early tracing of buffer, texture, and view creation 2021-03-03 16:54:38 -05:00
Dzmitry Malyshau
7c1db12cdc Refactor implicit BGLs to support early tracing 2021-03-03 16:48:23 -05:00
Dzmitry Malyshau
f7e1304c38 Expose CA surface creation 2021-03-03 15:43:55 -05:00
Dzmitry Malyshau
199e7e5f3b Trace pipeline creation before it actually happens 2021-03-03 15:18:48 -05:00
bors[bot]
c3e95273ff
Merge #1243
1243: Force-drop the token before calling fire_map_callbacks r=kvark a=kvark

**Connections**
Related to WebGPU update in Gecko

**Description**
Since the token was alive, technically, we saw an assertion firing up about concurrent access to the token root.

**Testing**
Tested in Gecko

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2021-03-02 19:12:58 +00:00
Dzmitry Malyshau
d20ab66741 Force-drop the token before calling fire_map_callbacks 2021-03-01 16:34:07 -05:00
Dzmitry Malyshau
62ca24580d Add limits for textures sizes and vertex imputs 2021-03-01 12:10:40 -05:00
Dzmitry Malyshau
103e7763a3 Rename depth to depth_or_array_layers 2021-03-01 11:08:17 -05:00
Imbris
2c153f5d50 Fix issue with multiple queued mappings where the last one is not cancelled 2021-02-28 00:56:17 -05:00
Imbris
c82a3a77d2 Avoid panic when requesting to unmap a buffer that is pending mapping 2021-02-27 17:38:53 -05:00
bors[bot]
c3a18c3d8b
Merge #1235
1235: Update VertexFormat variants r=grovesNL a=kvark

**Connections**
Matches https://github.com/gpuweb/gpuweb/pull/1322 and https://github.com/gpuweb/gpuweb/pull/1469

**Description**
Just updates us to recent upstream API.
Also breaks lots of user code!

**Testing**
Not functional


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-02-27 16:05:04 +00:00
bors[bot]
29058e03b0
Merge #1237
1237: Move `#[error]` attributes after the corresponding `#[derive]` r=kvark a=Aaron1011

**Connections**
See https://github.com/rust-lang/rust/issues/79202

**Description**
Fixes Nightly future-incompat warnings

**Testing**
There are no behavior changes intended.

Co-authored-by: Aaron Hill <aa1ronham@gmail.com>
2021-02-26 01:09:41 +00:00
Aaron Hill
12b086d92d
Move #[error] attributes after the corresponding #[derive]
This fixes Nightly warnings

See https://github.com/rust-lang/rust/issues/79202
2021-02-25 15:40:11 -05:00
Dzmitry Malyshau
cf165f9a3e Update VertexFormat variants 2021-02-25 15:25:56 -05:00
Aaron Hill
8b4bec5d9a
Update gfx to 0a201d1c406b5119ec11068293a40e50ec0be4c8
Fixes #246

Pulls in https://github.com/gfx-rs/gfx/pull/3653,
which fixes a segfault when using wgpu from a non-main thread.
2021-02-25 15:25:40 -05:00
Andreas Reich
dfe686bbc6 Added TextureFormatFeatures::filterable
Can overwrite TextureSampleType::Float.filterable
2021-02-23 23:59:17 +01:00
Dzmitry Malyshau
91f5329b33 Update gfx and naga to gfx-12 2021-02-21 11:25:45 -05:00
Dzmitry Malyshau
ff31911760 Update the blend API to upstream 2021-02-19 12:07:47 -05:00
Dzmitry Malyshau
fdd50e10fd Update naga to gfx-11 2021-02-16 09:46:22 -05:00
Dzmitry Malyshau
9bf47dd772 Validate texture bindings 2021-02-15 20:14:23 -05:00
bors[bot]
6442b947cb
Merge #1210
1210: Reset the bindings on the push constant change r=wumpf a=kvark

**Connections**
Fixes #1207
(unconfirmed!)

**Description**
I was able to replay the trace in #1207 without validation errors, so I looked deeper into what might have gone wrong.
The code isolated in #1194 looks great. However, the calling code's handling of push constants might have changed a bit.
And I see that the trace uses push constants, so here is what happened, I think:
  - layout A was set, expecting bind group layouts X and Z
  - bind groups X and Y where bound
  - layout B was set, expecting bind group layout X and Y. We see that Y group can now be bound, so we do this. The old logic in this case wasn't considering the push constants in any way, it would only consider them if bind group layouts didn't change, erroneously.
  - layout B has different push constant ranges...

So it's a one-line fix now, which I'm hoping is correct.

**Testing**
Not tested
@Wumpf would you be able to check this?

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2021-02-12 21:10:26 +00:00
Jakob Hellermann
b89cb21ce3 fix rustdoc warnings 2021-02-12 13:56:51 +01:00
Dzmitry Malyshau
692e82d521 Reset the bindings on the push constant change 2021-02-11 14:47:35 -05:00
Zsolt Bölöny
47a45bcaad Convert PrimitiveState::cull_mode to Option<Face> 2021-02-10 11:59:38 +01:00
Dzmitry Malyshau
42d3f1f087 Update naga to gfx-10, add push constants validation 2021-02-09 10:06:55 -05:00
bors[bot]
dc18ac72e4
Merge #1190
1190: Fix crash on zero init of buffer with no more ref count r=kvark a=Wumpf

**Description**
Previously, if a buffer would no longer have any reference, the zero init step crashed when trying to unwrap its ref_count.

**Testing**
Tested successfully on 54a0f4ff13 where this problem would pop up

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2021-02-06 22:15:44 +00:00
Dzmitry Malyshau
d0dcb105f5 Don't check the index format for non-indexed calls 2021-02-06 10:58:46 -05:00
Andreas Reich
3486fde638 Fix crash on zero init of buffer with no more ref count
Previously, if a buffer would no longer have any reference, the zero init step crashed when trying to unwrap its ref_count.
2021-02-06 11:11:10 +01:00
Dzmitry Malyshau
e357e3083a Fix command allocator race condition with maintenance 2021-02-05 00:57:18 -05:00
Dzmitry Malyshau
262d0c6dfc Isolate binding compatibility logic into a separate module 2021-02-04 01:16:40 -05:00
Andreas Reich
9dd88cb338 validate for strip_index_format being used with non-strip topology 2021-02-01 21:46:24 +01:00
bors[bot]
7c7501cab7
Merge #1182
1182: Update all versions r=kvark a=kvark

**Connections**
Picks up https://github.com/gfx-rs/gfx/pull/3620 and a bunch of other fixes in gfx-rs and naga.

**Description**
Updates the dependencies ("gfx-9" naga train) as well as self version to 0.7, to match the v0.7 branch.

**Testing**
Should just work :)

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-02-01 05:37:39 +00:00
Dzmitry Malyshau
8ed543f26a Update all versions 2021-02-01 00:35:40 -05:00
Andreas Reich
822424e519 Fix buffer init in bundle.rs with mem::size_of::<wgt::DrawIndirectArgs> 2021-01-31 22:01:52 +01:00
Andreas Reich
4f5acba5fb Fixed too eager lock usage, fixed O(N²) buffer range collapse 2021-01-31 21:56:31 +01:00
Andreas Reich
a8460b438c MemoryInitTracker drain is now O(N) 2021-01-31 21:56:31 +01:00
Andreas Reich
018ad05f56 memory init tracker check (previous is_initialized) clamps range now
and is O(log n)!
2021-01-31 21:56:31 +01:00
Andreas Reich
31d292b169 added clear helper method to memory_init_tracker, renamed drain 2021-01-31 21:56:31 +01:00
Andreas Reich
da86b3f401 Cleanup, better use of some rust std lib functions 2021-01-31 21:56:31 +01:00
Andreas Reich
216dcf949b MemoryInitTracker has now a custom impl that doesn't depend on range-alloc 2021-01-31 21:56:31 +01:00
Andreas Reich
32b4e32ac6 MemoryInitTracker tests and interface adjustments 2021-01-31 21:56:31 +01:00
Andreas Reich
492027fe6e command buffer buffer memory init tracking is only filled if necessary now 2021-01-31 21:56:22 +01:00
Andreas Reich
22fb9ab1eb buffer zero init on queue_submit emits correct barriers now
refactored this zero init into separate method
2021-01-31 21:55:49 +01:00
Andreas Reich
5d2afa52c1 Fix zero init for buffers mapped at cration that are not mappable 2021-01-31 21:55:49 +01:00
Andreas Reich
1efdc2b229 Queue_submit zeros out uninitialized buffer regions now
again but with fine grained scheme now
2021-01-31 21:55:49 +01:00
Andreas Reich
9595b39bb3 Fine grained tracking of buffer init requirements 2021-01-31 21:55:49 +01:00
Andreas Reich
5133b0da94 Introduced separate MemoryInitTracker 2021-01-31 21:55:49 +01:00
Andreas Reich
076aecd150 buffer map permeates zero init now in any case 2021-01-31 21:55:49 +01:00
Andreas Reich
a51b4f9232 buffer zero initialization prior to use in submit 2021-01-31 21:55:49 +01:00
Andreas Reich
875cfb5961 buffers are now zero initialized for mappings
queue_write_buffer marks as initialized
2021-01-31 21:55:49 +01:00
Andreas Reich
6b51328b2e Add public structs for indirect command buffers
and fix missing IndirectBufferOverrun error for IndirectDispatch
2021-01-31 21:32:33 +01:00
Dzmitry Malyshau
14eb99da87 Add DepthBiasState, rename StencilStateFace 2021-01-29 00:07:46 -05:00
Dzmitry Malyshau
4764ff21e9 Update gfx with the new iterator API 2021-01-28 12:40:24 -05:00
Dzmitry Malyshau
0346b43982 Update the render pipeline API 2021-01-27 15:09:13 -05:00
Dzmitry Malyshau
c233a70afc Handle zero-sized bindings as an error 2021-01-25 22:33:44 -05:00
Dzmitry Malyshau
6a684e5cdf Don't build shader interface without the validation flag 2021-01-25 14:15:27 -05:00
Jonathan Behrens
a97ec9df91
Add SHADER_FLOAT64 feature (#1154)
* Add SHADER_FLOAT64 feature

* Also enable SHADER_FLOAT64 hal feature when creating the device

* Update wgpu-core/src/instance.rs

Co-authored-by: monocodus[bot] <49363530+monocodus[bot]@users.noreply.github.com>

* Add warning about 64-bit float performance

* Add (currently unsupported) VERTEX_ATTRIBUTE_64BIT feature

Co-authored-by: monocodus[bot] <49363530+monocodus[bot]@users.noreply.github.com>
2021-01-24 21:59:09 -05:00
Dzmitry Malyshau
6538ac5d26 Remove temporary allocation for gpu-descriptor 2021-01-24 12:24:37 -05:00
Dzmitry Malyshau
952ccbcf85 Update naga to gfx-7 2021-01-23 22:17:09 -05:00
Matt Keeter
38b184428d Bump gfx to latest master 2021-01-22 08:58:51 -05:00
Dzmitry Malyshau
05bb482e49 Fix replaying issues with dropped texture views 2021-01-19 22:03:55 -05:00
Dzmitry Malyshau
5fccabf3b8 Update gpu-alloc and remove the associated locking 2021-01-19 20:59:50 -05:00
Dzmitry Malyshau
618bd9e53a Handle read-only storage + sampled combination 2021-01-19 09:54:41 -05:00
Dzmitry Malyshau
7f8c776a85 Update gfx to unborrowed APIs 2021-01-19 00:33:45 -05:00
Vengarioth | Andreas Fischer
6adaef6512 fix the size checks in transfer buffer to image commands 2021-01-18 18:46:37 +01:00
bors[bot]
4f2d0bb8c8
Merge #1151
1151: Update gfx and naga to gfx-6 tag r=cwfitzgerald a=kvark

**Connections**
Fixes #1149 
Regression from https://github.com/gfx-rs/gfx/pull/3573

**Description**
The physical devices held references to `RawInstance` in Vulkan backend, and we weren't cleaning them up.
Note: an alternative fix could be in `gfx-backend-vulkan` - to move the `Entry` into `RawInstance`, thus delaying the shutdown. I didn't go this way because that would be less explicit.

**Testing**
Tested on wgpu-rs examples

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2021-01-16 06:39:44 +00:00
Dzmitry Malyshau
87c8cb8fde Update gfx and naga to gfx-6 tag, fix the hub clears 2021-01-16 01:38:57 -05:00
Connor Fitzgerald
a22037ced0 Add pipeline statistics and timeline queries 2021-01-16 00:48:54 -05:00
Dzmitry Malyshau
6c05470db0 Minor dependencies bumps 2021-01-15 01:11:28 -05:00
Dzmitry Malyshau
a4f897b5d7 Include the extent into the framebuffer map key 2021-01-15 00:53:51 -05:00
Dzmitry Malyshau
012569845d Update render pass and framebuffers logic to the latest gfx-hal 2021-01-15 00:53:28 -05:00
dasetwas
c01e2d10ce Remove comment introduced in https://github.com/gfx-rs/wgpu/pull/1144 2021-01-13 23:28:44 +01:00
Mikko Lehtonen
6c56613045 Merge PassErrorScope::Draw* and Dispatch* variants 2021-01-12 22:23:17 +02:00
Mikko Lehtonen
0d60bd80c5 Include pipeline id in some pass error scopes 2021-01-12 17:58:44 +02:00
Dzmitry Malyshau
389a848dea Support trailing render passes after the swapchain rendering 2021-01-11 21:40:41 -05:00
bors[bot]
09ba19b265
Merge #1144
1144: Fix and simplify attachment dimension mismatch check r=kvark a=DasEtwas

This also improves error messages with detailed dimension and attachment type name info which developers can hopefully recognize.

**Connections**
None

**Description**
Before this commit, depth/stencil attachments are not considered when evaluating the renderpasses' dimension, which will result in a "NoAttachment" error with a confusing display message.

**Testing**
Tested by running an application making use of color-only and depth/stencil-only attachment renderpasses.

Tested by running boids, hello-triangle and shadow examples.


Co-authored-by: DasEtwas <18222134+DasEtwas@users.noreply.github.com>
2021-01-11 23:05:10 +00:00
DasEtwas
93f68add27 Decrease error variant code verbosity, apply reviews 2021-01-11 23:46:26 +01:00
DasEtwas
151d521ad9 Fix and simplify attachment dimension mismatch check
This also improves error messages with detailed dimension and attachment type name info which should help developers can hopefully recognize.
2021-01-11 20:13:14 +01:00
Niklas Korz
ac98c0bdfa Move get_swap_chain_preferred_format from device to adapter and check formats
Squashed commit of the following:

commit 16e9c89dbccda3e37d05f7548dc8b9ddfb1d8613
Author: Niklas Korz <niklas@niklaskorz.de>
Date:   Mon Jan 11 19:15:43 2021 +0100

    format

commit 8c69a70ec22427b6a030915e06654bb0fc9b3c69
Author: Niklas Korz <niklas@niklaskorz.de>
Date:   Mon Jan 11 19:12:24 2021 +0100

    Implement Global::adapter_get_swap_chain_preferred_format

commit 63efae1cff508d060eaa6ccafe80c02af6af21f4
Author: Niklas Korz <niklas@niklaskorz.de>
Date:   Mon Jan 11 17:25:42 2021 +0100

    Move get_swap_chain_preferred_format to adapter

commit 1e72a876994820aec9b18f9dac7f1a9ae82d7cee
Author: Niklas Korz <niklas@niklaskorz.de>
Date:   Mon Jan 11 15:49:10 2021 +0100

    Add fallback to device_get_swap_chain_preferred_format
2021-01-11 19:50:32 +01:00
Andreas Reich
78466fbb31 Enable storage read/write format feature 2021-01-10 22:12:09 +01:00
bors[bot]
8920e8b2ba
Merge #1135
1135: Make all textures support usage COPY_SRC and COPY_DST r=kvark a=fintelia

**Connections**
N/A

**Description**
In WebGPU, all textures should be allowed to have usages COPY_SRC and COPY_DST. However, right now when Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES is enabled any features that the backend says can't be blitted to/from will not gain these capabilities. In particular, compressed textures may not support blitting while still allowing access via copies to/from buffers.

You can also see the defaults used when TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES is not requested:
8c00cbcc8e/wgpu-types/src/lib.rs (L1224-L1342)

**Testing**
I ran a [patched version of the wgpu-rs cube example](https://github.com/fintelia/wgpu-rs/tree/cube-bc4/examples/cube).

Co-authored-by: Jonathan Behrens <fintelia@gmail.com>
2021-01-10 16:09:13 +00:00
Jonathan Behrens
1e7fa480a1 Make all textures support their guaranteed usages 2021-01-10 10:59:42 -05:00
TheArtist
ce908c5f57 Changed Arc<B::Memory> to Arc<Mutex<B::Memory>> in GpuAllocator 2021-01-09 19:53:13 +02:00
bors[bot]
8c00cbcc8e
Merge #1112
1112: Expose adapter specific formats features via Extension, support for storage read+write r=kvark a=Wumpf

**Connections**
Draft until https://github.com/gfx-rs/gfx/pull/3559 landed (then update and comment two lines in)
New & improved replacement for #1109

PR for wgpu-rs to be opened once there's some confidence that this is that it should look like. [Preview](https://github.com/gfx-rs/wgpu-rs/compare/master...Wumpf:texture-format-feature-query?expand=1)

**Description**
Adapter exposes now per texture format specific features. Feature struct defined as allowed usages + flags. Flags describe only storage texture usage so far.

Query not used for validation unless `TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES` feature is enabled on a device. Otherwise uses hardcoded feature set guaranteed by webgpu.
Storage read/write binding can then be used as a consequence (storage atomic has no effect yet).

**Testing**
Manual testing with my fluid sim project through wgpu-rs which covers storage r/w for a few different formats and storage in general for formats that don't support this usage by default at all.
Ran tests and a couple of samples to see if anything broke with the feature disabled.

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2021-01-06 18:56:30 +00:00
Andreas Reich
30c96bfead Added note on why hal update needed for STORAGE_READ_WRITE is blocked atm 2021-01-06 17:59:53 +01:00
Greg V
072b94c9fd Never prefer CPU devices over GPUs 2021-01-06 19:19:39 +03:00
Andreas Reich
e29d17a13f wgpu format features are again part of TextureFormatInfo
+ some cleanup/fix indentations
2021-01-05 23:54:50 +01:00
Dzmitry Malyshau
d70148725b Fix API traced dynamic offsets and object labels 2021-01-04 17:54:56 -05:00
Dzmitry Malyshau
922f2c0977 Check swapchain frame to still be in use 2021-01-04 17:03:16 -05:00
Dzmitry Malyshau
f328995950 Fix UB in populating dynamic offsets 2021-01-04 14:46:04 -05:00
bors[bot]
29cb9e687d
Merge #1124
1124: Fix range tracker merging r=kvark a=kvark

**Connections**
Fixes #1123 

**Description**
The merge routine was not properly updating the end pointer in some branches.

**Testing**
A unit test is added with the data extracted from the user case.

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2021-01-04 18:42:02 +00:00
Dzmitry Malyshau
a7e573d612 Fix range tracker merging 2021-01-04 13:41:25 -05:00
Dzmitry Malyshau
5953098461 Implement render bundle freeing 2021-01-04 09:30:10 -05:00
Dzmitry Malyshau
2b02b7c8e4 Lock device tracker after the resources 2021-01-03 11:29:18 -05:00
bors[bot]
36d274bc5a
Merge #1115
1115: Request buffer FAST_DEVICE_ACCESS only with some non MAP or COPY usage r=kvark a=fintelia

**Connections**
Fixes #1113 

**Description**
On Linux AMD (and likely elsewhere) buffers with FAST_DEVICE_ACCESS are very slow to access when mapped. This makes sure that upload/download buffers don't request it unless those buffers are leveraging MAPPABLE_PRIMARY_BUFFERS for some non-map/copy usage.

**Testing**
I reran the failing reproduction case in the linked issue.


Co-authored-by: Jonathan Behrens <fintelia@gmail.com>
2021-01-03 03:32:08 +00:00
Dzmitry Malyshau
d095dd39b7 Free associated staging buffers 2021-01-02 18:52:07 -05:00
Jonathan Behrens
0e84c29691 Limit when buffer FAST_DEVICE_ACCESS is requested 2021-01-02 14:18:14 -05:00
Andreas Reich
9770959577 Fixed error message for BindingTypeMaxCountError
Previously, it would incorrectly report the binding count as the violated limit. Now it reports both the limit and the count that violated it.
2021-01-02 15:13:52 +01:00
Andreas Reich
757d12aca3 map depth/stencil feature to RENDER_ATTACHMENT 2020-12-30 12:23:13 +01:00
Andreas Reich
c17b2dc6a0 Expose adapter_get_texture_format_features 2020-12-30 12:00:00 +01:00
Andreas Reich
4207e57c02 validation against adapter specific format features
TextureFormatFeatures is now a struct of two u32 flags. Query happens only at texture creation time
2020-12-30 10:38:55 +01:00
Andreas Reich
0ccad9a466 wip adapter specific format features & rw storage 2020-12-29 17:14:22 +01:00
Connor Fitzgerald
79973aaaff Bump gfx-hal and gpu-alloc 2020-12-27 01:10:24 -05:00
Dzmitry Malyshau
ab10d36ac0 Rename get_encoder to get_encoder_mut 2020-12-23 11:20:08 -05:00
Dzmitry Malyshau
a7587b41e6 Move the render pass setup logic into a separate method/struct 2020-12-22 22:30:27 -05:00
Dzmitry Malyshau
35b163ebc8 Encode render passes while command buffer is only read-locked 2020-12-22 13:48:18 -05:00
bors[bot]
2287ae3f8a
Merge #1103
1103: Fix Assorted Low-Hanging Validation and Error Message Issues r=kvark a=cwfitzgerald

**Connections**

Closes #1085
Closes #393
Closes #1053

**Description**

These commits are independent and should be reviewed individually. Combined into a single PR to reduce noise.

Overview of what was done:
- Add validation for empty texture and buffer usage flags. (#393)
- Add allowed texture usage flags to `format.describe()` (#1085)
  Validate new textures follow the allowed usage flags.
- Properly validates vertex and buffers are bound. (#1053)
  Improves error messages when no vertex buffer is bound. (Before it said the limit was 0, now it says something is unbound)
- Improve the vertex buffer overrun messages by keeping track of which slot has the smallest index.

**Testing**

Tested on examples by artificially creating the situation I am trying to validate, as well as running clean examples to make sure they pass validation.

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2020-12-22 04:29:38 +00:00
Connor Fitzgerald
1da153f3bd Improve vertex state error messages 2020-12-21 23:13:34 -05:00
Connor Fitzgerald
94579d8125 Properly validate vertex buffer state 2020-12-21 23:10:53 -05:00
Connor Fitzgerald
43814d258f Add format usage descriptions and validate on it. 2020-12-21 23:08:31 -05:00
Connor Fitzgerald
6c6ce2f28c Validate on empty usages 2020-12-21 17:27:17 -05:00
Connor Fitzgerald
073c0b2f3e Validate swapchain extent as non-zero 2020-12-21 14:56:06 -05:00
Imbris
e775987233 Pass DEPTH_CLAMPING feature request to gfx-hal 2020-12-19 16:14:51 -05:00
Dzmitry Malyshau
b95a66da5e Move AdapterInfo into wgt 2020-12-18 16:43:19 -05:00
bors[bot]
60086bb1d6
Merge #1096
1096: Fix build for wasm32 target r=kvark a=VincentFTS

**Connections**
#115 

**Description**
Fix Wgpu build for Wasm target

**Testing**
It’s just a first step toward wasm support in Wgpu-rs, a PR in Wgpu-rs will come later.


Co-authored-by: Vincent Jousse <contact@ftsoftware.fr>
2020-12-18 21:12:00 +00:00
Vincent Jousse
0899bb7207 Fix build for wasm32 target 2020-12-18 22:09:20 +01:00
Vincent Jousse
ab64aa5b92 Fix bad copy/paste in #907 2020-12-18 21:37:17 +01:00
bors[bot]
89e585af61
Merge #1093
1093: Update naga and gfx, move the shader validation into a shader descriptor bit r=cwfitzgerald a=kvark

**Connections**
Includes https://github.com/gfx-rs/gfx/pull/3533 and a bunch of Naga things.

**Description**
Updates Naga with the new WGSL syntax, lots of fixes.
Large update of the GL backend.

**Testing**
Tested on some wgpu-rs examples.

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2020-12-17 16:34:28 +00:00
Dzmitry Malyshau
f07cc8156b Update naga and gfx, move the shader validation into a shader descriptor bit 2020-12-17 11:33:47 -05:00
Dzmitry Malyshau
b84301110c Optimize submit() for no command buffers 2020-12-16 15:02:09 -05:00
Dzmitry Malyshau
cb67ef6542 Clean up render pass labels 2020-12-15 17:28:24 -05:00
Dzmitry Malyshau
394135f725 Fix and improve object labels and command markers 2020-12-15 11:28:11 -05:00
Emanuele Dalla Longa
b3f18ff3c5 Add SHADER_READ usage bit to non-readonly buffers
Change-Id: I99d189e7ef295a58c2179635f95656eb9a2f5fe6
2020-12-10 17:20:29 +01:00
bors[bot]
69196d85a3
Merge #1077
1077: Remove extern "C" from set_index_buffer r=kvark a=DevOrc

**Connections**
Fixes an issue that is blocking gfx-rs/wgpu-native#61

**Description**
Moves the ffi definition of wgpu_render_bundle_set_index_buffer / wgpu_render_pass_set_index_buffer to wgpu-native. This is needed because wgpu-native has its own version of IndexFormat that is different than the wgpu_types version. 

**Testing**
My projects with wgpu-native work


Co-authored-by: Noah Charlton <ncharlton002@gmail.com>
2020-12-08 15:45:00 +00:00
Noah Charlton
b71c47a064 Remove extern "C" from set_index_buffer 2020-12-07 17:03:54 -05:00
bors[bot]
071ccf24c9
Merge #1080
1080: Fix the validation of vertex buffer sizes r=kvark a=JCapucho

**Connections**
None that i know of

**Description**
~~The vertex buffer size (in vertices) was being divided by stride causing the limit to be lower than it was supposed to be.~~
This bug wasn't triggered earlier because if the stride was 0 it wouldn't perform any calculation and the stride was only set when a set pipeline command was received and the `VertexState` `inputs` were already created so the following commands would work:
```
SetPipeline with 1 vertex buffer
SetVertexBuffer with only 4 vertices
Draw 6 vertices
```
This would have passed validation while this wouldn't
```
SetPipeline with 1 vertex buffer of stride 8
SetVertexBuffer with 4 vertices
SetPipeline with 1 vertex buffer of stride 8
SetVertexBuffer with 4 vertices
Draw 3 vertices
```

Now all draw calls have proper vertex validation and not only after the `inputs` are populated

**Testing**
This change was tested after debugging an issue with the draw calls failing in a specific order in [veloren](https://gitlab.com/veloren/veloren/-/tree/imbris/wgpu-master-rebased)

Co-authored-by: Capucho <jcapucho7@gmail.com>
2020-12-07 15:48:11 +00:00
Capucho
713c23bc42
Grow the VertexState inputs in SetPipeline 2020-12-07 15:45:20 +00:00
Dzmitry Malyshau
a316fff427 Update Naga to gfx-4, update gfx with GL fixes 2020-12-07 01:30:52 -05:00
Dzmitry Malyshau
3f33434c6f Enable experimental translation to playtests 2020-12-06 15:14:14 -05:00
Dzmitry Malyshau
dccc57e7b5 Switch playtests to WGSL 2020-12-06 14:51:23 -05:00
Connor Fitzgerald
19fb491262 Fix validation of compressed mipmaps 2020-12-05 19:30:26 -05:00
Connor Fitzgerald
8f430ab1ef Implement ETC2 and ASTC textures 2020-12-05 19:30:26 -05:00
Dzmitry Malyshau
749f737c89 Add pervasive Naga support to shader module loading
The purpose of the PR is to support Naga modules everywhere.
As a requirement, it updates the gfx-rs version used.
Most of the logic is dedicated towards building a shader interface,
where previously we just used naga's IR. Now we have our own mini-IR.
2020-12-05 11:31:03 -05:00
kejor
4513fb2b83 Match upstream API changes for IndexFormat 2020-12-01 19:19:41 -05:00
Dzmitry Malyshau
9e2f6c2f01 Move to gfx master 2020-11-30 22:50:13 -05:00
Dzmitry Malyshau
10c11d718d Replace gfx-descriptor by gpu-descriptor 2020-11-30 21:48:04 -05:00
bors[bot]
67e652f471
Merge #1047
1047: Update bind group layout API to match upstream r=cwfitzgerald a=kvark

**Connections**
Follows https://github.com/gpuweb/gpuweb/pull/1076, https://github.com/gpuweb/gpuweb/pull/1223 (https://github.com/gpuweb/gpuweb/issues/1164), https://github.com/gpuweb/gpuweb/pull/1255, and https://github.com/gpuweb/gpuweb/pull/1256

**Description**
Aligns our API closer to the latest changes in WebGPU upstream. We technically don't have to do this, but I believe in the end it would be best if our API gets close to upstream.

Note: this is a sensitive change for the users, everybody will get their code broken. So please take a look at the API and see if something is missing or needs improvement, so that we don't have to go through the changes again afterwards.

**Testing**
Doesn't really need testing. Partially covered by the existing playtest.

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-11-30 22:31:49 +00:00
lordnoriyuki
e160de87d5 Merge remote-tracking branch 'upstream/master' 2020-11-28 16:13:37 -08:00
lordnoriyuki
162cd6bd86 Disable gfx-backend-gl on macOS 2020-11-28 16:11:16 -08:00
Dzmitry Malyshau
ee87d7fae7 Flush write_texture staging memory 2020-11-28 12:12:51 -05:00
Dzmitry Malyshau
5949dec61d Update bind group layout API to match upstream 2020-11-28 00:30:27 -05:00
bors[bot]
dd31c924df
Merge #1052
1052: Check for missing fragment shader outputs r=kvark a=kvark

**Connections**
Fixes  #1046

**Description**
Introduces a proper error for the missing outputs

**Testing**
Untested

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-11-27 17:46:56 +00:00
Dzmitry Malyshau
e5204e915c Check for missing fragment shader outputs 2020-11-27 12:44:31 -05:00
bors[bot]
99bc5679ed
Merge #1051
1051: Register init-destination buffer in the pending writes r=kvark a=kvark

**Connections**
Fixes #1049

**Description**
At some recent point we introduced the map of destination buffers for copies, and I missed the case where buffers are mapped at creation.

**Testing**
Tested on the test-case in #1049

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2020-11-26 22:00:46 +00:00
Dzmitry Malyshau
992e240938 Register init-destination buffer in the pending writes 2020-11-26 16:59:25 -05:00
Dzmitry Malyshau
55851add9b player: use the wgpu-cores's gfx-select macro 2020-11-26 14:47:48 -05:00
lordnoriyuki
c80ca8dbe4 Updating to latest gpu-alloc 2020-11-24 19:10:46 -08:00
Dzmitry Malyshau
2f55c708b8 Update gpu-alloc and naga with linear allocation fixes 2020-11-24 09:40:36 -05:00
Dzmitry Malyshau
c6bc37dbde [error] render bundles 2020-11-23 12:00:47 -05:00
Dzmitry Malyshau
6307294e2b [error] pipeline creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau
ad824de268 [error] bind groups and layouts creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau
fccbca28bd [error] shader module creation, separate descriptor 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau
e96e5f917c [error] sampler creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau
8287464855 [error] texture view creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau
bedd037517 [error] buffer creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau
eb4f633e39 [error] texture creation 2020-11-23 11:57:32 -05:00
Mikko Lehtonen
459e835250 Add Ids to PassErrorScope
Also makes it pub, and the places it is used.
Tweak some error messages.
2020-11-21 23:39:05 +02:00
Dzmitry Malyshau
46b87e220c Stop using Borrow<RefCount> 2020-11-21 10:38:20 -05:00
Mikko Lehtonen
48e64fc8c6 Add missing label query methods 2020-11-19 23:37:59 +02:00
Mikko Lehtonen
a41f7ea78f Make inner errors pub 2020-11-19 23:37:36 +02:00
Mikko Lehtonen
4498f172cc Retain labels for resources
As a braking api change, adds also label for the error id generation,
for labeling invalid ids too.

Also adds query methods the label.
2020-11-19 00:09:21 +02:00
Dzmitry Malyshau
b48764728d Update gpu-alloc and naga 2020-11-18 09:24:43 -05:00
bors[bot]
af9713b249
Merge #1023
1023: Drop surfaces and adapters r=cwfitzgerald a=kvark

**Connections**
Not very connected

**Description**
Refactors our destruction paths a bit

**Testing**
tested on wgpu-rs

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-11-13 23:50:28 +00:00
Dzmitry Malyshau
ac89fbab8a Drop surfaces and adapters 2020-11-13 18:39:14 -05:00
Dzmitry Malyshau
b0a98548d1 Update naga to 4d4e1cd4cb 2020-11-13 12:26:48 -05:00
Marvin Löbel
3787d3bedb Change Err(x)? to return Err(x.into()) 2020-11-13 00:03:13 +01:00
Marvin Löbel
8723a8379a Annotate all commands of {Compute,Render}Passes with error context informations 2020-11-12 23:05:10 +01:00
Dzmitry Malyshau
22efbeae70 Replace gfx-memory by gpu-alloc 2020-11-09 12:16:34 -05:00
Zsolt Bölöny
a493ed06d8 Rename OutputAttachment helper struct to RenderAttachment too to avoid confusion 2020-11-08 14:27:44 +01:00
Zsolt Bölöny
2151a252ad Rename TextureUsage::OUTPUT_ATTACHMENT to RENDER_ATTACHMENT 2020-11-08 14:24:39 +01:00
Dzmitry Malyshau
73d3f71caa
Enable the non-fill polygon mode feature if requested (#1016)
* Enable the non-fill polygon mode feature if requested

* Update wgpu-core/src/instance.rs

Co-authored-by: monocodus[bot] <49363530+monocodus[bot]@users.noreply.github.com>

Co-authored-by: monocodus[bot] <49363530+monocodus[bot]@users.noreply.github.com>
2020-11-06 00:32:04 -05:00
Zicklag
f7f1ff699a Implement OpenGL Backend For Unix Platforms 2020-11-04 20:32:33 -06:00
Zicklag
7beb7c3411 Update For Latest GFX
Using a specific Git commit for now because it is unreleased.
2020-11-02 20:25:07 -06:00
Zicklag
165d7717b4 Add Error Message When Surface Creation Fails 2020-11-02 20:24:30 -06:00
bors[bot]
7b9abf0fef
Merge #1008
1008: Add helpers to convert passes to serialized forms r=grovesNL a=kvark

**Connections**
Stuff I needed to fix in the upcoming Gecko WebGPU update.

**Description**
It allows us to use the tracing `Command` more aggressively.

**Testing**
Tested in Gecko, doesn't need testing in wgpu

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2020-11-02 23:15:03 +00:00
Dzmitry Malyshau
5e1e3314cd Check array layer counts 2020-10-30 17:31:43 -04:00