Commit Graph

2975 Commits

Author SHA1 Message Date
James Price 3a4443a681 spirv: Add block decorations with a transform
Any struct which is used as the store type of a buffer variable needs
to have a block decoration. If that struct is nested inside an array
or another struct, we wrap it inside another struct first.

This removes the SPIR-V backend's reliance on the [[block]] attribute,
which will soon be deprecated and removed.

Bug: tint:1324
Change-Id: Ib6ad54f24a3e4a090da9faeed699f266abcb66ba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72082
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-12-09 15:45:03 +00:00
James Price ac8975f291 validation: Remove requirement for block attribute
Replace all validation rules that rely on the block attribute with the
new rules based on fixed-footprint types.

Bug: tint:1324
Change-Id: I02656537bee66e6e1af95875e503a37bf23d4a6b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72081
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-12-09 15:45:03 +00:00
Ben Clayton 81b3948649 resolver: Implement element inference of vecN and matNxM
Fixed: tint:1334
Change-Id: Idc94d49ecd41e37354bb93138348e3af3e733932
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72143
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 14:37:37 +00:00
Ben Clayton f91b02bba1 test: Add vector constructor tests
These test vector constructors with an explicit element type.

Bug: tint:1334
Change-Id: I3d0f626e42850e841cffd70241274e32dcb75fbb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72142
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-12-09 14:37:37 +00:00
Ben Clayton e306927ff5 test: Add matrix constructor tests that take a vector
Bug: tint:1334
Change-Id: I7e625da4bd270b6d0bfdb43fbd8dbe41682180f9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72141
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-12-09 14:37:37 +00:00
Ben Clayton cf09c23a12 test: Shuffle matrix constructor tests
Move these under test/expressions, and rework the directory structure so we can test vector arguments and inferred element types.

Bug: tint:1334
Change-Id: I411fd7ce1ecdd50c6ef9b79be8407c09a6d38240
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72140
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-12-09 14:37:37 +00:00
James Price 0fe30b52a5 single_entry_point: Retain applied transforms
This transform does not use the top-level ctx.Clone() method, so we
need to manually copy the applied transforms over to the destination
program.

This fixes the GLSL backend, where this transform was dropping the
applied transforms and breaking a required transform dependency later
in the chain.

Change-Id: I3db688fe35dfbe67468b9941f739cb2ecf3a843b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72220
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-12-09 09:18:44 +00:00
Antonio Maiorano a8c202b8e7 HLSL: work around FXC failures when dynamically indexing matrices
This fixes errors like "error X3500: array reference cannot be used as
an l-value; not natively addressable". Note that FXC treats matrices
like arrays. We still get this error for dynamically indexed arrays in
structs.

Also improved HLSL assign tests, and add missing ones for vector
indexing.

Manually removed 20 e2e skip hlsl SKIP files that are now passing with
this change.

Bug: tint:1333
Change-Id: If23881a667857a4d4ec6881e72666af0a666ef10
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71982
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-12-08 23:03:33 +00:00
Ben Clayton 3703522d41 Implement textureGather, textureGatherCompare
All writers implemented, along with resolving and validation.

TODO: SPIR-V Reader.

Bug: tint:1330
Change-Id: I8ba2f6023749474f80efb8a5422ac187e6c73a69
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71820
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2021-12-08 19:54:08 +00:00
Antonio Maiorano 2f7730a16e Manually generate HLSL skip files for vk-gl-cts e2e tests
It seems we haven't run our e2e tests with FXC validation in a long time
 - at least not since we've added the vk-gl-cts corpus.

Locally disabled exclusion of "/test/vk-gl-cts/" in test-runner/main.go,
and ran:
./test/test-all.sh out/build/x64-Debug/tint.exe --format hlsl --fxc --generate-skip

These will need to be manually removed once the skips aren't needed by
deleting them all, and re-running as above.

Bug: tint:940
Change-Id: I27e395e69f5e1bd7d234f3155f40396b751720d4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71981
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-12-08 04:26:58 +00:00
Antonio Maiorano b2bbb14bd4 Add TINT_SYMBOL_STORE_DEBUG_NAME option to help debugging the AST
If TINT_SYMBOL_STORE_DEBUG_NAME is 1, Symbol instances store a
`debug_name_` member initialized with the name of the identifier they
represent. This member is not exposed, but is useful for debugging
purposes.

