Commit Graph

2936 Commits

Author SHA1 Message Date
Sarah Mashayekhi 3b04058d19 [validation] Update entry points validation v-0020
Remove irrelevant unit tests
Add/Update ValdiateEntryPoints function
Update known failure file

Bug: tint:296
Change-Id: I7d5c9c96fcca29f3e0a4c0315eb8ce869160a3ea
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32220
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2020-11-11 14:21:05 +00:00
Ben Clayton 1bbafa3445 wsgl parser: Tweak top-level unexpected token error message
I feel this reads better.

Bug: tint:282
Change-Id: I04fe42a0347ea050e93e5cf5ccae7259bc79bb58
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32283
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-11 14:16:45 +00:00
Ben Clayton b707258c8f wsgl parser: Fix tests that have multiple errors
A number of tests check the first encountered error is correct.
As the parser currently aborts after the first error, later errors are ignored.

Once the parser supports resynchronization, we'll emit multiple error messages, and these tests will start to fail. Fix them now.

Bug: tint:282
Change-Id: If8d0c41f030c652500b2e3b7284297b7a448d23e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32282
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-11 14:15:05 +00:00
Ben Clayton 54af8746ae wsgl parser: refactor statements()
Split out statments that are non-block (non-loops, etc) into a separate function.

These all end with a semi-colon, which is important for resynchronization on errors (coming up in another change).

Bug: tint:282
Change-Id: I0e58c4938f2bbe859dc6ffb8dcd45c8cf26101da
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32281
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-11 14:11:55 +00:00
Ben Clayton 00bc8ba88c wsgl parser: add expect_lt_gt_block(), use it
Reduces code, paves the way for multiple errors with resynchronization points.

Bug: tint:282
Change-Id: I68018ea8cabe4ec347afa21d1220126d6348d3d1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32280
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-11 14:10:25 +00:00
David Neto a4f49d91dc spirv-reader: support OpDot, OpOuterProduct
Change-Id: I39f2369572a340be1c4c7c6e4a2c8e0e9347d792
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32200
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
2020-11-11 13:59:24 +00:00
dan sinclair 6526bd4f73 [docs] Expand OpImageType documentation
This Cl adds the arrayed, depth and sampled flags to the OpImageType
examples.

Change-Id: Ib634268bfdf91f25c6f65c218d7a19b1340dcd72
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32321
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2020-11-11 01:49:28 +00:00
dan sinclair f7e152a3ab [msl-writer] Emit texture types
This CL adds texture and sampler type emission to the MSL backend.

Bug: tint:145
Change-Id: Iaab4d32b7fc6fedc1ffba16658f7800d6a502853
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32320
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-11 00:58:19 +00:00
Ryan Harrison dbcc1e0e80 [inspector] Extract Sampled Texture data
BUG=tint:257

Change-Id: I146591d052edfc959df33ccf235ea466cb59e59d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32260
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-11-10 22:30:56 +00:00
dan sinclair 2e6dc6037a [hlsl-writer] Emit texture types
This CL adds emission of the texture types from the HLSL backend.

Bug: tint:146
Change-Id: I378bd6d63719acfbedff887bdf280709dc981e8f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32221
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-10 22:10:56 +00:00
dan sinclair 84f827506a [spirv-writer] Hash names
This Cl hashes the OpName, OpEntryPoint and OpMemberName strings so we
are no longer passing user provided strings through into the resulting
SPIR-V binary.

Bug: tint:273
Change-Id: I0ca2c65d0cd2800c54d867ab698c7751c341778c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32061
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2020-11-10 21:49:56 +00:00
Ben Clayton 0573714bfd wsgl parser: Have Expect & Maybe operator-> deref
For values of type T* and std::unique_ptr<T>.

This allows us to replace all occurances of `res.value->member` with: `res->member`, which also asserts that `res` is not in an error state.

Brings the verbosity back down to pre-expect and pre-maybe levels.

Bug: tint:282
Change-Id: Ib00018affca53ac5e71ee2140e7e0cd607b83715
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32141
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-09 20:44:34 +00:00
Ben Clayton ab5dfee240 wsgl parser: Add ParserImpl::Maybe<T>
And use it for the non-ParserImpl::expect_xxx() methods.

Another step towards supporting multiple error messages, as the caller can now test to see if the specific call errored, or didn't match, instead of using a global error state.

