This commit was authored by running the following Nushell script, using
the `nu` binary and the lovely `fastmod` tool:
```nushell
# Copy-pasted from the OP in [`gpuweb`#4838](https://github.com/gpuweb/gpuweb/pull/4838).
let renames_table = '
Type Old New Used in
dict GPUImageDataLayout GPUTexelCopyBufferLayout "writeTexture,
parent type of ↙"
dict GPUImageCopyBuffer "GPUTexelCopyBufferInfo
extends ↑" T2B, B2T
dict GPUImageCopyTexture GPUTexelCopyTextureInfo T2B, B2T, T2T, writeTexture
dict GPUImageCopyTextureTagged "GPUCopyExternalImageDestInfo
extends ↑" copyExternalImageToTexture
dict GPUImageCopyExternalImage GPUCopyExternalImageSourceInfo copyExternalImageToTexture
union GPUImageCopyExternalImageSource GPUCopyExternalImageSource member of ↖
'
let renames_table = $renames_table
| from tsv
| select 'Old ' 'New '
| rename old new
| update new { $in | lines | get 0 } # only the first line has the renamed symbol identifier
| update old { strip_gpu_prefix | str trim }
| update new { strip_gpu_prefix | str trim }
| sort-by old | reverse # Replace most specific symbol names first (some have the same "word segments" but with fewer segments)
def strip_gpu_prefix []: string -> string {
$in | str replace --regex '^GPU' ''
}
# Rename image APIs.
for entry in $renames_table {
fastmod --accept-all --fixed-strings $entry.old $entry.new --iglob '!CHANGELOG.md' --iglob "!xtask/src/vendor_web_sys.rs" --iglob '!wgpu/src/backend/webgpu/webgpu_sys/' --iglob '!deno_webgpu/' --iglob '!wgpu/src/backend/webgpu.rs'
}
cargo fmt
```
…and cleaning up `deno_webgpu/`'s Rust compilation errors.
* fix more compile errors
* fix err
* fix all compile errors
* fix clippy errors
* fix issues in ray-traced-triangle example
* fix clippy warnings
* fix wasm not compiling
* fix test
* fix clippy (again)
* fix some rustfmt issues
* fix more rustfmt issues
* fix even more rustfmt issues
* fix yet more rustfmt issues
* add #[allow(dead_code)] to some structs to fix clippy on web assembly
* more format fixes
* even more format fixes
* close to final format fixes
* final format fixes (hopefully)
* actual final format fixes (hopefully)
* move ray_cube_cube example and fix bugs
* move other examples
* fix crash when dropping
* fix test
* apply clippy and rustfmt changes
* fix some memory leaks
* fix incompatibility with new wgpu trunk changes
* fix clippy & fmt
* fix clippy errors on github
* update to trunk
* remove a line that printed log "Created blas ..." in device create tlas
* fix merge issues
* fix merge
* fix fmt
* restored example ray scene functionality
* WIP fix rebase
* Fix compile issues
* More fixes
* Fix rebase
* Add wgls backend write_value_type AccelerationStructure
* Add back xtask Cargo.lock
* Revert serde path
* Doc typos
* Add -diff
* Revert more serde
* Revert serde again?
* Fix doc typo
* add test
* clippy & fmt
* fix error "blas does not exist"
* fix various things
* fix unused acceleration structures causing invalid SPIR-V
* fix merge
* fix use after free in a different way (now moved tlas instances to wgpu_core)
* refactor & fmt
* remove accidentally created file
* remove accidentally created file (actually)
* merge & fix
* Fix problems
* fix validation error
* fix validation
* fix merge
* fmt
* fix merge
* use staging buffer trackers in creating the ray-tracing staging buffers (not the tlas_s)
* change one missed staging buffer's tracker
* wip: example
* finished shadow!
* fix merge
* clippy
* remove some uses of blas ids
* fmt
* fix merge
* deduplicate code shared between command_encoder_build_acceleration_structures and command_encoder_build_acceleration_structures_unsafe_tlas
* clippy
* fix merge
* fix warnings
* clippy & fmt
* re-add matching to get_raw_tlas_instance_size and tlas_instance_into_bytes
* fmt
* fix command
* wip: fix merge
* fix merge
* fmt & docs
* fix wasm clippy
* fix issues with tests
* fix issues with tests
* fmt & clippy (wasm)
* wip ray-traced-triangle (non hal)
* unify camera location in ray_shadows
* fix tests
* add readme to ray_traced_triangle
* note that vertex format must be f32x3 (not yet validated)
* changelog
* require VertexFormat::Float32x3
* fix compile error
* when creating and building acceleration structures require Features::RAY_TRACING_ACCELERATION_STRUCTURE is enabled
* remove duplicate workaround
* fix most feedback
* remove all changes from .gitattributes
* fix compile error in test
* more changes along same lines
* format
* apply feedback to more places
* fix `cargo clippy` not just `cargo clippy --all-features`
* cache max instances from tlas creation
* fix clippy
* fix examples
* fix tests
* remove now useless docs
* add more docs
* yet more docs
* still more docs
* Documentation.
* Running out of unique commit messages to say writing docs.
* Add more references to docs.
* Get BindGroup in scope
* Remove unintentional changes
* Remove #[allow(dead_code)]
* Remove old comments
* Add device.poll
* make ray_scene start right way up
* fmt
* move scratch buffer to its own module
* actually remove intentional changes (turns out wgt is inconsistent)
* use better names in ray_scene/shader.wgsl
* fmt
* remove more unintentional changes.
* work on ray_tracing use after free
* spelling
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
* grammar
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
* move things into struct (should be all vectors with 3 item types or more)
* remove long-standing locks.
* fmt
* move not using index buffer to test
* impl index & index mut for tlas package
* impl index & index mut for tlas package
* fix errors
* fix test errors
* move everything out of ray_tracing.rs
* more index_mut
* fmt
* fix docs links
* move to separate impl block
* fix older request review
* fmt
* remove missed deref
* fix wasm clippy
* change to suggestions
* fmt
* add a note as to why `command_encoder_build_acceleration_structures_unsafe_tlas` and `command_encoder_build_acceleration_structures` are currently separate
* add a todo to reconsider soon `command_encoder_build_acceleration_structures_unsafe_tlas`
* switch to mat4 in ray-tracing examples
* Combine RT Tests Under Single Submodule
* Add More Raytracing Tests and Re-Organize
* Documentation and Formatting Fixes
* Remove Forced Alignment in wgpu-hal
* work on out_of_order_as_build and add out_of_order_as_build_use
* fmt
* update test label naming
* fix one validation error
* fix clippy & fmt
* add acceleration structure creation tests
* make mis-matched index test use the correct function
* move validation into validate_command_buffer
* fix tests
* add blas and tlas to pending writes to remove (now unneeded) `device.poll()`s
* remove commented out code from examples and properly use the constants in ray_shadow
* add examples to examples\README.md
* rename ray tracing to ray queries in readme
* remove unneeded usage from scratch buffer creation
* use snatchables for raw acceleration structures
* format
* add EXPERIMENTAL_ to features
* fix missed comment
---------
Co-authored-by: Daniel Keitel <daniel.mg.keitel@fau.de>
Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
Co-authored-by: atlas dostal <rodol@rivalrebels.com>
Co-authored-by: vero <email@atlasdostal.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
* [metal]: Create a new layer instead of overwriting the existing one
Overriding the `layer` on `NSView` makes the view "layer-hosting", see
[wantsLayer], which disables drawing functionality on the view like
`drawRect:`/`updateLayer`.
This prevents crates like Winit from providing a robust rendering
callback that integrates well with the rest of the system.
Instead, if the layer is not CAMetalLayer, we create a new sublayer, and
render to that instead.
[wantsLayer]: https://developer.apple.com/documentation/appkit/nsview/1483695-wantslayer?language=objc
* [metal]: Fix double-free when re-using layer
* doc: Document the behavior when mis-configuring width/height of Surface
* [metal]: Use kCAGravityResize for smoother resizing
* [metal] Do not keep the view around that the surface was created from
We do not need to use it, and the layer itself is already retained, so
it won't be de-allocated from under our feet.
* Always set delegate on layers created by Wgpu
* More docs on contentsGravity
This is just an API change for all the "set_bind_group" calls. Calls
that pass a Some() argument should have unchanged behavior. The None
cases are left as TODOs.
* chore: remove `Context` methods detected as dead code
This is detected by `rustc` as of Rust 1.79.0.
* refactor: satisfy `clippy::manual_inspect`
Detected as of Rust 1.81.0.
* refactor: satisfy `clippy::needless_borrows_for_generic_args`
Detected as of Rust 1.81.0.
* refactor: suppress false-positive `dead_code` lint for `SubmissionIndex`
* chore: eliminate `dead_code` when `target_os = "emscripten"`
Currently, we only increment the internal buffer/texture counters when creating them in the regular way (not when creating them from externally built hal objects (create_texture_from_hal/create_buffer_from_hal). However we decrement the counter in all cases, which makes the counters incorrect when these externally created resources are involved.
This commit fixes it by adding hooks (add_raw_buffer and add_raw_texture) in the hal device abstractions to inform when buffer or textures are created externally.