Commit Graph
8897 Commits
Author SHA1 Message Date
teoxoy 4945b7a803 [const-eval] implement pow & clamp built-in functions properly 2023-10-12 13:13:26 +02:00
teoxoy c46a69d993 [const-eval] account for ZeroValue index for AccessIndex expression 2023-10-12 13:13:26 +02:00
teoxoy d50c384328 [const-eval] check number of arguments for math functions 2023-10-12 13:13:26 +02:00
teoxoy c2141ab804 [const-eval] add wgsl/glsl behavior switch to evaluator 2023-10-12 13:13:26 +02:00
teoxoy 4e95667a1c [wgsl] test usage of constants in switch cases 2023-10-12 13:13:26 +02:00
teoxoy 5de27f2078 [wgsl] test const evaluation of division and multiplication 2023-10-12 13:13:26 +02:00
teoxoy b95a72b2f6 [wgsl] test @workgroup_size attribute with constants 2023-10-12 13:13:26 +02:00
teoxoy 55dd0e1fbc [wgsl-in] don't treat let declarations as const declarations 2023-10-12 13:13:26 +02:00
teoxoy 3d346977e5 avoid having constants pointing to other constants 2023-10-12 13:13:26 +02:00
teoxoy 648540999e [wgsl-in] use ast spans for errors since they are more accurate 2023-10-12 13:13:26 +02:00
Jim Blandy c16a298cac Let ConstantEvaluator see through Constant exprs in Splat exprs. 2023-10-12 13:13:26 +02:00
Jim Blandy 3e4d565576 Let ConstantEvaluator see through Constant exprs in Compose exprs. 2023-10-12 13:13:26 +02:00
Jim Blandy 6bd15e4492 Add snapshot tests for constant evaluation of splats and composes. 2023-10-12 13:13:26 +02:00
teoxoy c33d7ee40d add an expression constness tracker 2023-10-12 13:13:26 +02:00
Jim Blandy ab177af3ba Test that only constant expressions are hoisted to initializers. 2023-10-12 13:13:26 +02:00
Jim Blandy bdcb9f6f64 Split const-exprs.rs test into separate functions.
Also, just use a single out variable for each type. rather than
introducing a new output variable for every test we add.
2023-10-12 13:13:26 +02:00
Jim Blandy 1a4b526d9a ConstantEvaluator::swizzle: Handle vector concatenation and indexing (#2485)
* ConstantEvaluator::swizzle: Handle vector concatenation, indexing.

* Handle vector Compose expressions nested two deep.

* Move `flatten_compose` to `proc`, and make it a free function.

* [spv-out] Ensure that we flatten Compose for OpConstantCompose.
2023-10-12 13:13:26 +02:00
Jim Blandy f0ac838019 ConstantEvaluator::copy_from: Rename argument handle to expr. (#2490) 2023-10-12 13:13:26 +02:00
Jim Blandy 44ca6ac5b3 Document some parts of ConstantEvaluator. (#2489) 2023-10-12 13:13:26 +02:00
Jim Blandy ca69a6b372 Add a bit of logging to ConstantEvaluator. (#2488) 2023-10-12 13:13:26 +02:00
Jim Blandy aa041aafbd Replace ConstantEvaluator's closure with optional emitter data.
Instead of letting the user supply an arbitrary closure for appending
expressions, instead give `ConstantEvaluator` an `Option` that holds
an `Emitter` to interrupt, and a `block` to add any new `Emit`
statements to.
2023-10-12 13:13:26 +02:00
Jim Blandy 77851ebfb6 Move front::Emitter to proc.
With the addition of the constant evaluator to the `proc` module, it
is now concerned with constructing expressions. Any code that
constructs expressions will generally also need to deal with `Emit`
statements, which are handled by the `Emitter` type. However,
`Emitter` is private to the `front` module. This patch moves it to
`proc` and makes it accessible to both the constant evaluator and the
front ends.
2023-10-12 13:13:26 +02:00
teoxoy 0e4ac2a98c [glsl-in] set initializer of local variables 2023-10-12 13:13:26 +02:00
teoxoy fe7bc01d27 [glsl-in] const eval as soon as possible 2023-10-12 13:13:26 +02:00
teoxoy 3fb4c333a7 use LocalVariable init 2023-10-12 13:13:26 +02:00
teoxoy a730236b68 [wgsl-in] eagerly evaluate const-expressions
[wgsl-in] support const-expressions in attributes

allow `Splat` as an evaluated const-expression type
2023-10-12 13:13:26 +02:00
Teodor Tanasoaia 858d7d590e Fix features of player tests (#4232) 2023-10-11 17:11:47 -04:00
Connor Fitzgerald c5d884fca8 Add codeowners file 2023-10-11 14:05:04 -04:00
Nicolas SilvaandConnor Fitzgerald f95d1c55e3 Expose Instance flags (#4230)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-10-11 17:39:04 +00:00
Colin Edwards 0f7b530ea8 Add WinUI 3 SwapChainPanel support (#4191) 2023-10-11 13:36:30 -04:00
Erich Gubler c1748b2fea Make more HAL APIs require Debug (#4226) 2023-10-11 13:31:37 -04:00
Nicolas Silva b3135b9320 Properly handle user callbacks in surface_configure (#4227)
* Properly handle user callbacks in surface_configure

* Add a changelog entry
2023-10-11 09:35:00 +02:00
Nicolas Silva 35ebd4a528 Update naga to 0.13.0@git:33b75a27d93c6574b11b4dd4492b85b5783d6c52 (#4229) 2023-10-10 16:54:07 +00:00
Nicolas Silva 33b75a27d9 [wgsl-in] Parse the bgra8unorm storage format (#2550) 2023-10-10 09:13:19 -07:00
dependabot[bot] 152c239031 Bump tokio from 1.32.0 to 1.33.0 (#4223)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-10 00:12:45 -04:00
Nicolas Silva 2664da88b0 Update naga to 0.13.0@git:3c7dbc4016b84a35c69b30305b12abaeefc21fd9 (#4221) 2023-10-09 16:39:22 +00:00
TornaxO7andConnor Fitzgerald a5b9ebb3c9 fix clippy warnings and errors (#4205)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-10-09 16:34:06 +00:00
Nicolas Silva 651299b870 Handle user callbacks in surface_configure (#4220) 2023-10-09 12:06:00 -04:00
Nicolas Silva 3c7dbc4016 Add StorageFormat::Bgra8Unorm 2023-10-09 17:04:03 +02:00
dependabot[bot] 51742e4353 Bump libc from 0.2.148 to 0.2.149 (#4217)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-09 10:05:41 -04:00
dependabot[bot] 3a2413a8bb Bump num-traits from 0.2.16 to 0.2.17 (#4218)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-09 10:05:36 -04:00
Jim Blandy fe484b3a1b Require that Function and Private variables be CONSTRUCTIBLE.
Change the validator to enforce WGSL's requirement that all variables
in the `function` and `private` address spaces must have constructible
types.

Mark the `RayQuery` type as `CONSTRUCTIBLE`, since it is intended to
be used for local variables.

Add a regression test.
2023-10-09 12:27:05 +02:00
Jim Blandy fa0fed100e compact: Don't assume Emitted expressions are live.
If an `Emit` statement covers an `Expression` that is not otherwise
used by any `Statement`, remove it from the `Arena` anyway. An `Emit`
statement controls when `Expression`s are evaluated, but it doesn't
have any side effects, so unless an expression is used by some other
statement, it's not necessary to the program.
2023-10-09 12:21:43 +02:00
Jim Blandy e820c33abf compact: Minor cleanups.
- Simplify visibility markings.

- Remove some testing comments. (Tests carried out.)

- Remove some commented-out code.
2023-10-09 12:21:43 +02:00
JustAnotherCodemonkeyandAlphyr f738551250 Add Extended Examples (#3885)
* Add the base of the example. May need refining and definitely fact-checking.

* Start change to changelog.

* Complete changelog change for repeated-compute.

* Apply suggestion to fix typos.

Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com>

* Add storage-texture example which currently works native but needs to be changed to work for wasm. [no ci]

* repeated-compute now works on the web. [no ci]

* `storage-texture` now works on the web as well as native.

* Format because I forgot to do that (ugh).

* Add `storage-texture` to changelog.

* Add `render-to-texture` example.

* Not all the files got git added. Fixed it.

* Add `render-to-texture` to changelog.

* Make better readme's and add examples to said readme's.

* Oops. Put the example updates in the wrong place.

* Add `uniform-values` example.

* Apply clippy suggestions.

* Improved readme's and documentation.

* Fmt. Turning into the Joker rn.

* Make instructions for examples on the web more clear. \(Fmt and clippy happy\)

* hello-workgroups It doesn't work.

* Add basic comments and readme to hello-workgroups.

* Add hello-synchronization example. Currently doesn't have any tests but those should be added later.

* Forgot to check wasm compatibility for hello-synchronization. Fixed it.

* Add test for hello-synchronization.

* Make my examples downlevel defaults.

* Make uniform-values downlevel defaults. (Forgot to do that last commit.)

* Fix clippy doc complaints.

* Didn't fully fix the docs last commit. Got it here I think.

* Fix redundant bullet point in examples/hello-workgroups/README.md.

* Trim down the introduction section of examples/hello-workgroups/README.md.

* Add technical links section to examples/hello-workgroups/README.md.

* Use idiomatic Rust comments, break up big text wall into paragraphs, and fix some spelling errors.

* Move output image functions into examples/common and give output_image_wasm some upgrades.

* Modify changelog for moving output_image_native and output_image_wasm into wgpu-example.

* Fix output_image_wasm. (Formerly did not handle pre-existing output image targets.)

* Make a multiline comment be made of single lines to be more ideomatic.

* "Fix" more multiline comments. I think this is actually the last of them.

* Make the window a consistant, square size that's convenient for viewing.

* Make the window on uniform-values not endlessly poll, taking up 100% of the main thread in background at idle. Also, change layout a little and make native use nanos by default for logging.

* Make execute in hello-synchronization return a struct of vecs instead of using out parameters.

* Didn't realize the naming of wgpu_example::framework so I moved my common example utility functions into wgpu_example::utils.

* Add add_web_nothing_to_see_msg function to replace all the instances of adding "open the console" messages across the examples.

* Add small documentation to add_web_nothing_to_see_msg and change it to use h1 instead of p.

* Add documentation to output_image_native and output_image_wasm in examples/common.

* Do better logging for output image functions in wgpu-example::utils.

* Remove redundant append_child'ing of the output image element in wgpu-example::utils::output_image_wasm.

* Fix error regarding log message for having written the image in wgpu-example::utils::output_image_native.

* Fmt.

* In examples/README.md, re-arrange the examples in the graph to be in alphabetical order.

* Fix changlog item regarding wgpu-example::utils and the output image functions.

* Move all the added examples into one changelog item that lists all of them.

* Updated table in examples/README.md with new examples. Added new features to the table to accurately represent the examples.\n\nFor the new features, not all old examples may be fully represented.

* Fix inaccurate comment in hello-workgroups/src/shader.wgsl.

* Update examples/README.md to include basic descriptions of the basic examples as well as hints on how examples build off of each other.

* Remove `capture` example. See changelog entry for reasoning.

* Fix typo in hello-workgroups/shader.wgsl

* Change the method of vertex generation in the shader code of render-to-texture to make it more clear.

* Modify/correct message in repeated-compute/main.rs regarding the output staging buffer.

* Update message in uniform-values/main.rs about writing the app state struct to the input WGSL buffer.

* Add notice in repeated-compute/main.rs about why async channels are necessary (portability to WASM).

* Revise comment in uniform-values/main.rs about why we don't cast the struct using POD to be more clear.

* Change uniform-values to use encase for translating AppState to WGSL bytes.

* Cargo & Clippy: My two best friends.

* Add MIT-0 to the list of allowed liscences.

* Fix docs for wasm.

---------

Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com>
2023-10-08 02:05:51 -04:00
Brad Werth e6097ce3d4 Make buffer_map and buffer_unmap check for device validity, add tests. (#4212)
* Make buffer_unmap check for device validity, add tests.

This patch makes buffer_unmap check for a valid device, and corrects
buffer_map to return the appropriate error for an invalid device.
Tests are added for both operations.

It also adds device validity checks to device_maintain_ids and to the
functions that get and set buffer sub data.

* Update changelog and test comment.

* Run rustfmt.

* Update test device_lose_then_more to specify more buffer usages to keep Vulkan happy.
2023-10-07 16:28:07 +02:00
Jim Blandy c6716033da Improve docs for FunctionInfo::process_expression. 2023-10-06 18:43:22 +02:00
Jim Blandy 31f547580c Remove expression argument to FunctionInfo::process_expression.
We're already passing the handle and the arena, so it's superfluous.
2023-10-06 18:43:22 +02:00
Teodor Tanasoaia 4d6e0005f4 [valid] Disallow NaNs and infinities (#2508)
* [valid] disallow NaNs and infinities

* document literal float constraints
2023-10-05 12:50:36 -07:00
daxpedda c85cbea39e Bump khronos-egl to v6 (#3807) 2023-10-05 14:01:32 -04:00