Commit Graph

2990 Commits

Author SHA1 Message Date
David Neto 6d67dad7fe spirv-reader: Ignore duplicate decorations
Vulkan allows them, but WGSL does not.

A duplicate decoration is purely redundant.
A parameterized decoratio with different parameterization is
an inconsistency and a semantic error, at least for currently defined
SPIR-V decorations.

So for each target, only take the first decoration of each kind.

Fixed: tint:1337
Change-Id: I6ed5c39cf2e213c695cb8217ed1b97814da3db56
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72500
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-12-13 17:54:21 +00:00
Antonio Maiorano d733fdb85c HLSL: work around FXC failures when dynamically indexing arrays in structs
FXC fails to compile code that assigns to dynamically-indexed fixed-size
arrays in structs on internal shader variables with:

error X3500: array reference cannot be used as an l-value; not natively
addressable

This CL detects this case, and transforms such assignments into copying
out the array to a local variable, assigning to that local, and then
copying the array back.

Also manually regenerate SKIPs for HLSL/FXC after this change, which
fixes 30 tests. Also exposes some "compilation aborted unexpectedly" now
that  "array reference cannot be used as an l-value" has been fixed. For
tests that fail for both DXC and FXC, updating SKIPs to the DXC one to
help distinguish actual FXC bugs from valid errors.

Bug: tint:998
Bug: tint:1206
Change-Id: I09204d8d81ab27d1c257538ad702414ccc386543
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71620
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-12-13 15:55:11 +00:00
David Neto 5923803f7e Document that ast::Variable::type can be null
Change-Id: I7a29c1de49cbd082a5c3e0fc4bdcdead9dd2c956
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70340
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-12-10 21:51:05 +00:00
Ben Clayton 30d55fabc9 docs: Move OT changes to M99
These missed the M98 boat.

Change-Id: Ic15e8323457d78eea1ea3c59c104b2901c883b1b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72321
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-12-09 22:53:14 +00:00
David Neto 9c179a601c wgsl-reader: hex prefix only is an error
These are errors:

    let a = 0x;
    let b = -0x;

Fixes: tint:1338
Change-Id: I9d26ad66e32deb954550c0ecfbda0a9005bcd380
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72380
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 22:35:44 +00:00
James Price 1461b032aa glsl: Don't emit structs with runtime-sized arrays
The GLSL emitted for these was invalid, and we don't need these
structs since they're only used as the store types of buffers, which
are handled elsewhere.

Change-Id: I17c15e408b5c36e9b895e5950528a6d02d1802a6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72381
Reviewed-by: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 18:54:35 +00:00
James Price 57489928c6 test: Remove [[block]] for recently added tests
This attribute is now deprecated, and the warning is causing these
tests to fail.

Bug: tint:1324
Change-Id: I0665c9f3b657c8cb56e2252a23eb6184ea876075
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72420
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 18:54:35 +00:00
Ben Clayton 4e6e113816 reader/spirv: Allow leading underscore in identifiers
Bug: tint:1292
Change-Id: I738c981f503545075115101a3ead30941a19d95a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72320
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-12-09 16:55:04 +00:00
David Neto 01e4b54497 null character on input is an error
Fixes: tint:1311
Change-Id: Id80adc2c14c6d2cd5ee884e081d1d84f021e6620
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72200
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-12-09 15:57:30 +00:00
James Price 170a50353c reader/wgsl: Deprecate the [[block]] attribute
Bug: tint:1324
Change-Id: Ic8e9cd4a2e924498397659b5d23d6ac6d602588d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72088
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-12-09 15:45:03 +00:00
James Price a5d3986a0a tests: Stop using the [[block]] attribute
This has been deprecated and will soon be removed.

Bug: tint:1324
Change-Id: If5dbbc3a40d7591591fb2802dbe9c8dd5f96d299
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72087
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 15:45:03 +00:00
James Price 3530c6bf06 reader/spirv: Do not generate block attributes
These are no longer necessary and will soon be deprecated and removed.

Bug: tint:1324
Change-Id: I3fa076e7ce5eb36466d24c80fd1c83658c28c5ab
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72086
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 15:45:03 +00:00
James Price ebdfa5d303 transform: Do not generate block attributes
These are no longer necessary, and the attribute will soon be
deprecated and removed.

Bug: tint:1324
Change-Id: Ia3cdd4e9d9bd7bca45d734a06466993199b3e838
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72085
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 15:45:03 +00:00
James Price 7c0693d9fe Remove {ast,sem}::Struct::IsBlockDecorated()
No code should rely on the presence of the block attribute, which will
soon be deprecated and removed.

Bug: tint:1324
Change-Id: I868d5e795e66a93bdf99b94389c07dec98cb0ec2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72084
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-12-09 15:45:03 +00:00
James Price c7c80c053d glsl: Always emit structures
Skipping those that are block-decorated is not correct, as
block-decorated structures can also have non-buffer usages. This is
even clearer now that WGSL has removed the block attribute.

Bug: tint:1324
Change-Id: I6484766a5c541d39e2dc08beb3ae7b889759a3fb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72083
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-12-09 15:45:03 +00:00
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