Commit Graph

6876 Commits

Author SHA1 Message Date
Ben Clayton db5d2ea4f2 tint/writer/wgsl: Emit inferred-type arrays
Bug: tint:1628
Change-Id: If0907ee7c4dc3d0216aba0282dc2c5203a3ea727
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97590
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-08-01 18:11:25 +00:00
Ben Clayton 4a65620716 tint/resolver: Handle array() constructors
If the array constructor has no explicit type and count, infer from the
arguments.
Implement and test array materialization.

Also:
* Change sem::AbstractNumeric::IsConstructable() to return true. This
  has changed in the WGSL spec.
* Fix the test-helper builder for DataType<array<N, T>> - it was
  incorrectly calculating the array size.

Bug: tint:1628
Change-Id: I0ec4e55b469ca6423b4d1848f27bb11df4fa683b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97663
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2022-08-01 17:36:54 +00:00
Antonio Maiorano 70a43fa5b9 tint: Fix doxygen error.
Change-Id: Ibca03d2838aac894ccd46a6999f2d8ab745ed15b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97881
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-01 17:25:44 +00:00
Antonio Maiorano 239a92d2d0 tint: transform::RemovePhonies: skip builtins with no side effects
This transform was attempting to remove builtins with no side
effects, such as a call with abstract int/float args, which is unhandled
by this transform. For example, this would cause the transform to ICE:

_ = clamp(1, 2, 3);

Fixes ClusterFuzz issue crbug.com/1348739.

Bug: chromium:1348739
Change-Id: Ie355eb36c6c020417c2d93f2dc434c11dbb72d1f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97880
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-08-01 17:21:54 +00:00
Ben Clayton 6315a27778 tint/resolver: Tidy up type_constructor_validation_test.cc
Rename tests to remove redundancy.
Add missing 'Source' flavoured constructors to ProgramBuilder. Use them.

Change-Id: I9a41db2ebc8fdc12e2654836247370844990272a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97662
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-08-01 17:18:04 +00:00
Ben Clayton bf32bd4e96 tint/ast: Tighten AST definition of runtime-sized array
Just checking whether the count is nullptr is not sufficient to know
whether the array is fixed-size:

`array` represents a infered type, infered fixed-size array
`array<T>` represents an explicit type, runtime-sized array
`array<T, N>` represents an explicit type, explicit fixed-size array

Bug: tint:1628
Change-Id: I03f547078c015d1d2a8a38308bb5e41c733715ec
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97589
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-08-01 17:04:54 +00:00
Stephan Hartmann b779b2b13d IWYU: add cstdint for uint*_t in dawn::native::Blob
Bug: chromium:957519
Change-Id: Id7bf01df556fd9dd1ac7e587bfecd2a522122c9f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97841
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephan Hartmann <stha09@googlemail.com>
2022-08-01 16:02:43 +00:00
Ben Clayton 8c9cc86076 tint/resolver: Simplify / optimize Validator::Call()
The resolver has sensible places to dispatch to ArrayConstructor() and
StructureConstructor(), so don't do additional, unnecessary type
dispatches.

Change-Id: Id4edb1fc0dedf431d94507b1c3378bca164746a4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97588
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-08-01 15:19:54 +00:00
Ben Clayton 9c4d0c9410 tint/resolver: Split up the Array resolving logic
In preparation for array constructors that can infer type and count
based on constructor arguments.

Bug: tint:1628
Change-Id: I9f12d7a30de232cf0d34ed7e1a356dd5b92d26d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97587
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-07-31 19:33:04 +00:00
Yunchao He 122322b532 D3D12: Mitigate the security issue for texture corruption
2D Array texture might corrupt on some devices, making out-of-bound
texture access and memory information leak from another texture.
This is a critical security issue.

This change aim at mitigating the security issue via allocating
sufficent extra memory for each texture allocation for 2D array
texture on such devices.

Bug: dawn:949