Bug: tint:1331
Change-Id: Ia98e266aefc1ca26bbf30c6ece73d9eac8afdbd7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71780
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-12-07 14:43:17 +00:00
Antonio Maiorano cf3880201b Make HLSL validation run with same flags as Dawn
FXC is buggy, and I recently landed changes in Dawn to run with "/O0"
rather than /"O2" because of these bugs. Let's make sure Tint end-to-end
tests do the same. Also do the same when running against DXC.

Bug: dawn:1203
Change-Id: I1a30f16dee8306bd645d87b3ccb0cc87691c5972
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71800
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-12-07 14:40:47 +00:00
Ben Clayton c55c7715db Fix Kokoro ASAN builds
The VM has been updated to Kokoro 14.04, and now the docker instance
requires escalated privileges in order to run some sanitizer builds.

Change-Id: Icebbb1597dcdb67a854cb61ff7b0c0c11952b7f2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71921
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-07 13:54:19 +00:00
Ben Clayton 9c7b39f365 msl: Explicity validate against MSL 1.2
Fixed: tint:1327
Change-Id: I7d2e182f60c42894410500f393a1235d37efe5e1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71680
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-12-06 13:02:36 +00:00
Ben Clayton 05eedd81b0 writer/msl: Only use [[invariant]] on MSL 2.1+
This is not supported on older versions.
This behavior was agreed by the WGSL core group:
https://github.com/gpuweb/gpuweb/issues/893#issuecomment-745537465

Bug: tint:1327
Change-Id: I1a0459068c438e625ae9d99fe4a044a96f2db57e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71684
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-03 21:58:53 +00:00
Ben Clayton cc05d89820 writer/msl: Replace use of 'auto' with actual return type
Fixes MSL 1.2 error:
'auto' return without trailing return type; deduced return types are a C++14 extension

Bug: tint:1327
Change-Id: I5956aadf6b28b605b07c9681716ac4b3e31d804a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71683
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-03 21:50:23 +00:00
Ben Clayton c830130bb8 resolver: Fixes for bitcasts
Fix dependency graph traversal for bitcasts. These were not being traversed, leading to an ICE if the bitcast type was an alias, as the symbol was not resolved for later use by the resolver.

Add missing validation for bitcasts. We were permitting any bitcast that wasn't a being cast to a pointer type, when the spec only allows:
 * numeric_scalar to numeric_scalar
 * vecN<numeric_scalar> to vecN<numeric_scalar>

Add lots of tests.

Fixed: chromium:1276320
Change-Id: I9e5487ec7649ac543f73fc878e7e282bf932d8cb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71681
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-12-03 21:29:13 +00:00
Ben Clayton b9e8a0b87d writer/spirv: Add tests for automatic OpReturnValue
As requested at:
https://dawn-review.googlesource.com/c/tint/+/71604/5/src/writer/spirv/builder_if_test.cc#476

Bug: tint:1302
Change-Id: I661f877beb44f999e17f2769b4aa46b22180bbb9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71682
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-12-03 19:19:33 +00:00
Ben Clayton ea3eee9885 resolver: Migrate validation to behavior analysis
Migrate some of the validation logic over to use the results of behavior
analysis.

The most significant changes are:
* Unreachable-statements now consider merge-points of control flow. For
  example, if all branches of a if-statement or switch-statement either
  return or discard, the next statement will be considered unreachable.
* Unreachable statements are no longer an error, but a warning. See
  https://github.com/gpuweb/gpuweb/issues/2378.
* Statements that follow a loops that does not break, or have a
  conditional will now be considered unreachable.
* Unreachable statements produced by the SPIR-V reader are now removed
  using the new RemoveUnreachableStatements transform.

Some other new changes include additional validation for the continuing
block for for-loops, to match the rules of a loop continuing block.
The new cases this validation is testing for are not expressible in
WGSL, but some transforms may produce complex continuing statements that
might violate these rules. All the writers are able to decay these
complex for-loop continuing statements to regular loops.

