Commit Graph

1426 Commits

Author SHA1 Message Date
Valaphee The Meerkat
494ae1a815
Add support for occlusion queries (#3402)
Co-authored-by: Leo Kettmeir <crowlkats@toaxl.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-08-02 19:05:59 +00:00
Teodor Tanasoaia
48078a800a
Derive storage bindings via naga::StorageAccess instead of naga::GlobalUse (#3985)
Removes the feature check for read-only and read-write storage textures as it's later checked by `create_bind_group_layout`.

335f40f85a/wgpu-core/src/device/resource.rs (L1505-L1518)

Also removes the `GlobalUse` checks from `check_binding_use` as naga is already checking those.

535701f6b2/src/valid/interface.rs (L639-L669)
2023-07-31 15:30:47 +02:00
Teodor Tanasoaia
01160c3ad1
Revert "Make shader write&read storage buffers match non readonly layouts" (#3984) 2023-07-27 12:33:05 -04:00
Connor Fitzgerald
493ff2e564 Bump wgpu versions 2023-07-20 23:14:11 -04:00
amfaber
a60efbde96
Expose TextureUsages in SurfaceCapabilities (#3874)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-07-19 22:57:41 +00:00
Aaron Hill
fd5550cc89
Make RequestAdapterOptions.power_preference optional (#3903)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-07-19 21:04:31 +00:00
dependabot[bot]
db87ee8f20
Bump js-sys from 0.3.63 to 0.3.64 (#3861)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-07-19 16:30:14 -04:00
Nicolas Silva
80d19d890c
Update naga to 0.12.0@git:409239c0e2313bfd0dc4fd64f8c3021185ccef1b (#3935) 2023-07-18 13:25:48 +02:00
Nicolas Silva
7198d60f68
Validate that BufferDescriptor::usage is not zero (#3928)
* Validate that BufferDescriptor::usage is not zero.

* Add a changelog entry.
2023-07-14 22:41:34 +02:00
AdrianEddy
e85cc91b5d
Add support for importing external buffers (#3355) 2023-07-07 18:00:08 -04:00
Fredrik Fornwall
17143c149c
Make shader write&read storage buffers match non readonly layouts (#3893) 2023-06-29 22:30:34 +00:00
daxpedda
88f18ed190
Don't implement Send or Sync on Wasm (#3691)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-06-29 20:31:18 +00:00
Leo Kettmeir
973cd3ebf8
feat: add link feature (#3853) 2023-06-28 12:30:28 +02:00
Pieter-Jan Briers
acb7712c5a
Allow empty scissor rects (#3863) 2023-06-15 15:49:06 -04:00
Teodor Tanasoaia
dcad7dfba9
Update naga to 0.12.0@git:76003dc0035d53a474d366dcdf49d2e4d12e921f (#3866) 2023-06-14 18:55:33 +02:00
Connor Fitzgerald
10172e1f38
Move Examples and Tests to Their Own Crates (#3841)
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-06-10 18:35:46 +00:00
Connor Fitzgerald
1d2a667b71
Fix trying to use a renderpass inside a compute pass (#3828)
* Fix trying to use a renderpass inside a compute pass

* Fix pipeline statistics test on mac

* Changelog
2023-06-05 09:05:59 -04:00
Jim Blandy
4478c52deb wgpu-core: Move Device resource methods into device::resource. 2023-05-24 09:54:03 -07:00
Jim Blandy
286d625428 wgpu-core: Move device/mod.rs's Global impl to device/global.rs. 2023-05-24 09:54:03 -07:00
Jim Blandy
55e3558db4 wgpu-core: Move Resource trait to resource module. 2023-05-24 09:54:03 -07:00
Jim Blandy
4d1fbeb753 wgpu-core: Move storage code to new storage module. 2023-05-24 09:54:03 -07:00
Jim Blandy
17d5361879 wgpu-core: Move registry code to new registry module. 2023-05-24 09:54:03 -07:00
Jim Blandy
29914b308f wgpu-core: Move identity code to new identity module. 2023-05-24 09:54:03 -07:00
Jim Blandy
13bd3eea55 wgpu-core: Move HalAPI to new hal_api module. 2023-05-24 09:54:03 -07:00
Jim Blandy
f00e6b70ea wgpu-core: Move Global to new global module. 2023-05-24 09:54:03 -07:00
Malek
dafc189d6b
Fix multiview rendering (#3779) 2023-05-19 00:03:57 -04:00
Erich Gubler
0f0044f358
fix(wgpu-core)!: use u32 indices for bind group layouts everywhere (#3743) 2023-05-03 20:56:54 -04:00
Jim Blandy
49800337d1
Define wgpu_core::Global::create_render_bundle_error. (#3746) 2023-05-03 14:17:18 -07:00
Erich Gubler
3e562aaeaa
docs: note feature req. for Depth32FloatStencil8 (#3734)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-05-03 10:08:52 +00:00
Timo Kösters
4220a42139
Fix typo (#3719)
The error previously printed "otherusages" without a space
2023-04-28 23:15:08 +02:00
Erich Gubler
2571af9557
refactor: resolve clippy::redundant_clone (#3717) 2023-04-24 17:07:08 +02:00
Connor Fitzgerald
011a4e26d0
Release v0.16.0 (#3707)
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-04-19 22:06:21 +00:00
daxpedda
85fc427470
Adjust internal canvas size on Surface::configure() (#3690) 2023-04-19 21:09:31 +00:00
Jinlei Li
62ea7813e4
Implement Features::RG11B10UFLOAT_RENDERABLE (#3701) 2023-04-19 13:34:29 +02:00
Nicolas Silva
4035748c83
Update naga to 0.11.0@git:b9c5cb5a7841a8728137a58840fbbdbb9b310267 (#3705) 2023-04-19 10:54:40 +02:00
François
7c25c00f07
reject binding type multisampled when on a float filterable sample type (#3686) 2023-04-13 13:55:56 -04:00
Connor Fitzgerald
a7defb723f
Cleanups for WebGPU (#3671)
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-04-12 21:27:30 +00:00
Nicolas Silva
f3bf0f782e
Update naga to 0.11.0@git:f59668ccfaf7bdb3a7e43d84363a21c77357b2fe (#3665) 2023-04-11 14:13:16 +00:00
Connor Fitzgerald
51bf95bbd6
Make wgpu-core errors non-exhaustive (#3652)
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-04-07 19:18:29 +02:00
Teodor Tanasoaia
7fd129a535
[metal] Adapt code to work with the new per_entry_point_map (#3524) 2023-04-07 11:01:24 -04:00
Jim Blandy
711ab981b7
Document wgpu_core::hub::Hub locking rules. (#3577)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-04-05 22:48:43 +00:00
Teodor Tanasoaia
6918cf33d4
[metal] Fix metal erroring on an array_stride of 0 (#3538)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-04-05 22:40:15 +00:00
dependabot[bot]
a13ed91626
Bump bitflags from 1.3.2 to 2.0.2 (#3606)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-04-05 22:24:59 +00:00
Lukas Herzberger
b6dbce740f
Implement resolve query set (#3489
* implement command_encoder_resolve_query_set

* fix args

* add BufferUsages::QUERY_RESOLVE

* update changelog

* fix link text

* validate query resolve: check for QUERY_RESOLVE instead of CPY_DST

* update changelog, replace COPY_DST with QUERY_RESOLVE in mipmap example
2023-04-05 17:59:04 -04:00
Benjamin Schaaf
fdbbd02c1e
Properly drop surfaces (#3647)
Co-authored-by: Benjamin Schaaf <bschaaf@sublimetext.com>
Fixes #3646
2023-04-05 17:48:12 -04:00
Erich Gubler
c200597115 refactor: resolve clippy::useless_conversion 2023-03-27 19:24:16 +02:00
Emil Ernerfeldt
d20fc0d2b5
Fix typo I introduced in previous PR (#3615) 2023-03-22 14:44:54 +00:00
Emil Ernerfeldt
a89e35a4e0
Validate shader location clashes (#3613)
* Validate shader location clashes

* Add line to changelog
2023-03-22 14:56:52 +01:00
Connor Fitzgerald
0c3ca5c08b
Fix Metal Mipmap Behvior (#3610) 2023-03-21 16:37:30 +00:00
Jim Blandy
0772df798d
Don't emit ANSI colors in shader validation error messages. (#3591) 2023-03-14 22:35:02 -04:00
Jim Blandy
35b0a16a88
Update docs after #3466. (#3576) 2023-03-10 17:49:19 +00:00
Teodor Tanasoaia
cf40e64b16
Change type of bytes_per_row and rows_per_image (#3529) 2023-03-06 16:44:36 -05:00
Teodor Tanasoaia
7e72f30179
Allow copying of textures with copy-compatible formats (#3528)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-03-03 17:24:17 +00:00
Teodor Tanasoaia
ac689cbe1f
Update feature documentation (#3534) 2023-03-03 12:09:17 -05:00
Connor Fitzgerald
db3be88f90 Uppercase all error strings 2023-03-03 11:33:20 -05:00
Connor Fitzgerald
c98f4ed662 Improve RenderPass attachment errors 2023-03-03 11:33:20 -05:00
Connor Fitzgerald
38f1f0ede0 Improve RenderPass/RenderBundle compatibility errors 2023-03-03 11:33:20 -05:00
James Liu
6ee0d4c14d
Replace fxhash with rustc-hash (#3502)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-03-01 18:46:38 +00:00
Teodor Tanasoaia
2a3a9bf013
Remove unused STORAGE_ATOMICS flag (#3539) 2023-03-01 13:27:41 -05:00
daxpedda
74303308cd
Make crate features no-op on incompatible targets (#3466)
* Make crate features no-op on incompatible targets

* Remove `portable_features`

* Test `--all-features` in CI

* Make `renderdoc` no-op on WASM

* Address review
2023-02-21 13:50:55 +01:00
Nicolas Silva
438d6394ef
Update naga to 0.11.0@git:9742f1616c3e3dd2cc9a5880616fc886c391bb9f (#3512)
* Update naga to 0.11.0@git:9742f1616c3e3dd2cc9a5880616fc886c391bb9f

* Mark the zero init workgroup test as passing.
2023-02-21 12:50:22 +01:00
Nicolas Silva
71ee61aa09
Update naga to 0.11.0@git:58105a06e2bd5aefeb9330984d47976e63c11dc4 (#3506) 2023-02-20 14:37:08 +00:00
Nicolas Silva
8f1db56fc0
Work around a clippy error (#3505) 2023-02-20 15:35:58 +01:00
Teodor Tanasoaia
074d1da831
Set the new naga capabilities (#3494)
* remove redundant flag

* set the `MULTISAMPLED_SHADING` downlevel flag for gles and dx11

* set the right naga capabilities

add `Features::SHADER_EARLY_DEPTH_TEST`

* add changelog entry

* remove `@early_depth_test` from water example
2023-02-16 22:43:38 -05:00
Nicolas Silva
bf38b4b0b1
Update naga to 0.11.0@git:568d7c4c136dada369ef7f59ee8414a263d6c7b2 (#3491)
* Update naga to 0.11.0@git:568d7c4c136dada369ef7f59ee8414a263d6c7b2

* Fix the clear_texture after naga update.
2023-02-16 15:24:24 +01:00
daxpedda
e4445205c2
Remove emscripten crate features (#3467) 2023-02-15 21:46:00 +00:00
Teodor Tanasoaia
c51edd36fd
Support stencil-only views and copying to/from combined depth-stencil textures (#3436) 2023-02-15 16:20:22 -05:00
Teodor Tanasoaia
b33731c44c
Validate before extracting texture selectors (#3487)
Move calls to `extract_texture_selector` after calls to `validate_texture_copy_range`, to avoid overflow.
2023-02-14 12:31:18 -08:00
daxpedda
5b8c55c451
Build for WASM on docs.rs (#3462) 2023-02-09 15:38:40 -05:00
Nathan Adams
238697c2da
Add MULTISAMPLE_X16 texture format feature flag where supported (#3454) 2023-02-06 19:53:48 +01:00
Teodor Tanasoaia
41de797c74
Change type of mip_level_count and array_layer_count (members of TextureViewDescriptor and ImageSubresourceRange) from Option<NonZeroU32> to Option<u32> (#3445)
Clean up duplicated code related to texture layers/mips.
2023-02-03 15:03:34 +01:00
Nicolas Silva
6399dd4866
Update naga to 0.11.0@git:4b796b157cb2b67b0ab166a2238fe4e9473bfd52 (#3451) 2023-02-03 12:30:08 +01:00
Connor Fitzgerald
4ea31598a0
Re-sort view formats (#3444) 2023-02-02 09:22:33 +01:00
Elabajaba
1e27fd4afb
fix clippy for rust 1.67 (#3435)
* clippy --fix

* elide lifetimes

* fmt and more fixes

* disable clippy::needless_borrowed_reference as it clashes with clippy::pattern_type_mismatch

* missed flags for target=wasm32-unknown-unknown
2023-02-01 23:06:03 +01:00
João Capucho
c371e7039d
Implement the new checks for readonly stencils (#3443)
wgpu currently checks if the `write_mask` is 0 to determine wether a
stencil is used as readonly or not. However Webgpu contains a more
complex ruleset that also checks the cull mode and face operations to
determine if the stencil is readonly or not.

This commit brings these new rules to wgpu.
2023-02-01 21:13:46 +01:00
Teodor Tanasoaia
98ea3500fd
copyTextureToTexture src/dst aspects must both refer to all aspects of src/dst format (#3431)
* src/dst aspects must both refer to all aspects of src/dst format

* add changelog entry
2023-01-28 17:08:21 +01:00
Connor Fitzgerald
007d933260
Fix wgpu-core versioning 2023-01-25 19:30:39 -05:00
Connor Fitzgerald
d3fec9524f
Release of 0.15 (#3424) 2023-01-25 19:25:41 -05:00
Teodor Tanasoaia
d2809137ba
Zero-initialize workgroup memory (#3174)
fixes https://github.com/gfx-rs/wgpu/issues/2430
2023-01-25 18:28:35 -05:00
Jinlei Li
33f94c7c84
Implement view_formats for SurfaceConfiguration (#3409)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-01-25 21:04:41 +00:00
Jinlei Li
0d433214c7
validate the number of color_attachments in begin_render_pass (#3404) 2023-01-25 14:48:27 -05:00
Jinlei Li
969af43c05
move require_downlevel_flags(VIEW_FORMATS)? from create_texture_view() to create_texture() (#3420) 2023-01-25 17:33:58 +01:00
IceSentry
bb876f372a
Better error message for 16 byte alignment error (#3414)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: gilescope <gilescope@gmail.com>
Closes https://github.com/gfx-rs/wgpu/pull/3099
Closes https://github.com/gfx-rs/wgpu/issues/2832
2023-01-24 20:46:19 +00:00
Connor Fitzgerald
95a760bb42
Implement queue.copy_external_image_to_texture for WebGL2 and improve WebGPU Impl (#3288)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
Closes https://github.com/gfx-rs/wgpu/issues/1888
2023-01-24 18:44:15 +00:00
Teodor Tanasoaia
964c94a02d
Update TextureView validation (#3410)
* update TextureView validation

* add changelog entry

* remove call to clone

* dereference instead
2023-01-24 12:02:16 +01:00
Jinlei Li
4cd753bccd
vk: improve view_formats setting (#3412)
* vk: improve view_formats setting

* Fix extension detection

* Update wgpu-hal/src/vulkan/device.rs

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>

* Follow the suggestion

* Tiny doc fix

* Follow the suggestion

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-01-23 16:02:25 +01:00
Xiaopeng Li
24a904256e
Add create_surface_from_surface_handle (#3225)
Co-authored-by: lixiaopeng.jetspark <lixiaopeng.jetspark@bytedance.com>
2023-01-19 11:16:11 -05:00
Nicolas Silva
a3e3d2503f
Update naga to 1be8024. (#3405) 2023-01-19 15:25:25 +00:00
Connor Fitzgerald
2c3f9fabb7
Allow vulkan to change view formats (#3399) 2023-01-19 14:20:15 +01:00
Elabajaba
81569dd6c3
Updated Dxc integration for DX12 backend (#3356)
Co-authored-by: unknown <alimilhim5@gmail.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Closes https://github.com/gfx-rs/wgpu/issues/2722
closes https://github.com/gfx-rs/wgpu/pull/3147
2023-01-18 21:25:56 +00:00
Jinlei Li
0849e78600
Add view_formats in TextureDescriptor (#3237)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Closes https://github.com/gfx-rs/wgpu/issues/3030
2023-01-18 16:03:56 -05:00
Teodor Tanasoaia
fae740df5c
Fix being able to sample a depth texture with a filtering sampler (#3394) 2023-01-18 15:53:50 -05:00
Connor Fitzgerald
2ecced0c88
Improve write_buffer_with Spans (#3383) 2023-01-15 03:11:14 -05:00
Leo Kettmeir
f40611fd5c
don't panic on mapped buffer in queue_submit (#3364) 2023-01-15 07:10:11 +01:00
Jim Blandy
8c9f3f159b
queue_write_texture: Validate the destination texture. (#3378) 2023-01-14 10:35:46 +01:00
Nicolas Silva
5a2e60c50e
Update naga to e98bd92 (#3352) 2023-01-10 14:04:18 -05:00
JMS55
ad4dac87fb
Allow non-filtering integer texture sampling (#3362)
* Allow non-filtering integer texture sampling

* Add changelog entry
2023-01-09 11:08:14 +01:00
James0124
a06ef71fd7
Add validation in accordance with WebGPU GPUSamplerDescriptor valid… (#3353)
* Add validation in accordance with WebGPU `GPUSamplerDescriptor` valid usage for `lodMinClamp` and `lodMaxClamp`.

`lodMinClamp` must not be negative, and `lodMaxClamp` must be >= `lodMinClamp`

* Add changelog entry.

* Run `cargo fmt`.
2023-01-06 13:16:16 +01:00
Jinlei Li
33e5b7af26
vulkan feature exclude macOS and iOS by default (#3292)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Closes https://github.com/gfx-rs/wgpu/issues/3287
2023-01-04 21:35:29 +00:00
Teodor Tanasoaia
784ee43be7
Make ObjectId structure and invariants idiomatic (#3347) 2023-01-04 15:13:59 -05:00
Nathan Adams
186a29c34d
Implement TextureFormat::Stencil8 + add stencil example (#3343)
* Implement TextureFormat::Stencil8

* Add stencil-triangles demo to test Stencil8 and show how to use stencil testing

* Added changelog for Stencil8
2023-01-02 13:47:10 +01:00
Connor Fitzgerald
9670e9e6b9 Make sure all doctests and tests in wgpu-types run 2022-12-21 17:24:46 -05:00
Andreas Reich
eaa87ba42c
Force all adapters to report min buffer alignment of 32 (#3262) 2022-12-21 13:46:15 -05:00
Connor Fitzgerald
9b9cc330ca
Fix up strict-assert usage (#3320)
* Removes unused assertions.rs

* Strict assert macro fixes

* Strict asserts shouldn't be default on wgpu
2022-12-20 22:04:45 -08:00
Connor Fitzgerald
5241633b3a
Implement Presentation Timestamp Correlation (#3240)
Co-authored-by: Jim Blandy <jimb@red-bean.com>
2022-12-20 17:52:08 +00:00
Teodor Tanasoaia
62e932b0a8
Add missing DEPTH_BIAS_CLAMP and FULL_DRAW_INDEX_UINT32 downlevel flags (#3316)
* add missing `DEPTH_BIAS_CLAMP` and `FULL_DRAW_INDEX_UINT32` downlevel flags

* add changelog entry

* use require_downlevel_flags
2022-12-20 18:21:54 +01:00
Teodor Tanasoaia
14886ee142
Sync depth/stencil copy restrictions with the spec (#3314)
* sync depth/stencil copy restrictions with the spec

* add changelog entry
2022-12-20 15:26:00 +01:00
i509VCB
052bd17d41
Context dynamic dispatch (#3051) 2022-12-19 19:17:19 -05:00
Jim Blandy
de070b2846
Fix documentation comments for Rust 1.66. (#3310)
Somewhere after 1.64 but by 1.66, `rustdoc` started checking for
unmatched HTML tags in doc strings, meaning that text like

    /// Convenience function turning Option<Selector> into this enum.

causes problems, since `rustdoc` will pass through `<Selector>` as
HTML tag, which browsers displaying the output will misunderstand.
2022-12-19 11:41:19 -08:00
Erich Gubler
3cc6621fd3
Resolve Rust 1.66 clippy lints (#3304) 2022-12-16 17:23:12 -05:00
Jim Blandy
0e4c7dd6d2
Remove workspace inheritance (#3295) 2022-12-15 15:46:28 -05:00
Imbris
645469d2f9
Small typo fix in TextureViewDescriptor docs (#3300) 2022-12-15 15:19:00 -05:00
Connor Fitzgerald
3ce5ca866b
Improve dynamic offset binding errors (#3294) 2022-12-15 00:53:42 +00:00
Jim Blandy
a50836e0cb
Make wgpu-core users responsible for choosing back ends. (#3254) 2022-12-07 20:58:45 -05:00
Jim Blandy
537f077132
Evaluate gfx_select's #[cfg] conditions at the right time. (#3253)
See the comments in the code for details.
2022-12-05 12:47:42 -08:00
Kevin Reid
2209463a54
Return an error instead of panicking when canvas context is unavailable (#3052)
* Low-level error handling in canvas context creation (for WebGPU and WebGL 2).

Part of fixing #3017. This commit changes the handling of `web_sys`
errors and nulls from `expect()` to returning `Err`, but it doesn't
actually affect the public API — that will be done in the next commit.

* Breaking: Change type of `create_surface()` functions to expose canvas errors.

Part of fixing #3017.
2022-11-30 23:41:29 -05:00
Nicolas Silva
e90aacea96
Validate texture copy ranges earlier to prevent integer overflow (#3090)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-12-01 01:20:48 +00:00
Nicolas Silva
a9d33193b3
Fix incorrect offset in get_mapped_range (#3233)
* Add a test.

* Fix incorrect offset in get_mapped_range.

* Add an entry in the changelog.
2022-11-30 16:45:49 -05:00
Connor Fitzgerald
84cb3e65a9 Unify Surface Capabilities APIs under one function call 2022-11-27 01:50:47 -05:00
Nicolas Silva
82e9dcf8f7
Allow unspecified bits when deserializing the API's bitflags (#3229) 2022-11-25 23:13:22 -05:00
Jim Blandy
d4b1d57f3c
Move ResourceMetadata into its own module, and give it a proper interface (#3213) 2022-11-23 17:29:20 -05:00
Jim Blandy
73b23f1c8d
Move minimum supported rust version (MSRV) from 1.65 back to 1.64. (#3231) 2022-11-23 21:22:03 +00:00
Jim Blandy
f41a1c294b
Remove unnecessary mutability from ResourceMetadata field uses. (#3210) 2022-11-15 21:52:12 +00:00
Erich Gubler
18f3f5f6f0
Enable unsafe_ops_in_unsafe_fn lint in all workspaces (#3044) 2022-11-14 10:49:39 -08:00
i509VCB
0e937c8cd0
make Ids a u64 internally (#3178) 2022-11-09 15:48:07 -05:00
Ali
3c82a4cd5c
Added support for MSAA(x2,x8) beyond WEBGPU restrictions for native a… (#3140)
Closes https://github.com/gfx-rs/wgpu/issues/2910
2022-11-09 15:19:05 -05:00
Erich Gubler
319a916cb6 refactor: fix label shadow warning for new_alpha_mode 2022-11-07 17:36:04 -08:00
Erich Gubler
fb67de908e refactor: resolve clippy::explicit_auto_deref 2022-11-07 17:36:04 -08:00
Andreas Reich
b838b0871c
Added new UNRESTRICTED_INDEX_BUFFER downlevel flag. (#3157)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-11-07 15:45:50 -05:00
Nicolas Silva
db30e3909a
Avoid integer overflow on multiplication in write_texture. (#3146) 2022-11-07 15:31:19 -05:00
i509VCB
32febc5c9e export the strict assert macros uniformly 2022-11-01 04:59:24 -04:00
i509VCB
085e41171f use debug_assert_** with not(feature = "strict_asserts")
strict_asserts should at least validate with the debug_assert_** family of macros in debug builds. Otherwise undefined behavior can sneak by.
2022-11-01 04:59:24 -04:00
Harald Reingruber
51b34c5b51
Improve compute shader validation error message (#3139)
* Improve compute shader validation error message

* Add entry to changelog.

* Improve error message wording (by cwfitzgerald)

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

* Add credit and PR link to changelog

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-10-29 17:49:03 -04:00
Jinlei Li
dcc0baa1ff
Fix texture_as_hal internal unwrap may cause panic (#3131) 2022-10-26 17:13:43 -04:00
i509VCB
d81cb46be0
enable doc_auto_cfg for docs.rs (#3113)
* enable doc_auto_cfg for docs.rs

This should expose more feature labels in the generated documentation and removes the needs for the manually labeling the features for a type, function or enum variants.

* enable docsrs cfg when building docs for master
2022-10-26 17:07:25 -04:00
Jinlei Li
cc448817e7
Use cargo 1.64 workspace inheritance feature (#3107) 2022-10-20 01:41:17 -04:00
Xiaopeng Li
754a4bad80
Add Surface::as_hal_mut (#3123) 2022-10-19 16:06:23 -04:00
Jim Blandy
b28a87e298
Global init remove dummy argument (#3101) 2022-10-13 17:41:58 -04:00
Nicolas Silva
d1ff3838b8
Expose the full Result type to the rust map_async callback (#2939) 2022-10-13 15:41:52 -04:00
Jim Blandy
215884184b
Reformat comments in wgpu-core. (#3102) 2022-10-13 18:34:44 +00:00
Jim Blandy
fa4d8401e8
Use std::fmt::Formatter::debug_struct for RenderPass. (#3100) 2022-10-13 14:00:54 -04:00
Nicolas Silva
eca04f59db
Make some errors not fatal (#3094) 2022-10-11 13:40:30 -04:00
daxpedda
02cc2ae234
[BREAKING] Make Shader(Module)Source::Wgsl optional (#2890) 2022-10-08 01:12:50 -04:00
Nicolas Silva
0a3e209c90 Shrink the default max binding index to 640 and expose it in Limits.
Following the corresponding changes happening in WebGPU.
2022-10-06 10:12:16 -07:00
Jim Blandy
c781971792
When a command encoder is dropped, destroy its hal command buffer. (#3069)
Fixes #2965.
2022-10-06 01:06:55 -07:00
Connor Fitzgerald
872b436104 Update version to 0.14 2022-10-05 18:45:25 -04:00
Connor Fitzgerald
91e0dbd1ae Update naga + deps 2022-10-05 18:45:25 -04:00
Mikko Lehtonen
60fd2a32e9
Implement missing PrettyError impls (#3066) 2022-10-05 18:43:52 -04:00
i509VCB
2372895944
Handle unsupported surfaces more gracefully (#3054) 2022-10-05 16:42:06 -04:00
SpecificProtagonist
b65ebb4b30
remove copyless (#3050) 2022-09-26 05:15:35 +00:00
Xander Warnez
2c1d7a8a5c
Split Blendability and Filterability into Two Different TextureFormatFeatureFlags (#3012)
* Split Blendability and Filterability into Two Different TextureFormatFeatureFlags

* Update CHANGELOG.md

* Split out individual booleans to improve readability

* Make sure blendablity is correctly set for guaranteed format features of WebGPU

* Cargo fmt

Co-authored-by: Xander Warnez <xander.warnez@materialise.be>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-09-21 19:39:01 +00:00
Mauro Gentile
cdf6ee0c87
Updating TextureFormat matching specs (#2954)
Co-authored-by: Mauro Gentile <Mauro.Gentile@ubisoft.com>
2022-09-20 12:08:06 -04:00
daxpedda
95408cd48b
[BREAKING] Wrap ShaderSource::Naga in Cow<'static> (#2903) 2022-09-19 00:50:46 -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
Jinlei Li
44399bb4a3
Expose alpha_mode, support non-opaque mode on metal and vk backends (#2836) 2022-09-19 00:10:21 -04: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
bec26b79ec
Don't use a callback to return backend instance handles. (#2991)
Change `Instance::as_hal<A>` to simply return an
`Option<&A::Instance>`, rather than passing it to a callback. We're
just borrowing a reference to some `wgpu_hal::Api::Instance` owned by
the `wgpu_core::instance::Instance`, so there's no special scoping or
locking magic required here.
2022-09-02 17:32:58 -07:00
Jim Blandy
701564da8c
Use () instead of PhantomData as IdentityManager's Input type. (#2972)
* Use () instead of PhantomData as IdentityManager's Input type.

PhantomData suggests that there's some sort of persuasion required
for lifetime variance inference or other sorts of arcana, but it
doesn't seem to be necessary at all. `()` works just fine.
2022-09-02 15:37:21 -07:00
Jim Blandy
58bc205f2a Update to Naga b209d911 (2022-9-1).
This removes an expected failure on AMD RADV. I guess #2751 was our
bug all along.
2022-09-02 11:33:55 -07:00
Jim Blandy
7d138e2e76
Avoid overflow in check texture copy bounds. (#2963) 2022-08-28 20:07:04 -04:00
Jim Blandy
a0dfb28b8d
Document wgpu_core id handling, factories, etc. (#2973) 2022-08-28 19:49:09 -04:00
Jim Blandy
2cd08a1c9c
Placate Clippy 0.1.63. (#2977) 2022-08-24 17:25:59 -04:00
Jim Blandy
c6ca2a7d0d
Always free staging buffers (#2961)
* Have `prepare_staging_buffer` take a raw hal Device.

This helps the borrow checker understand that we can borrow
`pending_writes`'s encoder and the raw Device at the same time.

* Always free staging buffers.

We must ensure that the staging buffer is not leaked when an error
occurs, so allocate it as late as possible, and free it explicitly when
those fallible operations we can't move it past go awry.

Fixes #2959.

* Some tests for texture and buffer copies.

* Add CHANGELOG.md entry.
2022-08-13 18:25:49 -07:00
Jim Blandy
33d313cba9
Document some wgpu-core resource tracking types (#2960) 2022-08-13 20:35:57 -04:00
Nicolas Silva
6e99cd3a3e
Fix calculation/validation of layer/mip ranges in create_texture_view (#2955)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-08-14 00:01:19 +00:00
Nicolas Silva
96a85b3ac5
Add missing validation in copy_texture_to-Buffer. (#2958) 2022-08-13 19:48:17 -04: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
Nicolas Silva
ef3b31cd9a
Map bounds check (#2938)
* Validate that map_async's range is not negative.

map_async already checks that the range's end is within the bounds of the buffer, so this also ensures the range start is within bounds.

* Add an entry in the changelog.
2022-08-03 20:28:36 -07:00
Nicolas Silva
e59c33046b
Validate against the maximum binding index (#2892)
* Validate binding indices in create_bind_group_layout.

* Add an entry in the changelog
2022-08-01 16:25:32 -04:00
Seamooo
0dce58dfbd
changed websys features in core and hal to align with used features (#2922)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-08-01 19:06:26 +00:00
Nicolas Silva
a05c8dc2dc
Fix buffer zeroing with offset in map_buffer (#2916)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-07-31 22:05:18 +00:00
Valentin
271bb8690e
Fix documentation claiming shader entry points must return void (#2911) 2022-07-26 03:40:32 +00:00
Nicolas Silva
d0aa3f471a
Validate the number of color attachments in create_render_pipeline (#2913) 2022-07-25 23:28:52 -04:00
Connor Fitzgerald
537c6bed4e
Add warning when using CompareFunction::*Equal without an invariant Attribute (#2887) 2022-07-21 02:24:49 -04:00
Seamus Mulholland-Patterson
6d4677fd7f added downlevel restriction error message for InvalidFormatUsages error 2022-07-15 14:11:04 -04:00
Nicolas Silva
6058676dd2
Record that the buffer is mapped when its size is zero. (#2877)
* Record that the buffer is mapped when its size is zero.

* Avoid internally trying to map a zero-sized buffer if mapped_at_creation is true.

* Add an entry in the changelog.
2022-07-13 18:01:12 +00:00
Nicolas Silva
af345cd6c3
Validate the range in map_async. (#2876)
* Validate the range in map_async.

* Add an entry in the changelog.
2022-07-13 12:34:36 -04:00
i509VCB
db24c066cb
fix panic with as_hal functions (#2871) 2022-07-12 14:38:59 -04:00
Sébastien Marleau
2ce1318c8c
fix deduplication not taking into account render bundles (#2867) 2022-07-10 22:15:52 +00:00
Nicolas Silva
324de1bef6
Ensure the BufferMapCallback is always called. (#2848)
* Ensure the BufferMapAsyncCallback is always called.

This solves two issues on the Gecko side:
 - The callback cleans up after itself (the user data is deleted at the end of the callback), so dropping the callback without calling it is a memory leak. I can't think of a better way to implement this on the C++ side since there can be any number of callback at any time living for an unspecified amount of time.
 - This makes it easier to implement the error reporting of the WebGPU spec.

* Update the changelog.
2022-07-07 23:29:05 -07:00
Connor Fitzgerald
59f4efe93a Prevent get_texture_format_features from saying textures always support COPY_* 2022-07-06 11:06:34 -04:00
Connor Fitzgerald
7e369fdd57 Fix texture multi-sample-ability check with TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES 2022-07-06 11:06:34 -04:00
Craig
1da5bbd7b4
Prevent OpenGL from taking preference over Vulkan (#2853)
* Prevent OpenGL from taking preference over Vulkan

* update changelog

* fix wasm build of example
2022-07-06 00:11:22 -04:00
Connor Fitzgerald
7d85efb301 Fix out of bounds access when surface texture is written to by multiple command buffers 2022-07-03 01:08:40 -04:00
Connor Fitzgerald
eea8edb8a0 Fix AutoNoVsync on OpenGL 2022-07-03 01:08:40 -04:00
Spencer C. Imbleau (he/him)
72a4ef9362
Fixes #2840 (#2842) 2022-07-03 02:00:25 +00:00
Connor Fitzgerald
1ceef24261
Add changelog for 0.13 (#2823)
* Changelog

* Update CHANGELOG.md

* Bump versions to 0.13
2022-06-30 20:25:49 +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
98597da1ec
Allow fragment stage to have more outputs than the pipeline has (#2822) 2022-06-30 03:36:11 +00:00
Connor Fitzgerald
1d8bc57a86
Don't wait for current submission inside of submit (#2824) 2022-06-30 03:05:42 +00:00
Connor Fitzgerald
464b61d01c
Flip span labels to work better with tools (#2820) 2022-06-28 19:49:51 +00:00
Teodor Tanasoaia
5eb09f6bd7
Implement Queue::write_buffer_with (#2777)
* implement Queue::write_buffer_with

* address comments

* update doc

* Fix copy span location

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-06-28 18:32:43 +00:00
Jinlei Li
b0c798639a
core: restrict hal::TextureUses::COLOR_TARGET condition within create_texture (#2818) 2022-06-28 18:12:34 +00:00
Jim Blandy
7cfbd874af
Update Naga to 27d38aae (2022-6-27). (#2816) 2022-06-27 21:36:00 -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
84633a8b12
Force binding sizes to be multiples of 16 on webgl (#2808) 2022-06-27 02:39:51 +00:00
i509VCB
f041991d0c allow creating wgpu::Instance from wgpu_core::Instance 2022-06-26 15:32:34 -07:00
Connor Fitzgerald
533fc13afe
Properly Barrier Compute Indirect Buffers (#2810) 2022-06-26 21:03:56 +00:00