Commit Graph
202 Commits
Author SHA1 Message Date
Daniel McNab 907b7c7cda Workgroup uniform load (#2201)
Implement the WGSL `workgroupUniformLoad` function.
2023-05-26 13:32:22 -07:00
Teodor Tanasoaia 62b287e761 Change type of constant sized arrays to NonZeroU32 (#2337) 2023-05-12 14:38:50 +02:00
teoxoy d842d6688d Introduce GlobalCtx 2023-05-11 09:52:40 -07:00
Jim Blandy 02ddf6532c Introduce Expression::Literal. 2023-05-11 07:09:53 -07:00
Teodor Tanasoaia dcc8615c5b Introduce Expression::ZeroValue. 2023-05-10 19:30:03 -07:00
Erich Gubler dd54aaf260 refactor(valid)!: remove unneeded ConstantError::Unresolved{Component,Size} (#2330)
Resolves #2329.
2023-05-09 22:10:09 -07:00
Dzmitry Malyshau 37b3c36a8f Support array bindings of buffers (#2282)
* Support buffer resource arrays in IR, wgsl-in, and spv-out

* spv-out: refactor non-uniform indexing semantics to support buffers

* Update the doc comment on BindingArray type

* Improve TypeInfo restrictions on binding arrays

* Strip DATA out of binding arrays

* Include suggested documentation, more binding array tests, enforce structs
2023-04-24 21:30:49 -07:00
Erich Gubler 1421a5e1ab refactor(valid)!: remove TypeError::UnresolvedBase (#2308)
Resolves #2303.
2023-04-20 19:39:38 +02:00
teoxoy b9c5cb5a78 validate vertex stage returns the position built-in 2023-04-12 10:48:18 -07:00
daxpedda f59668ccfa Allow array_index to be unsigned (#2298) 2023-04-07 16:01:55 +02:00
Dzmitry Malyshau 024c197cc8 ray query: validation, better test 2023-03-22 17:23:07 -07:00
Jim Blandy 18710fee1e Expand on the documentation for ray-tracing features. 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau 13ee4369cc clippy fixes 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau 67d31b8e8c spv-out: basic ray query support 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau b856625821 Ray query expressions and special types 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau e46c53d212 Add ray query statements to the IR 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau 432b4990a7 Add ray query types to the IR 2023-03-22 17:23:07 -07:00
Evan Mark HopkinsandTeodor Tanasoaia 6db8da72ca Add partial derivative builtins (#2277)
* Add partial derivative builtins

* [dot] emit derivative control

* Fix fmt

---------

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-03-17 00:15:44 +01:00
teoxoy 6b0c2a532a enable clippy::match_wildcard_for_single_variants lint 2023-03-16 15:51:59 +01:00
Evan Mark Hopkins 8a72b7a8ad Differentiate between i32 and u32 in switch (#2269)
* Differentiate between i32 and u32 in switch

* Use similar wording to other error messages

* Remove duplicate enum
2023-03-10 17:53:11 +01:00
Pâris DOUADY a7b52b8663 enforce discard only in fragment (#2262) 2023-02-27 10:47:10 +01:00
Mauro GentileandTeodor Tanasoaia 810e9d26fc Add countTrailingZeros (#2243)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-02-20 20:40:59 +01:00
teoxoy cc3a8ac737 add Capabilities::MULTISAMPLED_SHADING 2023-02-16 18:16:49 -05:00
teoxoy 964d9204bc add Capabilities::EARLY_DEPTH_TEST 2023-02-16 18:16:49 -05:00
teoxoy df567a94eb add Capabilities::MULTIVIEW 2023-02-16 18:16:49 -05:00
Evan Mark Hopkinsandteoxoy 6be394dac3 Add countLeadingZeros (#2226)
* Add countLeadingZeros

* [glsl-out] Bake countLeadingZeros

* [hlsl-out] Bake countLeadingZeros

* [hlsl-out] Update Baked expressions

* Remove unnecessary bake for sints

* [glsl-out] CountLeadingZeros without findMSB

* Don't check negatives when uint

* Perform the type conv after mix

* use log2

* fix clippy lints

---------

Co-authored-by: teoxoy <28601907+teoxoy@users.noreply.github.com>
2023-01-31 21:31:05 +01:00
João Capucho 0074c68ec4 valid: Check dependencies between functions calls
This commit enforces the forward dependency rules on the IR across
functions and their calls, this fixes a crash in a later stage of the
validator.
2023-01-31 07:35:31 -08:00
João Capucho bebaac93b6 valid: Fix handle dependency validation
The handle dependency validation code was using the handle's index
directly while trying to erase the handle type. This would cause the
validator to crash while processing the first handle of the arena since
it would be trying to construct a `NonZeroU32` with a zero.

This commit fixes the issue by adding 1 to the index which not only
fixes this panic but also makes so that the created Handle is equal to
the passed handle (minus the type that was erased)

It also fixes the error message not including the subject's kind
2023-01-31 07:35:31 -08:00
teoxoy 3ace8b81cb fix array being flagged as constructible when its base isn't 2023-01-25 18:07:48 +01:00
teoxoy 85e3b0844f add type_flags to ModuleInfo 2023-01-25 18:07:48 +01:00
Jonathan Behrens 1be8024bda Support 16-bit unorm/snorm formats (#2210)
* Support 16-bit unorm/snorm formats

* Add Capabilities::STORAGE_TEXTURE_16BIT_NORM_FORMATS

* Add 16-bit normalized formats to spv frontend
2023-01-18 19:03:24 +01:00
Jonathan Behrens 1cffd236a7 Remove overly restrictive array stride check (#2215) 2023-01-18 16:28:38 +01:00
Jim Blandy cdcfad277a Let the uniformity analysis trust the handle validation pass.
Undo some changes from #1668, now that #2090 has been merged.
2023-01-14 19:25:31 -08:00
Jim Blandy 86a88de396 Revert "Error if the uniformity requirements for a barrier aren't met" (#2203)
This reverts commit e6e94d65ab.
2023-01-11 16:35:03 +01:00
Daniel McNab e6e94d65ab Error if the uniformity requirements for a barrier aren't met 2023-01-09 16:39:33 -08:00
PENGUINLIONG 24316fd4bc Allow u32 coordinates for textureStore/textureLoad (#2172) 2022-12-22 18:59:22 +01:00
Zhixing Zhang 8e1b0529e6 Supporting gl_PointCoord (#2180) 2022-12-21 13:05:15 +01:00
Jim Blandy 37be4df2b8 Fix warnings when building tests without validation. 2022-12-20 22:24:24 -08:00
Erich Gubler 461fdda425 Add handle validation pass to Validator (#2090)
Before proceeding with any other validation, check that all Handles are valid for their arenas, and refer only to older handles than themselves. This allows subsequent stages to simply use indexing without panics, assuming validation has passed.
2022-12-17 00:26:43 +00:00
Dzmitry Malyshau 76d30e5055 Add ValidationFlags::BINDINGS 2022-12-13 12:59:28 -05:00
Avi Weinstock 5d8fc3fdcf [wgsl-in/spv-out] Add support for WGSL's atomicCompareExchangeWeak (#2165)
* Add support for WGSL's `atomicCompareExchangeWeak` with the `__atomic_compare_exchange_result` struct, and add SPIR-V codegen for it.

Partially addresses https://github.com/gpuweb/gpuweb/pull/2113, #1755.

* Add tests for `atomicCompareExchangeWeak`, and support both u32 and i32 atomics with it.

* More thorough typechecking of the struct returned by `atomicCompareExchangeWeak`.
2022-12-13 10:47:28 +01:00
JMS55andTeodor Tanasoaia bf4e62b1ac Fix textureGather on texture_2d<u32/i32> (#2138)
* Fix textureGather on texture_2d<u32/i32>

* Add textureGather u32/i32 tests

* Update src/valid/expression.rs

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>

* Fix formatting

* undo analyzer change

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2022-12-05 10:03:11 +00:00
Erich Gubler 469272c613 refactor(valid): s/error/source member name for ValidationError 2022-10-26 16:31:48 -04:00
Erich Gubler 2a11d830bb refactor: factor out new Validator::global_var_ty for expr. validation (#2086) 2022-10-25 08:38:44 -07:00
Igor Shaposhnik 0f26e5c808 [validate] Fix compiler warning 2022-10-04 15:21:36 +01:00
João Capucho ff69053bf2 valid: Check regular functions don't have bindings
Checks that all arguments and return types have no bindings in regular functions.
2022-09-10 10:31:11 -07:00
Jim Blandy eb6124ec94 Document arithmetic binary operation type rules. 2022-09-10 17:12:35 +01:00
Evan Mark Hopkins a80967f860 Add support for the saturate function (#2025)
uses clamp in place of saturate in spv and glsl
2022-08-16 10:43:41 +00:00
Ashley e2d688088a Support for the OVR_multiview2 WebGL extension (#1933)
* Make some (currently hacky) changes to enable multiview in webgl

* Fix ViewIndex built in for this extension

* Run cargo fmt, fix tests

* Allow specifying if we're targetting webgl in the glsl version

* Document multiview2 extension

* fn embedded -> const fn embedded

* Fix tests

* Fix benches

* Add snapshot tests

* Revamp so that the glsl options have some multiview options. Also add tests

* Make clippy happier

* Go back to having is_webgl be part of Version

* Use wgsl as input for tests

* Rename Version::new_embedded to Version::new_gles, fix glsl validation

* Run cargo fmt

* Fix brand new clippy warnings
2022-06-30 17:58:47 +01:00
João Capucho 67ef37ae99 Add support for 'break if' to IR, wgsl-in, and all backends. 2022-06-24 17:47:07 -07:00