Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ray tracing updated #6

Closed
wants to merge 145 commits into from
Closed

Conversation

Vecvec
Copy link

@Vecvec Vecvec commented Sep 14, 2024

Connections
gfx-rs#3631

Description
Another update to trunk, Note: due to ObjectID being removed this implements a new type called BlasShared that is wrapped in an arc, and the blas becomes invalid after that is dropped instead. TlasInstance now holds an arc to this also. This also means that Tlaspackages that build after a blas is dropped work. This is designed as easy to be removed once gfx-rs#5121 is finished, but feel free to suggest a different idea.

Testing
ran ray scene, ray traced (fragment + compute).

Checklist

  • Run cargo fmt.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file. N/a

codefionn and others added 30 commits August 14, 2024 23:16
* windows-rs 0.58

* Clean up suspicious committed allocation workaround

* dx12: Flatten suballocation module
…updates (gfx-rs#6135)

Bumps the patch-updates group with 20 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [arrayvec](https://github.com/bluss/arrayvec) | `0.7.4` | `0.7.6` |
| [bytemuck](https://github.com/Lokathor/bytemuck) | `1.16.3` | `1.17.0` |
| [indexmap](https://github.com/indexmap-rs/indexmap) | `2.3.0` | `2.4.0` |
| [libc](https://github.com/rust-lang/libc) | `0.2.155` | `0.2.158` |
| [serde](https://github.com/serde-rs/serde) | `1.0.206` | `1.0.208` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.124` | `1.0.125` |
| [js-sys](https://github.com/rustwasm/wasm-bindgen) | `0.3.69` | `0.3.70` |
| [wasm-bindgen-futures](https://github.com/rustwasm/wasm-bindgen) | `0.4.42` | `0.4.43` |
| [wasm-bindgen-test](https://github.com/rustwasm/wasm-bindgen) | `0.3.42` | `0.3.43` |
| [web-sys](https://github.com/rustwasm/wasm-bindgen) | `0.3.69` | `0.3.70` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.39.2` | `1.39.3` |
| [unicode-xid](https://github.com/unicode-rs/unicode-xid) | `0.2.4` | `0.2.5` |
| [syn](https://github.com/dtolnay/syn) | `2.0.74` | `2.0.75` |
| [bytemuck_derive](https://github.com/Lokathor/bytemuck) | `1.7.0` | `1.7.1` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.1.10` | `1.1.13` |
| [clap](https://github.com/clap-rs/clap) | `4.5.15` | `4.5.16` |
| [cmake](https://github.com/rust-lang/cmake-rs) | `0.1.50` | `0.1.51` |
| [flate2](https://github.com/rust-lang/flate2-rs) | `1.0.31` | `1.0.32` |
| [is-terminal](https://github.com/sunfishcode/is-terminal) | `0.4.12` | `0.4.13` |
| [xcursor](https://github.com/esposm03/xcursor-rs) | `0.3.7` | `0.3.8` |



Updates `arrayvec` from 0.7.4 to 0.7.6
- [Release notes](https://github.com/bluss/arrayvec/releases)
- [Changelog](https://github.com/bluss/arrayvec/blob/master/CHANGELOG.md)
- [Commits](bluss/arrayvec@0.7.4...0.7.6)

Updates `bytemuck` from 1.16.3 to 1.17.0
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](Lokathor/bytemuck@v1.16.3...v1.17.0)

Updates `indexmap` from 2.3.0 to 2.4.0
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md)
- [Commits](indexmap-rs/indexmap@2.3.0...2.4.0)

Updates `libc` from 0.2.155 to 0.2.158
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.158/CHANGELOG.md)
- [Commits](rust-lang/libc@0.2.155...0.2.158)

Updates `serde` from 1.0.206 to 1.0.208
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.206...v1.0.208)

Updates `serde_json` from 1.0.124 to 1.0.125
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](serde-rs/json@v1.0.124...1.0.125)

Updates `js-sys` from 0.3.69 to 0.3.70
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

Updates `wasm-bindgen` from 0.2.92 to 0.2.93
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](rustwasm/wasm-bindgen@0.2.92...0.2.93)

Updates `wasm-bindgen-futures` from 0.4.42 to 0.4.43
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

Updates `wasm-bindgen-test` from 0.3.42 to 0.3.43
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

Updates `web-sys` from 0.3.69 to 0.3.70
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

Updates `tokio` from 1.39.2 to 1.39.3
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](tokio-rs/tokio@tokio-1.39.2...tokio-1.39.3)

Updates `unicode-xid` from 0.2.4 to 0.2.5
- [Commits](unicode-rs/unicode-xid@v0.2.4...v0.2.5)

Updates `syn` from 2.0.74 to 2.0.75
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](dtolnay/syn@2.0.74...2.0.75)

Updates `bytemuck_derive` from 1.7.0 to 1.7.1
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](Lokathor/bytemuck@bytemuck_derive-v1.7.0...bytemuck_derive-v1.7.1)

Updates `cc` from 1.1.10 to 1.1.13
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](rust-lang/cc-rs@cc-v1.1.10...cc-v1.1.13)

Updates `clap` from 4.5.15 to 4.5.16
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](clap-rs/clap@clap_complete-v4.5.15...clap_complete-v4.5.16)

Updates `cmake` from 0.1.50 to 0.1.51
- [Release notes](https://github.com/rust-lang/cmake-rs/releases)
- [Changelog](https://github.com/rust-lang/cmake-rs/blob/master/CHANGELOG.md)
- [Commits](rust-lang/cmake-rs@0.1.50...v0.1.51)

Updates `flate2` from 1.0.31 to 1.0.32
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Changelog](https://github.com/rust-lang/flate2-rs/blob/main/CHANGELOG.md)
- [Commits](rust-lang/flate2-rs@1.0.31...1.0.32)

Updates `is-terminal` from 0.4.12 to 0.4.13
- [Commits](sunfishcode/is-terminal@v0.4.12...v0.4.13)

Updates `serde_derive` from 1.0.206 to 1.0.208
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.206...v1.0.208)

Updates `wasm-bindgen-backend` from 0.2.92 to 0.2.93
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](rustwasm/wasm-bindgen@0.2.92...0.2.93)

Updates `wasm-bindgen-macro` from 0.2.92 to 0.2.93
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](rustwasm/wasm-bindgen@0.2.92...0.2.93)

Updates `wasm-bindgen-macro-support` from 0.2.92 to 0.2.93
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](rustwasm/wasm-bindgen@0.2.92...0.2.93)

Updates `wasm-bindgen-shared` from 0.2.92 to 0.2.93
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](rustwasm/wasm-bindgen@0.2.92...0.2.93)

Updates `wasm-bindgen-test-macro` from 0.3.42 to 0.3.43
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

Updates `xcursor` from 0.3.7 to 0.3.8
- [Commits](https://github.com/esposm03/xcursor-rs/commits)

---
updated-dependencies:
- dependency-name: arrayvec
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: bytemuck
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: js-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-test
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: web-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: unicode-xid
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: bytemuck_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: cc
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: clap
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: cmake
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: flate2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: is-terminal
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-backend
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-macro
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-macro-support
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-shared
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-test-macro
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: xcursor
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…fx-rs#5668)

* Add `HTMLImageElement` as external source for copying images

* Typo
* Make `wgpu_test::valid` print errors it detects.

When a block passed to `wgpu_test::valid` actually raises validation
errors, include the full error in the panic message.

---------

Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
…n Rust 1.80

`std::mem::{size,align}_of{,_val}` was added to `std::prelude` in Rust
1.80; see
[`rust`#123168](rust-lang/rust#123168).
However, we don't have an MSRV at 1.80 or higher yet. So, let's work
around it by importing these items fully. Since neither `clippy` nor
`rustc` lint against shadowed `prelude` items yet (see also a [proposed
`clippy` lint] for such), that lets us remove the explicit `std::mem::*`
imports later at our leisure.

[proposed `clippy` lint]: rust-lang/rust-clippy#8439
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.23.6 to 1.24.1.
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](crate-ci/typos@v1.23.6...v1.24.1)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Remove `wgpu`'s `.global_id()` getters.

Implement `PartialEq`, `Eq`, `Hash`, `PartialOrd` and `Ord` for wgpu resources.
…gfx-rs#6149)

* Expose the raw swapchain from a vulkan `Surface`

* Allow setting the present timing information on hal Vulkan

* Fix clippy without the feature enabled

* CHANGELOG

* Revert inadvertently formatted Cargo.toml

* Move display timing to a feature

* Update the changelog

* Whitespace and doc wording tweaks

* Apply suggestions from code review

Co-authored-by: Marijn Suijten <marijns95@gmail.com>

* Revert inadvertent formatting changes again

* Remove unused qualification

Co-authored-by: Marijn Suijten <marijns95@gmail.com>

* Address review feedback

* Fix flow of sentence and follow intra-doc-link

* Add more docs to `set_next_present_time`, and rename

* Also rename `next_present_times`

* Apply suggestions from code review

Co-authored-by: Marijn Suijten <marijns95@gmail.com>

---------

Co-authored-by: Marijn Suijten <marijns95@gmail.com>
teoxoy and others added 28 commits September 10, 2024 11:58
…buffers

We now only rely on the presence of the inner `CommandBufferMutable` to determine if command buffers are invalid.
… textures (gfx-rs#6249)

Co-authored-by: Adam Winiarczuk <tsu@liv.tv>
…cing-updated

# Conflicts:
#	wgpu-core/src/binding_model.rs
#	wgpu-core/src/command/mod.rs
#	wgpu-core/src/device/global.rs
#	wgpu-core/src/device/queue.rs
#	wgpu-core/src/hub.rs
…is the only compiled backend (gfx-rs#6197)

* Properly handle the case where `Navigator.gpu` is undefined and WebGPU is the only compiled backend.

Previously, `Instance::request_adapter` would invoke a wasm binding with an undefined arg0,
thus crashing the program. Now it will cleanly return `None` instead.

Fixes gfx-rs#6196.

* Fix typo in `Instance::new` doc comment.
* Add note to CHANGELOG.md
* Introduce `DefinedNonNullJsValue` type.
* Assert definedness of self.gpu in surface_get_capabilities.
* Use DefinedNonNullJsValue in signature of get_browser_gpu_property().
* Clarify meaning of gpu field with a comment.
* Document default pipeline layout behavior.

Fixes gfx-rs#6254.

* Fix typo

* Apply suggestions from code review

Co-authored-by: Andreas Reich <r_andreas2@web.de>

* Remove text about panics in get_bind_group_layout.

We shouldn't advertise the behavior until it is consistent between
webgpu and wgpu-core.

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
* add parsing for spirv::Op::AtomicLoad and spirv::Op::AtomicStore

* spv-in parse AtomicExchange and AtomicCompareExchange

* add atomic i decrement

* bookend atomic store statement with emmitter.finish/emitter.start to suppress a double load expression

bookend atomic result expressions with emitter.finish/start to prevent double defs

* add atomic iadd, isub, smin, umin, smax, umax, and, or, xor

* parse atomic flag test and set, parse atomic flag clear

* remove atomic compare exchange work

* changelog

* moved spirv tests into front/spv/mod.rs

* feature gate atomic spv tests because they require wgsl-[in,out]

* BlockContext::get_contained_global_variable returns Result

* Generate spans covering the entire instruction.

Granted, there is pre-existing code in the SPIR-V front end that gets
this wrong, but:

It doesn't make sense to read `self.data_offset`, and then immediately
pass that to `self.span_from_with_op`. The point of that function is
to make the span cover the entire instruction, operands included.

* Move `From` implementation into spv front end

* doc comments, minor cleanups

* remove parsing of OpAtomicFlagClear and OpAtomicFlagTestAndSet

* sync atomic spvasm files

---------

Co-authored-by: Jim Blandy <jimb@red-bean.com>
wgpu-hal does not compile with parking_lot versions that don't contain const Mutex::new.
…updates (gfx-rs#6293)

Bumps the patch-updates group with 11 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.87` | `1.0.89` |
| [glow](https://github.com/grovesNL/glow) | `0.14.0` | `0.14.1` |
| [arrayref](https://github.com/droundy/arrayref) | `0.3.8` | `0.3.9` |
| [bytes](https://github.com/tokio-rs/bytes) | `1.7.1` | `1.7.2` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.1.18` | `1.1.21` |
| [memmap2](https://github.com/RazrFalcon/memmap2-rs) | `0.9.4` | `0.9.5` |
| [rustix](https://github.com/bytecodealliance/rustix) | `0.38.36` | `0.38.37` |
| [toml_edit](https://github.com/toml-rs/toml) | `0.22.20` | `0.22.21` |
| [unicode-ident](https://github.com/dtolnay/unicode-ident) | `1.0.12` | `1.0.13` |
| [unicode-normalization](https://github.com/unicode-rs/unicode-normalization) | `0.1.23` | `0.1.24` |
| [unicode-segmentation](https://github.com/unicode-rs/unicode-segmentation) | `1.11.0` | `1.12.0` |



Updates `anyhow` from 1.0.87 to 1.0.89
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](dtolnay/anyhow@1.0.87...1.0.89)

Updates `glow` from 0.14.0 to 0.14.1
- [Commits](https://github.com/grovesNL/glow/commits)

Updates `arrayref` from 0.3.8 to 0.3.9
- [Commits](https://github.com/droundy/arrayref/commits)

Updates `bytes` from 1.7.1 to 1.7.2
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](tokio-rs/bytes@v1.7.1...v1.7.2)

Updates `cc` from 1.1.18 to 1.1.21
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](rust-lang/cc-rs@cc-v1.1.18...cc-v1.1.21)

Updates `memmap2` from 0.9.4 to 0.9.5
- [Changelog](https://github.com/RazrFalcon/memmap2-rs/blob/master/CHANGELOG.md)
- [Commits](RazrFalcon/memmap2-rs@v0.9.4...v0.9.5)

Updates `rustix` from 0.38.36 to 0.38.37
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Changelog](https://github.com/bytecodealliance/rustix/blob/main/CHANGELOG.md)
- [Commits](bytecodealliance/rustix@v0.38.36...v0.38.37)

Updates `toml_edit` from 0.22.20 to 0.22.21
- [Commits](toml-rs/toml@v0.22.20...v0.22.21)

Updates `unicode-ident` from 1.0.12 to 1.0.13
- [Release notes](https://github.com/dtolnay/unicode-ident/releases)
- [Commits](dtolnay/unicode-ident@1.0.12...1.0.13)

Updates `unicode-normalization` from 0.1.23 to 0.1.24
- [Commits](unicode-rs/unicode-normalization@v0.1.23...v0.1.24)

Updates `unicode-segmentation` from 1.11.0 to 1.12.0
- [Commits](unicode-rs/unicode-segmentation@v1.11.0...v1.12.0)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: glow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: arrayref
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: bytes
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: cc
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: memmap2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: rustix
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: toml_edit
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: unicode-ident
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: unicode-normalization
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: unicode-segmentation
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
See the comments in the code for details.

This patch emits the definition of the macro only when the first loop
is encountered. This does make that first loop's code look a bit odd:
it would be more natural to define the macro at the top of the
file. (See the modified files in `naga/tests/out/msl`.)

Rejected alternatives:

- We could emit the macro definition unconditionally at the top of the
  file. But this changes every MSL snapshot output file, whereas only
  eight of them actually contain loops.

- We could have the validator flag modules that contain loops. But the
  changes end up being not small, and spread across the validator, so
  this seems disproportionate. If we had other consumers of this
  information, it might make sense.

- We could change the MSL backend to allow text to be generated out of
  order, so that we can decide whether to define the macro after we've
  generated all the function bodies. But at the moment this seems like
  unnecessary complexity, although it might be worth doing in the
  future if we had additional uses for it - say, to conditionally emit
  helper function definitions.

Fixes gfx-rs#4972.
@Vecvec
Copy link
Author

Vecvec commented Sep 20, 2024

Now we have a new PR, so this is not necessary.

@Vecvec Vecvec closed this Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.