Commit Graph

2339 Commits

Author SHA1 Message Date
James Price 42220ba1b2 writer/msl: Hoist array and struct initializers
Pull the HLSL transformation out to a standalone transform that can be
used by both HLSL and MSL.

The new E2E tests do not yet pass for MSL because they produce array
assignments, which will be addressed in the next patch.

Fixed: tint:826
Change-Id: Idc27c81ad45e3d4ab96d82663927d2fc1384618e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52842
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-06-01 12:08:20 +00:00
Ben Clayton 1934f59427 src/sem: Generate ParameterUsage from intrinsics.def
Add a template file to generate parameter_usage.h and
parameter_usage.cc when using tools/intrinsic-gen

Bug: tint:832
Change-Id: I0ca4d092fdcda7d7846b968d43202f34450e516d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52644
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-01 10:00:10 +00:00
Ben Clayton 21f8772d65 src/sem: Generate IntrinsicType from intrinsics.def
Add a template file to generate intrinsic_type.h and
intrinsic_type.cc when using tools/intrinsic-gen

Bug: tint:832
Change-Id: I35ddfd497d6ab424dc49a18a9fd7e5eb7f8363b0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52643
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-01 09:55:00 +00:00
Ben Clayton 131cbcc6af [tools]: Add intrinsic-gen tool
Parses the intrinsics.def file, then scans the source tree for .tmpl files.
Using both of these, it produces source files for use in tint.

Bug: tint:832
Change-Id: I718114f4c540b9d620899e89d5758f048377ee04
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52642
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-01 09:38:30 +00:00
Ben Clayton 126adb1bbb [tools]: Minor intrinsic-gen changes
Have the resolver emit unique parameter names

Aslo: Update the parser tests to include ':' between parameter name and type.
This functionality landed a few changes up, but I missed this test from the change.

Bug: tint:832
Change-Id: If0d6d3a33bbcd8be4d70ee7182754158ed0da819
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52641
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-01 09:07:10 +00:00
Antonio Maiorano 39c05a902f Resolver: validate vector swizzle index is valid
Bug: tint:217
Change-Id: Ie8988b68f43914d1b05d982c8aa6f8b7346e2d8f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52800
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-01 00:37:40 +00:00
David Neto f534e9e692 spirv-writer: fix bool equality, inequality
Fixed: tint:743
Change-Id: I03b5d50d2bf3cd17b672401f1922bde35cbf2640
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52740
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-05-31 22:43:00 +00:00
Antonio Maiorano 4e6744f954 Fix Kokoro (linter failure)
Change-Id: I01e8957496cea7e406f6381517cc04aa4f05d8fb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52801
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-31 20:23:50 +00:00
Ben Clayton 52c37f354f Add tools/src/list: A dynamic typed list
Will be used by the lookup table package, which is used by the intrinsic definition generator.

Bug: tint:832
Change-Id: I72c2dc5e37678dbaffc1a32e1631caa8ba6c690e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52600
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-31 19:49:50 +00:00
Ben Clayton 16e86d3225 Add cmd/intrinsic-gen resolver and sem
Part of the new intrinsic definition parser.

Bug: tint:832
Change-Id: I701072def1a4ca723d10d08b44c1e271b9458212
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52540
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-05-31 19:45:20 +00:00
Ben Clayton 646f4a9958 ast::AccessControl: Remove 'Only' suffix from enums
As requested in:
https://dawn-review.googlesource.com/c/tint/+/52503/1..3/src/intrinsics.def#38

Bug: tint:832
Change-Id: I88881d0654305cdbc6c05256e227a3b048fbff29
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52640
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-31 19:40:30 +00:00
Ben Clayton 3264765bc2 [tools] Move getProjectRoot() out to fileutils.
Add tests.
This is going to be used by intrinsic-gen, a new tool

Bug: tint:832
Change-Id: Ib22ffa88a699be9c8dfdf3f8f6e32cff4ffc88e3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52602
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-31 19:40:00 +00:00
Antonio Maiorano c91f8f2822 Implement addition and subtraction of float matrices
Bug: tint:316
Change-Id: I3a1082c41c47daacf0220d029cb2a5f118684959
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52580
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-31 15:53:20 +00:00
David Neto 34c58a932c spirv-writer: refactor getting GLSLstd450 import
Change the GenerateGLSLStd450 method to GetGLSLStd450 and have it
return the import id.  That's the only interesting use.

