Commit Graph

242 Commits

Author SHA1 Message Date
Nicolas Silva
d1ff3838b8
Expose the full Result type to the rust map_async callback (#2939) 2022-10-13 15:41:52 -04:00
daxpedda
02cc2ae234
[BREAKING] Make Shader(Module)Source::Wgsl optional (#2890) 2022-10-08 01:12:50 -04:00
Leo Kettmeir
26f223964e
use custom ser/de impl for TextureFormat (#2908)
Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com>
2022-09-29 13:43:50 -04:00
Imbris
41006d7a88
Buffer usages mismatch check and documentation for mapped_at_creation size requirement. (#3023)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-09-19 04:41:29 +00:00
Alphyr
d1c94d09e2
Update dependencies (#3021) 2022-09-18 23:53:21 -04:00
i509VCB
9e3efd7019
pass around RawDisplayHandle and RawWindowHandle in implementation (#3022)
This change is to help with an attempt to allow the Context type in wgpu to be swappable at runtime. In order to do that, the functions provided by Context and it's associated types need to be object safe. Instead of passing a impl trait that combines both HasRawWindowHandle and HasRawDisplayHandle, we seperate the types into their RawDisplayHandle and RawWindowHandle parts internally to reduce some of the hal implementation code mess.
2022-09-15 16:29:20 -07:00
Jim Blandy
d655017439
Implement "strict_asserts" feature in wgpu-core. (#2872)
Since `wgpu-core`'s public functions are supposed to validate their
parameters, the internal `track` module skips many of Rust's usual
run-time checks in release builds. However, some `wgpu-core` users are
happy to pay the performance cost in exchange for more safety. The
`"strict_asserts"` feature causes `wgpu_core` to perform the same
checks in release builds as it does in debug builds.
2022-08-08 00:45:39 -04:00
Wyatt Herkamp
f7526ae960
winit 0.27 Update and raw-window-handle 0.5 (#2918) 2022-08-04 06:09:37 +00:00
Connor Fitzgerald
ea05b44f38
Improve Presentation Api (#2803)
* Add new presentation modes

* Expand presentation formats

* Add Surface::get_supported_modes

* Update to rust 2021 and improve some metal surface code

* Update wgpu-types/src/lib.rs

Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>

* Fix windows build errors

* Fix issues with ALLOW_TEARING

Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2022-06-30 14:24:17 -04:00
Jinlei Li
61796b1d59
Relax render pass color_attachments validation (#2778)
* Make the color attachments `Option`-al in render pipelines, render passes, and render bundles

* vk:  `Option`-al color attachments support

* dx12: sparse color_attachments support

* Only non-hole attachments is supported on wasm target and gl backend

* deno_webgpu: `Option`-al color attachments support

* Follow all suggestions
2022-06-27 16:10:18 -07:00
Connor Fitzgerald
5bd0a6c4ac
Implement submission indexes (#2700)
* Implement submission indexes

* Write some unit tests for poll

* Update wgpu/src/lib.rs

Co-authored-by: Jim Blandy <jimb@red-bean.com>

* Unify Maintain in both wgc and wgpu

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2022-06-05 17:22:25 -04:00
Connor Fitzgerald
32af4f5607
Convert map_async from being async to being callback based (#2698) 2022-05-31 11:22:21 -04:00
Jinlei Li
8063edc648
Add DEPTH24UNORM_STENCIL8 feature (#2689) 2022-05-30 15:29:12 -04:00
Jinlei Li
0c1233b834
Move TEXTURE_COMPRESSION_ETC2 | ASTC_LDR to web section to match spec (#2671) 2022-05-18 12:38:53 -04:00
Jinlei Li
26f96c7dfe
Add DEPTH32FLOAT_STENCIL8 featue (#2664) 2022-05-17 02:11:05 -04:00
Connor Fitzgerald
e54a36ee78
Move texture-array example over to wgsl (#2618) 2022-04-25 18:32:53 +00:00
Jim Blandy
579f809573 Avoid new WGSL reserved words in wgpu examples. 2022-04-17 21:33:55 -07:00
Igor Shaposhnik
eff50436f5 Update to Naga rev 1720725 2022-04-15 22:22:48 +03:00
Lucas Kent
bfcdcd6486
Update dev deps (#2493) 2022-02-18 23:24:18 -05:00
Samuel Hurel
3e0305d27d
Allow non struct buffers in wgsl (#2451)
* Bump naga

* Update examples
2022-02-05 09:53:04 -05:00
Jim Blandy
36ce638381 IdentityManager: from_index method is unneeded.
The `min_index` parameter has no useful effect. Because the range 0..n is pushed
on the free list, index values less than `min_index` do get allocated.

Document `IdentityManager` and `TypedId`.
2022-01-28 01:03:15 -05:00
João Capucho
dcd07f0391 Update to upstream naga 2022-01-22 18:36:26 -05:00
Dzmitry Malyshau
1e593a6bd3
Trace push/pop debug group on command encoder (#2294) 2021-12-15 17:48:48 +00:00
Dzmitry Malyshau
3960658529
Remove block decorations (#2292) 2021-12-15 12:29:37 -05:00
Dzmitry Malyshau
cdf948b920 Fix and re-enable player tests 2021-12-03 17:11:26 -05:00
Dzmitry Malyshau
6372aad845 Rename fill_buffer back to clear_buffer 2021-12-02 12:33:59 -05:00
Igor Shaposhnik
c6d1491bb1 Update raw-window-handle to 0.4 2021-12-01 15:59:05 -05:00
Jerónimo Sánchez
052cb3da39
Renaming CommandEncoder::clearBuffer to CommandEncoder::fillBuffer (#2174)
* Renamed clear_buffer to fill_buffer (keeping up with spec)
* fill_buffer does not require CLEAR_BUFFER feature

* Changed ClearBuffer to FillBuffer for `trace` feature

* Renamed clearBuffer for web backend
2021-11-14 19:16:10 -05:00
Alphyr
99830957e8
Update ron (#2154) 2021-11-04 22:41:21 -04:00
Wumpf
988716943f
Zero init textures (#1688)
* Added tests for texture zero init
sadly, they are typically passing even if texture zero init isn't doing its job
However, they form nice isolated examples for testing out texture initialization
It could be possible to dirty texture memory prior to ensure zero init did the job

* texture init tracker

* tracking texture init requirements for bind group, transfer and rendertarget

* texture clears for texture init
* queue submit
* write_texture

* Enforce presence of either render target or copy_dst flag

* clear render targets also with using buffer copies
enforce COPY_DST usage now on all textures

* adjust ImageSubresourceRange.layer_range calculation for 3D textures

init_tracker has now a `discard` function to get single data points back to uninitialized

use new standardized partition_point function

* track init state for discarded textures from renderpasses

missing:
* init on the fly if discarded is found within command buffer
* handle discarding only stencil or only depth

* added tests for zero init after discard

* tracking discarded surfaces now in separate struct, piping all inits through utility function
allows to resolve discard/init_action interactions

* Move various memory init code to separate mod
CommandBufferTextureMemoryActions is now fully encapsulated

* implemented discard init fixups for everything but renderpass

* render passes also cause now discard fixups

* fixup_discarded_surfaces takes now an iterator instead of Drain

* Add memory init test for discarding depth targets

* handle divergently discarded depth/stencil target

* comment & clippy fixes

* fix collect_zero_buffer_copies_for_clear_texture yielding block breaking copies

* [pr feedback] minor cleanup in zero_init_texture_after_discard, `use` hygenie

* [pr feedback] fix bug in ImageSubresourceRange range utils

* [pr feedback] fix texture tracker check, bundle transition_texture on init, cleanups

* Implemented drop for InitTrackerDrain

* remove incorrect comment about extents in add_pass_texture_init_actions

* Fix unit test & clippy issues in init_tracker
2021-10-28 09:15:53 -04:00
Dzmitry Malyshau
713f7fd7f2 Changelog update for 0.11 2021-10-07 19:15:49 -04:00
Dzmitry Malyshau
5092fb7ea5 Refactor presentation to be explicit 2021-10-06 17:02:10 -04:00
Dzmitry Malyshau
1ee6036f44 Implement software adapter selection 2021-10-01 17:22:51 -04:00
Dzmitry Malyshau
97d6db4d18 Allow if/panic in wgpu-hal 2021-10-01 16:22:51 -04:00
Wumpf
df2a686c29
Reintroduce clear_texture Metal/Vulkan/DX12 (#1905)
* enable CLEAR_COMMANDS feature for all adapters

* replaced fill_buffer with clear_buffer (minus variable value)

* Improve clear buffer/texture test
and remove unused clear-buffer.ron test

* renamed clear_image to clear_texture

* skeleton for new wgpu-hal clear_texture

* clear_texture implementation for vulkan

* clear_texture now restricts usage

* clear_texture implementation for dx12

* Implemented clear_texture for Metal backend

* Clean up GLES clear_buffer and leave note on how to implement clear_texture in the future

* fix linux compilation & formatting issues

* comment & namespace fixes

* Extent3d has now a simple mipmap calculating function

Fix incorrect use of texture.size in clear_texture for metal/dx12
Fix incorrect mip/layer ranges in clear_texture for metal/dx12
2021-09-06 21:14:40 -04:00
Dzmitry Malyshau
f2a18ee57c Update naga to 1907a92 2021-08-12 23:58:19 -04:00
Dzmitry Malyshau
dffe1f1793 Return a texture by the surface 2021-08-11 20:58:42 -04:00
Dzmitry Malyshau
f78061bcef Merge swap chain into surface 2021-08-11 20:58:42 -04:00
Zicklag
9310f264f1
Update Naga With New Storage Classes API (#1766) 2021-08-05 13:50:51 -04:00
Gordon-F
f0b1d5a673 Update winit to 0.25 2021-07-23 14:30:38 +03:00
Zicklag
0614ccea7e Enable All Backends for Trace Player 2021-07-09 20:42:59 -05:00
Dzmitry Malyshau
568ac3fa24 Switch all bitflag names to plural 2021-06-30 14:43:36 -04:00
Alex S
b4b3dd720c Reorder & reassign flags to group up the binding flags together. 2021-06-28 14:44:08 +03:00
Andreas Reich
a745383516 Do multiple queries in pipeline-statistics-query test 2021-06-27 11:20:53 +02:00
Andreas Reich
2525d6ce9d Add player test for pipeline statistics 2021-06-27 08:43:48 +02:00
Dzmitry Malyshau
4c03d286c6 Remove SPIRV entirely from wgpu-core 2021-06-22 12:35:22 -04:00
Dzmitry Malyshau
da38b8b077 Make spirv an optional feature 2021-06-21 12:09:12 -04:00
bors[bot]
96dbd06a1f
Merge #1525
1525: Add Naga bypass to allow feeding raw SPIR-V shader data to the backend. r=kvark a=ElectronicRU

**Connections**
Fixes #1520 .

**Description**
While Naga checking is undoubtedly very useful, it currently lags behind
what is possible in SPIR-V and even what is promised by WGPU (ie binding
arrays). This adds an unsafe method to wgpu::Device to allow feeding
raw SPIR-V data into the backend, and adds a feature flag to request a
backend supporting this operation.

**Testing**
`texture_arrays` example is runnable now, which uncovers an additional bug in Vulkan backend - binding arrays are instead treated like sole bindings, and indices shift, too. Lots of errors from validation layer ensue.


Co-authored-by: Alex S <alex0player@gmail.com>
2021-06-20 16:13:53 +00:00
Alex S
8bfa949261 Code review:
- rename ShaderInput variants
- rename feature flag
- hard error on Metal backend trying to compile SPIR-V
- fix test failing because of feature flag bits changing
2021-06-20 06:22:59 +03:00
Gordon-F
2873ac32d9 Remove MPL 2.0 header in files 2021-06-19 21:06:08 +03:00
Connor Fitzgerald
74d2becb18 Relicense to MIT/Apache 2021-06-18 13:40:31 -04:00
Dzmitry Malyshau
a421c1c8b6 Instance plumbing 2021-06-08 11:46:53 -04:00
Dzmitry Malyshau
569cd0cdd6 WIP new wgpu-hal 2021-06-08 00:46:08 -04:00
Andreas Reich
99e691932d add clear buffer/image to wgpu-rs api 2021-06-05 11:49:13 +02:00
Wumpf
f62d0d5edc
Native Extension: Expose fill buffer & clear image (#1335)
* Add command buffer fill buffer method

* Added test for buffer fill

* Added image clear + test

* image/buffer clear methods are now pure clear to zero

* fix cargo clippy & int type issues

* clear buffer alignment is now given by COPY_BUFFER_ALIGNMENT

* joined buffer/image clear player tests

* ImageSubresourceRange is now used in TextureViewDescriptor
2021-05-30 11:03:33 -04:00
Dzmitry Malyshau
19dfcd93ca Make player automatically start/stop the capture 2021-05-18 17:42:49 -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
bc4c5c8f03 Change error type for the backend shader 2021-04-21 17:06:58 -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
adamnemecek
af8b94c729 removed autocapture 2021-04-02 09:43:38 -07:00
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
Andreas Reich
50043875e5 rows_per_image & rows_per_image are now optional
Fixes #988
2021-03-20 12:33:28 +01: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
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
280c066e65 Update to naga-14 2021-03-14 00:27:57 -05:00
Dzmitry Malyshau
eef4a75454 Fix swapchain resize in the player 2021-03-10 15:34:21 -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
7c1db12cdc Refactor implicit BGLs to support early tracing 2021-03-03 16:48:23 -05:00
Dzmitry Malyshau
103e7763a3 Rename depth to depth_or_array_layers 2021-03-01 11:08:17 -05:00
Dzmitry Malyshau
91f5329b33 Update gfx and naga to gfx-12 2021-02-21 11:25:45 -05:00
Dzmitry Malyshau
b3387492a2 Handle player window resizing gracefully 2021-02-11 14:16:56 -05:00
Andreas Reich
fd810f839e merged buffer-zero-init-for-binding and buffer-zero-init-for-mapping-and-writing tests 2021-02-06 12:09:38 +01:00
Andreas Reich
52aee1a037 Better error output for player test 2021-02-03 23:44:50 +01:00
Andreas Reich
5e488d4fea Added player test with compute shader reading & writing an uninitialized buffer 2021-02-03 23:44:42 +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
cc183c885f Added player test for buffer-zero-init 2021-01-31 21:56:31 +01:00
Dzmitry Malyshau
0346b43982 Update the render pipeline API 2021-01-27 15:09:13 -05:00
Dzmitry Malyshau
05bb482e49 Fix replaying issues with dropped texture views 2021-01-19 22:03:55 -05: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
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
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
bors[bot]
d430e044b5
Merge #1076
1076: Fix player warnings r=kvark a=kvark

```
warning: unused `std::result::Result` that must be used
   --> player/src/bin/play.rs:142:29
    |
142 | ...                   gfx_select!(device => global.device_create_swap_chain(device, surface, &desc));
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(unused_must_use)]` on by default
    = note: this `Result` may be an `Err` variant, which should be handled
    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

warning: unused `std::result::Result` that must be used
   --> player/src/bin/play.rs:147:29
    |
147 | ...                   gfx_select!(device => global.swap_chain_present(id));
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this `Result` may be an `Err` variant, which should be handled
    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

warning: unused `std::result::Result` that must be used
   --> player/src/bin/play.rs:173:21
    |
173 |                     gfx_select!(device => global.device_poll(device, true));
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this `Result` may be an `Err` variant, which should be handled
    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

warning: 3 warnings emitted
```

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-12-05 23:56:38 +00:00
Dzmitry Malyshau
91a66b4b4a Fix player warnings 2020-12-05 18:55:27 -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
5949dec61d Update bind group layout API to match upstream 2020-11-28 00:30:27 -05:00
Dzmitry Malyshau
55851add9b player: use the wgpu-cores's gfx-select macro 2020-11-26 14:47:48 -05:00
Dzmitry Malyshau
c6bc37dbde [error] render bundles 2020-11-23 12:00:47 -05:00