Bug: tint:1302
Change-Id: I0d8a48c73d5d5c30a1cddf92cc3383a692a58e61
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71500
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-12-03 17:51:48 +00:00
Ben Clayton c270322884 writer/spirv: Fix trailing emission of OpReturn
writer::spirv::Function attempted to append a trailing OpReturn if the
function does not end with a terminating instruction. This wasn't
considering functions that have a non-void return type.

This has now been moved to spirv::Builder::GenerateFunction(),
where we can actually examine the function return type, and generate a
zero-expression to return if we need to.

Note: this was masked by WGSL validation that required all functions to
end with a return statement.

Bug: tint:1302
Change-Id: Iddfeda25a956622c318b8235dc6fc093a2a5c26d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71604
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-12-03 17:51:48 +00:00
Ben Clayton 2ec1393f31 main: Print the WGSL on reader/spirv error diagnostics
Just having a "error: blah" emitted without any additional context is not helpful without seeing the parsed SPIR-V as WGSL.

Change-Id: I6bf665f7fd3ce2637ec1ab020b2215f7fd5ee482
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71603
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-12-03 16:19:53 +00:00
Ben Clayton 3298625760 resolver: Implement Behavior Analysis
This change implements the behavior analysis for expressions and
statements as described in:
https://www.w3.org/TR/WGSL/#behaviors

This CL makes no changes to the validation rules. This will be done as a
followup change.

Bug: tint:1302
Change-Id: If0a251a7982ea15ff5d93b54a5cc5ed03ba60608
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68408
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-12-03 15:49:34 +00:00
Ben Clayton bf39c8fb19 sem: Replace SwitchCaseBlockStatement with CaseStatement
The SwitchCaseBlockStatement was bound to the BlockStatement of an ast::CaseStatement, but we had nothing that mapped to the actual ast::CaseStatement.
sem::CaseStatement replaces sem::SwitchCaseBlockStatement, and has a Block() accessor, providing a superset of the old behavior.

With this, we can now easily validate the `fallthrough` rules directly, instead of scanning the switch case. This keeps the validation more tigtly coupled to the ast / sem nodes.

Change-Id: I0f22eba37bb164b9e071a6166c7a41fc1a5ac532
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71460
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-12-03 15:23:52 +00:00
Ben Clayton 8e39ffd512 sem: Add constructor field to sem::Variable
Produces a direct SEM -> SEM pointer, reducing AST <-> SEM hopping.

Change-Id: I233b4c47d4e55b5f2c6e14ed08699a302b8fb64d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71321
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2021-12-03 11:42:43 +00:00
Brandon Jones f71784fc2b Transform texture_externals used in a user-defined function
Adds functionality and tests for performing the multiplanar external
texture transform on texture_external parameters in user-defined
functions.

Bug: dawn:1082
Change-Id: I15f23e639a6cd24ed3428055420908f05b69c0c6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70840
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-12-02 15:21:31 +00:00
Ben Clayton abf4f17b8e utils: Add copy constructor to EnumSet
Some versions of clang warn as error without this:

error: definition of implicit copy constructor for 'EnumSet<tint::ast::PipelineStage>' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
Change-Id: I02cee0b1f7b70d74f29da0067e888b50acf27ee1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71600
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-12-02 13:00:32 +00:00
Ben Clayton 62394b2492 utils: Add more methods to EnumSet
Add assignment operators and methods for adding, removing and operators for performing set arithmatic.

Change-Id: I13d30734354f503180f75480866b54034f647c2a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71320
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-01 16:17:00 +00:00
Ben Clayton 77e2c6f0b2 sem: Add Behavior to Statement and Expression
Nothing currently does the analysis to calculate these.

Change-Id: Ia2103102fbf36109f357aebf32cdfda24d6d8155
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68407
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2021-11-30 13:25:12 +00:00
Ryan Harrison 76fc6d61e9 Try #2: Update Mac version and remove stale experiment
Changing Mac version from 10.15 to 10.15|11

Also removes realms experiment, since it is no longer active and
lucicfg was emitting a warning about it.

BUG=chromium:1273569

Change-Id: I97308249c8cc21e677cbac9b34cd09aa4b471660
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71220
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2021-11-29 21:08:09 +00:00
Ben Clayton 8c30d752a0 resolver: Refactor Statement handling
Break up Resolver::Statement() into multiple resolver functions.
Move simple statement validation out to resolver_validation.cc