Change-Id: I3629eeb13be872b2107effa55539e5c24522d0fc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96220
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-07-30 07:00:33 +00:00
Antonio Maiorano d060f36a1c tint: refactor Number<T> constants for highest, lowest, etc.
Bug: tint:1581
Change-Id: I3945e8d6021370e5b9837e77d29eeb46fcb97082
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97560
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-07-29 17:12:01 +00:00
Alastair F. Donaldson 00cc485add Regex fuzzer: add swizzles
Adds random swizzle operations to candidate vector expressions.

Also excludes certain common keywords from the set of identifiers that
are matched by the regex fuzzer, which will serve to make other
mutations performed by the regex fuzzer more preise.

Fixes: tint:1619
Change-Id: I10b6937f2c6f7341ec4a85d3b7ab56b3a36ef169
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96780
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Alastair Donaldson <allydonaldson@googlemail.com>
2022-07-29 16:29:21 +00:00
Ben Clayton 3ca6880caf tint/sem: Add conversion handling of array types
Required for arrays of, or nested arrays of abstract-numerics,
abstract-numeric vectors and abstract-numeric matrices.

Bug: tint:1628
Change-Id: Ib360c687163d3b88be780fdbc2d3eb1a93689520
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97585
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-07-29 14:46:41 +00:00
Ben Clayton 6fb5d379c2 tint/sem: Add const to StructMember 'type'.
This should be immutable once the sem tree is built.
Add a hacky const_cast in Resolver for now, as this is preferable to
having some things non-const in sem.

Bug: tint:745
Change-Id: I67ebce76730347c9543875ab8e1c21a47d71fd56
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97584
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-07-29 14:32:51 +00:00
Ben Clayton 8e0368e554 tint: Use utils::Vector for sem::Type::Common()
Instead of a C-style array.

Change-Id: Ieb3e9811cddf505bfd3b484b7f265459f7b0e66b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97583
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-07-29 14:15:01 +00:00
Ben Clayton 05a76183e0 tint: Split Resolver::Materialize()
Add Resolver::ConcreteType() to determine the concrete type for an
abstract-numeric (or composite of abstract).

Will be used to recursively infer the concrete types of abstract arrays.

Bug: tint:1628
Change-Id: Ia26b778abc827b531848b346f3e36938ad1a0470
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97582
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-07-29 13:19:12 +00:00
Ben Clayton ea84b9b072 tint/sem: Treat abstract-numerics as scalars.
This tracks the WGSL spec and reduces tint complexity.

Change-Id: I240a87fc7bb7f51d9e0ff180af4911cd00a33758
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97581
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-07-29 13:08:11 +00:00
Zhaoming Jiang 6fe1f515d4 tint: Add f16 support for parts of float built-in, part 1
This patch add f16 support for a major part of numeric built-in, and
implement corresponding unittests for resolver and backends. This patch
also enable f16 constant evaluation for unary minus operator, `atan2`
and `clamp`.

The following numeric built-ins are not supported yet:
* frexp
* modf

The end-to-end tests for f16 built-in are not added yet.

Bug: tint:1473, tint:1502
Change-Id: If807185617b21c510a1a9c371179a60800c4f875
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96722
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
2022-07-29 11:41:51 +00:00
Zhaoming Jiang 65dcdcbad0 tint/resolver: Clean up the SPIRV builder built-in unittests
This patch clean up the writer/spirv/builder_builtin_test. The major
changes are:
1. Group the testcases by built-in types (array built-ins, logical
built-ins, derivative built-ins, texture built-ins, etc.), and put each
types in a namespace, which may help reading the code.
2. Make sure all tests for numeric built-in use variable rather than
literal as input, in order to prevent supporting constant evaluation for
these built-ins break the unit tests.
3. Make float type (`f32` for now) explicit in test names for float
built-ins, to help implementing corresponding f16 testcases.

Bug: tint:1473, tint:1502
Change-Id: I6a1ad5fe24729d36d01f4fd570bfae5fae7351ed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97384
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-07-29 09:52:31 +00:00
Austin Eng bc285fb573 Rename CacheKey-related files to Stream
Bug: dawn:1480, dawn:1481
Change-Id: If61f0466d79e7759ed32c4ddf541ad0c17247996
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96904
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-07-29 00:36:21 +00:00
Austin Eng 79ab0d38bb Refactor [de]serialization functions out of CacheKey
Storing values into the cache will need to serialize and deserialize
values in addition to keys. This patch factors the serialization
utilities out of CacheKey into a more general "Stream" utility that
supports both input and output for serialization and deserialization.