Change-Id: I4fc70e702af160bc797680e5e75e9742e9e24f16
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52421
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-05-31 15:01:20 +00:00
Ben Clayton 8dd465a6f4 match/match_test.go: Fix import
This test was not building, as relative imports are not allowed when using modules

Change-Id: I661870c0d676029a782fe2a05acb98d4544fbb95
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52502
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-31 09:48:48 +00:00
Ben Clayton 6cf2fd42c5 Add cmd/intrinsic-gen parser and ast
Ground work for the new intrinsic definition parser.

Bug: tint:832
Change-Id: I0aff7f8cf5db4b6aa3a56939b944a37abc360cc7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52501
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-31 09:48:48 +00:00
Ben Clayton c95e05784d Add cmd/intrinsic-gen lexer and tokens
Ground work for the new intrinsic definition parser.

Bug: tint:832
Change-Id: I341ae11e36ef7af96ce7d01609a96e2c02425e87
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52500
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-31 09:48:48 +00:00
Ben Clayton d78f55390d Add src/intrinsics.def
The definition file for the WGSL intrinsics.
Will be parsed by a new `intrinsic-gen` parser to generate the IntriniscTable and tests.

Bug: tint:832
Change-Id: I3c523b6d86faa59150e2b6fb302d27c06f0e3cbe
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52503
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-05-29 18:19:38 +00:00
Antonio Maiorano eaed2b6ce2 Add support for binary arithmetic expressions with mixed scalar and vector operands
Bug: tint:376
Change-Id: I2994ff7394efa903050b470a850b41628d5b775c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52324
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-05-27 21:07:56 +00:00
David Neto d5f4ea22f0 wsgl-writer: emit inf, nan, subnormal as hex float
Signed zeros are emitted.
Subormal numbers are emitted as hex float.

Handling Inf and NaN is unresolved in the spec.
See https://github.com/gpuweb/gpuweb/issues/1769

NaN tests are disabled, due to platform dependence.
Windows x86-64 seems to always set the high mantissa bit
on NaNs.

Fixed: tint:76
Change-Id: I06c69b93b04c869a63ec2f574022996acc7a6dbe
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52321
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-05-27 20:46:46 +00:00
Antonio Maiorano 0131ce2205 Resolver: merge binary expression validation and resolving logic together
This avoid duplicating the logic in two places, and makes it easier to
implement according to the spec.

Bug: tint:376
Change-Id: If62f508e2c76b5b661e66aae9ff20b8e874a65d8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52323
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-05-27 18:25:06 +00:00
Ben Clayton 25b7d4064f reader/spirv: Handle parser error
MaybeEmitCombinatorialValue() didn't check that MakeOperand() or RectifySecondOperandSignedness() didn't error, leading to ICEs.

Bug: crbug.com/tint/804
Change-Id: Ic78487a70a591e718c7b5936c6678e7a19c4b626
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51927
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-27 17:05:47 +00:00
James Price 564000fdd3 Remove deprecated functionality
The following deprecated features are no longer supported:
- frag_coord builtin
- sample_mask_in and sample_mask_out builtins
- void keyword
- const keyword

Fixed: tint:677
Fixed: tint:699
Fixed: tint:714
Fixed: tint:715
Change-Id: I40ce9711310e70e62465f58f2a7f4d959039e307
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52041
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-05-27 17:03:27 +00:00
James Price cbd3bbc6d7 Disable MSL tests that fail to validate
Change-Id: Iaf31627798a83625a075e529aa3886cf84b164b1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52040
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-05-27 16:48:57 +00:00
Antonio Maiorano 4e848d76d0 Simplify Expr_Binary_Test_Invalid
Previous logic relied on the fact that for most operations, for a given
lhs type, there was exactly one rhs type allowed, except for
multiplication. This is no longer true in the spec, so making this test
work is more complex now. Instead, we simplify the test by having it
take the cartesian product of all possible (type * type * op), and
skipping any triplet not found in the all_valid_cases table.

