* 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
In `wgpu_hal`:
- Document that `wgpu_hal` guarantees that shaders will not access buffer
contents beyond the bindgroups' bound regions, rounded up to some
adapter-specific alignment. Introduce the term "accessible region" for
the portion of the buffer that shaders can actually get at.
- Document that all bets are off if you disable bounds checks with
`ShaderModuleDescriptor::runtime_checks`.
- Provide this alignment in `wgpu_hal::Alignments`. Update all backends
appropriately.
- In the Vulkan backend, use Naga to inject bounds checks on buffer accesses
unless `robustBufferAccess2` is available; `robustBufferAccess` is not
sufficient. Retrieve `VK_EXT_robustness2`'s properties, as needed to discover
the alignment above.
In `wgpu_core`:
- Use buffer bindings' accessible regions to determine which parts of the buffer
need to be initialized.
In `wgpu_types`:
- Document some of the possible effects of using
`ShaderBoundsChecks::unchecked`.
Fixes#1813.
* [wgpu-hal] Upgrade `glutin` to `0.31`
`glutin 0.30` onwards completely refactored its internals to no longer
be reliant on `winit`, as they (by default) have no direct relation
except needing to perform _some_ operations (platform-specific) at
strategic times in window creation and event loop handling. Most of
that is handled by a new `glutin-winit` introp crate, while the core
`glutin` crate now exclusively focuses on wrapping the various OpenGL
context APIs (CGL, EGL, WGL, ...).
This does result in a little more verbose handling to get the right
`GLDisplay`, `GLConfig`, `GLContext` and `GLSurface`, but gives much
more control and makes all intricacies more explicit. Most of the
code was copied from `glutin 0.31`'s example crate, with the code for
transparency support removed.
Note that the example doesn't at all handle event loop events properly:
resizes and redraws are not listened to, and mobile-specific surface
events (`Resumed` and `Suspended`) are equally ignored.
* [wgpu-hal] Implement proper `Surface` availability semantics in `raw-gles` example
* 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>
…using `cargo +1.79.0 clippy --workspace --all-features --all-targets
--fix`, plus some manual changes to (1) catch some missed cases (not run
on all platforms?) and (2) `--fix` doesn't make things compile again. 😀
Some module doc comments were using `/*! ... */` syntax and had
leading ` *` prefixes on each line. This interferes with the
tracking of `clippy::doc_lazy_continuation`, so switch those over
to `//!` style comment blocks.
This leaves `/*! ... */` blocks alone which didn't prefix each
line.
* Expose gpu allocation configuration options
This commit adds hints to control memory allocations strategies to the configuration options. These hints allow for automatic profiles such as optimizing for performance (the default, makes sense for a game), optimizing for memory usage (typically more useful for a web browser or UI library) and specifying settings manually.
The details of gpu allocation are still in flux. The goal is to switch vulkan and metal to gpu_allocator which is currently used with d3d12. gpu_allocator will also likely receive more configuration options, in particular the ability to start with smaller memory block sizes and progressively grow the block size. So the manual settings already provision for this upcoming option. Another approach could be to wait and add the manual option after the dust settles.
The reason for providing presets and defining values in the backends is that I am convinced that optimal fonigurations should take hardware capabilities into consideration. It's a deep rabbithole, though, so that will be an exercise for later.
* changelog
* Update CHANGELOG.md
Co-authored-by: Andreas Reich <r_andreas2@web.de>
* Add a comment about not entirely knowing what we are doing
---------
Co-authored-by: Andreas Reich <r_andreas2@web.de>
* Allow unconsumed inputs in fragment shaders by removing them from vertex
outputs when generating HLSL.
Fixes https://github.com/gfx-rs/wgpu/issues/3748
* Add naga:🔙:hlsl::FragmentEntryPoint for providing information
about the fragment entry point when generating vertex entry points via
naga:🔙:hlsl::Writer::write. Vertex outputs not consumed by the
fragment entry point are omitted in the final output struct.
* Add naga snapshot test for this new feature,
* Remove Features::SHADER_UNUSED_VERTEX_OUTPUT,
StageError::InputNotConsumed, and associated validation logic.
* Make wgpu dx12 backend pass fragment shader info when generating
vertex HLSL.
* Add wgpu regression test for allowing unconsumed inputs.
* Address review
* Add note that nesting structs for the inter-stage interface can't
happen.
* Remove new TODO notes (some addressed and some transferred to an issue
https://github.com/gfx-rs/wgpu/issues/5577)
* Changed issue that regression test refers to 3748 -> 5553
* Add debug_assert that binding.is_some() in hlsl writer
* Fix typos caught in CI
Also, fix compiling snapshot test when hlsl-out feature is not enabled.
* Add an optional system for counting and reporting internal resources and events
* Count API objects in wgpu-hal
* Expose internal counters in wgpu-core and wgpu.
Add the following flags to `wgpu_types::Features`:
- `SHADER_INT64_ATOMIC_ALL_OPS` enables all atomic operations on `atomic<i64>` and
`atomic<u64>` values.
- `SHADER_INT64_ATOMIC_MIN_MAX` is a subset of the above, enabling only
`AtomicFunction::Min` and `AtomicFunction::Max` operations on `atomic<i64>` and
`atomic<u64>` values in the `Storage` address space. These are the only 64-bit
atomic operations available on Metal as of 3.1.
Add corresponding flags to `naga::valid::Capabilities`. These are supported by the
WGSL front end, and all Naga backends.
Platform support:
- On Direct3d 12, in `D3D12_FEATURE_DATA_D3D12_OPTIONS9`, if
`AtomicInt64OnTypedResourceSupported` and `AtomicInt64OnGroupSharedSupported` are
both available, then both wgpu features described above are available.
- On Metal, `SHADER_INT64_ATOMIC_MIN_MAX` is available on Apple9 hardware, and on
hardware that advertises both Apple8 and Mac2 support. This also requires Metal
Shading Language 2.4 or later. Metal does not yet support the more general
`SHADER_INT64_ATOMIC_ALL_OPS`.
- On Vulkan, if the `VK_KHR_shader_atomic_int64` extension is available with both the
`shader_buffer_int64_atomics` and `shader_shared_int64_atomics` features, then both
wgpu features described above are available.