mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 00:03:29 +00:00
Merge branch 'trunk' into ruint64
This commit is contained in:
commit
eea8239515
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -629,7 +629,7 @@ jobs:
|
||||
run: taplo format --check --diff
|
||||
|
||||
- name: Check for typos
|
||||
uses: crate-ci/typos@v1.26.0
|
||||
uses: crate-ci/typos@v1.26.8
|
||||
|
||||
check-cts-runner:
|
||||
# runtime is normally 2 minutes
|
||||
|
202
CHANGELOG.md
202
CHANGELOG.md
@ -40,42 +40,139 @@ Bottom level categories:
|
||||
|
||||
## Unreleased
|
||||
|
||||
### New Features
|
||||
|
||||
#### Naga
|
||||
|
||||
- Parse `diagnostic(…)` directives, but don't implement any triggering rules yet. By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456).
|
||||
- Fix an issue where `naga` CLI would incorrectly skip the first positional argument when `--stdin-file-path` was specified. By @ErichDonGubler in [#6480](https://github.com/gfx-rs/wgpu/pull/6480).
|
||||
|
||||
### Changes
|
||||
|
||||
#### HAL
|
||||
|
||||
- Change the `DropCallback` API to use `FnOnce` instead of `FnMut`. By @jerzywilczek in [#6482](https://github.com/gfx-rs/wgpu/pull/6482)
|
||||
|
||||
## 23.0.0 (2024-10-25)
|
||||
|
||||
### Themes of this release
|
||||
|
||||
This release's theme is one that is likely to repeat for a few releases: convergence with the WebGPU specification! WGPU's design and base functionality are actually determined by two specifications: one for WebGPU, and one for the WebGPU Shading Language.
|
||||
|
||||
This may not sound exciting, but let us convince you otherwise! All major web browsers have committed to offering WebGPU in their environment. Even JS runtimes like [Node][nodejs-webgpu-interest] and [Deno][deno_webgpu-crate-manifest] have communities that are very interested in providing WebGPU! WebGPU is slowly [eating the world][eat-the-world-meaning], as it were. 😀 It's really important, then, that WebGPU implementations behave in ways that one would expect across all platforms. For example, if Firefox's WebGPU implementation were to break when running scripts and shaders that worked just fine in Chrome, that would mean sad users for both application authors _and_ browser authors.
|
||||
|
||||
[nodejs-webgpu-interest]: https://github.com/orgs/nodejs/discussions/41994
|
||||
[deno_webgpu-crate-manifest]: https://github.com/gfx-rs/wgpu/tree/64a61ee5c69569bbb3db03563997e88a229eba17/deno_webgpu#deno_webgpu
|
||||
[eat-the-world-meaning]: https://www.quora.com/What-did-Marc-Andreessen-mean-when-he-said-that-software-is-eating-the-world
|
||||
|
||||
WGPU also benefits from standard, portable behavior in the same way as web browsers. Because of this behavior, it's generally fairly easy to port over usage of WebGPU in JavaScript to WGPU. It is also what lets WGPU go full circle: WGPU can be an implementation of WebGPU on native targets, but _also_ it can use _other implementations of WebGPU_ as a backend in JavaScript when compiled to WASM. Therefore, the same dynamic applies: if WGPU's own behavior were significantly different, then WGPU and end users would be _sad, sad humans_ as soon as they discover places where their nice apps are breaking, right?
|
||||
|
||||
The answer is: yes, we _do_ have sad, sad humans that really want their WGPU code to work _everywhere_. As Firefox and others use WGPU to implement WebGPU, the above example of Firefox diverging from standard is, unfortunately, today's reality. It _mostly_ behaves the same as a standards-compliant WebGPU, but it still doesn't in many important ways. Of particular note is Naga, its implementation of the WebGPU Shader Language. Shaders are pretty much a black-and-white point of failure in GPU programming; if they don't compile, then you can't use the rest of the API! And yet, it's extremely easy to run into this:
|
||||
|
||||
```wgsl
|
||||
fn gimme_a_float() -> f32 {
|
||||
return 42; // fails in Naga, but standard WGSL happily converts to `f32`
|
||||
}
|
||||
```
|
||||
|
||||
We intend to continue making visible strides in converging with specifications for WebGPU and WGSL, as this release has. This is, unfortunately, one of the major reasons that WGPU has no plans to work hard at keeping a SemVer-stable interface for the foreseeable future; we have an entire platform of GPU programming functionality we have to catch up with, and SemVer stability is unfortunately in tension with that. So, for now, you're going to keep seeing major releases and breaking changes. Where possible, we'll try to make that painless, but compromises to do so don't always make sense with our limited resources.
|
||||
|
||||
This is also the last planned major version release of 2024; the next milestone is set for January 1st, 2025, according to our regular 12-week cadence (offset from the originally planned date of 2024-10-09 for _this_ release 😅). We'll see you next year!
|
||||
|
||||
### Contributor spotlight: @sagudev
|
||||
|
||||
This release, we'd like to spotlight the work of @sagudev, who has made significant contributions to the WGPU ecosystem this release. Among other things, they contributed a particularly notable feature where runtime-known indices are finally allowed for use with `const` array values. For example, this WGSL shader previously wasn't allowed:
|
||||
|
||||
```wgsl
|
||||
const arr: array<u32, 4> = array(1, 2, 3, 4);
|
||||
|
||||
fn what_number_should_i_use(idx: u32) -> u32 {
|
||||
return arr[idx];
|
||||
}
|
||||
```
|
||||
|
||||
…but now it works! This is significant because this sort of shader rejection was one of the most impactful issues we are aware of for converging with the WGSL specification. There are more still to go—some of which we expect to even more drastically change how folks author shaders—but we suspect that many more will come in the next few releases, including with @sagudev's help.
|
||||
|
||||
We're excited for more of @sagudev's contributions via the Servo community. Oh, did we forget to mention that these contributions were motivated by their work on Servo? That's right, a _third_ well-known JavaScript runtime is now using WGPU to implement its WebGPU implementation. We're excited to support Servo to becoming another fully fledged browsing environment this way.
|
||||
|
||||
### Major Changes
|
||||
|
||||
In addition to the above spotlight, we have the following particularly interesting items to call out for this release:
|
||||
|
||||
#### `wgpu-core` is no longer generic over `wgpu-hal` backends
|
||||
Dynamic dispatch between different backends has been moved from the user facing `wgpu` crate,
|
||||
to a new dynamic dispatch mechanism inside the backend abstraction layer `wgpu-hal`.
|
||||
|
||||
Whenever targeting more than a single backend (default on Windows & Linux) this leads to faster compile times and smaller binaries!
|
||||
This also solves a long standing issue with `cargo doc` failing to run for `wgpu-core`.
|
||||
Dynamic dispatch between different backends has been moved from the user facing `wgpu` crate, to a new dynamic dispatch mechanism inside the backend abstraction layer `wgpu-hal`.
|
||||
|
||||
Benchmarking indicated that compute pass recording is slower as a consequence,
|
||||
whereas on render passes speed improvements have been observed.
|
||||
However, this effort simplifies many of the internals of the wgpu family of crates
|
||||
which we're hoping to build performance improvements upon in the future.
|
||||
Whenever targeting more than a single backend (default on Windows & Linux) this leads to faster compile times and smaller binaries! This also solves a long standing issue with `cargo doc` failing to run for `wgpu-core`.
|
||||
|
||||
Benchmarking indicated that compute pass recording is slower as a consequence, whereas on render passes speed improvements have been observed. However, this effort simplifies many of the internals of the wgpu family of crates which we're hoping to build performance improvements upon in the future.
|
||||
|
||||
By @wumpf in [#6069](https://github.com/gfx-rs/wgpu/pull/6069), [#6099](https://github.com/gfx-rs/wgpu/pull/6099), [#6100](https://github.com/gfx-rs/wgpu/pull/6100).
|
||||
|
||||
#### `wgpu`'s resources no longer have `.global_id()` getters
|
||||
|
||||
`wgpu-core`'s internals no longer use nor need IDs and we are moving towards removing IDs
|
||||
completely. This is a step in that direction.
|
||||
`wgpu-core`'s internals no longer use nor need IDs and we are moving towards removing IDs completely. This is a step in that direction.
|
||||
|
||||
Current users of `.global_id()` are encouraged to make use of the `PartialEq`, `Eq`, `Hash`, `PartialOrd` and `Ord`
|
||||
traits that have now been implemented for `wgpu` resources.
|
||||
Current users of `.global_id()` are encouraged to make use of the `PartialEq`, `Eq`, `Hash`, `PartialOrd` and `Ord` traits that have now been implemented for `wgpu` resources.
|
||||
|
||||
By @teoxoy [#6134](https://github.com/gfx-rs/wgpu/pull/6134).
|
||||
By @teoxoy in [#6134](https://github.com/gfx-rs/wgpu/pull/6134).
|
||||
|
||||
#### `set_bind_group` now takes an `Option` for the bind group argument.
|
||||
|
||||
https://gpuweb.github.io/gpuweb/#programmable-passes-bind-groups specifies that bindGroup
|
||||
is nullable. This change is the start of implementing this part of the spec.
|
||||
Callers that specify a `Some()` value should have unchanged behavior. Handling of `None` values still
|
||||
needs to be implemented by backends.
|
||||
For convenience, the `set_bind_group` on compute/render passes & encoders takes `impl Into<Option<&BindGroup>>`,
|
||||
so most code should still work the same.
|
||||
https://gpuweb.github.io/gpuweb/#programmable-passes-bind-groups specifies that bindGroup is nullable. This change is the start of implementing this part of the spec. Callers that specify a `Some()` value should have unchanged behavior. Handling of `None` values still needs to be implemented by backends.
|
||||
|
||||
By @bradwerth [#6216](https://github.com/gfx-rs/wgpu/pull/6216).
|
||||
For convenience, the `set_bind_group` on compute/render passes & encoders takes `impl Into<Option<&BindGroup>>`, so most code should still work the same.
|
||||
|
||||
By @bradwerth in [#6216](https://github.com/gfx-rs/wgpu/pull/6216).
|
||||
|
||||
#### `entry_point`s are now `Option`al
|
||||
|
||||
One of the changes in the WebGPU spec. (from [about this time last year][optional-entrypoint-in-spec] 😅) was to allow optional entry points in `GPUProgrammableStage`. In `wgpu`, this corresponds to a subset of fields in `FragmentState`, `VertexState`, and `ComputeState` as the `entry_point` member:
|
||||
|
||||
```wgsl
|
||||
let render_pipeline = device.createRenderPipeline(wgpu::RenderPipelineDescriptor {
|
||||
module,
|
||||
entry_point: Some("cs_main"), // This is now `Option`al.
|
||||
// …
|
||||
});
|
||||
|
||||
let compute_pipeline = device.createComputePipeline(wgpu::ComputePipelineDescriptor {
|
||||
module,
|
||||
entry_point: None, // This is now `Option`al.
|
||||
// …
|
||||
});
|
||||
```
|
||||
|
||||
When set to `None`, it's assumed that the shader only has a single entry point associated with the pipeline stage (i.e., `@compute`, `@fragment`, or `@vertex`). If there is not one and only one candidate entry point, then a validation error is returned. To continue the example, we might have written the above API usage with the following shader module:
|
||||
|
||||
```wgsl
|
||||
// We can't use `entry_point: None` for compute pipelines with this module,
|
||||
// because there are two `@compute` entry points.
|
||||
|
||||
@compute
|
||||
fn cs_main() { /* … */ }
|
||||
|
||||
@compute
|
||||
fn other_cs_main() { /* … */ }
|
||||
|
||||
// The following entry points _can_ be inferred from `entry_point: None` in a
|
||||
// render pipeline, because they're the only `@vertex` and `@fragment` entry
|
||||
// points:
|
||||
|
||||
@vertex
|
||||
fn vs_main() { /* … */ }
|
||||
|
||||
@fragment
|
||||
fn fs_main() { /* … */ }
|
||||
```
|
||||
|
||||
[optional-entrypoint-in-spec]: https://github.com/gpuweb/gpuweb/issues/4342
|
||||
|
||||
#### WGPU's DX12 backend is now based on the `windows` crate ecosystem, instead of the `d3d12` crate
|
||||
|
||||
WGPU has retired the `d3d12` crate (based on `winapi`), and now uses the `windows` crate for interfacing with Windows. For many, this may not be a change that affects day-to-day work. However, for users who need to vet their dependencies, or who may vendor in dependencies, this may be a nontrivial migration.
|
||||
|
||||
By @MarijnS95 in [#6006](https://github.com/gfx-rs/wgpu/pull/6006).
|
||||
|
||||
### New Features
|
||||
|
||||
@ -95,27 +192,28 @@ By @bradwerth [#6216](https://github.com/gfx-rs/wgpu/pull/6216).
|
||||
|
||||
#### General
|
||||
|
||||
- Add `VideoFrame` to `ExternalImageSource` enum. By @jprochazk in [#6170](https://github.com/gfx-rs/wgpu/pull/6170)
|
||||
- Add `wgpu::util::new_instance_with_webgpu_detection` & `wgpu::util::is_browser_webgpu_supported` to make it easier to support WebGPU & WebGL in the same binary. By @wumpf in [#6371](https://github.com/gfx-rs/wgpu/pull/6371)
|
||||
- Add `VideoFrame` to `ExternalImageSource` enum. By @jprochazk in [#6170](https://github.com/gfx-rs/wgpu/pull/6170).
|
||||
- Add `wgpu::util::new_instance_with_webgpu_detection` & `wgpu::util::is_browser_webgpu_supported` to make it easier to support WebGPU & WebGL in the same binary. By @wumpf in [#6371](https://github.com/gfx-rs/wgpu/pull/6371).
|
||||
|
||||
#### Vulkan
|
||||
|
||||
- Allow using [VK_GOOGLE_display_timing](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_GOOGLE_display_timing.html) unsafely with the `VULKAN_GOOGLE_DISPLAY_TIMING` feature. By @DJMcNab in [#6149](https://github.com/gfx-rs/wgpu/pull/6149)
|
||||
- Allow using [VK_GOOGLE_display_timing](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_GOOGLE_display_timing.html) unsafely with the `VULKAN_GOOGLE_DISPLAY_TIMING` feature. By @DJMcNab in [#6149](https://github.com/gfx-rs/wgpu/pull/6149).
|
||||
|
||||
#### Metal
|
||||
|
||||
- Implement `atomicCompareExchangeWeak`. By @AsherJingkongChen in [#6265](https://github.com/gfx-rs/wgpu/pull/6265)
|
||||
- Implement `atomicCompareExchangeWeak`. By @AsherJingkongChen in [#6265](https://github.com/gfx-rs/wgpu/pull/6265).
|
||||
- Unless an explicit `CAMetalLayer` is provided, surfaces now render to a sublayer. This improves resizing behavior, fixing glitches during on window resize. By @madsmtm in [#6107](https://github.com/gfx-rs/wgpu/pull/6107).
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix incorrect hlsl image output type conversion. By @atlv24 in [#6123](https://github.com/gfx-rs/wgpu/pull/6123)
|
||||
- Fix incorrect hlsl image output type conversion. By @atlv24 in [#6123](https://github.com/gfx-rs/wgpu/pull/6123).
|
||||
|
||||
#### Naga
|
||||
|
||||
- SPIR-V frontend splats depth texture sample and load results. Fixes [issue #4551](https://github.com/gfx-rs/wgpu/issues/4551). By @schell in [#6384](https://github.com/gfx-rs/wgpu/pull/6384).
|
||||
- Accept only `vec3` (not `vecN`) for the `cross` built-in. By @ErichDonGubler in [#6171](https://github.com/gfx-rs/wgpu/pull/6171).
|
||||
- Configure `SourceLanguage` when enabling debug info in SPV-out. By @kvark in [#6256](https://github.com/gfx-rs/wgpu/pull/6256).
|
||||
- Per-polygon and flat inputs should not be considered subgroup uniform. By @magcius in [#6276](https://github.com/gfx-rs/wgpu/pull/6276).
|
||||
- Do not consider per-polygon and flat inputs subgroup uniform. By @magcius in [#6276](https://github.com/gfx-rs/wgpu/pull/6276).
|
||||
- Validate all swizzle components are either color (rgba) or dimension (xyzw) in WGSL. By @sagudev in [#6187](https://github.com/gfx-rs/wgpu/pull/6187).
|
||||
- Fix detection of shl overflows to detect arithmetic overflows. By @sagudev in [#6186](https://github.com/gfx-rs/wgpu/pull/6186).
|
||||
- Fix type parameters to vec/mat type constructors to also support aliases. By @sagudev in [#6189](https://github.com/gfx-rs/wgpu/pull/6189).
|
||||
@ -128,28 +226,28 @@ By @bradwerth [#6216](https://github.com/gfx-rs/wgpu/pull/6216).
|
||||
|
||||
#### General
|
||||
|
||||
- If GL context creation fails retry with GLES. By @Rapdorian in [#5996](https://github.com/gfx-rs/wgpu/pull/5996)
|
||||
- Fix profiling with `tracy`. By @waywardmonkeys in [#5988](https://github.com/gfx-rs/wgpu/pull/5988)
|
||||
- As a workaround for [issue #4905](https://github.com/gfx-rs/wgpu/issues/4905), `wgpu-core` is undocumented unless `--cfg wgpu_core_doc` feature is enabled. By @kpreid in [#5987](https://github.com/gfx-rs/wgpu/pull/5987)
|
||||
- Bump MSRV for `d3d12`/`naga`/`wgpu-core`/`wgpu-hal`/`wgpu-types`' to 1.76. By @wumpf in [#6003](https://github.com/gfx-rs/wgpu/pull/6003)
|
||||
- Print requested and supported usages on `UnsupportedUsage` error. By @VladasZ in [#6007](https://github.com/gfx-rs/wgpu/pull/6007)
|
||||
- Fix function for checking bind compatibility to error instead of panic. By @sagudev [#6012](https://github.com/gfx-rs/wgpu/pull/6012)
|
||||
- Deduplicate bind group layouts that are created from pipelines with "auto" layouts. By @teoxoy [#6049](https://github.com/gfx-rs/wgpu/pull/6049)
|
||||
- Fix crash when dropping the surface after the device. By @wumpf in [#6052](https://github.com/gfx-rs/wgpu/pull/6052)
|
||||
- Fix error message that is thrown in create_render_pass to no longer say `compute_pass`. By @matthew-wong1 [#6041](https://github.com/gfx-rs/wgpu/pull/6041)
|
||||
- Document `wgpu_hal` bounds-checking promises, and adapt `wgpu_core`'s lazy initialization logic to the slightly weaker-than-expected guarantees. By @jimblandy in [#6201](https://github.com/gfx-rs/wgpu/pull/6201)
|
||||
- If GL context creation fails retry with GLES. By @Rapdorian in [#5996](https://github.com/gfx-rs/wgpu/pull/5996).
|
||||
- Fix profiling with `tracy`. By @waywardmonkeys in [#5988](https://github.com/gfx-rs/wgpu/pull/5988).
|
||||
- As a workaround for [issue #4905](https://github.com/gfx-rs/wgpu/issues/4905), `wgpu-core` is undocumented unless `--cfg wgpu_core_doc` feature is enabled. By @kpreid in [#5987](https://github.com/gfx-rs/wgpu/pull/5987).
|
||||
- Bump MSRV for `d3d12`/`naga`/`wgpu-core`/`wgpu-hal`/`wgpu-types`' to 1.76. By @wumpf in [#6003](https://github.com/gfx-rs/wgpu/pull/6003).
|
||||
- Print requested and supported usages on `UnsupportedUsage` error. By @VladasZ in [#6007](https://github.com/gfx-rs/wgpu/pull/6007).
|
||||
- Fix function for checking bind compatibility to error instead of panic. By @sagudev [#6012](https://github.com/gfx-rs/wgpu/pull/6012).
|
||||
- Deduplicate bind group layouts that are created from pipelines with "auto" layouts. By @teoxoy [#6049](https://github.com/gfx-rs/wgpu/pull/6049).
|
||||
- Fix crash when dropping the surface after the device. By @wumpf in [#6052](https://github.com/gfx-rs/wgpu/pull/6052).
|
||||
- Fix error message that is thrown in create_render_pass to no longer say `compute_pass`. By @matthew-wong1 [#6041](https://github.com/gfx-rs/wgpu/pull/6041).
|
||||
- Document `wgpu_hal` bounds-checking promises, and adapt `wgpu_core`'s lazy initialization logic to the slightly weaker-than-expected guarantees. By @jimblandy in [#6201](https://github.com/gfx-rs/wgpu/pull/6201).
|
||||
- Raise validation error instead of panicking in `{Render,Compute}Pipeline::get_bind_group_layout` on native / WebGL. By @bgr360 in [#6280](https://github.com/gfx-rs/wgpu/pull/6280).
|
||||
- **BREAKING**: Remove the last exposed C symbols in project, located in `wgpu_core::render::bundle::bundle_ffi`, to allow multiple versions of WGPU to compile together. By @ErichDonGubler in [#6272](https://github.com/gfx-rs/wgpu/pull/6272).
|
||||
- Call `flush_mapped_ranges` when unmapping write-mapped buffers. By @teoxoy in [#6089](https://github.com/gfx-rs/wgpu/pull/6089).
|
||||
- When mapping buffers for reading, mark buffers as initialized only when they have `MAP_WRITE` usage. By @teoxoy in [#6178](https://github.com/gfx-rs/wgpu/pull/6178).
|
||||
- Add a separate pipeline constants error. By @teoxoy in [#6094](https://github.com/gfx-rs/wgpu/pull/6094).
|
||||
- Ensure safety of indirect dispatch by injecting a compute shader that validates the content of the indirect buffer. By @teoxoy in [#5714](https://github.com/gfx-rs/wgpu/pull/5714)
|
||||
- Ensure safety of indirect dispatch by injecting a compute shader that validates the content of the indirect buffer. By @teoxoy in [#5714](https://github.com/gfx-rs/wgpu/pull/5714).
|
||||
|
||||
#### GLES / OpenGL
|
||||
|
||||
- Fix GL debug message callbacks not being properly cleaned up (causing UB). By @Imberflur in [#6114](https://github.com/gfx-rs/wgpu/pull/6114)
|
||||
- Fix calling `slice::from_raw_parts` with unaligned pointers in push constant handling. By @Imberflur in [#6341](https://github.com/gfx-rs/wgpu/pull/6341)
|
||||
- Optimise fence checking when `Queue::submit` is called many times per frame. By @dinnerbone in [#6427](https://github.com/gfx-rs/wgpu/pull/6427)
|
||||
- Fix GL debug message callbacks not being properly cleaned up (causing UB). By @Imberflur in [#6114](https://github.com/gfx-rs/wgpu/pull/6114).
|
||||
- Fix calling `slice::from_raw_parts` with unaligned pointers in push constant handling. By @Imberflur in [#6341](https://github.com/gfx-rs/wgpu/pull/6341).
|
||||
- Optimise fence checking when `Queue::submit` is called many times per frame. By @dinnerbone in [#6427](https://github.com/gfx-rs/wgpu/pull/6427).
|
||||
|
||||
#### WebGPU
|
||||
|
||||
@ -157,14 +255,14 @@ By @bradwerth [#6216](https://github.com/gfx-rs/wgpu/pull/6216).
|
||||
|
||||
#### Vulkan
|
||||
|
||||
- Vulkan debug labels assumed no interior nul byte. By @DJMcNab in [#6257](https://github.com/gfx-rs/wgpu/pull/6257)
|
||||
- Add `.index_type(vk::IndexType::NONE_KHR)` when creating `AccelerationStructureGeometryTrianglesDataKHR` in the raytraced triangle example to prevent a validation error. By @Vecvec in [#6282](https://github.com/gfx-rs/wgpu/pull/6282)
|
||||
- Avoid undefined behaviour with adversarial debug label. By @DJMcNab in [#6257](https://github.com/gfx-rs/wgpu/pull/6257).
|
||||
- Add `.index_type(vk::IndexType::NONE_KHR)` when creating `AccelerationStructureGeometryTrianglesDataKHR` in the raytraced triangle example to prevent a validation error. By @Vecvec in [#6282](https://github.com/gfx-rs/wgpu/pull/6282).
|
||||
|
||||
### Changes
|
||||
|
||||
- `wgpu_hal::gles::Adapter::new_external` now requires the context to be current when dropping the adapter and related objects. By @Imberflur in [#6114](https://github.com/gfx-rs/wgpu/pull/6114).
|
||||
- Reduce the amount of debug and trace logs emitted by wgpu-core and wgpu-hal. By @nical in [#6065](https://github.com/gfx-rs/wgpu/issues/6065)
|
||||
- `Rg11b10Float` is renamed to `Rg11b10Ufloat`. By @sagudev in [#6108](https://github.com/gfx-rs/wgpu/pull/6108)
|
||||
- Reduce the amount of debug and trace logs emitted by wgpu-core and wgpu-hal. By @nical in [#6065](https://github.com/gfx-rs/wgpu/issues/6065).
|
||||
- Rename `Rg11b10Float` to `Rg11b10Ufloat`. By @sagudev in [#6108](https://github.com/gfx-rs/wgpu/pull/6108).
|
||||
- Invalidate the device when we encounter driver-induced device loss or on unexpected errors. By @teoxoy in [#6229](https://github.com/gfx-rs/wgpu/pull/6229).
|
||||
- Make Vulkan error handling more robust. By @teoxoy in [#6119](https://github.com/gfx-rs/wgpu/pull/6119).
|
||||
- Add bounds checking to Buffer slice method. By @beholdnec in [#6432](https://github.com/gfx-rs/wgpu/pull/6432).
|
||||
@ -180,29 +278,29 @@ By @bradwerth [#6216](https://github.com/gfx-rs/wgpu/pull/6216).
|
||||
|
||||
#### HAL
|
||||
|
||||
- Change the inconsistent `DropGuard` based API on Vulkan and GLES to a consistent, callback-based one. By @jerzywilczek in [#6164](https://github.com/gfx-rs/wgpu/pull/6164)
|
||||
- Change the inconsistent `DropGuard` based API on Vulkan and GLES to a consistent, callback-based one. By @jerzywilczek in [#6164](https://github.com/gfx-rs/wgpu/pull/6164).
|
||||
|
||||
### Documentation
|
||||
|
||||
- Removed some OpenGL and Vulkan references from `wgpu-types` documentation. Fixed Storage texel types in examples. By @Nelarius in [#6271](https://github.com/gfx-rs/wgpu/pull/6271)
|
||||
- Removed some OpenGL and Vulkan references from `wgpu-types` documentation. Fixed Storage texel types in examples. By @Nelarius in [#6271](https://github.com/gfx-rs/wgpu/pull/6271).
|
||||
- Used `wgpu::include_wgsl!(…)` more in examples and tests. By @ErichDonGubler in [#6326](https://github.com/gfx-rs/wgpu/pull/6326).
|
||||
|
||||
### Dependency Updates
|
||||
|
||||
#### GLES
|
||||
|
||||
- Replace `winapi` code in WGL wrapper to use the `windows` crate. By @MarijnS95 in [#6006](https://github.com/gfx-rs/wgpu/pull/6006)
|
||||
- Update `glutin` to `0.31` with `glutin-winit` crate. By @MarijnS95 in [#6150](https://github.com/gfx-rs/wgpu/pull/6150) and [#6176](https://github.com/gfx-rs/wgpu/pull/6176)
|
||||
- Implement `Adapter::new_external()` for WGL (just like EGL) to import an external OpenGL ES context. By @MarijnS95 in [#6152](https://github.com/gfx-rs/wgpu/pull/6152)
|
||||
- Replace `winapi` code in WGL wrapper to use the `windows` crate. By @MarijnS95 in [#6006](https://github.com/gfx-rs/wgpu/pull/6006).
|
||||
- Update `glutin` to `0.31` with `glutin-winit` crate. By @MarijnS95 in [#6150](https://github.com/gfx-rs/wgpu/pull/6150) and [#6176](https://github.com/gfx-rs/wgpu/pull/6176).
|
||||
- Implement `Adapter::new_external()` for WGL (just like EGL) to import an external OpenGL ES context. By @MarijnS95 in [#6152](https://github.com/gfx-rs/wgpu/pull/6152).
|
||||
|
||||
#### DX12
|
||||
|
||||
- Replace `winapi` code to use the `windows` crate. By @MarijnS95 in [#5956](https://github.com/gfx-rs/wgpu/pull/5956) and [#6173](https://github.com/gfx-rs/wgpu/pull/6173)
|
||||
- Get `num_workgroups` builtin working for indirect dispatches. By @teoxoy in [#5730](https://github.com/gfx-rs/wgpu/pull/5730)
|
||||
- Replace `winapi` code to use the `windows` crate. By @MarijnS95 in [#5956](https://github.com/gfx-rs/wgpu/pull/5956) and [#6173](https://github.com/gfx-rs/wgpu/pull/6173).
|
||||
- Get `num_workgroups` builtin working for indirect dispatches. By @teoxoy in [#5730](https://github.com/gfx-rs/wgpu/pull/5730).
|
||||
|
||||
#### HAL
|
||||
|
||||
- Update `parking_lot` to `0.12`. By @mahkoh in [#6287](https://github.com/gfx-rs/wgpu/pull/6287)
|
||||
- Update `parking_lot` to `0.12`. By @mahkoh in [#6287](https://github.com/gfx-rs/wgpu/pull/6287).
|
||||
|
||||
## 22.0.0 (2024-07-17)
|
||||
|
||||
|
131
Cargo.lock
generated
131
Cargo.lock
generated
@ -111,9 +111,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.15"
|
||||
version = "0.6.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
|
||||
checksum = "23a1e53f0f5d86382dafe1cf314783b2044280f406e7e1506368220ad11b1338"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
@ -126,43 +126,43 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.8"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
|
||||
checksum = "8365de52b16c035ff4fcafe0092ba9390540e3e352870ac09933bebcaa2c8c56"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
version = "0.2.5"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
|
||||
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
|
||||
dependencies = [
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-query"
|
||||
version = "1.1.1"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
|
||||
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
|
||||
dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "3.0.4"
|
||||
version = "3.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
|
||||
checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.90"
|
||||
version = "1.0.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37bf3594c4c988a53154954629820791dde498571819ae4ca50ca811e060cc95"
|
||||
checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8"
|
||||
|
||||
[[package]]
|
||||
name = "arbitrary"
|
||||
@ -396,9 +396,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.7.2"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3"
|
||||
checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da"
|
||||
|
||||
[[package]]
|
||||
name = "calloop"
|
||||
@ -555,9 +555,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
version = "1.0.2"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
|
||||
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
||||
|
||||
[[package]]
|
||||
name = "combine"
|
||||
@ -1055,9 +1055,9 @@ checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6"
|
||||
|
||||
[[package]]
|
||||
name = "fdeflate"
|
||||
version = "0.3.5"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8090f921a24b04994d9929e204f50b498a33ea6ba559ffaa05e04f7ee7fb5ab"
|
||||
checksum = "07c6f4c64c1d33a3111c4466f7365ebdcc37c5bd1ea0d62aae2e3d722aacbedb"
|
||||
dependencies = [
|
||||
"simd-adler32",
|
||||
]
|
||||
@ -1700,7 +1700,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-targets 0.52.6",
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1739,7 +1739,7 @@ checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
|
||||
|
||||
[[package]]
|
||||
name = "lock-analyzer"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"ron",
|
||||
@ -1834,9 +1834,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "minicov"
|
||||
version = "0.3.5"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c71e683cd655513b99affab7d317deb690528255a0d5f717f1024093c12b169"
|
||||
checksum = "def6d99771d7c499c26ad4d40eb6645eafd3a1553b35fc26ea5a489a45e82d9a"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"walkdir",
|
||||
@ -1875,7 +1875,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "naga"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
"arrayvec",
|
||||
@ -1905,13 +1905,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "naga-cli"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"argh",
|
||||
"bincode",
|
||||
"codespan-reporting",
|
||||
"env_logger",
|
||||
"log",
|
||||
"naga",
|
||||
]
|
||||
|
||||
@ -2233,18 +2234,18 @@ checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.1.6"
|
||||
version = "1.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec"
|
||||
checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95"
|
||||
dependencies = [
|
||||
"pin-project-internal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-internal"
|
||||
version = "1.1.6"
|
||||
version = "1.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8"
|
||||
checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2253,9 +2254,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.14"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
|
||||
checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
@ -2271,7 +2272,7 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
|
||||
|
||||
[[package]]
|
||||
name = "player"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
dependencies = [
|
||||
"env_logger",
|
||||
"log",
|
||||
@ -2394,9 +2395,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.88"
|
||||
version = "1.0.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9"
|
||||
checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@ -2507,9 +2508,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.11.0"
|
||||
version = "1.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8"
|
||||
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@ -2608,9 +2609,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.37"
|
||||
version = "0.38.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811"
|
||||
checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"errno",
|
||||
@ -2688,18 +2689,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.210"
|
||||
version = "1.0.213"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
|
||||
checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.210"
|
||||
version = "1.0.213"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
|
||||
checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2926,9 +2927,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.82"
|
||||
version = "2.0.85"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "83540f837a8afc019423a8edb95b52a8effe46957ee402287f4292fae35be021"
|
||||
checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2946,18 +2947,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.64"
|
||||
version = "1.0.65"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
|
||||
checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.64"
|
||||
version = "1.0.65"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
|
||||
checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -3045,9 +3046,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.40.0"
|
||||
version = "1.41.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
|
||||
checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
@ -3449,9 +3450,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wayland-client"
|
||||
version = "0.31.6"
|
||||
version = "0.31.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3f45d1222915ef1fd2057220c1d9d9624b7654443ea35c3877f7a52bd0a5a2d"
|
||||
checksum = "b66249d3fc69f76fd74c82cc319300faa554e9d865dab1f7cd66cc20db10b280"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"rustix",
|
||||
@ -3472,9 +3473,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wayland-cursor"
|
||||
version = "0.31.6"
|
||||
version = "0.31.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a94697e66e76c85923b0d28a0c251e8f0666f58fc47d316c0f4da6da75d37cb"
|
||||
checksum = "32b08bc3aafdb0035e7fe0fdf17ba0c09c268732707dca4ae098f60cb28c9e4c"
|
||||
dependencies = [
|
||||
"rustix",
|
||||
"wayland-client",
|
||||
@ -3564,7 +3565,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"cfg_aliases",
|
||||
@ -3588,7 +3589,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-benchmark"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"bytemuck",
|
||||
@ -3605,7 +3606,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-core"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bit-vec",
|
||||
@ -3631,7 +3632,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-examples"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"cfg-if",
|
||||
@ -3662,7 +3663,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-hal"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"arrayvec",
|
||||
@ -3712,7 +3713,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-info"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitflags 2.6.0",
|
||||
@ -3725,7 +3726,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-macros"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
dependencies = [
|
||||
"heck 0.5.0",
|
||||
"quote",
|
||||
@ -3734,7 +3735,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-test"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arrayvec",
|
||||
@ -3769,7 +3770,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-types"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"js-sys",
|
||||
@ -3813,7 +3814,7 @@ version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
26
Cargo.toml
26
Cargo.toml
@ -47,30 +47,30 @@ keywords = ["graphics"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
homepage = "https://wgpu.rs/"
|
||||
repository = "https://github.com/gfx-rs/wgpu"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
authors = ["gfx-rs developers"]
|
||||
|
||||
[workspace.dependencies.wgc]
|
||||
package = "wgpu-core"
|
||||
path = "./wgpu-core"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
|
||||
[workspace.dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
path = "./wgpu-types"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
|
||||
[workspace.dependencies.hal]
|
||||
package = "wgpu-hal"
|
||||
path = "./wgpu-hal"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
|
||||
[workspace.dependencies.naga]
|
||||
path = "./naga"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
|
||||
[workspace.dependencies]
|
||||
anyhow = "1.0.90"
|
||||
anyhow = "1.0.91"
|
||||
argh = "0.1.5"
|
||||
arrayvec = "0.7"
|
||||
bincode = "1"
|
||||
@ -125,12 +125,12 @@ smallvec = "1"
|
||||
static_assertions = "1.1.0"
|
||||
strum = { version = "0.25.0", features = ["derive"] }
|
||||
tracy-client = "0.17"
|
||||
thiserror = "1.0.64"
|
||||
wgpu = { version = "22.0.0", path = "./wgpu", default-features = false }
|
||||
wgpu-core = { version = "22.0.0", path = "./wgpu-core" }
|
||||
wgpu-macros = { version = "22.0.0", path = "./wgpu-macros" }
|
||||
wgpu-test = { version = "22.0.0", path = "./tests" }
|
||||
wgpu-types = { version = "22.0.0", path = "./wgpu-types" }
|
||||
thiserror = "1.0.65"
|
||||
wgpu = { version = "23.0.0", path = "./wgpu", default-features = false }
|
||||
wgpu-core = { version = "23.0.0", path = "./wgpu-core" }
|
||||
wgpu-macros = { version = "23.0.0", path = "./wgpu-macros" }
|
||||
wgpu-test = { version = "23.0.0", path = "./tests" }
|
||||
wgpu-types = { version = "23.0.0", path = "./wgpu-types" }
|
||||
winit = { version = "0.29", features = ["android-native-activity"] }
|
||||
|
||||
# Metal dependencies
|
||||
@ -178,7 +178,7 @@ deno_url = "0.143.0"
|
||||
deno_web = "0.174.0"
|
||||
deno_webidl = "0.143.0"
|
||||
deno_webgpu = { version = "0.118.0", path = "./deno_webgpu" }
|
||||
tokio = "1.40.0"
|
||||
tokio = "1.41.0"
|
||||
termcolor = "1.4.1"
|
||||
|
||||
# android dependencies
|
||||
|
@ -10,7 +10,7 @@ We do a patch releases as needed in the weeks between major releases. Once a new
|
||||
|
||||
Anyone can perform most of these steps, except actually publishing the crates.
|
||||
|
||||
Currently only @kvark and @cwfitzgerald can publish all crates. @grovesNL can also publish `wgpu` crates. @jimblandy can publish `naga` crates. @msiglreith can publish `d3d12`.
|
||||
Currently only @kvark and @cwfitzgerald can publish all crates. @grovesNL can also publish `wgpu` crates. @jimblandy can publish `naga` crates.
|
||||
|
||||
## Major Release Process
|
||||
|
||||
@ -24,7 +24,6 @@ Approx 1 Week Before:
|
||||
|
||||
Day of Release:
|
||||
- Update all crates to be the new version. We bump all versions even if there were no changes.
|
||||
- `d3d12`
|
||||
- `naga`
|
||||
- `naga-cli`
|
||||
- `wgpu-types`
|
||||
@ -38,7 +37,6 @@ Day of Release:
|
||||
- Checkout `trunk` with the merged PR.
|
||||
- Publish! These commands can be pasted directly into your terminal in a single command, and they will publish everything.
|
||||
```bash
|
||||
cargo publish -p d3d12
|
||||
cargo publish -p naga
|
||||
cargo publish -p naga-cli
|
||||
cargo publish -p wgpu-types
|
||||
|
@ -8,6 +8,7 @@ homepage.workspace = true
|
||||
repository.workspace = true
|
||||
version.workspace = true
|
||||
authors.workspace = true
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
ron.workspace = true
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "naga-cli"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
authors = ["gfx-rs developers"]
|
||||
edition = "2021"
|
||||
description = "Shader translation command line tool"
|
||||
@ -23,9 +23,10 @@ codespan-reporting.workspace = true
|
||||
env_logger.workspace = true
|
||||
argh.workspace = true
|
||||
anyhow.workspace = true
|
||||
log.workspace = true
|
||||
|
||||
[dependencies.naga]
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
path = "../naga"
|
||||
features = [
|
||||
"compact",
|
||||
|
@ -375,7 +375,10 @@ impl fmt::Display for CliError {
|
||||
impl std::error::Error for CliError {}
|
||||
|
||||
fn run() -> anyhow::Result<()> {
|
||||
env_logger::init();
|
||||
env_logger::builder()
|
||||
.filter_level(log::LevelFilter::Info)
|
||||
.parse_default_env()
|
||||
.init();
|
||||
|
||||
// Parse commandline arguments
|
||||
let args: Args = argh::from_env();
|
||||
@ -448,13 +451,15 @@ fn run() -> anyhow::Result<()> {
|
||||
return bulk_validate(args, ¶ms);
|
||||
}
|
||||
|
||||
let (input_path, input) = if let Some(path) = args.files.first() {
|
||||
let path = Path::new(path);
|
||||
(path, fs::read(path)?)
|
||||
} else if let Some(path) = &args.stdin_file_path {
|
||||
let mut files = args.files.iter();
|
||||
|
||||
let (input_path, input) = if let Some(path) = args.stdin_file_path.as_ref() {
|
||||
let mut input = vec![];
|
||||
std::io::stdin().lock().read_to_end(&mut input)?;
|
||||
(Path::new(path), input)
|
||||
} else if let Some(path) = files.next() {
|
||||
let path = Path::new(path);
|
||||
(path, fs::read(path)?)
|
||||
} else {
|
||||
return Err(CliError("Input file path is not specified").into());
|
||||
};
|
||||
@ -489,12 +494,12 @@ fn run() -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
let output_paths = args.files.get(1..).unwrap_or(&[]);
|
||||
let output_paths = files;
|
||||
|
||||
// Decide which capabilities our output formats can support.
|
||||
let validation_caps =
|
||||
output_paths
|
||||
.iter()
|
||||
.clone()
|
||||
.fold(naga::valid::Capabilities::all(), |caps, path| {
|
||||
use naga::valid::Capabilities as C;
|
||||
let missing = match Path::new(path).extension().and_then(|ex| ex.to_str()) {
|
||||
@ -564,7 +569,7 @@ fn run() -> anyhow::Result<()> {
|
||||
//
|
||||
// If the user asked for output, don't stop: some output formats (".txt",
|
||||
// ".dot", ".bin") can be generated even without a `ModuleInfo`.
|
||||
if output_paths.is_empty() {
|
||||
if output_paths.clone().next().is_none() {
|
||||
if info.is_some() {
|
||||
println!("Validation successful");
|
||||
return Ok(());
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "naga"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
authors = ["gfx-rs developers"]
|
||||
edition = "2021"
|
||||
description = "Shader translation infrastructure"
|
||||
@ -77,7 +77,7 @@ indexmap.workspace = true
|
||||
log = "0.4"
|
||||
spirv = { version = "0.3", optional = true }
|
||||
thiserror.workspace = true
|
||||
serde = { version = "1.0.210", features = ["derive"], optional = true }
|
||||
serde = { version = "1.0.213", features = ["derive"], optional = true }
|
||||
petgraph = { version = "0.6", optional = true }
|
||||
pp-rs = { version = "0.2.1", optional = true }
|
||||
hexf-parse = { version = "0.2.1", optional = true }
|
||||
|
@ -15,7 +15,7 @@ libfuzzer-sys = "0.4"
|
||||
|
||||
[target.'cfg(not(any(target_arch = "wasm32", target_os = "ios")))'.dependencies.naga]
|
||||
path = ".."
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
features = ["arbitrary", "spv-in", "wgsl-in", "glsl-in"]
|
||||
|
||||
[[bin]]
|
||||
|
@ -24,7 +24,7 @@ fn get_dimension(type_inner: &crate::TypeInner) -> Dimension {
|
||||
/// types are simply the direct SPIR-V analog of the Naga IR's. But in some
|
||||
/// cases, the Naga IR and SPIR-V types need to diverge.
|
||||
///
|
||||
/// This enum specifies how [`BlockContext::write_expression_pointer`] should
|
||||
/// This enum specifies how [`BlockContext::write_access_chain`] should
|
||||
/// choose a SPIR-V result type for the `OpAccessChain` it generates, based on
|
||||
/// the type of the given Naga IR [`Expression`] it's generating code for.
|
||||
///
|
||||
@ -68,7 +68,7 @@ enum AccessTypeAdjustment {
|
||||
|
||||
/// The results of emitting code for a left-hand-side expression.
|
||||
///
|
||||
/// On success, `write_expression_pointer` returns one of these.
|
||||
/// On success, `write_access_chain` returns one of these.
|
||||
enum ExpressionPointer {
|
||||
/// The pointer to the expression's value is available, as the value of the
|
||||
/// expression with the given id.
|
||||
@ -407,7 +407,7 @@ impl<'w> BlockContext<'w> {
|
||||
} => {
|
||||
// Only binding arrays in the `Handle` address space will take
|
||||
// this path, since we handled the `Pointer` case above.
|
||||
let result_id = match self.write_expression_pointer(
|
||||
let result_id = match self.write_access_chain(
|
||||
expr_handle,
|
||||
block,
|
||||
AccessTypeAdjustment::IntroducePointer(
|
||||
@ -498,7 +498,7 @@ impl<'w> BlockContext<'w> {
|
||||
} => {
|
||||
// Only binding arrays in the `Handle` address space will take
|
||||
// this path, since we handled the `Pointer` case above.
|
||||
let result_id = match self.write_expression_pointer(
|
||||
let result_id = match self.write_access_chain(
|
||||
expr_handle,
|
||||
block,
|
||||
AccessTypeAdjustment::IntroducePointer(
|
||||
@ -1751,7 +1751,7 @@ impl<'w> BlockContext<'w> {
|
||||
///
|
||||
/// On success, the return value is an [`ExpressionPointer`] value; see the
|
||||
/// documentation for that type.
|
||||
fn write_expression_pointer(
|
||||
fn write_access_chain(
|
||||
&mut self,
|
||||
mut expr_handle: Handle<crate::Expression>,
|
||||
block: &mut Block,
|
||||
@ -1982,7 +1982,7 @@ impl<'w> BlockContext<'w> {
|
||||
access_type_adjustment: AccessTypeAdjustment,
|
||||
result_type_id: Word,
|
||||
) -> Result<Word, Error> {
|
||||
match self.write_expression_pointer(pointer, block, access_type_adjustment)? {
|
||||
match self.write_access_chain(pointer, block, access_type_adjustment)? {
|
||||
ExpressionPointer::Ready { pointer_id } => {
|
||||
let id = self.gen_id();
|
||||
let atomic_space =
|
||||
@ -2603,7 +2603,7 @@ impl<'w> BlockContext<'w> {
|
||||
}
|
||||
Statement::Store { pointer, value } => {
|
||||
let value_id = self.cached[value];
|
||||
match self.write_expression_pointer(
|
||||
match self.write_access_chain(
|
||||
pointer,
|
||||
&mut block,
|
||||
AccessTypeAdjustment::None,
|
||||
@ -2703,7 +2703,7 @@ impl<'w> BlockContext<'w> {
|
||||
self.cached[result] = id;
|
||||
}
|
||||
|
||||
let pointer_id = match self.write_expression_pointer(
|
||||
let pointer_id = match self.write_access_chain(
|
||||
pointer,
|
||||
&mut block,
|
||||
AccessTypeAdjustment::None,
|
||||
@ -2884,7 +2884,7 @@ impl<'w> BlockContext<'w> {
|
||||
.write_barrier(crate::Barrier::WORK_GROUP, &mut block);
|
||||
let result_type_id = self.get_expression_type_id(&self.fun_info[result].ty);
|
||||
// Embed the body of
|
||||
match self.write_expression_pointer(
|
||||
match self.write_access_chain(
|
||||
pointer,
|
||||
&mut block,
|
||||
AccessTypeAdjustment::None,
|
||||
|
97
naga/src/diagnostic_filter.rs
Normal file
97
naga/src/diagnostic_filter.rs
Normal file
@ -0,0 +1,97 @@
|
||||
//! [`DiagnosticFilter`]s and supporting functionality.
|
||||
|
||||
/// A severity set on a [`DiagnosticFilter`].
|
||||
///
|
||||
/// <https://www.w3.org/TR/WGSL/#diagnostic-severity>
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
pub enum Severity {
|
||||
Off,
|
||||
Info,
|
||||
Warning,
|
||||
Error,
|
||||
}
|
||||
|
||||
impl Severity {
|
||||
const ERROR: &'static str = "error";
|
||||
const WARNING: &'static str = "warning";
|
||||
const INFO: &'static str = "info";
|
||||
const OFF: &'static str = "off";
|
||||
|
||||
/// Convert from a sentinel word in WGSL into its associated [`Severity`], if possible.
|
||||
pub fn from_ident(s: &str) -> Option<Self> {
|
||||
Some(match s {
|
||||
Self::ERROR => Self::Error,
|
||||
Self::WARNING => Self::Warning,
|
||||
Self::INFO => Self::Info,
|
||||
Self::OFF => Self::Off,
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
|
||||
/// Checks whether this severity is [`Self::Error`].
|
||||
///
|
||||
/// Naga does not yet support diagnostic items at lesser severities than
|
||||
/// [`Severity::Error`]. When this is implemented, this method should be deleted, and the
|
||||
/// severity should be used directly for reporting diagnostics.
|
||||
#[cfg(feature = "wgsl-in")]
|
||||
pub(crate) fn report_diag<E>(
|
||||
self,
|
||||
err: E,
|
||||
log_handler: impl FnOnce(E, log::Level),
|
||||
) -> Result<(), E> {
|
||||
let log_level = match self {
|
||||
Severity::Off => return Ok(()),
|
||||
|
||||
// NOTE: These severities are not yet reported.
|
||||
Severity::Info => log::Level::Info,
|
||||
Severity::Warning => log::Level::Warn,
|
||||
|
||||
Severity::Error => return Err(err),
|
||||
};
|
||||
log_handler(err, log_level);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// A filterable triggering rule in a [`DiagnosticFilter`].
|
||||
///
|
||||
/// <https://www.w3.org/TR/WGSL/#filterable-triggering-rules>
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
pub enum FilterableTriggeringRule {
|
||||
DerivativeUniformity,
|
||||
}
|
||||
|
||||
impl FilterableTriggeringRule {
|
||||
const DERIVATIVE_UNIFORMITY: &'static str = "derivative_uniformity";
|
||||
|
||||
/// Convert from a sentinel word in WGSL into its associated [`FilterableTriggeringRule`], if possible.
|
||||
pub fn from_ident(s: &str) -> Option<Self> {
|
||||
Some(match s {
|
||||
Self::DERIVATIVE_UNIFORMITY => Self::DerivativeUniformity,
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
|
||||
/// Maps this [`FilterableTriggeringRule`] into the sentinel word associated with it in WGSL.
|
||||
pub const fn to_ident(self) -> &'static str {
|
||||
match self {
|
||||
Self::DerivativeUniformity => Self::DERIVATIVE_UNIFORMITY,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "wgsl-in")]
|
||||
pub(crate) const fn tracking_issue_num(self) -> u16 {
|
||||
match self {
|
||||
FilterableTriggeringRule::DerivativeUniformity => 5320,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A filter that modifies how diagnostics are emitted for shaders.
|
||||
///
|
||||
/// <https://www.w3.org/TR/WGSL/#diagnostic-filter>
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct DiagnosticFilter {
|
||||
pub new_severity: Severity,
|
||||
pub triggering_rule: FilterableTriggeringRule,
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
use crate::diagnostic_filter::FilterableTriggeringRule;
|
||||
use crate::front::wgsl::parse::directive::enable_extension::{
|
||||
EnableExtension, UnimplementedEnableExtension,
|
||||
};
|
||||
use crate::front::wgsl::parse::directive::language_extension::{
|
||||
LanguageExtension, UnimplementedLanguageExtension,
|
||||
};
|
||||
use crate::front::wgsl::parse::directive::{DirectiveKind, UnimplementedDirectiveKind};
|
||||
use crate::front::wgsl::parse::lexer::Token;
|
||||
use crate::front::wgsl::Scalar;
|
||||
use crate::proc::{Alignment, ConstantEvaluatorError, ResolveError};
|
||||
@ -194,6 +194,7 @@ pub(crate) enum Error<'a> {
|
||||
UnknownConservativeDepth(Span),
|
||||
UnknownEnableExtension(Span, &'a str),
|
||||
UnknownLanguageExtension(Span, &'a str),
|
||||
UnknownDiagnosticRuleName(Span),
|
||||
SizeAttributeTooLow(Span, u32),
|
||||
AlignAttributeTooLow(Span, Alignment),
|
||||
NonPowerOfTwoAlignAttribute(Span),
|
||||
@ -276,10 +277,6 @@ pub(crate) enum Error<'a> {
|
||||
PipelineConstantIDValue(Span),
|
||||
NotBool(Span),
|
||||
ConstAssertFailed(Span),
|
||||
DirectiveNotYetImplemented {
|
||||
kind: UnimplementedDirectiveKind,
|
||||
span: Span,
|
||||
},
|
||||
DirectiveAfterFirstGlobalDecl {
|
||||
directive_span: Span,
|
||||
},
|
||||
@ -295,6 +292,13 @@ pub(crate) enum Error<'a> {
|
||||
kind: UnimplementedLanguageExtension,
|
||||
span: Span,
|
||||
},
|
||||
DiagnosticInvalidSeverity {
|
||||
severity_control_name_span: Span,
|
||||
},
|
||||
DiagnosticNotYetImplemented {
|
||||
triggering_rule: FilterableTriggeringRule,
|
||||
span: Span,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@ -562,6 +566,15 @@ impl<'a> Error<'a> {
|
||||
)
|
||||
.into()],
|
||||
},
|
||||
Error::UnknownDiagnosticRuleName(span) => ParseError {
|
||||
message: format!("unknown `diagnostic(…)` rule name `{}`", &source[span]),
|
||||
labels: vec![(span, "not a valid diagnostic rule name".into())],
|
||||
notes: vec![concat!(
|
||||
"See available trigger rules at ",
|
||||
"<https://www.w3.org/TR/WGSL/#filterable-triggering-rules>."
|
||||
)
|
||||
.into()],
|
||||
},
|
||||
Error::SizeAttributeTooLow(bad_span, min_size) => ParseError {
|
||||
message: format!("struct member size must be at least {min_size}"),
|
||||
labels: vec![(bad_span, format!("must be at least {min_size}").into())],
|
||||
@ -914,24 +927,6 @@ impl<'a> Error<'a> {
|
||||
labels: vec![(span, "evaluates to false".into())],
|
||||
notes: vec![],
|
||||
},
|
||||
Error::DirectiveNotYetImplemented { kind, span } => ParseError {
|
||||
message: format!(
|
||||
"the `{}` directive is not yet implemented",
|
||||
DirectiveKind::Unimplemented(kind).to_ident()
|
||||
),
|
||||
labels: vec![(
|
||||
span,
|
||||
"this global directive is standard, but not yet implemented".into(),
|
||||
)],
|
||||
notes: vec![format!(
|
||||
concat!(
|
||||
"Let Naga maintainers know that you ran into this at ",
|
||||
"<https://github.com/gfx-rs/wgpu/issues/{}>, ",
|
||||
"so they can prioritize it!"
|
||||
),
|
||||
kind.tracking_issue_num()
|
||||
)],
|
||||
},
|
||||
Error::DirectiveAfterFirstGlobalDecl { directive_span } => ParseError {
|
||||
message: "expected global declaration, but found a global directive".into(),
|
||||
labels: vec![(
|
||||
@ -1008,6 +1003,38 @@ impl<'a> Error<'a> {
|
||||
kind.tracking_issue_num()
|
||||
)],
|
||||
},
|
||||
Error::DiagnosticInvalidSeverity {
|
||||
severity_control_name_span,
|
||||
} => ParseError {
|
||||
message: "invalid `diagnostic(…)` severity".into(),
|
||||
labels: vec![(
|
||||
severity_control_name_span,
|
||||
"not a valid severity level".into(),
|
||||
)],
|
||||
notes: vec![concat!(
|
||||
"See available severities at ",
|
||||
"<https://www.w3.org/TR/WGSL/#diagnostic-severity>."
|
||||
)
|
||||
.into()],
|
||||
},
|
||||
Error::DiagnosticNotYetImplemented {
|
||||
triggering_rule,
|
||||
span,
|
||||
} => ParseError {
|
||||
message: format!(
|
||||
"the `{}` diagnostic filter is not yet supported",
|
||||
triggering_rule.to_ident()
|
||||
),
|
||||
labels: vec![(span, "".into())],
|
||||
notes: vec![format!(
|
||||
concat!(
|
||||
"Let Naga maintainers know that you ran into this at ",
|
||||
"<https://github.com/gfx-rs/wgpu/issues/{}>, ",
|
||||
"so they can prioritize it!"
|
||||
),
|
||||
triggering_rule.tracking_issue_num()
|
||||
)],
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,14 @@ pub(crate) mod language_extension;
|
||||
|
||||
/// A parsed sentinel word indicating the type of directive to be parsed next.
|
||||
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)]
|
||||
#[cfg_attr(test, derive(strum::EnumIter))]
|
||||
pub(crate) enum DirectiveKind {
|
||||
/// A [`crate::diagnostic_filter`].
|
||||
Diagnostic,
|
||||
/// An [`enable_extension`].
|
||||
Enable,
|
||||
/// A [`language_extension`].
|
||||
Requires,
|
||||
Unimplemented(UnimplementedDirectiveKind),
|
||||
}
|
||||
|
||||
impl DirectiveKind {
|
||||
@ -23,44 +25,25 @@ impl DirectiveKind {
|
||||
/// Convert from a sentinel word in WGSL into its associated [`DirectiveKind`], if possible.
|
||||
pub fn from_ident(s: &str) -> Option<Self> {
|
||||
Some(match s {
|
||||
Self::DIAGNOSTIC => Self::Unimplemented(UnimplementedDirectiveKind::Diagnostic),
|
||||
Self::DIAGNOSTIC => Self::Diagnostic,
|
||||
Self::ENABLE => Self::Enable,
|
||||
Self::REQUIRES => Self::Requires,
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
|
||||
/// Maps this [`DirectiveKind`] into the sentinel word associated with it in WGSL.
|
||||
pub const fn to_ident(self) -> &'static str {
|
||||
match self {
|
||||
Self::Enable => Self::ENABLE,
|
||||
Self::Requires => Self::REQUIRES,
|
||||
Self::Unimplemented(kind) => match kind {
|
||||
UnimplementedDirectiveKind::Diagnostic => Self::DIAGNOSTIC,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn iter() -> impl Iterator<Item = Self> {
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
UnimplementedDirectiveKind::iter().map(Self::Unimplemented)
|
||||
}
|
||||
}
|
||||
|
||||
/// A [`DirectiveKind`] that is not yet implemented. See [`DirectiveKind::Unimplemented`].
|
||||
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)]
|
||||
#[cfg_attr(test, derive(strum::EnumIter))]
|
||||
pub(crate) enum UnimplementedDirectiveKind {
|
||||
Diagnostic,
|
||||
}
|
||||
|
||||
impl UnimplementedDirectiveKind {
|
||||
pub const fn tracking_issue_num(self) -> u16 {
|
||||
match self {
|
||||
Self::Diagnostic => 5320,
|
||||
}
|
||||
impl crate::diagnostic_filter::Severity {
|
||||
#[cfg(feature = "wgsl-in")]
|
||||
pub(crate) fn report_wgsl_parse_diag<'a>(
|
||||
self,
|
||||
err: crate::front::wgsl::error::Error<'a>,
|
||||
source: &str,
|
||||
) -> Result<(), crate::front::wgsl::error::Error<'a>> {
|
||||
self.report_diag(err, |e, level| {
|
||||
let e = e.as_parse_error(source);
|
||||
log::log!(level, "{}", e.emit_to_string(source));
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,32 +53,7 @@ mod test {
|
||||
|
||||
use crate::front::wgsl::assert_parse_err;
|
||||
|
||||
use super::{DirectiveKind, UnimplementedDirectiveKind};
|
||||
|
||||
#[test]
|
||||
fn unimplemented_directives() {
|
||||
for unsupported_shader in UnimplementedDirectiveKind::iter() {
|
||||
let shader;
|
||||
let expected_msg;
|
||||
match unsupported_shader {
|
||||
UnimplementedDirectiveKind::Diagnostic => {
|
||||
shader = "diagnostic(off,derivative_uniformity);";
|
||||
expected_msg = "\
|
||||
error: the `diagnostic` directive is not yet implemented
|
||||
┌─ wgsl:1:1
|
||||
│
|
||||
1 │ diagnostic(off,derivative_uniformity);
|
||||
│ ^^^^^^^^^^ this global directive is standard, but not yet implemented
|
||||
│
|
||||
= note: Let Naga maintainers know that you ran into this at <https://github.com/gfx-rs/wgpu/issues/5320>, so they can prioritize it!
|
||||
|
||||
";
|
||||
}
|
||||
};
|
||||
|
||||
assert_parse_err(shader, expected_msg);
|
||||
}
|
||||
}
|
||||
use super::DirectiveKind;
|
||||
|
||||
#[test]
|
||||
fn directive_after_global_decl() {
|
||||
@ -103,7 +61,7 @@ error: the `diagnostic` directive is not yet implemented
|
||||
let directive;
|
||||
let expected_msg;
|
||||
match unsupported_shader {
|
||||
DirectiveKind::Unimplemented(UnimplementedDirectiveKind::Diagnostic) => {
|
||||
DirectiveKind::Diagnostic => {
|
||||
directive = "diagnostic(off,derivative_uniformity)";
|
||||
expected_msg = "\
|
||||
error: expected global declaration, but found a global directive
|
||||
|
@ -1,3 +1,4 @@
|
||||
use crate::diagnostic_filter::{self, DiagnosticFilter, FilterableTriggeringRule};
|
||||
use crate::front::wgsl::error::{Error, ExpectedToken};
|
||||
use crate::front::wgsl::parse::directive::enable_extension::{
|
||||
EnableExtension, EnableExtensions, UnimplementedEnableExtension,
|
||||
@ -2528,11 +2529,22 @@ impl Parser {
|
||||
let mut enable_extensions = EnableExtensions::empty();
|
||||
|
||||
// Parse directives.
|
||||
while let Ok((ident, span)) = lexer.peek_ident_with_span() {
|
||||
while let Ok((ident, _directive_ident_span)) = lexer.peek_ident_with_span() {
|
||||
if let Some(kind) = DirectiveKind::from_ident(ident) {
|
||||
self.push_rule_span(Rule::Directive, &mut lexer);
|
||||
let _ = lexer.next_ident_with_span().unwrap();
|
||||
match kind {
|
||||
DirectiveKind::Diagnostic => {
|
||||
if let Some(diagnostic_filter) = self.diagnostic_filter(&mut lexer)? {
|
||||
let triggering_rule = diagnostic_filter.triggering_rule;
|
||||
let span = self.peek_rule_span(&lexer);
|
||||
Err(Error::DiagnosticNotYetImplemented {
|
||||
triggering_rule,
|
||||
span,
|
||||
})?;
|
||||
}
|
||||
lexer.expect(Token::Separator(';'))?;
|
||||
}
|
||||
DirectiveKind::Enable => {
|
||||
self.directive_ident_list(&mut lexer, |ident, span| {
|
||||
let kind = EnableExtension::from_ident(ident, span)?;
|
||||
@ -2566,9 +2578,6 @@ impl Parser {
|
||||
}
|
||||
})?;
|
||||
}
|
||||
DirectiveKind::Unimplemented(kind) => {
|
||||
return Err(Error::DirectiveNotYetImplemented { kind, span })
|
||||
}
|
||||
}
|
||||
self.pop_rule_span(&lexer);
|
||||
} else {
|
||||
@ -2618,4 +2627,55 @@ impl Parser {
|
||||
}
|
||||
Ok(brace_nesting_level + 1)
|
||||
}
|
||||
|
||||
fn diagnostic_filter<'a>(
|
||||
&self,
|
||||
lexer: &mut Lexer<'a>,
|
||||
) -> Result<Option<DiagnosticFilter>, Error<'a>> {
|
||||
lexer.expect(Token::Paren('('))?;
|
||||
|
||||
let (severity_control_name, severity_control_name_span) = lexer.next_ident_with_span()?;
|
||||
let new_severity = diagnostic_filter::Severity::from_ident(severity_control_name).ok_or(
|
||||
Error::DiagnosticInvalidSeverity {
|
||||
severity_control_name_span,
|
||||
},
|
||||
)?;
|
||||
|
||||
lexer.expect(Token::Separator(','))?;
|
||||
|
||||
let (diagnostic_name_token, diagnostic_name_token_span) = lexer.next_ident_with_span()?;
|
||||
let diagnostic_rule_name = if lexer.skip(Token::Separator('.')) {
|
||||
// Don't try to validate these name tokens on two tokens, which is conventionally used
|
||||
// for third-party tooling.
|
||||
lexer.next_ident_with_span()?;
|
||||
None
|
||||
} else {
|
||||
Some(diagnostic_name_token)
|
||||
};
|
||||
let diagnostic_rule_name_span = diagnostic_name_token_span;
|
||||
|
||||
let filter = diagnostic_rule_name
|
||||
.and_then(|name| {
|
||||
FilterableTriggeringRule::from_ident(name)
|
||||
.map(Ok)
|
||||
.or_else(|| {
|
||||
diagnostic_filter::Severity::Warning
|
||||
.report_wgsl_parse_diag(
|
||||
Error::UnknownDiagnosticRuleName(diagnostic_rule_name_span),
|
||||
lexer.source,
|
||||
)
|
||||
.err()
|
||||
.map(Err)
|
||||
})
|
||||
})
|
||||
.transpose()?
|
||||
.map(|triggering_rule| DiagnosticFilter {
|
||||
new_severity,
|
||||
triggering_rule,
|
||||
});
|
||||
lexer.skip(Token::Separator(','));
|
||||
lexer.expect(Token::Paren(')'))?;
|
||||
|
||||
Ok(filter)
|
||||
}
|
||||
}
|
||||
|
@ -255,6 +255,7 @@ pub mod back;
|
||||
mod block;
|
||||
#[cfg(feature = "compact")]
|
||||
pub mod compact;
|
||||
pub mod diagnostic_filter;
|
||||
pub mod error;
|
||||
pub mod front;
|
||||
pub mod keywords;
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wgpu-core"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
authors = ["gfx-rs developers"]
|
||||
edition = "2021"
|
||||
description = "WebGPU core logic on wgpu-hal"
|
||||
@ -129,17 +129,17 @@ thiserror.workspace = true
|
||||
|
||||
[dependencies.naga]
|
||||
path = "../naga"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
path = "../wgpu-types"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
|
||||
[dependencies.hal]
|
||||
package = "wgpu-hal"
|
||||
path = "../wgpu-hal"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
default-features = false
|
||||
|
||||
[build-dependencies]
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wgpu-hal"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
authors = ["gfx-rs developers"]
|
||||
edition = "2021"
|
||||
description = "WebGPU hardware abstraction layer"
|
||||
@ -133,7 +133,7 @@ glow = { workspace = true, optional = true }
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
path = "../wgpu-types"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
# backend: Vulkan
|
||||
@ -191,7 +191,7 @@ ndk-sys = { workspace = true, optional = true }
|
||||
|
||||
[dependencies.naga]
|
||||
path = "../naga"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
|
||||
[build-dependencies]
|
||||
cfg_aliases.workspace = true
|
||||
@ -199,7 +199,7 @@ cfg_aliases.workspace = true
|
||||
# DEV dependencies
|
||||
[dev-dependencies.naga]
|
||||
path = "../naga"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
features = ["wgsl-in"]
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -305,24 +305,28 @@ pub type AtomicFenceValue = std::sync::atomic::AtomicU64;
|
||||
|
||||
/// A callback to signal that wgpu is no longer using a resource.
|
||||
#[cfg(any(gles, vulkan))]
|
||||
pub type DropCallback = Box<dyn FnMut() + Send + Sync + 'static>;
|
||||
pub type DropCallback = Box<dyn FnOnce() + Send + Sync + 'static>;
|
||||
|
||||
#[cfg(any(gles, vulkan))]
|
||||
pub struct DropGuard {
|
||||
callback: DropCallback,
|
||||
callback: Option<DropCallback>,
|
||||
}
|
||||
|
||||
#[cfg(all(any(gles, vulkan), any(native, Emscripten)))]
|
||||
impl DropGuard {
|
||||
fn from_option(callback: Option<DropCallback>) -> Option<Self> {
|
||||
callback.map(|callback| Self { callback })
|
||||
callback.map(|callback| Self {
|
||||
callback: Some(callback),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(gles, vulkan))]
|
||||
impl Drop for DropGuard {
|
||||
fn drop(&mut self) {
|
||||
(self.callback)();
|
||||
if let Some(cb) = self.callback.take() {
|
||||
(cb)();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -997,6 +997,11 @@ impl PhysicalDeviceProperties {
|
||||
extensions.push(ext::robustness2::NAME);
|
||||
}
|
||||
|
||||
// Optional `VK_KHR_external_memory_win32`
|
||||
if self.supports_extension(khr::external_memory_win32::NAME) {
|
||||
extensions.push(khr::external_memory_win32::NAME);
|
||||
}
|
||||
|
||||
// Require `VK_KHR_draw_indirect_count` if the associated feature was requested
|
||||
// Even though Vulkan 1.2 has promoted the extension to core, we must require the extension to avoid
|
||||
// large amounts of spaghetti involved with using PhysicalDeviceVulkan12Features.
|
||||
@ -1578,6 +1583,9 @@ impl super::Instance {
|
||||
}),
|
||||
image_format_list: phd_capabilities.device_api_version >= vk::API_VERSION_1_2
|
||||
|| phd_capabilities.supports_extension(khr::image_format_list::NAME),
|
||||
#[cfg(windows)]
|
||||
external_memory_win32: phd_capabilities
|
||||
.supports_extension(khr::external_memory_win32::NAME),
|
||||
};
|
||||
let capabilities = crate::Capabilities {
|
||||
limits: phd_capabilities.to_wgpu_limits(),
|
||||
|
@ -686,6 +686,7 @@ impl super::Device {
|
||||
super::Texture {
|
||||
raw: vk_image,
|
||||
drop_guard,
|
||||
external_memory: None,
|
||||
block: None,
|
||||
usage: desc.usage,
|
||||
format: desc.format,
|
||||
@ -695,6 +696,167 @@ impl super::Device {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn find_memory_type_index(
|
||||
&self,
|
||||
type_bits_req: u32,
|
||||
flags_req: vk::MemoryPropertyFlags,
|
||||
) -> Option<usize> {
|
||||
let mem_properties = unsafe {
|
||||
self.shared
|
||||
.instance
|
||||
.raw
|
||||
.get_physical_device_memory_properties(self.shared.physical_device)
|
||||
};
|
||||
|
||||
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPhysicalDeviceMemoryProperties.html
|
||||
for (i, mem_ty) in mem_properties.memory_types_as_slice().iter().enumerate() {
|
||||
let types_bits = 1 << i;
|
||||
let is_required_memory_type = type_bits_req & types_bits != 0;
|
||||
let has_required_properties = mem_ty.property_flags & flags_req == flags_req;
|
||||
if is_required_memory_type && has_required_properties {
|
||||
return Some(i);
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
fn create_image_without_memory(
|
||||
&self,
|
||||
desc: &crate::TextureDescriptor,
|
||||
external_memory_image_create_info: Option<&mut vk::ExternalMemoryImageCreateInfo>,
|
||||
) -> Result<ImageWithoutMemory, crate::DeviceError> {
|
||||
let copy_size = desc.copy_extent();
|
||||
|
||||
let mut raw_flags = vk::ImageCreateFlags::empty();
|
||||
if desc.is_cube_compatible() {
|
||||
raw_flags |= vk::ImageCreateFlags::CUBE_COMPATIBLE;
|
||||
}
|
||||
|
||||
let original_format = self.shared.private_caps.map_texture_format(desc.format);
|
||||
let mut vk_view_formats = vec![];
|
||||
let mut wgt_view_formats = vec![];
|
||||
if !desc.view_formats.is_empty() {
|
||||
raw_flags |= vk::ImageCreateFlags::MUTABLE_FORMAT;
|
||||
wgt_view_formats.clone_from(&desc.view_formats);
|
||||
wgt_view_formats.push(desc.format);
|
||||
|
||||
if self.shared.private_caps.image_format_list {
|
||||
vk_view_formats = desc
|
||||
.view_formats
|
||||
.iter()
|
||||
.map(|f| self.shared.private_caps.map_texture_format(*f))
|
||||
.collect();
|
||||
vk_view_formats.push(original_format)
|
||||
}
|
||||
}
|
||||
if desc.format.is_multi_planar_format() {
|
||||
raw_flags |= vk::ImageCreateFlags::MUTABLE_FORMAT;
|
||||
}
|
||||
|
||||
let mut vk_info = vk::ImageCreateInfo::default()
|
||||
.flags(raw_flags)
|
||||
.image_type(conv::map_texture_dimension(desc.dimension))
|
||||
.format(original_format)
|
||||
.extent(conv::map_copy_extent(©_size))
|
||||
.mip_levels(desc.mip_level_count)
|
||||
.array_layers(desc.array_layer_count())
|
||||
.samples(vk::SampleCountFlags::from_raw(desc.sample_count))
|
||||
.tiling(vk::ImageTiling::OPTIMAL)
|
||||
.usage(conv::map_texture_usage(desc.usage))
|
||||
.sharing_mode(vk::SharingMode::EXCLUSIVE)
|
||||
.initial_layout(vk::ImageLayout::UNDEFINED);
|
||||
|
||||
let mut format_list_info = vk::ImageFormatListCreateInfo::default();
|
||||
if !vk_view_formats.is_empty() {
|
||||
format_list_info = format_list_info.view_formats(&vk_view_formats);
|
||||
vk_info = vk_info.push_next(&mut format_list_info);
|
||||
}
|
||||
|
||||
if let Some(ext_info) = external_memory_image_create_info {
|
||||
vk_info = vk_info.push_next(ext_info);
|
||||
}
|
||||
|
||||
let raw = unsafe { self.shared.raw.create_image(&vk_info, None) }.map_err(map_err)?;
|
||||
fn map_err(err: vk::Result) -> crate::DeviceError {
|
||||
// We don't use VK_EXT_image_compression_control
|
||||
// VK_ERROR_COMPRESSION_EXHAUSTED_EXT
|
||||
super::map_host_device_oom_and_ioca_err(err)
|
||||
}
|
||||
let req = unsafe { self.shared.raw.get_image_memory_requirements(raw) };
|
||||
|
||||
Ok(ImageWithoutMemory {
|
||||
raw,
|
||||
requirements: req,
|
||||
copy_size,
|
||||
view_formats: wgt_view_formats,
|
||||
raw_flags,
|
||||
})
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// - Vulkan 1.1+ (or VK_KHR_external_memory)
|
||||
/// - The `d3d11_shared_handle` must be valid and respecting `desc`
|
||||
/// - `VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT` flag is used because we need to hold a reference to the handle
|
||||
#[cfg(windows)]
|
||||
pub unsafe fn texture_from_d3d11_shared_handle(
|
||||
&self,
|
||||
d3d11_shared_handle: windows::Win32::Foundation::HANDLE,
|
||||
desc: &crate::TextureDescriptor,
|
||||
) -> Result<super::Texture, crate::DeviceError> {
|
||||
if !self.shared.private_caps.external_memory_win32 {
|
||||
log::error!("VK_KHR_external_memory extension is required");
|
||||
return Err(crate::DeviceError::ResourceCreationFailed);
|
||||
}
|
||||
|
||||
let mut external_memory_image_info = vk::ExternalMemoryImageCreateInfo::default()
|
||||
.handle_types(vk::ExternalMemoryHandleTypeFlags::D3D11_TEXTURE);
|
||||
|
||||
let image =
|
||||
self.create_image_without_memory(desc, Some(&mut external_memory_image_info))?;
|
||||
|
||||
let mut import_memory_info = vk::ImportMemoryWin32HandleInfoKHR::default()
|
||||
.handle_type(vk::ExternalMemoryHandleTypeFlags::D3D11_TEXTURE)
|
||||
.handle(d3d11_shared_handle.0 as _);
|
||||
|
||||
let mem_type_index = self
|
||||
.find_memory_type_index(
|
||||
image.requirements.memory_type_bits,
|
||||
vk::MemoryPropertyFlags::DEVICE_LOCAL,
|
||||
)
|
||||
.ok_or(crate::DeviceError::ResourceCreationFailed)?;
|
||||
|
||||
let memory_allocate_info = vk::MemoryAllocateInfo::default()
|
||||
.allocation_size(image.requirements.size)
|
||||
.memory_type_index(mem_type_index as _)
|
||||
.push_next(&mut import_memory_info);
|
||||
let memory = unsafe { self.shared.raw.allocate_memory(&memory_allocate_info, None) }
|
||||
.map_err(super::map_host_device_oom_err)?;
|
||||
|
||||
unsafe { self.shared.raw.bind_image_memory(image.raw, memory, 0) }
|
||||
.map_err(super::map_host_device_oom_err)?;
|
||||
|
||||
if let Some(label) = desc.label {
|
||||
unsafe { self.shared.set_object_name(image.raw, label) };
|
||||
}
|
||||
|
||||
self.counters.textures.add(1);
|
||||
|
||||
Ok(super::Texture {
|
||||
raw: image.raw,
|
||||
drop_guard: None,
|
||||
external_memory: Some(memory),
|
||||
block: None,
|
||||
usage: desc.usage,
|
||||
format: desc.format,
|
||||
raw_flags: image.raw_flags,
|
||||
copy_size: image.copy_size,
|
||||
view_formats: image.view_formats,
|
||||
})
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// - `vk_buffer`'s memory must be managed by the caller
|
||||
@ -1028,74 +1190,16 @@ impl crate::Device for super::Device {
|
||||
&self,
|
||||
desc: &crate::TextureDescriptor,
|
||||
) -> Result<super::Texture, crate::DeviceError> {
|
||||
let copy_size = desc.copy_extent();
|
||||
|
||||
let mut raw_flags = vk::ImageCreateFlags::empty();
|
||||
if desc.is_cube_compatible() {
|
||||
raw_flags |= vk::ImageCreateFlags::CUBE_COMPATIBLE;
|
||||
}
|
||||
|
||||
let original_format = self.shared.private_caps.map_texture_format(desc.format);
|
||||
let mut vk_view_formats = vec![];
|
||||
let mut wgt_view_formats = vec![];
|
||||
if !desc.view_formats.is_empty() {
|
||||
raw_flags |= vk::ImageCreateFlags::MUTABLE_FORMAT;
|
||||
wgt_view_formats.clone_from(&desc.view_formats);
|
||||
wgt_view_formats.push(desc.format);
|
||||
|
||||
if self.shared.private_caps.image_format_list {
|
||||
vk_view_formats = desc
|
||||
.view_formats
|
||||
.iter()
|
||||
.map(|f| self.shared.private_caps.map_texture_format(*f))
|
||||
.collect();
|
||||
vk_view_formats.push(original_format)
|
||||
}
|
||||
}
|
||||
if desc.format.is_multi_planar_format() {
|
||||
raw_flags |= vk::ImageCreateFlags::MUTABLE_FORMAT;
|
||||
}
|
||||
|
||||
let mut vk_info = vk::ImageCreateInfo::default()
|
||||
.flags(raw_flags)
|
||||
.image_type(conv::map_texture_dimension(desc.dimension))
|
||||
.format(original_format)
|
||||
.extent(conv::map_copy_extent(©_size))
|
||||
.mip_levels(desc.mip_level_count)
|
||||
.array_layers(desc.array_layer_count())
|
||||
.samples(vk::SampleCountFlags::from_raw(desc.sample_count))
|
||||
.tiling(vk::ImageTiling::OPTIMAL)
|
||||
.usage(conv::map_texture_usage(desc.usage))
|
||||
.sharing_mode(vk::SharingMode::EXCLUSIVE)
|
||||
.initial_layout(vk::ImageLayout::UNDEFINED);
|
||||
|
||||
let mut format_list_info = vk::ImageFormatListCreateInfo::default();
|
||||
if !vk_view_formats.is_empty() {
|
||||
format_list_info = format_list_info.view_formats(&vk_view_formats);
|
||||
vk_info = vk_info.push_next(&mut format_list_info);
|
||||
}
|
||||
|
||||
let raw = unsafe {
|
||||
self.shared
|
||||
.raw
|
||||
.create_image(&vk_info, None)
|
||||
.map_err(map_err)?
|
||||
};
|
||||
fn map_err(err: vk::Result) -> crate::DeviceError {
|
||||
// We don't use VK_EXT_image_compression_control
|
||||
// VK_ERROR_COMPRESSION_EXHAUSTED_EXT
|
||||
super::map_host_device_oom_and_ioca_err(err)
|
||||
}
|
||||
let req = unsafe { self.shared.raw.get_image_memory_requirements(raw) };
|
||||
let image = self.create_image_without_memory(desc, None)?;
|
||||
|
||||
let block = unsafe {
|
||||
self.mem_allocator.lock().alloc(
|
||||
&*self.shared,
|
||||
gpu_alloc::Request {
|
||||
size: req.size,
|
||||
align_mask: req.alignment - 1,
|
||||
size: image.requirements.size,
|
||||
align_mask: image.requirements.alignment - 1,
|
||||
usage: gpu_alloc::UsageFlags::FAST_DEVICE_ACCESS,
|
||||
memory_types: req.memory_type_bits & self.valid_ash_memory_types,
|
||||
memory_types: image.requirements.memory_type_bits & self.valid_ash_memory_types,
|
||||
},
|
||||
)?
|
||||
};
|
||||
@ -1105,31 +1209,35 @@ impl crate::Device for super::Device {
|
||||
unsafe {
|
||||
self.shared
|
||||
.raw
|
||||
.bind_image_memory(raw, *block.memory(), block.offset())
|
||||
.bind_image_memory(image.raw, *block.memory(), block.offset())
|
||||
.map_err(super::map_host_device_oom_err)?
|
||||
};
|
||||
|
||||
if let Some(label) = desc.label {
|
||||
unsafe { self.shared.set_object_name(raw, label) };
|
||||
unsafe { self.shared.set_object_name(image.raw, label) };
|
||||
}
|
||||
|
||||
self.counters.textures.add(1);
|
||||
|
||||
Ok(super::Texture {
|
||||
raw,
|
||||
raw: image.raw,
|
||||
drop_guard: None,
|
||||
external_memory: None,
|
||||
block: Some(block),
|
||||
usage: desc.usage,
|
||||
format: desc.format,
|
||||
raw_flags,
|
||||
copy_size,
|
||||
view_formats: wgt_view_formats,
|
||||
raw_flags: image.raw_flags,
|
||||
copy_size: image.copy_size,
|
||||
view_formats: image.view_formats,
|
||||
})
|
||||
}
|
||||
unsafe fn destroy_texture(&self, texture: super::Texture) {
|
||||
if texture.drop_guard.is_none() {
|
||||
unsafe { self.shared.raw.destroy_image(texture.raw, None) };
|
||||
}
|
||||
if let Some(memory) = texture.external_memory {
|
||||
unsafe { self.shared.raw.free_memory(memory, None) };
|
||||
}
|
||||
if let Some(block) = texture.block {
|
||||
self.counters.texture_memory.sub(block.size() as isize);
|
||||
|
||||
@ -2584,3 +2692,11 @@ impl From<gpu_descriptor::AllocationError> for crate::DeviceError {
|
||||
fn handle_unexpected(err: vk::Result) -> ! {
|
||||
panic!("Unexpected Vulkan error: `{err}`")
|
||||
}
|
||||
|
||||
struct ImageWithoutMemory {
|
||||
raw: vk::Image,
|
||||
requirements: vk::MemoryRequirements,
|
||||
copy_size: crate::CopyExtent,
|
||||
view_formats: Vec<wgt::TextureFormat>,
|
||||
raw_flags: vk::ImageCreateFlags,
|
||||
}
|
||||
|
@ -1095,6 +1095,7 @@ impl crate::Surface for super::Surface {
|
||||
raw: swapchain.images[index as usize],
|
||||
drop_guard: None,
|
||||
block: None,
|
||||
external_memory: None,
|
||||
usage: swapchain.config.usage,
|
||||
format: swapchain.config.format,
|
||||
raw_flags,
|
||||
|
@ -532,6 +532,8 @@ struct PrivateCapabilities {
|
||||
robust_image_access2: bool,
|
||||
zero_initialize_workgroup_memory: bool,
|
||||
image_format_list: bool,
|
||||
#[cfg(windows)]
|
||||
external_memory_win32: bool,
|
||||
}
|
||||
|
||||
bitflags::bitflags!(
|
||||
@ -760,6 +762,7 @@ impl crate::DynAccelerationStructure for AccelerationStructure {}
|
||||
pub struct Texture {
|
||||
raw: vk::Image,
|
||||
drop_guard: Option<crate::DropGuard>,
|
||||
external_memory: Option<vk::DeviceMemory>,
|
||||
block: Option<gpu_alloc::MemoryBlock<vk::DeviceMemory>>,
|
||||
usage: crate::TextureUses,
|
||||
format: wgt::TextureFormat,
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wgpu-types"
|
||||
version = "22.0.0"
|
||||
version = "23.0.0"
|
||||
authors = ["gfx-rs developers"]
|
||||
edition = "2021"
|
||||
description = "WebGPU types"
|
||||
|
Loading…
Reference in New Issue
Block a user