Commit Graph
1775 Commits
Author SHA1 Message Date
Pieter-Jan Briers 544ccf88da Handle case insensitive FXC HLSL keywords. (#2347)
There are a few keywords like "pass" in HLSL that are actually case-insensitive for FXC. This can be disabled with strict mode, but even if you do that FXC will continue to give an error if you try to use them in identifiers (at all, with any casing).

This changes the namer code to escape these keywords even if the casing is different.

If you're wondering where I got the list from: I looked at the list of strings in D3DCompiler_47.dll.
2023-05-31 15:00:23 +02:00
Daniel McNab 907b7c7cda Workgroup uniform load (#2201)
Implement the WGSL `workgroupUniformLoad` function.
2023-05-26 13:32:22 -07:00
Shaye Garg 1c17fa82d4 [wgsl-in] Error on param redefinition (#2342)
* error on param redefinition

* also fix #2312
2023-05-25 13:13:27 +02:00
Jim Blandy baed251cb1 Document which expressions are in scope for a break_if expression. (#2326) 2023-05-25 13:08:24 +02:00
Jim Blandy 201c0e2999 [spv-in] Improve documentation for SPIR-V control flow parsing. (#2324) 2023-05-25 13:06:21 +02:00
Erich Gubler 4b41e07a99 refactor: add several clippy lints (#2296) 2023-05-24 17:23:24 +02:00
Ashley ce48588d74 [front/spir-v] Obey the is_depth field of OpTypeImage (#2341)
* [front/spir-v] Obey the is_depth field of OpTypeImage

* Add changed tests
2023-05-22 09:35:58 -07:00
Eduard-Mihai Burtescu 423a069dcd [spv-in] Convert conditional backedges to break if. 2023-05-12 13:59:08 -07:00
Teodor Tanasoaia 62b287e761 Change type of constant sized arrays to NonZeroU32 (#2337) 2023-05-12 14:38:50 +02:00
teoxoy 405413452d Correct type of index and flush the emitter 2023-05-11 12:57:28 -07:00
teoxoy d842d6688d Introduce GlobalCtx 2023-05-11 09:52:40 -07:00
Jim Blandy d763fb31e2 [spv-in] Generate Expression::Literal in some limited cases. 2023-05-11 07:09:53 -07:00
Jim Blandy 959c84f039 [glsl-in] Generate Expression::Literal. 2023-05-11 07:09:53 -07:00
Jim Blandy 412d5aa62e [wgsl-in] Generate Expression::Literal. 2023-05-11 07:09:53 -07:00
Jim Blandy 02ddf6532c Introduce Expression::Literal. 2023-05-11 07:09:53 -07:00
Teodor Tanasoaia 4d87401fac Use Expression::ZeroValue in SPIR-V and WGSL front ends. 2023-05-10 19:30:03 -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
Jim Blandyandteoxoy 59a2441a43 [msl-out] Revert af4d989 since #764 removes the need for it (#2331)
Assigning arrays by value works fine since all arrays are now wrapped by a struct.

Co-authored-by: teoxoy <28601907+teoxoy@users.noreply.github.com>
2023-05-09 16:20:15 -07:00
Ashley da3f43394f [wgsl-out] Simplify map_binding_to_attribute to always return an interpolate attribute (#2318) 2023-05-02 13:50:59 +02:00
Evan Mark Hopkins 9befaed7e9 [hlsl-out] Fix return type for firstbitlow/high (#2315) 2023-04-25 14:49:26 +02: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
Erich Gubler 99a7773e65 fix(hlsl-out): use Interlocked<op> intrinsic for atomic integers (#2294)
We currently assume that we are using raw `RWByteAddressBuffer` methods for all atomic operations (`<pointer>.Interlocked<op>(<raw_byte_offset>, …)`), which is only true when we use `var<storage, read_write>` globals. For `var<workgroup>` globals, we need `Interlocked<op>(<pointer>, …)`, using the original expression as the first argument.

Fix this by branching on the `pointer`'s address space in `Atomic` statements, and implementing the workgroup address space case with intrinsics.

Remove atomic ops from `access`, add new `atomicOps` test.

Fixes #2284
2023-04-05 19:37:22 -07:00
Christopher Fleetwood 7c00548075 [wgsl] Use alias instead of type for type aliases (#2299) 2023-04-04 12:35:32 +02:00
Jim Blandy da8e911d9d [hlsl-out]: Document storage access generation. (#2295) 2023-03-31 17:30:43 -07:00
PyryM 52043be004 [spv-out] Fix invalid spirv being generated from integer dot products (#2291)
* Fix invalid spirv generation in int dotprod

constants cannot be declared inside of a function block, so instead use `write_constant_null` to produce a correctly-declared constant 0.

* autogenerated test snapshots
2023-03-30 16:02:54 +02:00
Jim Blandy 53d62b9ede Clean up handling of RayDesc builtin type, somewhat. 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau c34eed5e47 Address Jim's review notes, use typegen module for atomic struct 2023-03-22 17:23:07 -07: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 532d1ad510 msl: ray query support 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau 22e341b039 wgsl: handle RayDesc/RayIntersection at the type decl level instead of an AST constructor 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau ab9c36441f fill up the ray query intersection struct 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
Erich Gubler 0b87d1918a fix(hlsl): emit constructor functions for arrays (#2281)
* test(hlsl-out): add failing case for array as ctor arg

See issue #2184.

* fix(hlsl): emit constructor functions for arrays
2023-03-20 17:21:52 +01:00
Andreas Reich 67c081bebe [spirv-out] Fix adding illegal decorators on fragment outputs. (#2286)
* [spirv-out] Fix adding illegal decorators on fragment outputs.

Furthermore, fix allowing to add `Centroid` and `Sample` decorator to vertex inputs.
Fixes #2270

* Add test for fragment outputs

* Fix fragment-output.wgsl test using more than 8 outputs in a single shader
Breaks HLSL & MSL validation

* formatting
2023-03-20 13:43:13 +01: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
teoxoy 3450e795bc enable clippy::rest_pat_in_fully_bound_structs lint 2023-03-16 15:51:59 +01:00
teoxoy bdc25dd689 fix rust 1.68 lints 2023-03-16 15:51:59 +01:00
teoxoy 4a03280e6c remove old clippy::if_same_then_else lint 2023-03-16 15:51:59 +01:00
Teodor TanasoaiaandJim Blandy 63e91faecb Skip gl_PerVertex unused builtins in the SPIR-V frontend (#2272)
Co-authored-by: Jim Blandy <jimb@red-bean.com>
2023-03-15 18:46:25 +01:00
Evan Mark Hopkins 7f829c6ac6 [glsl-in] Switch implicit type conversion (#2273) 2023-03-14 10:11:03 +01:00