Multiple files are not renamed to make parsing the diff easier. They
will be renamed in Change If61f0466d79e7759ed32c4ddf541ad0c17247996.

Bug: dawn:1480, dawn:1481
Change-Id: If7594c4ff7117454c1ab3d0afaeee5653120add8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96480
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-07-28 23:04:31 +00:00
Ben Clayton 316fb47afe dawn/node: Fix crash when using device after destroy()
Do not assign null to the wgpu::Device, as this will result in a nullptr dereference if you attempt to use the device after destruction.
The wgpu device correctly handles the error state of being used after destroy().

Fixes crashes of CTS tests:
'webgpu:api,validation,state,device_lost,destroy,*'

Change-Id: Ibee1078436efadf25f53735fbaa47d5fc5f74898
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97442
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-07-28 14:11:17 +00:00
Zhaoming Jiang 5af9ce441b tint/resolver: Clean up the resolver built-in unittests
This patch clean up the resolver/builtin_test. The major changes are:
1. Group the testcases by built-in types (array built-ins, logical
built-ins, derivative built-ins, texture built-ins, etc.), and put each
types in a namespace, which may help reading the code.
2. Rewrite the parameterized tests for float and integer built-ins, i.e.
numeric built-in overloads that take at least one float parameter and
all integer parameters. Built-ins that may take either float and integer
parameters, e.g. `abs`, `min` and `clamp`, are tested in both testsuits,
rather than having a third testsuits.
3. Stop checking the detailed candidate lists for float and integer
built-ins in parameterized testsuits.

This patch is helpful for implementing f16 built-ins.

Bug: tint:1473, tint:1502
Change-Id: I23d46a7b0ac2ef4a35d4aa462ede39025ba92158
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97382
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-07-28 13:14:40 +00:00
Ben Clayton 634a2430d8 tint: Use OverrideId for SubstituteOverride transform
Makes the tint public API use the same standardized way to identify overrides.

Bug: tint:1155
Bug: tint:1582
Change-Id: Ib25d9ed5d41844486581e088add24b9131f5f4bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97007
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-07-28 10:22:17 +00:00
Jiawei Shao 6d40394d89 D3D12: Add RENDER_ATTACHMENT usage on depth stencil textures on Intel GPUs
This patch adds RENDER_ATTACHMENT to the internal usage of D3D12 depth
stencil textures on Intel GPU because due to a driver bug we have to
initialize all the depth stencil textures with clear on Intel GPUs
before copying with them. Otherwise, if a depth stencil texture is created
without RENDER_ATTACHMENT usage, it will be initialized by copies, which
will still trigger the driver bug mentioned above.

Bug: 1487
Test: dawn_end2end_test
Change-Id: I78b9a3e2bc4098d6f3f2619644c80fd54dafd4e8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96985
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2022-07-28 02:14:00 +00:00
Jiawei Shao c44a577cd8 D3D12: use typeless format when CastingFullyTypedFormatSupported is false
This patch adds a check in the creation of D3D12 texture that we should
always use typeless formats for castable textures on the platforms where
CastingFullyTypedFormatSupported is false.

With this patch the test TextureViewSamplingTest.SRGBReinterpretation will
pass on Intel HD530 GPUs.

Bug: dawn:1276
Test: dawn_end2end_tests
Change-Id: I3f49b1c5aac9a0b881469968e22a5228aac9f35f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97184
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-07-28 01:48:38 +00:00
dan sinclair 3b2ce130b6 Stay within lex'd token bounds.
If we've walked to the end of the list, make sure we don't advance past
the EOF or Error tokens.

