Ben Clayton
11ed0db30d
resolver: Don't use ast to_str() methods
...
These return weird names that love the use of '__' and have little relation to WGSL.
Improve the duplicate case error message.
Clean up control_block_validation_test.cc by making used of the ProgramBuilder helpers.
Bug: tint:1225
Change-Id: I8c4cf3943145cf8372c00d33ae0166c0c0bcbb8b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66442
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Antonio Maiorano <amaiorano@google.com >
Reviewed-by: James Price <jrprice@google.com >
Commit-Queue: Ben Clayton <bclayton@google.com >
2021-10-14 20:30:29 +00:00
Ben Clayton
262210f12b
utils: Add ReplaceAll() string helper
...
Helpful for template string substitutions in tests, to reduce string concat noise.
Change-Id: I612084e2c267d93d79c92cf3ac0231b6b904f0e3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66440
Commit-Queue: Ben Clayton <bclayton@google.com >
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Antonio Maiorano <amaiorano@google.com >
2021-10-14 20:24:50 +00:00
Stephen White
b281dd168d
GLSL: implement atan2.
...
GLSL has no atan2() instrinsic, but a 2-parameter overloaded atan()
instead.
Bug: tint:1222
Change-Id: I368b3989117cd329fea1020cd941daa0a69525cd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66360
Kokoro: Kokoro <noreply+kokoro@google.com >
Commit-Queue: Stephen White <senorblanco@chromium.org >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-10-14 16:17:38 +00:00
Stephen White
2f963aaf82
More GLSL fixes.
...
Remove register-and-space decoration.
Add "main" to GLSL keywords, to force renaming.
Output correct compute width decoration (not numthreads).
Remove static keyword.
Bug: tint:1218 tint:1219 tint:1220
Change-Id: I171f183690b6531c76218414e0d81f6ef5e22e6b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66340
Kokoro: Kokoro <noreply+kokoro@google.com >
Commit-Queue: Stephen White <senorblanco@chromium.org >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-10-14 16:16:19 +00:00
Stephen White
7cf3b28a87
GLSL writer: validate all entry points with glslang.
...
Generate and validate all entry points individually.
This is required since GLSL has separate shader files, and
can only have a single "main" entry point.
Bug: tint:1217
Change-Id: Ie5cb510aaef3b7c8a7573f5fa9446815284afecb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/61920
Kokoro: Kokoro <noreply+kokoro@google.com >
Commit-Queue: Stephen White <senorblanco@chromium.org >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-10-14 14:39:36 +00:00
Ben Clayton
f3f2d0a218
Resolver: Remove texture_storage read access
...
The intrinsics that did anything useful with this were deprecated
several releases ago.
Change-Id: I79e3c901b6a78583853a067ec46cfa98e346517c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66262
Kokoro: Kokoro <noreply+kokoro@google.com >
Commit-Queue: Ben Clayton <bclayton@google.com >
Reviewed-by: James Price <jrprice@google.com >
2021-10-14 10:10:45 +00:00
Ben Clayton
14fc622161
ast: Rename CallExpression::params() to args()
...
Arguments are the values passed to a function.
Parameters receive arguments.
Fixed: tint:811
Change-Id: I82fe71aa795b8b365bc78981e84c86b419eb3eb2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66263
Kokoro: Kokoro <noreply+kokoro@google.com >
Commit-Queue: Ben Clayton <bclayton@chromium.org >
Auto-Submit: Ben Clayton <bclayton@google.com >
Reviewed-by: James Price <jrprice@google.com >
2021-10-14 09:51:14 +00:00
Ben Clayton
2aa6855914
intrinsics: Remove deprecated modf & frexp overloads
...
These have been deprecated for multiple chrome releases.
Change-Id: I4cc05a74ff8f085e6d13f93aefb93077480e52f5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66261
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: James Price <jrprice@google.com >
Commit-Queue: Ben Clayton <bclayton@google.com >
2021-10-12 21:57:47 +00:00
Ben Clayton
d57a129810
reader/spirv: Remove stdout spam in tests
...
Change-Id: I06361ae5bb0f69b3ac66c3ddc22abb5988e4c4fe
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66260
Commit-Queue: Ben Clayton <bclayton@google.com >
Auto-Submit: Ben Clayton <bclayton@google.com >
Kokoro: Ben Clayton <bclayton@google.com >
Reviewed-by: David Neto <dneto@google.com >
2021-10-12 17:35:27 +00:00
Ryan Harrison
ce90ac52f4
Remove BoundArrayAccessors
...
BUG=tint:1212
Change-Id: I054bedb6f20ef18d70408087f774ef252403b49c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66100
Auto-Submit: Ryan Harrison <rharrison@chromium.org >
Commit-Queue: Ben Clayton <bclayton@google.com >
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-10-07 21:55:21 +00:00
Stephen White
a9f8c7db81
Implement GLSL writer backend.
...
This is a modified version of the HLSL writer.
Basic types, arrays, entry points, reserved keywords, uniforms,
builtin uniforms, structs, some builtin functions, zero initialization
are implemented. Textures, SSBOs and storage textures in particular are
unimplemented. All the unit tests "pass", but the output is not correct
in many cases.
triangle.wgsl outputs correct vertex and fragment shaders that pass
GLSL validation via glslang. compute_boids.wgsl outputs a valid but not
correct compute shader.
Change-Id: I96c7aaf60cf2d4237e45d732e5f51b345aea0552
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57780
Kokoro: Kokoro <noreply+kokoro@google.com >
Commit-Queue: Stephen White <senorblanco@chromium.org >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-10-06 18:55:10 +00:00
James Price
ceab140a8b
validation: Reject struct builtins on wrong stages
...
Change-Id: I047f28c5be6a7d878b9f7ad37b6accc842b4fe98
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65840
Auto-Submit: James Price <jrprice@google.com >
Commit-Queue: Ben Clayton <bclayton@google.com >
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-10-05 15:02:17 +00:00
Ryan Harrison
2271b9541c
Support reflecting uninitialized pipeline overrideable constants
...
Also adds testing for constants type reporting
BUG=tint:852
Change-Id: Ic644f3a4e6687446a552ce755951966743c8ee97
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65641
Auto-Submit: Ryan Harrison <rharrison@chromium.org >
Commit-Queue: Ben Clayton <bclayton@google.com >
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-10-04 11:01:19 +00:00
Ben Clayton
5e35864c1b
writer/spirv: Fix abs() on unsigned integers
...
GLSLstd450SAbs expects a *signed* integer.
abs() of an unsigned number is now a no-op.
Fixes WebGPU CTS tests:
webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:*
Bug: tint:1194
Change-Id: I65c5e9f2f03aac0b788b9ba88c383cbec136d7c6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65620
Commit-Queue: Ben Clayton <bclayton@chromium.org >
Kokoro: Ben Clayton <bclayton@chromium.org >
Reviewed-by: David Neto <dneto@google.com >
2021-10-01 08:41:55 +00:00
James Price
ee23c17345
resolver: Deterministic constant ID allocation
...
Use global declaration order for allocating implicit
pipeline-overridable constant IDs, instead of iterating over an
unordered_map.
Bug: tint:1155
Change-Id: Ia5ff534c617b0d57e45fc20dd0a5a591854e6473
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65522
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-30 17:29:50 +00:00
James Price
5ffae32177
validation: Improve continue-bypasses-decl message
...
Attach the error to the continue statement, and add notes to show
where the variable is both declared and used.
Change-Id: Ie9939a5ca674e7216069bbb1d8dc82ab6949367c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65521
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-30 17:29:50 +00:00
James Price
7166f6ba93
validation: Fix continue-bypasses-decl check
...
An expression that is inside an if-statement condition does not have a
"current block", which is what we were using to see if the usage was
inside a continuing block. Use the current statement to find the
containing block instead.
Fixed: chromium:1251664
Change-Id: Icc808ca1cf6a1b51757da8303901fa5ecb693e83
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65520
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-30 17:29:50 +00:00
James Price
1ca6fbad8f
msl: Use a struct for threadgroup memory arguments
...
MSL has a limit on the number of threadgroup memory arguments, so use
a struct to support an arbitrary number of workgroup variables.
This commit introduces a `State` object to this transform, which is
used to track which structs have been cloned eagerly, in order to
avoid duplicating them.
Bug: tint:938
Change-Id: Ia467db186e176a08f160455eab5fd3b3662f56b8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65360
Auto-Submit: James Price <jrprice@google.com >
Kokoro: James Price <jrprice@google.com >
Commit-Queue: James Price <jrprice@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-29 18:56:17 +00:00
Ben Clayton
9c7cd9e9c3
transform: Avoid symbol collision in Canonicalize IO
...
Correctly rename fields when combining two or more input structures together into a single input structure.
Bug: chromium:1251009
Change-Id: I0c7ab5ed3116b97035e100d1ef96e772e819f640
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64545
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: James Price <jrprice@google.com >
Commit-Queue: Ben Clayton <bclayton@google.com >
2021-09-27 21:40:33 +00:00
David Neto
e6f5730aef
Add OpImageSampeProj* unit tests to end-to-end list
...
Fixed: tint:1143
Change-Id: Ib812b9c1c55e48ee78280c32b465afca1b707b82
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65040
Auto-Submit: David Neto <dneto@google.com >
Commit-Queue: Ben Clayton <bclayton@google.com >
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-27 19:21:43 +00:00
Corentin Wallez
40ef4a8269
Revert "msl: Use a struct for threadgroup memory arguments"
...
This reverts commit af8cd3b7f5 .
Reason for revert: breaking roll into Dawn.
Original change's description:
> msl: Use a struct for threadgroup memory arguments
>
> MSL has a limit on the number of threadgroup memory arguments, so use
> a struct to support an arbitrary number of workgroup variables.
>
> Bug: tint:938
> Change-Id: I40e4a8d99bc4ae074010479a56e13e2e0acdded3
> Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64380
> Kokoro: Kokoro <noreply+kokoro@google.com >
> Auto-Submit: James Price <jrprice@google.com >
> Reviewed-by: Ben Clayton <bclayton@google.com >
> Commit-Queue: James Price <jrprice@google.com >
TBR=bclayton@google.com ,jrprice@google.com ,noreply+kokoro@google.com ,tint-scoped@luci-project-accounts.iam.gserviceaccount.com
Change-Id: I58a07c4ab7e92bda205e2bbbab41e0b347aeb1e8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: tint:938
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65162
Reviewed-by: Corentin Wallez <cwallez@chromium.org >
Commit-Queue: Corentin Wallez <cwallez@chromium.org >
Kokoro: Corentin Wallez <cwallez@chromium.org >
2021-09-27 19:00:15 +00:00
James Price
af8cd3b7f5
msl: Use a struct for threadgroup memory arguments
...
MSL has a limit on the number of threadgroup memory arguments, so use
a struct to support an arbitrary number of workgroup variables.
Bug: tint:938
Change-Id: I40e4a8d99bc4ae074010479a56e13e2e0acdded3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64380
Kokoro: Kokoro <noreply+kokoro@google.com >
Auto-Submit: James Price <jrprice@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
Commit-Queue: James Price <jrprice@google.com >
2021-09-27 15:06:13 +00:00
Austin Eng
b9a2f5946e
spirv-reader: Implement OpImageSampleProj* instructions
...
Bug: tint:1143
Change-Id: Ic07245a2c5afdb2400f3a9777b6fd42f70dab3c8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64700
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: David Neto <dneto@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
Commit-Queue: David Neto <dneto@google.com >
2021-09-24 18:00:04 +00:00
shrekshao
28d6763ef8
Add type to OverridableConstant
...
The overridable constants type can only be deducted from shader, those
passed into `record<USVString, GPUPipelineConstantValue> constants;`
are all double. In dawn pipeline (vulkan backend for exmaple) we need to
do type cast for these double values and passed in to native API
Bug: tint:1155, dawn:1041
Change-Id: I3abb43e61d63f054402ca8d3280b44a833a5f67e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64601
Kokoro: Kokoro <noreply+kokoro@google.com >
Commit-Queue: Shrek Shao <shrekshao@google.com >
Reviewed-by: Ryan Harrison <rharrison@chromium.org >
2021-09-21 18:12:59 +00:00
David Neto
92265504fe
spirv-reader: don't dedup composite constants
...
The SPIR-V optimizer's representation deduplicates constants
by structural equality. We don't want that for WGSL.
Fixed: tint:1173
Change-Id: I7a3936fcd4803a1cda02e71cbaa7c4be89eba433
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64701
Auto-Submit: David Neto <dneto@google.com >
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
Commit-Queue: David Neto <dneto@google.com >
2021-09-21 18:07:28 +00:00
David Neto
0ed87c8182
spirv-reader: Don't deduplicate SPIR-V array types
...
Bug: tint:1173
Change-Id: I2adefadf4b79c70f58ed32acda3ea50cd84c8550
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64681
Auto-Submit: David Neto <dneto@google.com >
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
Commit-Queue: David Neto <dneto@google.com >
2021-09-21 17:14:58 +00:00
David Neto
1d81f83704
spirv-reader: only generate aliases for array types
...
Refactoring only.
Change-Id: Ia931870a337cf93a54c5f2154754ef549c8559d7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64680
Auto-Submit: David Neto <dneto@google.com >
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
Commit-Queue: David Neto <dneto@google.com >
2021-09-21 15:05:13 +00:00
David Neto
ddc9eb2b85
wgsl-reader: reject identifiers starting with underscrore
...
Update one test to avoid this error.
Fixed: tint:1179
Change-Id: Id41b0eb0f404648de4e86a835fe43f1729cb4696
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64464
Auto-Submit: David Neto <dneto@google.com >
Kokoro: Kokoro <noreply+kokoro@google.com >
Commit-Queue: David Neto <dneto@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-20 14:38:45 +00:00
Antonio Maiorano
dad26395d8
spirv backend: do not generate a load for ignored expressions
...
Fixes spirv-val failing on loads of dynamic arrays.
Bug: chromium:1249602
Change-Id: Ic15af9f9ef2beb45bc732e4e45f023651544a1c7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64400
Reviewed-by: Ben Clayton <bclayton@google.com >
Kokoro: Antonio Maiorano <amaiorano@google.com >
Commit-Queue: Antonio Maiorano <amaiorano@google.com >
2021-09-16 13:32:57 +00:00
Ben Clayton
d1d99bc7de
Resolver: Validate that type sizes fit in uint32_t
...
Bug: chromium:1249708
Bug: tint:1177
Change-Id: I31c52f160e4952475e977453206ab4224fd20df7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64320
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: David Neto <dneto@google.com >
Commit-Queue: Ben Clayton <bclayton@google.com >
2021-09-15 17:37:00 +00:00
James Price
acaecab29d
msl: Handle workgroup matrix allocations
...
Use a threadgroup memory argument for any workgroup variable that
contains a matrix.
The generator now provides a list of threadgroup memory arguments for
each entry point, so that the runtime knows how many bytes to allocate
for each argument.
Bug: tint:938
Change-Id: Ia4af33cd6a44c4f74258793443eb737c2931f5eb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64042
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
Commit-Queue: James Price <jrprice@google.com >
2021-09-13 19:56:01 +00:00
Sarah
de767b1842
validation: fix arrayAcceor/memberAccessor error msg and add unit-tests
...
Bug: tint:1172
Change-Id: Icbc920dbc6adc9a5c78b8ae7d700b527a4fa48f7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64100
Reviewed-by: Ben Clayton <bclayton@google.com >
Kokoro: Kokoro <noreply+kokoro@google.com >
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com >
2021-09-13 19:30:19 +00:00
James Price
c306cda4db
inspector: reflect num_workgroups builtin usage
...
Dawn needs to know if a given entry point uses this builtin, so that
it can pass this information via a root constant for HLSL.
Bug: tint:752
Change-Id: I8bcd3a343db16774ffedd9db9813451f97f10aba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64040
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-13 17:11:58 +00:00
James Price
922fce7295
Implement and test num_workgroups for all backends
...
For HLSL, use the new NumWorkgroupsFromUniform transform, and expose
the binding point to use for the generated uniform as a backend
option.
The MSL mapping is trivial, and it was already implemented for WGSL
and SPIR-V.
Bug: tint:752
Change-Id: I4bd37b5d26181629d72b152fe064a60caf8ecdc5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63962
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-13 17:11:58 +00:00
James Price
77a25c060f
transform: Add NumWorkgroupsFromUniform transform
...
This transform scans entry points for struct parameters that contain
the num_workgroups builtin, and replace accesses to these members with
a value loaded from a uniform buffer.
This will be used by the HLSL backend to implement the num_workgroups
builtin.
Bug: tint:752
Change-Id: Iefab3b14af8a08a6135348fded368a06d932e915
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63961
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-13 17:11:58 +00:00
James Price
1bb637195b
resolver: Enable the num_workgroups builtin
...
The subsequent commits will implement this for all remaining backends.
Bug: tint:752
Change-Id: Id26f920fea93b5678466705612dcbfc229dc878a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63921
Reviewed-by: Ben Clayton <bclayton@google.com >
Kokoro: James Price <jrprice@google.com >
2021-09-13 17:11:58 +00:00
David Neto
d705a13599
Fix typo in a comment
...
Change-Id: I85aa498e6f593567b361f01734af1e8eb586ceba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64080
Auto-Submit: David Neto <dneto@google.com >
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
Commit-Queue: Ben Clayton <bclayton@google.com >
2021-09-13 15:18:59 +00:00
James Price
f66f651374
transform/BindingRemapper: Validate access mode
...
Ensure that remapped access modes are valid enum values.
NB: This is hard to test, as UBSan flags an out-of-range enum value as
a hard error.
Fixed: chromium:1248754, chromium:1248755
Change-Id: I2e686843134e6a285fb8316a1960fc4eadff2a93
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64120
Auto-Submit: James Price <jrprice@google.com >
Kokoro: Kokoro <noreply+kokoro@google.com >
Commit-Queue: Ben Clayton <bclayton@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-13 14:58:39 +00:00
Ben Clayton
2ebcb93cb3
reader/spiv: Fix typo in entry-point IO sorting
...
We were sorting the inputs twice.
Also make use the UniqueVector::operator std::vector() to simplify the code a little.
Doesn't appear to change any tests.
Just spotted while looking through code.
Change-Id: Iddb433b9c8c429f32b40a10cf466c712fde7a317
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63701
Auto-Submit: Ben Clayton <bclayton@google.com >
Commit-Queue: David Neto <dneto@google.com >
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: David Neto <dneto@google.com >
2021-09-10 15:25:13 +00:00
James Price
ebab7d2f7a
spirv: Remove the sanitizer transform
...
Invoke the required transforms directly in the SPIR-V backend.
Change-Id: I78dc667d5c4c9c1d4da13ef5a99ece831c103982
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63801
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-09 14:40:07 +00:00
James Price
5b3be6a64a
hlsl: Remove the sanitizer transform
...
Invoke the required transforms directly in the HLSL backend.
Change-Id: I9465fef375dd4dad6a91c1e7e16ede6401b9bfc0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63800
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-09 14:40:07 +00:00
Ben Clayton
25517e9ce8
resolver: Validate unreachable stmts when terminator is in block(s)
...
Will requires updating the WGSL spec, which currently has rules looser than SPIR-V.
Fixed: tint:1167
Bug: chromium:1246163
Change-Id: Ie8fcfabc0bb89c7fb69c345475ff99c07fa04172
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63560
Commit-Queue: Ben Clayton <bclayton@google.com >
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: David Neto <dneto@google.com >
Auto-Submit: Ben Clayton <bclayton@google.com >
2021-09-09 12:38:19 +00:00
James Price
733addc20f
msl: Remove the sanitizer transform
...
Invoke the required transforms directly in the MSL backend.
Change-Id: Id8026b1a64415fbe363f8f8a5790e8216cd12c68
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63620
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
Commit-Queue: James Price <jrprice@google.com >
2021-09-08 19:57:47 +00:00
Ben Clayton
b7bcbf0d20
Resolver: Traverse expressions without recursion
...
This CL changes the way that the resolver traverses expressions to avoid stack overflows for deeply nested expressions.
Instead of having the expression resolver methods call back into
Expression(), add a TraverseExpressions() method that collects all the
expression nodes with a simple DFS.
This currently only changes the way that Expressions are traversed. We
may need to do the same for statements.
Bug: chromium:1246375
Change-Id: Ie81905da1b790b6dd1df9f1ac42e06593d397c21
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63700
Auto-Submit: Ben Clayton <bclayton@google.com >
Reviewed-by: David Neto <dneto@google.com >
Commit-Queue: Ben Clayton <bclayton@google.com >
Kokoro: Kokoro <noreply+kokoro@google.com >
2021-09-08 15:18:36 +00:00
David Neto
be514a1efb
wgsl-reader: hex float: zero mantissa results in zero result
...
When the magnitude is zero, then we don't care about the magnitude
of the exponent. The result value is always zero, without emitting
an error.
Fixed: tint:1166
Change-Id: I303d7c336e7ea42719571854f0a22cbfd19da32c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63520
Kokoro: Kokoro <noreply+kokoro@google.com >
Auto-Submit: David Neto <dneto@google.com >
Reviewed-by: Antonio Maiorano <amaiorano@google.com >
Commit-Queue: Antonio Maiorano <amaiorano@google.com >
2021-09-08 13:46:51 +00:00
James Price
676ec7cf99
spirv: Handle sample_mask in shader IO transform
...
This is easy to do while we are processing builtins in the main
transform now that we use wrapper functions.
This is step towards removing the sanitizers completely.
Change-Id: If5472ce552e3cce1e5905916eeffa8fef90461c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63585
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-07 18:59:21 +00:00
James Price
1b9ed7de4a
msl/module-scope-var: Add unit test for folding &*
...
As noted in the CL that folded &* during this transform, we were
missing a unit test for this:
https://dawn-review.googlesource.com/c/tint/+/60520
Bug: tint:1086
Change-Id: I61941d40dbcc478e8cc2672144186e5c0f10e587
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63584
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-07 18:59:21 +00:00
James Price
3646400342
transform: Add ModuleScopeVarToEntryPointParam
...
This is the HandleModuleScopeVars() part of the MSL sanitizer moved
verbatim to a standalone transform. The transform code is unchanged,
but some expected test outputs are different as this is now tested in
isolation instead of along with the rest of the sanitizer transforms.
This is step towards removing the sanitizers completely.
Change-Id: I7be826e2119451fc2ce2891740cc94f978e7d5a1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63583
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-07 18:59:21 +00:00
James Price
b584b374a1
transform: Add transform to add empty entry point
...
Use this from the HLSL and SPIR-V sanitizers, instead of duplicating
this logic for them.
This is step towards removing the sanitizers completely.
Change-Id: Ifa9f23d84fd3505d30a928c260181a699c5f1783
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63582
Kokoro: Kokoro <noreply+kokoro@google.com >
Reviewed-by: Ben Clayton <bclayton@google.com >
2021-09-07 18:59:21 +00:00
James Price
c77214d52d
Move array accessor tests to their own file
...
No new tests or any changes, just moving to a separate file in
preparation for adding lots more of these tests soon.
Change-Id: Iaa7eef52384e702c395a6db312fef19e22507644
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63580
Kokoro: Kokoro <noreply+kokoro@google.com >
Auto-Submit: James Price <jrprice@google.com >
Reviewed-by: Antonio Maiorano <amaiorano@google.com >
Commit-Queue: James Price <jrprice@google.com >
2021-09-07 14:48:24 +00:00