Commit Graph

903 Commits

Author SHA1 Message Date
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
Dzmitry Malyshau
6e3c7b359f Add missing license headers 2020-10-28 13:40:41 -04:00
Dzmitry Malyshau
a168886497 Add helpers to convert passes to serialized forms 2020-10-27 13:19:05 -04:00
Connor Fitzgerald
dcc14fe645 Improve cubemap validation 2020-10-25 17:14:14 -04:00
bors[bot]
6c519e0d92
Merge #1000
1000: Elide redundant set_pipeline calls. r=kvark a=Kimundi

**Description**
This adds an check in each `set_pipeline()` call for wether the same pipeline id has already been set previously. This should cause free performance wins for suboptimal usage of the wgpu API, while having neglible overhead otherwise.

An example scenario for where this would be useful is a game that just blindly sets all render state for each object, but has few actually different objects:

```rust
for game_obj in game_objs {
    rpass.set_pipeline(...);
    rpass.set_bind_group(...);
    rpass.set_vertex_buffer(...);
    rpass.draw(...);
}
```

**Testing**
Ideally we would have tests that check that pipeline changes have been ellided, but I'm not sure how to write them in the current codebase.

**Future work**
- We could extend this kind of redundant state change detection to most `.set_*` methods on `RenderPass`es.
- If we want to guarantee this behavior in the API, we should also document it.

Co-authored-by: Marvin Löbel <loebel.marvin@gmail.com>
2020-10-22 17:18:24 +00:00
Marvin Löbel
752c1aad33 Elide redundant set_pipeline calls.
Add a small abstraction over state changes