Bug: 1347943
Change-Id: I79c9254c39747cc0fb236ae92f8a0f3aa035a932
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97460
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-07-27 22:54:50 +00:00
Ben Clayton 08659d098d tint/ast: Generate ast::TexelFormat from intrinsics.def
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: I603c2a1bd238eb8d059f3d13238e5e48379de6af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97202
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-07-27 22:30:10 +00:00
Ben Clayton fe8e6ee682 tint/ast: Generate ast::BuiltinValue from intrinsics.def
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: Ic95177b8b60a51f0bcd6dab4138984f54f30ed6d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97201
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-07-27 22:21:30 +00:00
Ben Clayton 9a6acc419e tint: Add tint::OverrideId
This is a public API definition of a program-unique override identifier.

Bug: tint:1155
Change-Id: I6e55d43208e72a7a316557a89e2169d1b952f9bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97006
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-07-27 20:50:40 +00:00
dan sinclair b2306e27fc Drop line and col in intrinsic file
Change-Id: I282ada54b2ff9d5101dd1e8d4f2c01c3cf0b5a05
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97401
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
2022-07-27 19:47:36 +00:00
dan sinclair 8dbd4d0280 Add storage_class error reporting to generators and transform.
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>
2022-07-27 18:54:05 +00:00
Ben Clayton f330229de5 tint/ast: Rename Builtin to BuiltinValue
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>
2022-07-27 18:48:06 +00:00
Ben Clayton f50d56aa05 tint/ast: Generate ast::Extension from intrinsics.def
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>
2022-07-27 18:32:19 +00:00
Ben Clayton a1571ac403 tint/inspector: Use a std::optional for workgroup_size
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>
2022-07-27 17:05:56 +00:00
Ben Clayton a123b892a5 tint/ast: Generate ast::StorageClass from intrinsics.def
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>
2022-07-27 16:36:35 +00:00
Antonio Maiorano bf8ee35498 const eval of clamp
Bug: tint:1581
Change-Id: Icffaf023021e704b3beaacf35136a9d6263b31e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97221
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-07-27 15:02:25 +00:00
Antonio Maiorano 4de90f0bb1 const eval of atan2
Bug: tint:1581

Change-Id: I6268e291540bc8c712f6925f0bcb82c5873359c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96902
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-07-27 14:51:27 +00:00
Jiawei Shao d144805688 Skip tests about writeonly storage texture In render pass on ANGLE
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>
2022-07-27 10:09:25 +00:00
Jiawei Shao dd96f830f9 Test non-zero buffer copy offset in DepthStencilCopyTests
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>
2022-07-27 00:57:55 +00:00
Ben Clayton 48085845bd tint/ast: Clean up StorageClass enum
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>
2022-07-26 22:51:36 +00:00
Austin Eng ce8876074f Move code around in prep for CacheKey -> Stream refactor
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>
2022-07-26 21:01:24 +00:00
Ben Clayton c768e640f4 tint/intrinsics.def: Change language for enums
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>
2022-07-26 17:49:54 +00:00
Ben Clayton 02e9ce19ec tint: Make tint::ast::HasAttribute() accept multiple template arguments
Change-Id: I42efb3e603ac1d92c77e48784f7a9d010ade3047
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96021
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-07-26 16:40:15 +00:00
Corentin Wallez a55b686ded Remove unused dawn::native:🤘:GetMetalDevice
Bug: None
Change-Id: I07d4c2f4afce9202619e9def9dd1a214ae0906a4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97203
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-07-26 16:28:45 +00:00
Ben Clayton cde5009be3 tools: Shuffle 'intrinsic-gen' tooling
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>
2022-07-26 15:46:44 +00:00
dan sinclair 62c58a076c Stay at the EOF or Error token.
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>
2022-07-26 14:59:54 +00:00
Ben Clayton 0fba14e3c6 tint/val: Make DXC validation output stable
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>
2022-07-26 14:23:24 +00:00
Ben Clayton e9585f5548 tint/val: Fix HLSL validation with DXC
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>
2022-07-26 14:19:54 +00:00
Ben Clayton 958a4642f1 tint/resolver: Use utils::Vector in a few places
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>
2022-07-26 07:55:24 +00:00