Change-Id: Ifa29433af0a9afa39a66ac3e4f7ca376351adfbf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71102
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-11-26 16:26:42 +00:00
Ben Clayton c5835eb4a0 test: Regenerated expected HLSL file
This new expectation file was added with a similar parent that changed the expected output.

Bug: tint:1112
Change-Id: Icb6175f68b6459385933d39e07460eb863ecb9ff
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71101
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-11-26 15:28:49 +00:00
Ben Clayton 0ea236f755 resolver: Forbid module-scope declarations from aliasing a builtin
Fixed: tint:1318
Change-Id: Ifcb1aced6885bebcf3eb883f39bfbd0871dae7b0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70663
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-11-26 09:56:19 +00:00
Corentin Wallez 9c97592628 Revert "Update Mac version and remove stale experiment"
This reverts commit 401d694d03.

Reason for revert: No Mac-11 in luci.flex

Original change's description:
> Update Mac version and remove stale experiment
>
> Moving Mac version from 10.15->11
>
> Also removes realms experiment, since it is no longer active and
> lucicfg was emitting a warning about it.
>
> BUG=chromium:1273569
>
> Change-Id: Ib0962a1330985da82336ea93cc9014c2439b452b
> Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71020
> Auto-Submit: Ryan Harrison <rharrison@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>

TBR=cwallez@chromium.org,rharrison@chromium.org,bclayton@google.com,noreply+kokoro@google.com,tint-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I66d3d1dbed04ecee2ebf8566e3eb126977728a1a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1273569
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71100
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-11-26 09:16:01 +00:00
Antonio Maiorano e2528e9297 Reland "HLSL: force FXC to never unroll loops"
Now that I've landed this change to Dawn to disable FXC optimizations:
https://dawn-review.googlesource.com/c/dawn/+/70700,, we can reland this
change. The Tint-into-Dawn roll was failing because FXC would miscompile
certain loops into infinite loops when not unrolled.

Also reland
test/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.hlsl

Bug: tint:1112
Bug: dawn:1203
Change-Id: I641d68864b833e0fbe3b117d397b89ae96482536
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71000
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-11-25 18:44:50 +00:00
Ben Clayton 91785d277b resolver: Fix bug in dep graph SortGlobals()
If we encounter a global twice, the stack vector was not popped, which could trigger false cyclic-dependency errors. Because the cyclic dependency did not actually exist, later logic could break, expecting to find a global->global edge which did not exist.

Fixed: chromium:1273451
Change-Id: I9d99f1aeeaea042d9ed847a878c4717803122240
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70980
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-11-25 18:07:57 +00:00
Ben Clayton 0079a597e6 test: Add a test case for tint:1321
It's surprising that the fuzzers didn't find this, but I've confirmed that at least one of the fuzzers will fail with this case.
By adding a e2e test case, this will be used as a seed for the fuzzer corpus.

Bug: tint:1321
Change-Id: Ibf4bfa50bf376ae4cba401dfc31a2498fa3b9eec
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70982
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-11-25 18:02:36 +00:00
Ryan Harrison 401d694d03 Update Mac version and remove stale experiment
Moving Mac version from 10.15->11

Also removes realms experiment, since it is no longer active and
lucicfg was emitting a warning about it.

BUG=chromium:1273569

Change-Id: Ib0962a1330985da82336ea93cc9014c2439b452b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71020
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-11-25 17:54:58 +00:00
Ben Clayton e0a560c8da transform: Don't consider type-ctor/casts as having side-effects
RemovePhonies was transforming:

_ = f32(1)
_ = vec2<f32>(1.0, 2.0)

into:

f32(1)
vec2<f32>(1.0, 2.0)

Which the resolver gets grumpy about, as these are expressions, not statements.

Fixed: chromium:1273230
Change-Id: Ie85d3cee705fa3f792db686c021d76331e241f17
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70960
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2021-11-25 16:10:28 +00:00
Ben Clayton 9e1f3e271c Remove test.wgsl, add to .gitignore
Accidental commit of my test file for checking tint behavior.
Add to the .gitignore file so I don't accidentally check this in again.