Makes reading the control flow conditionals a bit easier too.

Change-Id: Ie8627b8499ec9079167965da2a566401cd6bd903
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32102
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-09 19:52:24 +00:00
Ben Clayton 653c4042e2 wsgl parser: Add ParserImpl::Expect<T>
And use it for the ParserImpl::expect_xxx() methods.

This is the first step towards supporting multiple error messages, as
the caller can now test to see if the specific call errored, instead of
using a global error state.

Also cleans up a bunch of code.

Bug: tint:282

Change-Id: I5e39fc33bd1e16620cee80d27fa728bc2af3387e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32101
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-09 19:39:34 +00:00
Ben Clayton f2e91857e1 wsgl parser: Migrate more code to use expect & match
Reduces code. Keeps things more consistent.

Bug: tint:282
Change-Id: Iff280880eb033fbcee4c6095c2da2d4af06835b5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32103
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-09 19:19:44 +00:00
Ben Clayton d60f0feee4 wsgl parser: expect for storage_class
All the call sites of `storage_class()` add their own error handling, so transform this into `expect_storage_class()`.

Also makes error messages more consistent.

Bug: tint:282
Change-Id: I5131acd84f91fc7494ed6b90965853b7d0fc37f0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32104
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-09 18:45:53 +00:00
Ben Clayton b8df12042a wsgl parser: expect for variable_ident_decl
All the call sites of `variable_ident_decl()` add their own error handling, so transform this into `expect_variable_ident_decl()`.

Also makes error messages more consistent.

Bug: tint:282
Change-Id: I0b5ac984018ba78896ddec0320636f5b5c4ad0b2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32100
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-09 18:41:23 +00:00
Sarah Mashayekhi 6512327f01 [validation] relax rule v-0002: return is mandatory for non-void functions
Bug: tint:302
Change-Id: Ia8a5cf1d36d5da6e2defdfff6c87f0d8a1a39b4a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32040
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-09 16:11:43 +00:00
Ben Clayton cd477e6b7b wsgl parser: Remove pointless nullptr checks
The `expect_` prefixes now clearly indicate when a method will internally error, or produce a valid AST object.

Verified by code coverage.

Bug: tint:282
Change-Id: Icbdae9db02bd48c69aec010a4f8fdc5a496125f8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32002
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2020-11-09 15:58:42 +00:00
Ben Clayton 7b750dc733 wsgl parser: Prefix methods with `expect_`
... for those that will internally error if the grammar does not match,
otherwise will always return a valid AST object.

This helps identify whether the caller is expected to error or not.

Bug: tint:282
Change-Id: Ied94f717526a63033f2e6c9e94fca43dbf0b8f05
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32001
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-09 15:49:33 +00:00
dan sinclair 8655b62207 Switch to GLSL450 memory model.
This CL updates Tint to use the GLSL450 memory model.

Bug: tint:63
Change-Id: Ia32851fbf8ee71233977a00386af5a91cb4b4b58
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31601
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2020-11-07 02:03:45 +00:00
dan sinclair 2c0cd311b8 Remove unused param documentation
Change-Id: I5e7a6deddfe49cf992a8066771a19ea77bed2618
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32041
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-07 01:30:25 +00:00
Ryan Harrison 110af53089 [inspector] Extract ComparisonSampler resource binding information
Adds in method to get resource binding information for comparison
samplers along with tests.

BUG=tint:257

Change-Id: I60f675347d2b9596308b1599d0a9b846615d547e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31980
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-11-06 17:53:45 +00:00
Sarah Mashayekhi 34f90a0097 [validation] make validator directory
Change-Id: Ia5caea84b48b37f0bee9582ee4c8514da4ee3978
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31981
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-11-06 17:31:15 +00:00
Ryan Harrison cc2305dd95 [inspector] Extract Sampler resource binding information
Adds in method to get resource binding information for non-comparison
samplers along with tests. Additionally some of the infrastructure for
implementing an equivalent comparison sampler code path is included.

BUG=tint:257

Change-Id: I5775bbd6233e1014bea54c5281d460544ab8383d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31920
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-05 20:09:50 +00:00
dan sinclair 795bf4c716 Fixup emitting duplicate globals in HLSL.
This CL fixes the issue with duplicate globals being emitted in HLSL if
used in multiple entry points. Tests are added for the other backends to
verify the issue does not exist there.

