Moves code around to simplify viewing the diff for Change
If7594c4ff7117454c1ab3d0afaeee5653120add8
Bug: dawn:1480, dawn:1481
Change-Id: Iecfe4356b1a933a46741cec185008ca1d927c0a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96903
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Previously enum members were added to the global namespace, so that
overload template parameters could be constrained to a single
enum-entry without the need to declare a matcher. While this was a minor
convenience feature, it means that you cannot declare an enum with
members that share the same name as a type. This will be very common for
extensions, like 'f16' where 'f16' is the name of an extension and a
type name.
Change scoping so that enum members need to be fully qualified. Also
change the intrinsic syntax so that enums always need to use a matcher
for enums.
Change-Id: Ided91130e9df537d38dc8ecb41325c0992dea14b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97146
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
These were not marked as optional previously because it would mean that
C++ methods would look like void F(a = null, b, c) which is invalid in C++
because default arguments must be contiguous and at the end of the
signature.
This commit adds a special case when optional=true where no_default=true
still marks the argument as optional, but doesn't produce a C++ default
argument.
Fixed: dawn:1502
Change-Id: I1b648d37edb94b8412109fc0a06a91bbbd31b8c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97002
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
The headers have changed.
Change-Id: I45046ceb05d205015c3b462136ecf10c0057162e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97147
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Rename to 'gen', so that more templating can be added without having a confusing name.
Can now be run with './tools/run gen'
Move the bulk of the intrinsic-gen logic to `tools/src/tint/intrinsic`
Change-Id: I750989a5aa86272c10c2ad37adffe7def11c61f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97141
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
When the `next` token is requested, if we're already at EOF or Error
we can just return that token and stay at that index.
Bug: crbug:1347298
Change-Id: I1c31cf32a7030166c174d336455c7adabf97c6c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97220
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Replace the temporary file name with 'shader.hlsl', so that
skip-expectations can be stably re-generated.
Change-Id: I5ead2235e6e0d84ad67c8d90f8d06b812c8fd593
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97145
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Unlike on Windows, where command line argument splitting is done by the
callee, on 'nix systems, the arguments need to be split by the caller.
Fixes issues where validation was different on windows to other
operating systems.
Change-Id: If55738c431586f706e3edf0ac683661f34b53391
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97144
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Use the new vector type in some of the hot code paths of the resolver.
Bug: tint:1613
Change-Id: Ie56d8c96f73c9112f37934ad67e588513aafb982
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96282
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This CL removes the copies of the `Source` and, in some cases, the token
name in the parser implementation.
Change-Id: I91c0797244a19fa5a36d39029d02823a20cee0cd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97072
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
* Added a class template argument deduction guide (CTAD) to infer the
`T` and `N` template arguments. This lets you write `Vector{1,2,3}`
instead of `Vector<int, 3>{1,2,3}`. This is important as a mismatch
between the number of constructor arguments and the `N` template
argument can cause silent heap allocations, which we're trying to
avoid. The `T` deduction uses the same smarts as the return-type
deduction of `Switch()`, so:
* `Vector{1, 2.0}` would construct a `Vector<double, 2>`
* `Vector{i32, u32}` would construct a `Vector<const sem::Type*, 2>`
* Removed the Vector(size_t) and Vector(size_t, const T&) constructors.
This is a move away from the std::vector style API, but these are
rarely more efficient than calling Reserve() and Push(), as you remove
the redundant initialization. The main reason for doing this is to
remove ambiguity between `Vector{1}` and `Vector(1)`.
* Added support for covariance conversion
(`Vector<Derived*, N>` -> `Vector<Base*, N>`).
Only supports pointers to `Castable`, as this can only safely work
with single-inheritance.
* Added support for conversion of `Vector<T*, N>` -> `Vector<const T*, N>`.
This will remove pointless vector copies from the sem package.
Bug: tint:1613
Change-Id: I79b9f82d623f90afa14f8ba1613ee49cccceafeb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97020
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL updates the parser and lexer to pre-parse the token list and
then the parser works off the list of tokens. This allows the parser to
work with references to the tokens and not have to worry about them
going stale.
For any splittable token a placeholder token is injected after the
token. If the token ends up getting split the placeholder is overwritten
with the new type.
Change-Id: I5a8ccca15d8c14b5027df7dd2734be6753e46fa9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97070
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL updates match to compare against characters instead of strings.
If the prefix character doesn't match we stop checking for any
punctuation which starts with that character.
Change-Id: Ifddc1ff3f3936ab3a53c37e080394ed35dc2aecf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97065
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL expands the ASCII short circuit to add the number range and _
into IsXIDContinue.
IsXIDStart is updated to filter out anything less then the first
sequence after the (a-zA-Z) blocks as they won't be XIDStart but do cover
all of the common ASCII punctuation characters.
Change-Id: Ib839d9840f5a1ecc3d2e80774b11af2444e9f439
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97071
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This patch fix a nullptr dereference case in Validator::BuiltinCall,
which check if a no-return-value built-in is called in something other
than call statement. Such call may don't have a statement context at all.
Bug: chromium:1346830
Change-Id: Ieef02daa5c93a3ac253cd7a7366a53e0fc7887b1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96986
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
We saved the string in the lexer try_float for use in error messages,
then changed the message to not show the string. This CL removes the
creation of the float string.
Change-Id: I9bb381bebe31f25609c66d5ccda91de0277199cc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97069
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Our common case is ASCII characters but, because those come at the start
of the XID Start range they'll end up being checked _last_ as we binary
search through the range. This means we're getting the worst case
behaviour for our common character.
This CL adds a quick check for [a-zA-Z] at the start of IsXIDStart to
quickly determine if we're an ascii character.
Change-Id: Iae733b0e8a64c855764cf58c0563a407e6a81f7d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97068
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This VVL check seems either impossible to satisfy, or difficult due to
underspecification of the error in the Vulkan spec.
Bug: angleproject:7513
Change-Id: I82873fb41aa7f03413114ed6672ba2bebd98f009
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96982
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Also parallelize some of the more lengthy file generation steps
Bug: dawn:1479
Change-Id: I7674fca4958e4d9948e287008916c4b0d33e1ca1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97022
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Change tint's `--fxc` flag to take the path of the FXC compiler DLL.
Have tint attempt to validate with both FXC and DXC if `--validate` is
passed.
Fix the 'dirsWithNoPassExpectations' logic which looks like it got
broken with the tint -> dawn merge. It also incorrectly applied
filepath.FromSlash() on windows.
Change-Id: I0f46aa5c21bc48a2abc48402c41f846aff4a8633
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96800
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This Cl remoevs the address space names from the keyword list and
makes their parsing context dependant. The mechanism in the parser
is the same, we just change to looking for an `ident` in
`expect_address_space`.
`storage_buffer` is kept for now, this keeps the functionality the same.
Bug: tint:1621
Change-Id: I928a5472d8ac194b2bef2da56a224e9f4abb65a8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96905
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
The spec talks about initializers for `var`, `const` and `let`
constructs. The parser was emitting `constructor`. This CL updates
the terminology to match the spec in order to make searching for
answers easier.
Bug: tint:1600
Change-Id: Ic135856ba9afbfd2580b648d8f2e402059bac8be
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96906
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
This CL renames paren_rhs_stmt to match the new spec name of
paren_expression.
Bug: tint:891
Change-Id: I040137d8264916ce2fecce90edad97f622be354d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96940
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL adds a SubstituteOverride transform which will convert
an `override` into a `const`. The transform is provided a map of
(string, double) which matches what the WebGPU API accepts as
data for overrides.
Bug: tint:1582
Change-Id: I6e6bf51b98ce4d4746f8de55128666c36735e585
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96760
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>