Change-Id: Ie67f04cc307fa180d3a65d867a1777d008be8e17
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70981
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2021-11-25 13:52:57 +00:00
Austin Eng 9756030d4e fuzzer: Implement BuildImpl for msl/hlsl Options structs
The default implementation of this was generating random data for
the underlying pointers of std::unordered_map, leading to crashes
when the map was accessed. This CL populates the map in a
structured manner with pseudo-random data.

Bug: chromium:1273001
Change-Id: Ic20ecab85bedba2a59587ebe4a5016be6e53e6f8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70701
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-11-24 16:22:18 +00:00
Ryan Harrison 1c1b9762ce Add tests for fuzzers::RandomGenerator
BUG=tint:1019

Change-Id: Ia462080877a97348c5589bfa71231a832a7ebfd3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70081
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-11-24 14:55:05 +00:00
Ben Clayton 066c175852 writer/hlsl: Prevent NPE on error
If the HLSL sanitizer errors, then there may be no ArrayLengthFromUniform::Result, so we check the pointer before attempting to dereference it.

Bug: chromium:1273230
Change-Id: I9575d20748720623a94ac86f45da14302b20440a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70740
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-11-24 00:08:28 +00:00
Shrek Shao fb3c1c4d4b Fix sem::Node forward declare
To unblock g3 tint import

Change-Id: Id6591dc210e06c93ca09f15056ba5cbccae7d2a9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70703
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-11-23 22:51:38 +00:00
Ben Clayton d1f0a14563 resolver: Track global uses in function decorations
Fixed: tint:1320
Change-Id: Ib92c37d4de0641d11e508be4d8e05d641e808be9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70662
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-11-23 21:46:48 +00:00
Ben Clayton b05e185a36 resolver: Support shadowing
Add transform::Unshadow to renamed shadowed symbols. Required by a
number of other transforms.

Replace Resolver symbol resolution with dep-graph.

The dependency graph now performs full symbol resolution before the
regular resolver pass.
Make use of this instead of duplicating the effort.

Simplfies code, and actually performs variable shadowing consistently.

Fixed: tint:819
Bug: tint:1266
Change-Id: I595d1812aebe1d79d2d32e724ff90de36e74cf4b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70523
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-11-23 20:45:51 +00:00
Ben Clayton e524ee1813 transform: Combine InlinePointerLets and Simplify
They are always used together, and can actually be simplified when
combined.
This transform cannot currently deal with shadowing, and will need
need to depend on a new 'unshadow' transform.

Fixes a long-standing bug where we'd get an ICE if we attempt to inline
a pointer let declaration with side-effects in a for-loop initializer.

Fixed: tint:1321
Bug: tint:819
Change-Id: I236fed688e33a4996e47310b5ece44c991b5249f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70661
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-11-23 20:45:51 +00:00
Ben Clayton f83ada8b5d resolver: Error on use of local decl in initalizer
`var x = x;`
`let y = y;`

Should not compile.

Bug: tint:819
Bug: tint:1266
Change-Id: I6944a8a95d49329ef754aea3374f20b0dc91e513
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70660
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-11-23 20:45:51 +00:00
Ben Clayton 93fc113837 reader/spirv: Remove test that only tests SPIR-V val
The error message has recently changed, and is causing rolls to fail.
I don't see any reason why we're testing SPIR-V val here. Just remove the test.

Bug: tint:912
Change-Id: Ia24f81a8cc86edafe893493279f7aaa73f1d746a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70666
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-11-23 20:31:37 +00:00
Ben Clayton a40e45522b intrinsics: Deprecate isNan, isInf, isFinite, isNormal
These have all been removed from the spec as we cannot guarantee they will behave as expected on the various backends.

Bug: tint:1312
Change-Id: I9d7d81cfdc44489fffe08c5183ed8da84901a024
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70665
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-11-23 18:57:57 +00:00
Ben Clayton 7cff4c8745 test: Update expected output of FXC bug
Looks like this should have been part of bc5d8f6b

Bug: tint:1112
Change-Id: I62e98bbb5f8ca29a171d5d5baa65af55b3a090d4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70664
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-11-23 18:57:57 +00:00