Bug: tint:297
Change-Id: I16d7504e8458fd375c6e1896758fe180ad963871
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31880
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-11-05 14:52:32 +00:00
dan sinclair eff1fb88fc [wgsl-reader][wgsl-writer] Update storage texture type name.
This Cl updates the storage textures to have `storage` in the name. So,
`texture_ro_1d` -> `texture_storage_ro_1d`

Bug: tint:286
Change-Id: I0a9ea02f15de2681d64e272cb42be51a940b6a13
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31840
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-11-04 22:19:33 +00:00
Ben Clayton 88dc2a4895 wsgl parser: Unify logic for all decorations
Parse all decorations with the same function, and create a
`ast::DecorationList`. Once the parser has progressed to the consumer of
the decorations, we attempt to downcast these to the required type,
erroring if they're the wrong kind.

While the error message could be improved further, this greatly reduces
the headscratching around crbug.com/tint/291.

Also knocks another 223 lines off parser_impl.cc.

Bug: tint:291
Bug: tint:282
Change-Id: I7506faeb56d876e5446d900c7c134669a9db6409
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31660
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-04 20:55:31 +00:00
Ben Clayton 786bc92002 wsgl parser: Add expect_block(), use it
`expect_block()` takes a start and end token, along with a function to parse a lexical block body.

This reduces code, keeps error messages consistent, and also gives us a future place to try resynchronising the parser so we can have more than one error emitted.

`expect_paren_block()` and `expect_brace_block()` are convenience helpers for providing the start and end tokens for common block types.

Bug: tint:282
Change-Id: I432a0301727b131a6fce875687b952dfc6889a4b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31736
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-04 20:08:51 +00:00
Ben Clayton b8791a5129 wsgl parser: Add expect_builtin()
Mirrors expect_pipeline_stage()

Bug: tint:282
Change-Id: I413c87b3684c1f5cfec0c4acd7d3a5160d4b24a9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31735
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-04 20:06:21 +00:00
Ben Clayton 32ba9b6722 wsgl parser: pipeline_stage() -> expect_pipeline_stage()
The only place that calls `pipeline_stage()` expects a stage to exist, so follow the `expect_` pattern.

Bug: tint:282
Change-Id: Ie18d24ed25a5f882e66a8e553e53b4fb52dcf6fa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31734
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-04 20:00:31 +00:00
Ben Clayton 53e619f7e9 wsgl parser: Use match() for more trivial patterns
Keeps error message consistent. Reduces code.

Bug: tint:282
Change-Id: I75ac50ef4a2435cfd42e95e851fa1f3524d1dd63
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31733
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-04 19:11:41 +00:00
dan sinclair a7e1492a6a [wgsl-reader][wgsl-writer] Support new sampled texture syntax.
This CL updates Tint to support the `texture_1d` format for sampled
textures. This is alongside the old `texture_sampled_1d` to allow
migration time.

The WGSL writer will always output the new form when converting to WGSL.

Bug: tint:286
Change-Id: I96f0308ad3c28ade96bcab7e24aa0b405e3c4f05
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31380
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-11-04 19:03:21 +00:00
Ben Clayton 4ce7a93202 wsgl parser: Add optional Source* out params
... to match() and expect_ident().

The uses of these two functions frequently want to know the souce of the matched token.

Bug: tint:282
Change-Id: I5279fc2e0834f48d419c6d8c9888189f6212c44a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31732
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-04 18:39:41 +00:00
Ben Clayton 0371cc4a8d wsgl parser: Use expect_ident()
Keeps error message consistent. Reduces code.

Bug: tint:282
Change-Id: Id6e219222a5967bb4b6d67e54816f669c38d0c19
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31731
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2020-11-04 16:34:10 +00:00
Ryan Harrison 77f7bb5b00 [inspector] Refactor to handle access control wrapped uniform-buffers
Updates the extraction code to assume that the StructType will be
wrapped by an AccessControlType. Tests are changed to match this
behaviour, and some minor naming clean up occured.

BUG=tint:257

Change-Id: I888ac2fae228531e956437afb937082a142d5736
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31780
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-04 16:08:00 +00:00
Ben Clayton 443039a58f wsgl parser: Use expect() for call r-parenthesis
Keeps error message consistent. Reduces code.