Bug: tint:376
Change-Id: Icc76158823630e34dc8f25dfb0a0827545693108
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52322
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-05-27 15:57:57 +00:00
James Price 5102f87e38 writer/msl: Add parentheses for member accesses
The LHS should be wrapped in parentheses if it has lower precedence
than the access. This fixes issues with pointer dereferences followed
by member accesses, where we were previously generating *a.b.

Fixed: tint:831
Change-Id: I8a194ad4f54c80a01c24eb983ec8064037575216
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51963
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-05-27 14:15:47 +00:00
David Neto 42d89ca199 spirv-writer: support isFinite
Fixed: tint:157
Change-Id: I7b9af49edd44cbd8feb85fe637b82ac76a225e50
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52420
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-05-27 04:17:06 +00:00
James Price 7a47fa8495 writer/msl: Handle private and workgroup variables
Add a transform that pushes these into the entry point and then passes
them by pointer to any functions that need them.

Since WGSL does not allow non-function storage class at
function-scope, add a DisableValidation attribute to bypass this
check.

Fixed: tint/726
Change-Id: Ic1f4cd691a54c19e77a60e8ba178508e4249bfd9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51962
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-05-26 15:41:02 +00:00
James Price 61e573663d CloneContext: Add InsertBack()
Inserts a new node at the end of a (potentially empty) list.

Change-Id: Ibd487b995aee4a3ae2c3d17b5eb6e8562c43a1c4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52320
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-05-26 15:12:12 +00:00
Ben Clayton 61fbf13d25 CloneContext: Add InsertFront()
Inserts a new node at the start of a (potentially empty) list.

Change-Id: Ie2896fa3e1beabeb89f64e69a84091986ffbf7a2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51369
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-05-26 11:31:32 +00:00
Ben Clayton 81cbe07c12 Fix doxygen warnings
Change-Id: I7c3b685a5313f30e5d6cf20bc958e9876856a56d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51926
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-05-25 20:20:22 +00:00
Ryan Harrison 4fe6cb98e2 Migrate Linux CQ from Xenial to Bionic
BUG=chromium:1212166

Change-Id: I605fd926e0235da4f8e5b60bd471971dc1bded32
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52021
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-05-24 08:32:55 +00:00
James Price bcefe46f44 sem: Track function callsites in sem::Function
This will soon be used by a new MSL sanitizing transform.

Change-Id: I254c0d26a843cf6153dc8d146389d09b615e8d89
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51961
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
2021-05-22 12:48:24 +00:00
James Price 28ec968b4f ast: Use IdentifierExpression for call targets
They are always identifiers, and this removes unnecessary type casting
from usages of CallExpression::func().

Change-Id: I7a11dc10658abab578395e20ad830cd5bc5a5b71
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51960
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-05-22 12:42:14 +00:00
James Price e5fdd58352 writer/msl: Emit const on array and ptr parameters
This fixes issues with passing constant arrays to functions.

Change-Id: I6e2f1c3f64df836c0b6a55ab925cf3c2bc317733
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51861
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-05-22 12:40:04 +00:00
Ben Clayton ed86bf99b0 Add transform::Simplify
Performs basic peephole optimizations on the AST.

Use in transform::Hlsl.

Required to have the DecomposeStorageAccess transform operate correctly with the output of InlinePointerLets transform, specifically when declaring `let` pointer expressions to storage buffers.

Fixed: tint:221
Fixed: tint:492
Fixed: tint:829
Change-Id: I536390921a6492378104e9c3c100d9e761294a27
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51921
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2021-05-21 21:01:23 +00:00
Ben Clayton 7b0c5e880e samples/main: Print the WGSL on error
A diagnostic is not very helpful without the surrounding code.
This is especially useful when debugging issues with the SPIR-V reader and post-transform.

Change-Id: Idfeeaebf0cf0be98093838f8c8ad8bca4866b5b0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51922
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-05-21 20:49:33 +00:00
David Neto 8fb6402c98 Clarify NumCoordinateAxes
Change-Id: Ie8a4e31c7f0440e3285827d0a592427a8be3ba0d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51804
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-05-21 20:25:53 +00:00
David Neto e92a1ae4ac Remove duplicated tests on ast::TextureType
Those tests already exist under src/ast.

Add a test of sem::Texture::dim() instead

