Fix `IsAbstract()` so that it doesn't consider most-nested element types.
Add `ElementType()` and `DeepestElementType()` helpers.
Add `OverloadUsesF16` as a helper for https://dawn-review.googlesource.com/c/dawn/+/96722.
Simplifies template code.
Change-Id: Iff5a9a7258caea06e00ee37c29e5298d9c35b799
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97361
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
With the experimental push_contants PR we will have AST which can not be
generated by all backends. Historically this would trigger the fuzzers as
an error. This CL changes the storage_class to an error from an ICE and
updates the code so the fuzzers only error on ICE or Fatal errors.
Change-Id: I2039a3d4cb457d805d38e2d6a790121318d1f07d
Bug: tint:1620
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97281
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This is what it is called in the spec, and avoids confusion with the builtin functions.
Change-Id: I5cd4a250351c10928e90b640a8c68c7834bcf2a0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97200
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Emit unit tests for parsing and printing.
Emit benchmarks for parsing.
Uses intrinsics.def as a single-source-of-truth.
The generators provide a way to optimize the enum parsers.
Change-Id: I7f13128f510b2156c2ef724c89df7bb85dae17ed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97151
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
No-value represents a workgroup size that is derived from an override-expression.
Bug: dawn:1504
Bug: chromium:1346929
Change-Id: Idf6caa9d052aa56e8ef1913d16d1f68d2c5844ed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97362
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Emit unit tests for parsing and printing.
Emit benchmarks for parsing.
Uses intrinsics.def as a single-source-of-truth.
The generators provide a way to optimize the enum parsers.
Change-Id: I1669c123d375f24aca45f3ea4abf04d7892673c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97150
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This patch modify the test/tint/builtins/gen/gen.wgsl.tmpl to emit
enable directive for dot4I8Packed and dot4U8Packed built-in function.
The expectaion files are added.
Bug: tint:1497
Change-Id: I53331695fe2e6609858e94bc261383ba3028d77c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96640
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
StorageTextureTests.WriteonlyStorageTextureInFragmentShader and
StorageTextureZeroInitTests.
WriteonlyStorageTextureClearsToZeroInRenderPass starts to fail on
the bots after the latest roll of ANGLE, so we have to temporarily
suppress them.
Bug: dawn:1503
Test: dawn_end2end_tests
Change-Id: Id8abf7c0a5bd30e5de12c838f871e1ab896ab4fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97127
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
* Ensure that copyright years are preserved when regenerating.
* Add 'Split' function which maps to strings.Split.
* Add 'Scramble' function with messes with a string.
* Add 'Import' function which allows templates to be imported, allowing
for reusable macros.
Change-Id: Ib77f59a989cf55addcced3e337c9031062a83470
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97149
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Adds the "type" field to the websocket message sent
by the CTS JavaScript code with a value of
"TEST_FINISHED". This is in preparation for the
switch to using a heartbeat system for test timeouts
instead of a fixed timeout.
Bug: chromium:1340602
Change-Id: I886d89dbdfb1e3946dd8c59ecf23f9b18385b65e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97280
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@google.com>
Auto-Submit: Brian Sheedy <bsheedy@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This patch adds the tests on the buffer-texture copies with depth
stencil textures when buffer copy offset is not zero.
Note that the tests about texture-buffer copies with depth stencil
textures are temporarily skipped on D3D12 backends as there is still a
bug on the texture-to-buffer copies with depth stencil textures on some
D3D12 platforms. We will fix this issue in the next patch.
Bug: dawn:727
Test: dawn_end2end_tests
Change-Id: I1d92cca80945ad77506db5441c396ce3eea00cca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97180
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Remove unused enum entries.
Add a ParseStorageClass() function. Have the WGSL parser use this.
First step to standardizing the way we parse enum-backed token sets.
Change-Id: I31c02816493beeabda740ff43946edce097f5fd1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97148
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
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>