Deduplicate redundant pipeline state checking
2020-10-21 19:25:21 +02:00
qthree
c3a5144ae0 Fix regression in device_create_swap_chain
It was caused by new behavior of Storage::remove.
2020-10-20 13:33:03 +07:00
Dzmitry Malyshau
8ce2530b69 Save an allocation of raw bindings in create_bind_group 2020-10-15 16:37:10 -04:00
Dzmitry Malyshau
a4e8d58144 Update gfx-backend-vulkan to 0.6.4 2020-10-15 16:03:30 -04:00
Dzmitry Malyshau
6d40a81833 Revert "Fix coalescing of descriptor sets"
This reverts commit 56df63b122.
2020-10-15 15:53:26 -04:00
Dzmitry Malyshau
8a364d3c69 Revert "Group binding writes by wgt::BindingType"
This reverts commit 98c3de7884.
2020-10-15 15:52:58 -04:00
Dzmitry Malyshau
150ee25c01 Align stencil reference flags between pipeline creation and setting 2020-10-14 16:54:15 -04:00
bors[bot]
3be2c452c4
Merge #982
982: Fix debug markers in render passes (#981) r=kvark a=kazimuth

Hey, that was easy. Didn't change anything in the debug groups markers / command pass markers, since afaict they work correctly.

I didn't add a test here because I'm not sure how to use the `player` testing apparatus, but I figure since I'm just adding a line of code that's already there for compute passes ([here](https://github.com/gfx-rs/wgpu/blob/master/wgpu-core/src/command/compute.rs#L452)) it should be alright. Let me know if there's anything else I should add.

Co-authored-by: James Gilles <jameshgilles@gmail.com>
2020-10-13 22:45:14 +00:00
Dzmitry Malyshau
ecbf81f4c9 Fix locking of device lifetime tracker on resource drop 2020-10-13 18:37:20 -04:00
James Gilles
05c58e805b Fix garbled debug markers in render passes 2020-10-13 17:34:25 -04:00
Dzmitry Malyshau
98c3de7884 Group binding writes by wgt::BindingType 2020-10-13 16:06:50 -04:00
frbimo
fdd561e69e remove PowerPreference::Default
Signed-off-by: frbimo <fr.bimo@gmail.com>
2020-10-12 19:17:44 +08:00
Dzmitry Malyshau
56df63b122 Fix coalescing of descriptor sets 2020-10-11 22:47:41 -04:00
bors[bot]
f963193be1
Merge #966
966: Immediate resource destruction and freeing r=cwfitzgerald a=kvark

**Connections**
Fixes #964

**Description**
We are making it so a buffer or a texture can have their native resources freed while they are still referenced, so without waiting for GC.

In addition, the PR adds a few missing cases where error IDs should have been handled, like at render pass encoding.

**Testing**
Tested on wgpu-rs examples, see https://github.com/gfx-rs/wgpu-rs/pull/591

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-10-11 17:10:42 +00:00
Dzmitry Malyshau
c87a94f976 Early texture destruction 2020-10-08 23:21:11 -04:00
PENGUINLIONG
6f4508523a
Pass [u8] instead of [u32] for push constants (#918)
* Pass [u8] instead of [u32] for push constants

Use 2-instruction aligner

Fixed alignment

Fixed offsets

Added alignment checks and fixed size

Use semantic constants

* Replaced all magic number with constant

* Fixed type cast
2020-10-08 23:13:18 -04:00
Dzmitry Malyshau
c4c8e3b224 Early buffer destruction logic 2020-10-08 22:28:52 -04:00
Dzmitry Malyshau
0a7d81351c Handle cases where buffer contents are destroyed 2020-10-08 12:57:17 -04:00
Dzmitry Malyshau
50594a747d Another small Naga update 2020-10-07 16:14:25 -04:00
Dzmitry Malyshau
0070bf703c Coalesce bindings into a single write 2020-10-07 16:14:25 -04:00
Dzmitry Malyshau
962e4dbaf7 Defer bind group creation to after validation 2020-10-07 16:14:25 -04:00
bors[bot]
aee0bead78
Merge #963
963: Add repr(C) on mapping structs r=trivial a=kvark

**Connections**
Required for https://phabricator.services.mozilla.com/D92636

**Description**
Allows C clients to avoid redefining those structs.

**Testing**
No need

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2020-10-06 17:37:45 +00:00
Dzmitry Malyshau
dc2d581c8d Add repr(C) on mapping structs 2020-10-06 13:36:17 -04:00
Dzmitry Malyshau
45ade807cc Only request features that are needed 2020-10-05 14:51:32 -04:00
Dzmitry Malyshau
0a67d6a7be Enable RBA feature where available 2020-10-05 10:21:39 -04:00
bors[bot]
bcb3162b2b
Merge #947
947: Update naga with the new usage validation r=cwfitzgerald a=kvark

**Connections**
Includes https://github.com/gfx-rs/naga/pull/200, https://github.com/gfx-rs/naga/pull/203, https://github.com/gfx-rs/naga/pull/214, and others

**Description**
We get more comprehensive validation, which can sometimes be annoying :)

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

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-10-01 16:05:42 +00:00
Dzmitry Malyshau
c18ac58fd8 Update naga with the new usage validation 2020-09-28 10:18:35 -04:00
lberrymage
41228ef1a4
Fix clippy warnings about using if-let over match
The specific lint triggered was
https://rust-lang.github.io/rust-clippy/master/index.html#single_match.
2020-09-25 23:02:51 -08:00
Adam Nemecek
db1870e7fc use self 2020-09-25 19:11:46 -07:00
Leon Scherer
1fecbe18ed Fixed typo in texture size check 2020-09-25 14:21:38 +02:00
bors[bot]
a56f9949ec
Merge #938
938: Remove erroneous extra feature check r=kvark a=cwfitzgerald

**Connections**

None, found during investigation of DI issue.

**Description**

This line of code just shows up twice in a row, checking the same feature and setting the same feature.

**Testing**

Untested, but shouldn't affect anything.


Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2020-09-24 13:18:04 +00:00
Dzmitry Malyshau
0345c56758 Properly implement compute pass usage scopes 2020-09-23 19:01:47 -04:00
Connor Fitzgerald
a9750f83bc Remove erroneous extra feature check 2020-09-23 18:13:54 -04:00
Kunal Mohan
485dab9a52 Prevent an invalid texture from being registered in device_create_texture 2020-09-23 00:30:50 +05:30
Mikko Lehtonen
8252758674 Reverts the addition of LabeledContextError
Removed as discussed, moving them to wgpu-rs side
2020-09-14 22:45:10 +03:00
Kunal Mohan
d423d3d5d7
Allow dropping of error resources (#925)
* Allow dropping of error resources

* Unregister error resources without panic
Panic when removing Vacant element or when index is out of range

* address review comments
2020-09-13 21:17:53 -04:00
Dzmitry Malyshau
6a3c106cc4 Update naga with new image API 2020-09-11 12:34:20 -04:00
Manuel Woelker
336d070b26 add polygon_mode: PolyonMode to RasterizationStateDescriptor to allow drawing wireframes 2020-09-09 21:34:37 +02:00
Mikko Lehtonen
2fb8fc34d2 Add LabeledContextError
Purpose for this is to add more context to an error.
create_render_pipeline error is improved, by showing the action
(creating render pipeline) and the user provided label, to aid with
the investigation.
2020-09-08 17:44:53 +03:00
Ben Frankel
2ee07a2a47 Fix invalid mip level count check 2020-09-07 16:49:06 -07:00
Dzmitry Malyshau
68bf10a3a5 Fix invalidated segment of the staging memory 2020-09-06 20:37:03 -04:00
Dzmitry Malyshau
eed8bf84ef Playtest for binding a group 2020-09-04 23:47:24 -04:00
Dzmitry Malyshau
1886149cae Don't bind groups that aren't expected by the layout 2020-09-04 23:47:24 -04:00
Dzmitry Malyshau
35d2ed39b5 Flush staging init buffers 2020-09-02 15:58:32 -04:00
bors[bot]
6df8421f22
Merge #909
909: Add Quad play test r=kvark a=DevOrc

**Connections**
#807 

**Description**
Adds a play test that renders a white quad to a texture. The texture is then copied to a buffer and checked for accuracy with a file of expected bytes (All 0xFF). 

**Testing**
Cargo test succeeds

Co-authored-by: Noah Charlton <ncharlton002@gmail.com>
2020-09-01 20:18:21 +00:00
Noah Charlton
d05d1aeec1 Add Quad play test 2020-09-01 16:07:24 -04:00
Zicklag
7572dbeaf9 Use CFG Aliases to Replace the backends! Macro
Uses the `cfg_aliases` crate to replace the `backends!` macro and
provide a more natural way to gate backend specific code.
2020-08-29 21:55:17 -05:00
bors[bot]
bba82724a8
Merge #903
903: fix for mixed STORAGE_STORE and STORAGE_LOAD r=kvark a=kocsis1david

**Connections**
None

**Description**
A buffer that contains dynamic data is used for both uniforms and storage read. This was a problem for wgpu and it gave a `PendingTransition` error.

**Testing**
It's a trivial fix, but I don't know if there's an example for it in wgpu-rs that can be used for testing.

It seems that the PR "Sync changes from mozilla-central" is already solving the same issue.


Co-authored-by: Dávid Kocsis <kocsis1david@windowslive.com>
2020-08-28 16:10:55 +00:00
Maximilian Lupke
5d50b2ac24
Allow copying from depth textures (#901)
* Allow copying from depth textures

* Rename TextureFormat::is_depth_format to just is_depth

* Only allow Depth32Float format for copying, and only as source
2020-08-28 10:58:48 -04:00
Dávid Kocsis
5ea3ea7b55 fix for mixed STORAGE_STORE and STORAGE_LOAD 2020-08-28 07:23:38 +02:00
bors[bot]
4de1d24bc6
Merge #898
898: Update naga with improved SPIR-V parsing and reflection r=cwfitzgerald a=kvark

**Connections**
Fixes #892
Fixes #899
Includes https://github.com/gfx-rs/naga/pull/153 and the awesome https://github.com/gfx-rs/naga/pull/122
Also includes https://github.com/gfx-rs/naga/pull/157 now.

**Description**
This PR updates naga and our validation code.
~~We can successfully validate only `hello-triangle` and `cube` examples, still.~~
We mostly pass the validation of the examples now!
Meta-issue filed in https://github.com/gfx-rs/naga/issues/155 to unlock the rest.

**Testing**
Tested on examples in https://github.com/gfx-rs/wgpu-rs/pull/537

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-08-27 21:06:27 +00:00
Mikko Lehtonen
5fab78e175 Address nits in #897 2020-08-27 22:11:42 +03:00
Dzmitry Malyshau
ceac2344fc Update naga to bd9efe5915 2020-08-27 11:52:02 -04:00
Dzmitry Malyshau
03becf1a17 Force width=4 in all shader-matched variables 2020-08-26 15:53:39 -04:00
Dzmitry Malyshau
b5475d7d80 Update naga to 4797773152 2020-08-26 15:35:14 -04:00
Mikko Lehtonen
dbd6081a8e Improve diagnostics of incompatible attachments 2020-08-26 10:03:44 +03:00
bors[bot]
59f0996eab
Merge #895
895: Improve validation in B2B copies and RenderCommands r=kvark a=kunalmohan

**Connections**
_Link to the issues addressed by this PR, or dependent PRs in other repositories_

**Description**
_Describe what problem this is solving, and how it's solved._
Validation for the following have been added-
- Validate all parameters in B2B copy even if `copy_size == 0`.
- Check for copy operations issued within same buffer.
- `RenderPass.setViewport()`
- `RenderPass.setScissorRect()`

**Testing**
_Explain how this change is tested._
Tested with CTS in Servo. More tests pass now. Will test on wgpu-rs now.
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See https://github.com/gfx-rs/wgpu/pull/666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Kunal Mohan <kunalmohan99@gmail.com>
2020-08-24 18:00:47 +00:00
Kunal Mohan
a10e5cdb53 Check whether attachments are of same size or not 2020-08-24 23:02:04 +05:30
Dzmitry Malyshau
b8b7561796 Improve texture creation validation 2020-08-24 13:00:34 -04:00
Kunal Mohan
f266431f24 Improve validation in b2b copies and RenderCommands 2020-08-24 21:14:07 +05:30
Justin Shrake
19eeee27ee Add AddressMode::ClampToBorder behind a feature 2020-08-22 13:23:50 -07:00
Dzmitry Malyshau
6f1d6145f5 Fix swapchain preferred format 2020-08-21 12:31:52 -04:00
Connor Fitzgerald
f9265bccd2 Improve buffer and texture overrun error messages 2020-08-19 11:44:54 -04:00
Dzmitry Malyshau
901b043b19 Version bump to 0.6 and changelog update 2020-08-17 16:51:22 -04:00
Dzmitry Malyshau
d1da6d8106 Switch gfx-hal to 0.6 2020-08-17 10:34:50 -04:00
John Mitchell
4cb50e8395 Added image cube array. 2020-08-16 23:10:06 -04:00
Dzmitry Malyshau
44fdfb80d0 Fix support for d24unorm format 2020-08-13 17:26:44 -04:00
Dzmitry Malyshau
d8341c5996 Add labels to pipelines 2020-08-13 12:14:24 -04:00
Dzmitry Malyshau
2473c25971 Refactor the stencil state descriptor a bit 2020-08-12 20:04:47 -04:00
Dzmitry Malyshau
d07d8503a0 Move the subscriber into a different crate 2020-08-12 15:00:15 -04:00
Dzmitry Malyshau
a0711cf9b2 Move the RenderCommand into the shared draw module 2020-08-12 14:33:42 -04:00
Dzmitry Malyshau
9d8dc0b04d Grand cleanup and refactor of the descriptors in the API 2020-08-12 14:13:32 -04:00
Dzmitry Malyshau
1f5622a0b3 Respect texture view aspect on creation 2020-08-10 16:14:20 -04:00
Dzmitry Malyshau
f164fd1f46 Bump BGL refcounts on getting them from pipelines 2020-08-10 10:11:31 -04:00
Dzmitry Malyshau
55064ace4c New get_bind_group_layout functions 2020-08-09 18:33:47 -04:00
Dzmitry Malyshau
d8efe3b6fe Attempt to unite implicit layout code between compute and render 2020-08-09 18:16:03 -04:00
Dzmitry Malyshau
173c7c3dbf Create implicit layouts for render pipelines 2020-08-09 14:43:44 -04:00
Dzmitry Malyshau
a9b8a99e19 Create implicit layouts for compute pipelines 2020-08-09 08:33:33 -04:00
Dzmitry Malyshau
f18fa7ef9b Derive bind group layout entries in Naga validation 2020-08-08 01:09:41 -04:00
Dzmitry Malyshau
8731da278e Streghten the multi-ref-count on BGLs 2020-08-05 17:39:25 -04:00
Kunal Mohan
aa44969818 Replace u32 with NonZeroU32 in TextureView 2020-08-05 21:23:25 +05:30
Gabriel Majeri
021251a908 Remove power module 2020-08-05 16:27:41 +03:00
Dzmitry Malyshau
dbd7e2c579 Separate valid internal IDs from external ones 2020-08-04 11:16:59 -04:00
Dzmitry Malyshau
3291b72368 Update naga and fix type widths 2020-07-31 23:46:19 -04:00
Connor Fitzgerald
00a5be7f7b Fix multi-layer copies 2020-07-30 16:58:29 -04:00
Kunal Mohan
c8360152cd Replace NonZeroU32 with u32 in TextureViewDescriptor 2020-07-30 21:35:07 +05:30
Connor Fitzgerald
e5c647745e Implement TEXTURE_COMPRESSION_BC extension 2020-07-29 18:43:50 -04:00
bors[bot]
f6ba5b8298
Merge #845
845: Finish error model refactor r=kvark a=GabrielMajeri

**Connections**
I think this is the last part of #638. I've reviewed all the remaining `unwrap`s and `assert`s in the code, and these should be the last ones left which ought to return errors (the remaining ones seem to uphold internal invariants).

**Description**
Implements error handling for various conditions, which are then returned to the caller. Including, but not limited to:
- running out of memory when creating a command pool
- running out of memory when creating a frame buffer for a render pass
- invalid dimensions when creating a texture

**Testing**
Tested with core and player.

Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
2020-07-29 18:10:33 +00:00
Gabriel Majeri
a5f72d26d3 Handle DeviceLost in triage_submissions 2020-07-29 20:17:48 +03:00
Gabriel Majeri
62f1f9c438 Error types for conv module 2020-07-29 20:17:46 +03:00
Kunal Mohan
0ef76a7643 Add mip level count and array layer count validation to texture_create_view 2020-07-29 21:47:28 +05:30
Gabriel Majeri
2f06d3e4f9 Return out of memory condition from render pass 2020-07-29 09:58:46 +03:00
Gabriel Majeri
e860dd995f Handle command pool creation error 2020-07-29 09:56:42 +03:00
Dzmitry Malyshau
d2c1e725db Make level and layer count for texture view optional 2020-07-28 22:55:39 -04:00
Dzmitry Malyshau
bf862b7907 Clarity renames according to the Gecko review 2020-07-28 16:58:28 -04:00
Dzmitry Malyshau
b16640cdc4 Refactor pipeline creation to check the resource counts earlier 2020-07-28 13:55:07 -04:00