Bug: tint:282
Change-Id: Ibbbb98bb6f080dd338af7de415c6e86298d910e3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31730
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-04 15:48:20 +00:00
Ben Clayton 67c37197d6 wsgl parser: Use expect_[nonzero_]uint()
Keeps error message consistent. Reduces code.

Bug: tint:282
Change-Id: If89265dfe4356468d610dab931c906aa3260ce5a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31728
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-04 14:27:51 +00:00
Ben Clayton 0358d1bc1b wsgl parser: Use expect() for parenthesis checks
Keeps error message consistent. Reduces code.

Bug: tint:282
Change-Id: Ie5059599ed538bc589d594d7f16aa3db6774110b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31727
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-04 14:25:21 +00:00
Ben Clayton 5c58a06515 wsgl parser: Use match() for trivial patterns
Replace uses of peek, test, return-or-next with match().
Reduces code.

Bug: tint:282
Change-Id: I5e53601746e78efd007773cfea7109483c5e1630
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31726
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-04 14:21:51 +00:00
Ben Clayton f7fc63b8e3 wsgl parser: Use expect() for semicolon checks
Keeps error message consistent. Reduces code.

Bug: tint:282
Change-Id: Ifddb63b65d44427e0680bb25837fcb24ca854eb0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31725
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-04 14:17:51 +00:00
Ben Clayton d70f251188 wsgl parser: Add match() and expect() helpers
These will be used to simplify common parser patterns.

Bug: tint:282
Change-Id: Ia281b9aa66b98f4afc726e876fe8aeae5ff4f12c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31724
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-04 14:14:40 +00:00
Ben Clayton a47b277b26 Fix build
https://dawn-review.googlesource.com/c/tint/+/31760 landed just after https://dawn-review.googlesource.com/c/tint/+/31722, which added a new parameter to all decorator constructors.

Add the missing parameters to fix the build.

Change-Id: Id8360dd23dd59096ffdff0cf523c3323ac01b431
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31729
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-04 14:12:51 +00:00
Ben Clayton 88cd156fd9 wgsl parser: Replace set_error() with add_error()
Have slightly different overloads.

Long term we will want to be able to emit more than one error in a single parse.

Bug: tint:282
Bug: tint:291
Change-Id: Ide61c6ca75d45065e917b8fa16a097048397e31b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31723
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-04 02:23:10 +00:00
Ryan Harrison e862fde45c [inspector] Extract Read Only Storage Buffer data
BUG=tint:257

Change-Id: Ie9486726b2a164971d720f4496a87a0bd118ebde
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31760
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-11-03 22:19:50 +00:00
Ben Clayton 34a2eb1999 Add Source parameter to decoration constructors
Once a `Decoration` has been parsed, it'll be placed into a `DecorationList` and validated later in the parse. In order to create error diagnostics that refer back to the decoration, we need to know its source.

Bug: tint:282
Bug: tint:291
Change-Id: I38de708adbd041601b61d7e0a4d0402e9a2fe526
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31722
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-11-03 21:48:20 +00:00
Ben Clayton 35298800a6 ast: Have all decorations derive from base class
This is the first step in unifying the way decorations are parsed - i.e. instead of parsing decorations in different ways based on the predicted grammar that follows, we can parse decorations blocks in a unified way, then later verify what we have is as expected.

`StructDecoration` has been transformed from an `enum class` to a proper class so it can derive from `Decoration`.

Bug: tint:282
Bug: tint:291
Change-Id: Iaf12d266068d03edf695acdf2cd21e6cc3ea8eb3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31663
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2020-11-03 21:40:20 +00:00
Ryan Harrison 4735f01193 Move diagnostic/printer.h into the public API
Bug: None
Change-Id: I6dc33f3e589de80b225199fb01a0d80df774ada3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31740
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2020-11-03 19:13:50 +00:00
Ben Clayton 1a61e8613e formatter: Remove colon line prefix with no source
If a diagnostic has no Source information, don't start the diagnostic line with a colon.

Bug: tint:282
Change-Id: I80c4103e31556b2769d4b4c2a98dce21a2e1c233
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31662
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2020-11-03 18:27:29 +00:00
Ben Clayton 06c892a6ec diagnostic/printer: Print newline at end of tests
Otherwise other test messages will continue from the same line as the pretty colors.

Bug: tint:282
Change-Id: I14727b4faa7bbca490523cdd6941fa09dc6b514a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31661
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2020-11-03 17:56:29 +00:00