Change-Id: I4b77d46b9a4e3aca8292d64e2477bb002ab5c1cb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51805
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-05-21 19:40:23 +00:00
David Neto 9d555d1621 spirv-reader: support textureSampleCompareLevel
- Translates from OpImageSampleDrefExplicitLod, but the Lod must
  be a constant 0, or the reader issues an error.
  The requirement for Lod 0 is a constraint from Metal, inherited
  by WGSL.

Fixed: tint:425, tint:482
Change-Id: I8fdf10dbd9c5ac3e24398519a28202c84677c38d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51803
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-05-21 19:17:33 +00:00
Ben Clayton a53a3b8c19 test-runner: Add option to limit number of threads
Fixed: tint:830
Change-Id: I46696d0f72760549743f95a35ea21fef96269146
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51924
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-21 18:02:33 +00:00
Antonio Maiorano 6cf7f2eca5 Remove ast::AccessControl::kInvalid
Also spruce up texture validation tests so that they validate error
messages.

Bug: tint:805
Change-Id: I6c86fc16014b127a7ef8254e5badf9b5bed08623
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51860
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-05-21 14:32:38 +00:00
Ben Clayton ee0b69ce53 test: Add expected files for HLSL tests that pass
Change-Id: Ieb1999c0a73eb346bbf38df1b5081398bddba40b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51920
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-05-21 13:57:48 +00:00
Ben Clayton ada560b289 writer/hlsl: Fix continuing block emission
Inline the `continuing` block in the places where `continue` is called.

Simplifies the emission, and fixes emission of `let` statements in the loop.

Also fix random indenting of intrinsic functions.

Fixed: tint:744
Fixed: tint:818
Change-Id: I06994dbc724bc646e0435a1035b00760eaf5f5ab
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51784
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-05-20 21:31:37 +00:00
James Price 0c978e9bbb writer/msl: Fix array type emission
Add a special-case for pointer-to-array types, where the * and the
variable name need to be enclosed in parentheses in between the array
element type and the size.

Move the `const` qualifier to before the array size.

Add E2E tests to cover all non-handle types used in various places.

Fixed: tint:822
Change-Id: I93b7d6867f92397aa47838ab2c94530b6e634617
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51823
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-05-20 21:20:47 +00:00
Ben Clayton 351ac4a009 transform::VarForDynamicIndex: Operate on matrices
Much like arrays, the SPIR-V writer cannot cope with dynamic indexing of matrices.

Fixed: tint:825
Change-Id: Ia111f15e0cf6fbd441861a4b3455a33b82b692ab
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51781
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-05-20 18:16:07 +00:00
James Price 6c582778cf writer/msl: Simplify type constructor generation
The special-case for zero-valued constructors is unnecessary, as an
empty initializer list already correctly zero-initializes for all
types. This was causing an additional {} to be emitted for empty
structures, which the MSL compiler rejects.

Fixed: tint:821
Change-Id: Ib48c73eadef15b517e14b248229ecfbbfeb13f81
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51822
Commit-Queue: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-05-20 16:45:47 +00:00
Ryan Harrison ba1fb84855 Reland updating manually generated configs
These configs match the output of the new Starlark generated configs
that are being worked on. Landing these in advance to a) confirm that
they working, and b) make the patch using Starlark a no-op from the
config contents perspective.

Contains f3dcbf5c5c and
dffb68e49d that were reverted.

BUG=tint:693

Change-Id: Idf03edac2d318695a8088b9f779803b431da9e8c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51820
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-05-20 15:26:48 +00:00
Ben Clayton 22d891c6c4 sem: Add FunctionBlockStatement
BlockStatement for the root block of a function

Add some basic tests for this lot.

Bug: tint:812
Change-Id: I26b65717798cbff576a44bd78fbcb5c8f0d013e6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51368
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Alastair Donaldson <allydonaldson@googlemail.com>
2021-05-20 15:17:08 +00:00
Ben Clayton 19d3205e15 Remove typ::TypePair.
You've helped us bridge two worlds.
Good Night, Sweet Prince.

Fixed: tint:724
Change-Id: I0b4ba960e9cf5dcff7df9d2f332ea36d6663c440
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51667
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-05-20 15:10:48 +00:00