Commit Graph

7152 Commits

Author SHA1 Message Date
Austin Eng 185fd3deca Add go tests to presubmit
Change-Id: I2d56a463cecf0b1bcb96c51ae134c6fa07d87b21
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100560
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-09-06 18:20:33 +00:00
Ben Clayton 8b4ed5093e tint: Fix / remove tests that access OOB
With constant indices.
Also fix the SPIR-V builder tests that did something completely different from the test name / comment.

Bug: tint:1665
Change-Id: I83537cf6e44ffcb14d54de52649d1f9da1ef7e1b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101182
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-06 17:43:23 +00:00
Brandon Jones 2b0fce7071 Revert "Implement maxBindingsPerBindGroup limit"
This reverts commit 4d67a883b6.

Reason for revert: Seems to be causing MSAN issues with the Dawn/Chromium roll?

Original change's description:
> Implement maxBindingsPerBindGroup limit
>
> Bug: dawn:1523
> Change-Id: Ifcf83f6836a5d7ed447080ccb033e4163970432e
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100706
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Brandon Jones <bajones@chromium.org>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: dawn:1523
Change-Id: I757457089be6af18dfce7f64c0da5d310351cece
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101401
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-09-06 17:38:03 +00:00
dan sinclair 72340d00ce Add location into `sem::Parameter`.
This CL adds a `location` value into the `Parameter` sem object.
This will be set if the parameter has an `@location` attribute
applied.

Bug: tint:1633
Change-Id: I55cb5cbda951f70d071ebe1400865b63af1fb20a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101065
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-09-06 16:05:54 +00:00
dan sinclair 766a458f53 Store location value into `sem::Function`.
This CL adds an optional location value to the `sem::Function`
which will store the resolved `@location` value.

Bug: tint:1633
Change-Id: I95130858d8a1cecae1389be74120da29fec2b448
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101063
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-06 16:00:13 +00:00
Ben Clayton c8278e5cbd tint/transform: Fix hasher return type
These should return `size_t`, not `uint64_t`.
Fixes x86 build.

Change-Id: I83125afc3bce9a9dab7d53c4818f9de3daf4cfb2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101320
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-06 14:53:33 +00:00
dan sinclair 97c9e0ba9f Store struct member location into the sem.
This CL adds the `@location` of a Struct Member into the
`StructMember` sem object as a `std::optional<uint32_t>`. The
resolver then populates the location value if an attribute is
found during resolution.

This will provide a place to store the evaluated expression value
for a location in the future.

Bug: tint:1633
Change-Id: I6f696968dddf95af1f933d96cdb4a7630badac2e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101062
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-09-06 14:41:16 +00:00
Ben Clayton d7d71889d8 tint: Add FriendlyName() to Program
Use this instead of ProgramBuilder::FriendlyName() in the Std140 transform.
If this were called, we'd ICE that the program ids wouldn't match the type, as the type belongs to the source program, not the target program builder.

Change-Id: I29066b18789493c231a89f7ee1dbc24d7e66d33f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101180
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-09-05 20:51:23 +00:00
Ben Clayton 0cd830c571 tint: Fix type is_signed_integer helpers which were ignoring abstracts
Abstracts are now considered scalars, so these should be returning true for abstract-integers.

Change-Id: If15f87932d412663d2aef4f9737675a8ece9e551
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101181
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-09-05 10:43:03 +00:00
Antonio Maiorano 3740ac6092 tint: implement const eval of binary divide
Bug: tint:1581
Change-Id: I72f7f34046086ad00d3bf8f21d67db831903d60b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100861
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-03 22:42:51 +00:00
Antonio Maiorano 679cf4f351 tint: HLSL and GLSL backends now emit 0 for inf and nan
Bug: tint:1581
Change-Id: I62dcde177c3b82408cd8d737526d10d481b48a17
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101240
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-03 21:43:01 +00:00
Antonio Maiorano 1741f4443e tint: add CheckedDiv for abstract numbers
Bug: tint:1581
Change-Id: Iafed168a916ac3a1062bcf53299e8ff17fc389fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101041
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-03 21:31:23 +00:00
Robert Stewart 89dd52881c spirv-reader: Fix for SelectUsingReferenceVariable
Started from https://dawn-review.googlesource.com/c/dawn/+/99220/2

Fixed: tint:1650
Change-Id: Ic5e097135a54c68e2cb9736198082179b522a4ba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101069
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-09-03 00:10:30 +00:00
Antonio Maiorano 8478dfca56 tint: improve error message for const eval operator overflow
Bug: tint:1581
Change-Id: I112c7981d6b1998dd8133d1f80409fdc12a16a21
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101042
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-02 23:01:00 +00:00
Stephen White 863d9edf59 GLSL: Change Add[Spirv]BlockAttribute to support GLSL
Modify the AddSpirvBlockAttribute transform to fix top-level structure
access of uniform, storage and push-constant buffers for use in the
GLSL backend. The small change to the transform makes the transform
wrap host-sharable buffers, if they're also used as a
non-host-sharable structure. Also rename the transform to
AddBlockAttrbibute in order to reflect its wider applicability.

Change-Id: Ib2bf4ebf6bce72790791dbae9387032be765e4b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101061
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-09-02 19:19:10 +00:00
David Neto 822de46c74 spirv-reader: fix image write texel conversion for scalar integer cases
Started with https://dawn-review.git.corp.google.com/c/dawn/+/98980,
then took ownership to add tests and land.

Change-Id: I8da4d5e626be3a5cadc6addb36cdbe00a87b8a3c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101064
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-09-02 18:09:30 +00:00
Robert Stewart ece807852d spirv-reader: Fix texel type confusion in loop
Started from https://dawn-review.googlesource.com/c/dawn/+/99001

Fixed: tint:1642
Change-Id: Ia5d7e45dc3de5de8303a2f161c9bf365227f9b5e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101068
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-02 16:48:32 +00:00
Stephen White ae4d073b49 Revert "Skip tests about writeonly storage texture In render pass on ANGLE"
This reverts commit d144805688.

Reason for revert: offending ANGLE problem should be fixed now

ANGLE bug was fixed here: https://chromium-review.googlesource.com/c/angle/angle/+/3790473

Original change's description:
> 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>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: dawn:1503
Change-Id: I339eb503b2f8156899b7db3358c9948d58de308d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101066
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-09-02 14:05:20 +00:00
Ben Clayton 8b30ca3efa tint/transform: Fix FoldTrivialSingleUseLet for abstracts
If the let initializer was an abstract numeric that was implicitly materialized to a concrete type, then we could inlining the initializer into the use without the implicit materialization cast.
This could lead to validation errors, and subtly different results in the program.

In this situation, add an explicit cast to keep the types the same before and after inlining.

Fixed: tint:1664
Change-Id: Icca980cf8af74673906ad6c681a6b07d0c1932fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101160
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-02 13:58:00 +00:00
Robert Stewart 188be384f7 spirv-reader: UnwrapRef on image coords
The coordinate value may have been hoisted into a 'var'.
So when inspecting the coordinate type, UnwrapRef first.

Fixed: tint:1646
Change-Id: I713018e1dc37d820fdda5694fa214db84cad8ac3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101067
Kokoro: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
2022-09-02 13:52:25 +00:00
Ben Clayton 648bd7b4be tint: Add TINT_REFLECT() & ForeachField()
This uses template and macro magic to reflect the fields of a class.

Dawn:
* Reflect the fields of the types that are used by Dawn's stream::Stream<T> specializations, and use tint::ForeachField() to call StreamIn().

Fuzzers:
* Replace tint::fuzzers::DataBuilder::BuildImpl<T> specializations with the new reflection system.
* static_assert that the type is either POD or reflected. Add a specialization for std::optional which was missing.

Move tint::transform::BindingPoints into MultiplanarExternalTexture, as this is only used by MultiplanarExternalTexture.

All this reduces fragility of the struct declarations slipping out of sync with the uses.

Bug: tint:1640
Change-Id: I08729c1c356f1b427e85983efe3c2678fc2ce717
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101001
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-09-02 11:40:19 +00:00
Ben Clayton 657e61d43d tint: Add and use new Std140 transform
This transform breaks up matNx2<f32> matrices used in uniform buffers
into column vectors, which fixes std140 layout rules.

Used by the SPIR-V and GLSL backends.

Re-enable tests that were disabled for these cases.

Bug: tint:1632
Change-Id: I596d016582b4189a0b413d762b3e7eabd3504b22
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100907
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-09-01 22:12:19 +00:00
dan sinclair 644d23b3f8 Update sample code WGSL.
This CL fixes up the sample code to use ',' instead of ';' for
struct members. This allows the Animometer and ComputeBoids samples
to execute again after the Tint change.

Change-Id: I96fae4fe3b96b0a6cc596edfd73013f2aa6ef0da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101060
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-09-01 18:19:19 +00:00
Ben Clayton 655db07022 tint/sem: Rename sem::Manager to TypeManager
This used to live in a `type` namespace, and wasn't prefixed when types were moved to sem.

Change-Id: Ic7a08c2fb40aff034247524c755d9f66157e4da2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101000
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-01 17:35:39 +00:00
Antonio Maiorano c20c5dfb4a tint: Implement const eval of binary multiply
Bug: tint:1581
Change-Id: I70ff40ed4d8faf0a665824fef936ffbafb3f0948
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99362
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-09-01 14:57:39 +00:00
Ben Clayton 2b47c21640 tint/sem: Add Find() to the type manager
Lets you lookup a type without modifying anything.

Change-Id: I7a37d37f1c49c7f37f96c35b8e73a66743d9000a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100906
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-09-01 09:15:20 +00:00
Zhaoming Jiang 426b47e481 tint: add missing F16 conversion expression support
This CL add missing type conversions for f16, especially for SPIRV
backend which require special handling. A transform,
VectorizeMatrixConversions, are also added for SPIRV to replace a matrix
conversion to a matrix construction with converted column vectors.
Unittests for the transform and SPIRV writer, and end-to-end tests for
all conversion rules are added.

Bug: tint:1473, tint:1502, chromium:1356215
Change-Id: Iaff125e5dd295d35c4ab74757eb56b642802a51a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100483
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-01 03:08:20 +00:00
Brandon Jones 0df4e4aea3 Disabled Swiftshader for Android Builds.
Currently fails to build with the following error:

../../third_party/swiftshader/src/Vulkan/VkImage.hpp:24:11:
  fatal error: 'vulkan/vk_android_native_buffer.h' file not found

Bug: dawn:286
Change-Id: I7daa992ba775621524ae936e9fa6ed4ee8a5727a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100940
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2022-09-01 00:04:39 +00:00
Ben Clayton 0c7c23b9c4 tint: Misc hash / container contract improvements
Add a hash implementation to tint::Number.
Add a utils::Hasher specialization for std::variant.
Add an operator!= for Vector. Needed for std::variants.
Drop the need for explicit on Vector constructors from refs.

These all help general usage with STL and util containers.

Change-Id: I1e594edf532e78f531062c534dacaee7616cded5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100905
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-08-31 23:51:48 +00:00
Ben Clayton 6a17e33f3d tint/writer: Remove spirv::Operand hasher
It's not used any more. utils::Hasher is specialized for vectors.

Change-Id: Ic7c6978ae1f54b608b4dba98abeac077c1be9567
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100904
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-31 23:51:18 +00:00
Ben Clayton b04d992f83 tint/utils: Fix Hashmap::GetOrCreate() for map mutation in create
Its not unreasonable for the create callback to mutate the map. If this
happened, the map would be corrupted.
This change fixes this.

Change-Id: I2bb3820061c741c6da36ebe3667cb6b878515a27
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100903
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-08-31 23:15:38 +00:00
Antonio Maiorano b6d524380e tint: Improve resolver test helper to specify more than one expression arg
Bug: tint:1581
Change-Id: Ie77c56c15a5965b20008036cd99a81cbabd86988
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100340
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-31 22:59:08 +00:00
Ben Clayton cd716e6f01 tint::CloneContext: Use Hashmap::Generation()
Instead of tracking its own generation.

Change-Id: Iea9710fd6665cfc13fb72741b8a80c6dde4f64e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100902
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-31 19:43:48 +00:00
Ben Clayton 4e0335c5af tint/utils: Add Generation() to Hashmap and Hashset.
Useful for knowing if you have to look up an entry again since the last
lookup.

Change-Id: Ib0374627ef5cd7fcff7fa2d9e72b4214260b2df3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100901
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-08-31 19:04:28 +00:00
Brandon Jones 4d67a883b6 Implement maxBindingsPerBindGroup limit
Bug: dawn:1523
Change-Id: Ifcf83f6836a5d7ed447080ccb033e4163970432e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100706
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-08-31 17:01:58 +00:00
Antonio Maiorano ff0295ebd8 tint: Fix AInt -> AFloat implicit conversion from construction
Bug: tint:1581
Change-Id: I8c6a1e375130ab38ef52cb0d8dddaca03cc098da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100800
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-31 13:48:41 +00:00
dan sinclair 5361d9e778 Convert @id to an expression.
This CL updates the @id AST nodes to store an expression instead
of a literal value. This is in anticipation of the parser updates
for ID expressions.

Bug: tint:1633
Change-Id: I4dd626007dd1f9093999a0236e220ffdbc9e62db
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100760
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-31 13:39:48 +00:00
jchen10 fb2c8fb6a1 Enable gbm VideoViewsTests
When writting texels into the mapped texture, we need to take
'stride' into consideration.

chromium:1258986

Change-Id: Icc892d4ce324539e6280307d1699599d59204a9d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100480
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-31 01:16:47 +00:00
Ben Clayton 54bcbdbbf3 tint/resolver: Fix intrinsic table matching of AInt as AFloat
An AInt argument can be passed to a parameter of type AFloat.
Fix the matcher for AFloat so that it includes AInts.

Change-Id: I6aeebb567b6176b146920a2035f09cd07c11c014
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100780
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-31 01:06:28 +00:00
Corentin Wallez ef8b50f9d2 Suppress an additional OOM allocation test on M1.
Bug: dawn:1506
Change-Id: I0ebd89c17284ff724a5cf8b875fbb01d2366f3e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100703
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-08-31 00:49:18 +00:00
dan sinclair 7b332abc82 Remove cmake visibility flags.
This Cl removes the visiblity flags from the CMake file. In both
Debug and Release mode on OSX setting these flags caused piles
of warnings about mis-matched visibility settings throughout the
third_party libraries.

This CL fixes that by removing the flags. This maynot be the right
way to fix this, but it does fix the warnings. We need to decide
if we want to hide symbols by default and, if so, figure out how
to fix the downstream projects.

Change-Id: I8ee7422cfa2aec3715dba226da58e974f39e0d18
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100420
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-30 20:42:48 +00:00
Corentin Wallez 1105ec78fe Merge DAWN_FORMAT_VALIDATION_ERROR in DAWN_VALIDATION_ERROR.
Done with changes to Error.h and the following command:
git grep -l DAWN_FORMAT_VALIDATION_ERROR | xargs sed -i "" "s/DAWN_FORMAT_VALIDATION_ERROR/DAWN_VALIDATION_ERROR/"
then fixing compilation errors in ErrorTests.cpp, Pipeline.cpp and
CommandEncoder.cpp.

Bug: dawn:563
Change-Id: I081a514d662e81f4842b6d7fadfcea67c12720d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100468
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-08-30 13:39:47 +00:00
Corentin Wallez 1eb6d2dd02 Convert a few remaining DAWN_VALIDATION_ERROR.
There are still DAWN_VALIDATION_ERROR occurences left but they don't use
any format string so it is fine to merge DAWN_FORMAT_VALIDATION_ERROR
into DAWN_VALIDATION_ERROR in follow-up CLs.

Bug: dawn:563
Change-Id: Ic1ba1de44216b36ef6a972712b957685e0ee193e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100467
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-08-30 13:33:37 +00:00
Corentin Wallez 7143450998 Remove support for snake_case wgpu::Features.
Chromium has been updated so the fallback is no longer needed.

Bug: dawn:550
Change-Id: I25b054617fc054926e0eb850229f244ddc51bb61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100470
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-08-30 01:00:50 +00:00
Corentin Wallez 5fee3f93aa Remove ToSampleTypeBit as it is unused.
Bug: dawn:527
Change-Id: I09ce1e7e30b7d1329e3e42db9308f7220199cdd8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100469
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-30 00:57:33 +00:00
Corentin Wallez 59b2ccc09a Remove TODO that's already done.
Bug: None
Change-Id: Iee58a385868e46879bb003b7e1fa8b39e9812fc3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100471
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-30 00:51:30 +00:00
Loko Kung 3a53edcf18 Promote LoseForTesting to ForceLoss device so that user agents can use.
Bug: chromium:1356738
Change-Id: I348837ad4224124d9adba1ecf69a05b2060760c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100566
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-08-29 22:33:50 +00:00
dan sinclair be4c9f48aa Convert @group to an expression
This CL updates the group attribute to store an expression
instead of a single value. The parser always produces an
IntLiteralExpression at the moment.

Bug: tint:1633
Change-Id: Ice05c26d652c7f5c21825f745f270e96e3d88e08
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100441
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-29 21:22:31 +00:00
dan sinclair f9b831c39a Convert @binding to an expression
This CL updates the binding attribute to store an expression
instead of a single value. The parser always produces an
IntLiteralExpression at the moment.

Bug: tint:1633
Change-Id: I14b2a61b5bcdea66e9e24df7afbb55fb60be785e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100440
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-29 21:13:00 +00:00
Antonio Maiorano cbe8b36256 tint: spir-v reader: add support for GLSLstd450Determinant
Bug: tint:1061
Change-Id: I18f6d0726c2fac192b8893f35dcbf45bf4a3d752
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100466
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-29 20:52:00 +00:00
Austin Eng c165937955 Return false from IsDeviceIdle if there are pending callback tasks
Fixes a race where async pipeline compilations could never see their
callbacks called because Chromium stopped calling device.Tick().

Fixed: dawn:1527
Change-Id: I273409d427ef02a7a6817647eb38564adfdf0da8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100565
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
2022-08-29 18:46:10 +00:00
Corentin Wallez bc93cbc2a2 Correctly print backend type in DiscoverAdapters logs.
Bug: chromium:1348664
Change-Id: Id2eaf25a9f46b1f6614d80642dc7f8e8aef09b9e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100520
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-08-29 16:38:39 +00:00
Yunchao He 81d62d7ca9 Texture corruption issue: add tests for a few rendering types
The original tests for texture corruption only contain WriteTexture
and B2TCopy, this change adds more write types like rendering a
constant color, rendering from texture sampling, and rendering
from textureLoad, all of which need a render pipeline and shaders.

The new tests manifest that:
For a given 2d-array texture dimension, if WriteTexture and B2TCopy
fail, rendering, sampling and textureLoad also fail, and vice versa.

Bug: dawn:949, dawn:1507

Change-Id: I28035fe3dd84d36c01befd7fd8ff9d78b312446a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100061
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-26 21:23:47 +00:00
Ben Clayton 92943b2831 dawn: Fix unreachable code warning
Change-Id: I98fd18b4747365c6474dc1ca1f9003464d171ec7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100580
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-26 20:52:53 +00:00
Jiawei Shao 8b99a54b26 Call ExecutePendingCommandContext() in ExternalImageDXGIImpl::Destroy()
Before destroying ExternalImageDXGI we should execute all the pending
commands before calling NextSerial(), or the device will be lost as
the CommandAllocator will be destroyed before the pending commands are
executed.

Bug: dawn:576
Test: dawn_end2end_tests
Change-Id: I6e291586cd78a7e0feaf2f8dfee87a289ec27f77
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100100
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-08-26 03:08:28 +00:00
Corentin Wallez 667db19838 Build with -Wextra-semi
Bug: chromium:1355871
Change-Id: Id6c9774e7f7a86837f02cddfea0b36724e7c609e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100343
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-25 13:17:31 +00:00
dan sinclair 7517e213cf Update `workgroup_size` to use `expression`.
This CL updates the `workgroup_size` attribute to use `expression`
values instead of `primary_expression`.

Bug: tint:1633
Change-Id: I0afbabd8ee61943469f04a55d56f85920563e2da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99960
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-24 21:31:45 +00:00
dan sinclair 436b4a2bd0 Drop `maybe_` from method names.
With the old grammar elements removed, rename the new elements and
drop the `maybe_` prefixes.

Bug: tint:1633
Change-Id: Iafe223546f8af1ddd8a4b60572a106160a226b72
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99921
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-24 19:11:55 +00:00
dan sinclair 202362f47d Convert to new expression grammar
This CL moves all the grammar rules to use the new
`maybe_expression` rules. All of the old `expression` rules
are removed.

Bug: tint:1633
Change-Id: I29637a4c6fcd200650a2b57011b6539c66be942a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99920
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-24 18:05:26 +00:00
dan sinclair acdf6e1a53 Remove `ast::VariableBindingPoint` in favour of `sem::BindingPoint`.
This CL removes `VariableBindingPoint`. The `Variable` object has a
`has_binding_point` method added which returns true if there is
_both_ a `Group` and `Binding` attribute. Code has all been updated
to use the `sem::BindingPoint` which is populated during the resolve.

Bug: tint:1633
Change-Id: I79a0da662be61d5fb1c1b61342ab239cc4c66809
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100240
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-24 15:47:25 +00:00
Tom Anderson a85290b909 Fix build with -Wextra-semi
Change-Id: I48b8ca89dfe90e138fb6d9c00a69353a05f19cd2
Bug: chromium:1355871
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100241
Auto-Submit: Tom Anderson <thomasanderson@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-08-24 00:03:35 +00:00
Ben Clayton 93c2d559a1 tint/utils: Default to using Hasher instead of std::hash
STL std::hash<T*> implementations have a tendency of just reinterpreting the
pointer as a size_t. This is fast, but produces a bad hash, as most pointers
tend to be 4 or 16 byte aligned. The lack of entropy in the LSBs causes
clustering of hashmap slots. Use tint::utils::Hasher to get better hashes.

Change-Id: Ife768d573cd1875e746ca9d77a4ac19e43b06aca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99281
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-08-23 19:09:34 +00:00
Ben Clayton 18dc315ccb tint::CloneContext: Use utils::Hashset and utils::Hashmap
For fewer heap allocations, faster lookups.

Also use a generational counter to cache `ListTransforms` map lookups between clones. Reduces repeated map lookups in super-hot code.

Change-Id: I34865bb39c756129be845b1eb6255ce436e275f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99280
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-08-23 18:38:35 +00:00
Ben Clayton b90b6bff1d tint: Minor no-op cleanup changes
Change-Id: I91ad6044e7809ed2deab0fbd4417da90c7870d81
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99705
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-08-23 16:23:05 +00:00
Ben Clayton e3f2005b2d tint/utils: Cleanup & optimize hash utilities
Do less work for single-value hashes.
Specialize pointer hashing to improve hash quality.

Change-Id: I2f3839d15754543735728814c7f54a5e7ac81569
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99282
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-08-23 16:10:35 +00:00
Ben Clayton e5d337171a tint: Castable - optimize IsAnyOf()
`HashCodeOf()` sets two bits in the mask to `1`.
We can check for two bits set, after masking, to quickly eliminate impossible Is() tests.

Change-Id: I8d9c1ece87b714e83bd292d02e02274d42e143ef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92664
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-23 15:39:15 +00:00
Ben Clayton cdcc85973b tint: Clean up AddSpirvBlockAttribute
* Walk the sem type list, instead of all AST nodes to just find the
  types.
* Walk the AST global list, instead of all declarations, then filtering
  to globals.
* Use the ast::IsHostSharable() helper where possible.
* Only lookup the sem node once instead of twice, per global.
* Use the new utils::Hashmap and utils::Hashset containers instead of
  std::unordered_map and std::unordered_set.

Change-Id: Idb47c855ae9dfd27515774a89cedb7ed06e07035
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100140
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-08-23 14:30:24 +00:00
dan sinclair 4964d9bc20 Convert `@align` to hold an expression.
With the updated WGSL grammar the `@align` attribute takes an
expression instead of a value. This CL updates the internal data
structures to store an expression instead of an integer value.

The parser still only parses integers, they're just turned into
`IntLiteralExpressions` at the moment.

Bug: tint:1633
Change-Id: If34901798ed6ceaced354bc06ae9b6df875b700e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99980
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-23 13:28:44 +00:00
dan sinclair 64b09959f7 Update `type_decl` and `primary_expression`
This CL updates the `type_decl` and `primary_expression` rules
to the new WGSL grammar.

Bug: tint:1633
Change-Id: Ifc457e01f43fe33e083fc8f9e316fdd02bfd87c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99881
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-22 19:42:14 +00:00
dan sinclair 08d735e6a9 Add missing relational_expression.post.unary_expression checks.
This CL adds the missing checks and tests for `==` and `!=` into
the `relational_expression.post.unary_expression` grammar elements.

Bug: tint:1633
Change-Id: Ib5fbb42994ea12af133ca531989421fddc2393f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99940
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-22 19:23:24 +00:00
dan sinclair a838e34954 Handle peeking past placeholder elements.
Currently when peeking, if there is placeholder then anything after
the `peek(0)` will be off by 1 position as the placeholder will
end up included in the index count.

This CL updates the peek routine to correctly skip over any
placeholder element between the current index and the requested
peek token.

Bug: tint:1633
Change-Id: Idd2905cc3b9c0a0dcbbcc94c0f6dd349b569ec3e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99900
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-22 19:19:44 +00:00
dan sinclair 393de082d3 Add `mat_prefix`, `vec_prefix`, `callable` and `type_decl_without_ident`
This CL adds the `mat_prefix`, `vec_prefix`, `callable` and
`type_decl_without_ident` constructuctions.

Bug: tint:1633
Change-Id: Id1fb0417f522b7da2ac6bd4441d17b0a35ae5f14
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99880
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-22 16:15:04 +00:00
dan sinclair 9284f8ab55 Add test for let with complex constructor
This CL adds a let unittest with a complex constructor. The test
verifies the entire statement is parsed.

Bug: tint:1633
Change-Id: I56bb7c009efb5668aa41c9b7ec80dcde65c4ec40
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99863
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-22 16:02:19 +00:00
dan sinclair 96a7d5a6bd Add some parenthesis.
With the upcoming expression changes we need to put parenthesis around
boolean expressions which mix `&&` and `||`.

Bug: tint:1633
Change-Id: I7a304e5a23998d9977630c2d4466312be7ae169e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99862
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-22 15:59:34 +00:00
dan sinclair e76521153f Fixup shift_expression parsing.
This CL fixes the shift_expression to call the higher level math
expression instead of multiplicative_expression. This allows addition
in shift expressions along with multiplicative expressions.

Bug: tint:1633
Change-Id: I29414bfa540bff612110d5ea16c5c89222a5eb6b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99861
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-22 14:55:04 +00:00
dan sinclair ee25586aec Sync `expression` grammar element with WGSL spec.
This CL updates the `expression` grammar element with the WGSL
spec.

Bug: tint:1633
Change-Id: Iad1f16f5d73cf4d9ba53ef638aaad73418712403
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99822
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-22 14:06:44 +00:00
Austin Eng a09d05c10b Make Adapter and Instance lifetimes more robust
Previously, we would get a use-after-free if you dropped the instance
before an adapter created from it. This CL fixes up the lifetimes
such that Device refs Adapter refs Instance. Instance uses a
cycle-breaking refcount so that it releases internal refs to its
adapters when the last external ref is dropped.

Bug: none
Change-Id: I5304ec86f425247d4c45ca342fda393cc19689e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99820
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-08-20 02:22:41 +00:00
dan sinclair 158c85dab4 Add new relational rules to WGSL grammar.
This CL adds the `relational_expression.post.unary_expression` grammar
rule into the WGSL parser. A `shift_expression` helper and a
`relational_expression` helper are also added.

Note, the two helpers have `maybe_` as name prefixes. This will be
dropped when the old parser path is removed which current uses the
other versions of those names.

Bug: tint:1633
Change-Id: I6431edfe8fdb9f5a6eea804a7d6fa9a4982ea04e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99761
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-19 22:19:11 +00:00
dan sinclair 97e0c71eb6 Add new shift expression grammar rule.
This CL adds the `shift_expression.post.unary_expression` grammar
rule into the WGSL parser.

Bug: tint:1633
Change-Id: I833ddb05399afe8c792bd0b1abf3eda7f1d114e7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99760
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-08-19 22:16:21 +00:00
dan sinclair 9d27ab7043 Update parser comments.
This CL updates a few parser comments to match spec.

Bug: tint:1633
Change-Id: I8cde5ea9a85f0ca58b914d2741ad131d1fa374c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99700
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-08-19 22:07:23 +00:00
Ben Clayton d0ccb1aae6 tint/fuzzers: Add a fuzzer that tests concurrency
Currently triggers a bunch of simultaneous program writers, sharing the
same program.

Bug: tint:1651
Change-Id: I9114a3072fb14182f72d5823fa8120088c2ab167
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99802
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-19 21:33:01 +00:00
dan sinclair 2788becd09 Add `element_count_expression` to WGSL parser
This CL adds the `element_count_expression` and the requisite math
expression parsing to support along with tests.

Bug: tint:1633

Change-Id: I54ab37339754217f417f69dcd6140adbc14cbf83
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99560
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-19 21:26:01 +00:00
Ben Clayton 5d7de871b4 tint/writer/msl: Remove TODO and old logic
crbug.com/tint/1580 has been implemented for some time.
Remove the bodge to handle constant value lets.

Bug: tint:1580
Change-Id: I9a71ed8f91b6c9925fa0557bcb4c95d90461421f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99704
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-08-19 20:07:22 +00:00
Ben Clayton 58794ae118 tint::ProgramBuilder: Simplify variable constructors
Expand the Option argument paradigm to:
* Remove the requirement to always pass a 'type' parameter. Type inferencing is the easier, and increasingly common way to declare a variable, so this prevents a whole lot of `nullptr` smell which negatively impacts readability.
* Accept attributes directly as arguments, removing the `utils::Vector{ ... }` smell.

Rename `ProgramBuilder::VarOptionals` to `VarOptions`, and add equivalent `LetOptions`, `ConstOptions` and `OverrideOptions`.

Clean up all the calls to `Var()`, `Let()`, `Const()` and `Override()`:
* Use the `Group()` and `Binding()` helpers where possible
* Removing `nullptr` type arguments
* Replace attribute vectors with the list of attributes.
* Remove already-defaulted `ast::StorageClass::kNone` arguments.
* Remove already-defaulted `ast::Access::kUndefined` arguments.

Finally, remove the `GroupAndBinding()` helper, which only existed because you needed to pass attributes as a vector.

Change-Id: I8890e4eb0ffac9f9df2207b28a6f02a163e34d96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99580
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-08-19 17:28:53 +00:00
Takahiro 6a314e49e1 Accept unfilterable-float sample type for depth format texture
Allow unfilterable-float sample type for depth format texture
and add unit tests and end2end tests to check it.

Bug: dawn:1508
Change-Id: I46fc22d66d0c2ad5e3923a18e4d13d174203964a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99060
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2022-08-18 21:07:19 +00:00
Ryan Harrison 841db7f515 Add libfuzzer_exports.h to Tint fuzzer common code
BUG=chromium:1353969

Change-Id: I66a08a3ad19a175b52737a5c3a81d3b1a5a786f5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99702
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-18 18:41:17 +00:00
Austin Eng bf3243568c Add DeviceBase::APIGetAdapter
Adds a way to query the adapter from a device. Only valid in Dawn Native.
Returns a new reference to the caller. The caller is responsible for
releasing it.

This is needed so in Chrome, SharedImage can query the WGPUAdapter from
the WGPUDevice, and then WGPUAdapterProperties may be queried from the
WGPUAdapter.

Change-Id: I719a8728eff06ab7a22be3db5fb5cfd2ebb2f0f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99703
Reviewed-by: Zhenyao Mo <zmo@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-08-18 18:02:00 +00:00
dan sinclair ff2cb02e92 Add bitwise_expression to the WGSL parser.
This CL adds the `bitwise_expression.post.unary_expression` parsing
into the WGSL parser.

Bug: tint:1633
Change-Id: Idaf1a413662d1c10d9d9f25d3b35ed5323b8f883
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99383
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-18 14:37:17 +00:00
Loko Kung 30fa0d8d2c Makes sure to zero-init D3D12 descriptors for cache keys.
Fixed: dawn:1471
Change-Id: I2692d3caa9b0d4dabe473b7a7d5249473da80c5b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99600
Auto-Submit: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-18 02:34:40 +00:00
Ben Clayton e86758cb26 reader/wgsl: Error if 'struct' has attributes
Attributes were being parsed, constructed, then thrown away, when declared on a structure. This was triggering the unreachable-AST node seatbelt in the Resolver.

Replace the confusing `Maybe<bool>` return types with `Maybe<Void>`. The boolean return value was not actually being used, as logic was (correctly) using the `Maybe` error / matched state.

Bug: chromium:1352803
Change-Id: I39e4994e3e9b13201ba4f4e4820cd4b2f46e93c5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99100
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2022-08-17 18:57:49 +00:00
Zhaoming Jiang ff1330240b tint/transform: Fix index 0 accessing in DecomposeMemoryAccess
This patch fix a bug in DecomposeMemoryAccess, allowing access index 0
of a member in uniform and storage buffer being recognized as constant
index.

Bug: tint:1652
Change-Id: Ia428de17c860bdafe87c3af9e46426c74fe8fd68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99480
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Zhaoming Jiang <zhaoming.jiang@intel.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-17 18:15:00 +00:00
Ben Clayton dce63f5717 tint/utils/UniqueVector: Use utils::Vector and utils::Hashset
For fewer heap allocations, faster lookups.

Change-Id: I02da7c1a63608096ec898b0d89f9f97c6db8733f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98141
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-17 18:07:20 +00:00
Antonio Maiorano b79238d7ec tint: Implement const eval of binary minus
Bug: tint:1581
Change-Id: I90ce59e89a5b4b9e94de1181ca9d85e9040be3e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99421
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-17 17:38:23 +00:00
dan sinclair eb0af9def7 Add optionally_typed_ident to WGSL parser.
This CL adds the `optionally_typed_ident` construct into the WGSL
parser and uses it where the conditional was used previously.

Bug: tint:1633
Change-Id: I15eaf838792208f56b4ddebd950086f14c8962b3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99382
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-17 17:38:17 +00:00
Ben Clayton 0f0ba20208 tint/transform: Fix PromoteInitializersToLetTest for materialized constants
PromoteInitializersToLet was not handling sem::Materialize nodes.
This can happen for const arrays when they are dynamically indexed.

Fixed: tint:1653
Change-Id: I3d67d8139e481c89b31a3a30c7ef44384b7545ba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99500
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-17 17:26:41 +00:00
dan sinclair 873f92e741 Convert assignment_statement to new WGSL grammar.
This CL converts the `assignment_statement` to
`variable_updating_statement`. Some more test cases are added
around the phony assignment and usage of compound operators.

The `lhs_expression` and `core_lhs_expression` are converted to
return `Maybe`s.

Bug: tint:1633
Change-Id: Iaed6373e2f202609adf341b57dc9027e5a04af34
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99380
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-17 17:20:50 +00:00
dan sinclair 6c8dc15d64 Add core_lhs_expression and lhs_expression to parser.
This CL updates the WGSL parser to have a `core_lhs_expression`
and a `lhs_expression` grammar rule. The rules are not used anywhere
yet, but are standalone so are added with tests.

Bug: tint:1633
Change-Id: I87bdaefeb06be637f72a7e6fa72ce2b6298c7bb7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99240
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-17 16:30:30 +00:00
Ben Clayton e13160efb6 tint/utils: Add Hashmap and Hashset
Algorithmically faster than `std::unordered_[map|set]`, and use a small vector internally reducing heap allocations.

Change-Id: I9c0b00468272d9d7c72ab077d832d66d1368500c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98123
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-08-17 16:28:23 +00:00
Ben Clayton 81f0686523 tint/utils/vector: Allow use of incomplete types
Attempting to make a Vector of an incomplete pointer type would trigger an error as the `CanReinterpretSlice` trail magic is wanting to know the base types, which isn't known yet.

Split `CanReinterpretSlice` into class specializations, where the common case of no-cast doesn't look at the base types.

Change-Id: Id016b027b131f7988ccf3cae93622dacb7802a1d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98140
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-08-17 15:42:15 +00:00
dan sinclair 6e716c77ac Sync some WGSL grammar names to spec
This CL updates some of the names used in the WGSL parser to match
the grammar rules in the spec.

Bug: tint:1633
Change-Id: I489e1c6a945bdd6063d400cfdbd87aa81a97c5f0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99200
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-17 14:28:31 +00:00
Antonio Maiorano f8a34d08dd tint: Add CheckedSub functions
Bug: tint:1581
Change-Id: Iee836af4b5a1252335f680cba7ab4e04c2996728
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99420
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-17 12:46:39 +00:00
Sunny Sachanandani 1130a602ef d3d12: Disallow creating external image after device destruction
ExternalImageDXGIImpl holds a weak reference to the device. If the
device is destroyed before the image is created, the image will have a
dangling reference to the device which can cause a use-after-free.

This CL fixes that by adding a ValidateIsAlive() check before creating
the image similar to creating other API objects.

Bug: chromium:1352802
Change-Id: I477f15680ffd27e1ad0166835c4debb80b4be761
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99384
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-08-17 03:52:59 +00:00
Loko Kung f83652f019 Remove suppressions from dawn:1471.
- Tests seem to be passing fine in manual testing. Fixes throughout key
  generation and stream implementation may have unintentionally fixed
  this issue.

Fixed: dawn:1471
Change-Id: I17268d66be6dfc47cd7f3b480b424909f18e7f1f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99422
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-08-16 22:44:09 +00:00
Jiawei Shao d9d6dfac9a Enable the workaround about T2T copy on Intel Gen11 GPUs
This patch enables the workaround about using a temporary buffer in
the T2T copy on Intel Gen11 GPUs after running WebGPU CTS on these
platforms.

Bug: chromium:1161355
Change-Id: Id4a4f189b4a7a3954dc66062d27e9b226d1409f6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99320
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-08-16 18:05:03 +00:00
Antonio Maiorano 2de4deea1f tint: Fix implicit conversion of vector-scalar of abstract types in binary operations
Example: const v2 = vec3(1) + 2.2;

Bug: chromium:1350147
Change-Id: Ie75d76bf00a6b2f6abd49293290f6e5065c31dfb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99301
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-16 16:00:02 +00:00
Antonio Maiorano fa4a7291f2 tint: add [[nodiscard]] on utils::Result class
Helps when changing the return type of a function from `void` to
`Result<T>`. The compiler fails in places where the return value is
ignored, which is never what we want with Result.

Change-Id: Id3271ea9fb1128f8f493030f013b2b577235be8f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99160
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-15 19:31:51 +00:00
Peter Kasting c935b497e6 Split some structs out of DawnTest.h into their own file.
This allows them to be fully defined before being referenced, which
fixes compile errors in C++20.

Bug: chromium:1284275
Change-Id: I3c0f874406247c04d53710431931f82c3deaff3c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99080
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peter Kasting <pkasting@google.com>
Auto-Submit: Peter Kasting <pkasting@google.com>
2022-08-15 18:55:41 +00:00
Antonio Maiorano cc937971c9 tint: natvis: add utils::Slice, utils::Vector, and utils::VectorRef
Bug: tint:1331
Change-Id: I710c3f390234160d1c21a04f71bd26eb56ff585a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99140
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-15 18:29:21 +00:00
dan sinclair 735e4b4fa1 Emit deprecation for fallthrough.
The `fallthrough` statement is being removed from WGSL. This CL adds
a deprecation warning into the current implementation to prepare folks
for the upcoming removal.

Bug: tint:1644
Change-Id: I599984b6a30b39312c4b794a9ecd70f0f626c759
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98841
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>
2022-08-15 11:41:07 +00:00
dan sinclair 52cc4f5d1c Add a target for the GLFW surface helper.
This CL moves the GLFWUtils.cpp into a dawn/glfw/utils.cpp and
GLFWUtils.h into include/webgpu/webgpu_glfw.h. A build target
(`webgpu_glfw` alias to `dawn_glfw`) is added in order to allow
using that target in downstream projects without having to re-implement.

Change-Id: I93e85d5af3f486b3c754f2f854aafbda51901d6d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98700
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-08-14 15:59:25 +00:00
Austin Eng f7ee534b2c Beautify visitable structs with more helpers
Bug: dawn:1480
Change-Id: I01450e1916766daba016f71c0ed825e6b6664541
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98840
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-08-12 20:39:03 +00:00
Ryan Harrison 4acf608cf2 Include 'libfuzzer_exports.h' in fuzzers that are missing it
This is part of a workaround in the Chromium build infrastructure for
the fact that on Mac, the linker tends to strip LLVMFuzzer*
implementation because of how they are loaded/used.

All of the rest of the machinary is already setup and working, just
need to actually include the header. Dawn and other fuzzers use this
same fix.

BUG=chromium:1319605

Change-Id: Ifced8e0b29a48cdf64cd82002c90eb3c765b01c0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98880
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-11 20:41:31 +00:00
dan sinclair 3abad2c125 When emitting a MSL struct initializer emit the struct name.
This CL changes the MSL emission for struct initializers to emit the
struct name first.

`const a = {.f=float3(1)}` becomes `const a = Normals{.f=float3(1)}`.

This fixes an issues where the initialization happens inside an array
which the downstream compiler rejected without the explicit struct
naming.

Bug: tint:1641
Change-Id: I948b9ca94f4b89eac6d5bbbaa615b3d71d50c737
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98760
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-08-11 02:28:01 +00:00
jchen10 7126ed9111 Add eager Transition support for external textures
This eagerly transitions external textures to be ready for export
on every submit. With this support, we can save the current submit
of export.

Bug: chromium:1258986
Change-Id: I92c2019ff486afc24adc190a1f7b2f85f416cd52
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97642
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2022-08-11 01:36:21 +00:00
Antonio Maiorano a58d8c9fac tint: fix builtin calls and binary ops with abstract args of different type
If a call to atan2 with args of type AFloat and AInt is made, Resolver
would correctly select the atan2(AFloat, AFloat) overload, but if the
input args were of type (AFloat, AInt), it would attempt to constant
evaluate without first converting the AInt arg to AFloat. The same would
occur for a binary operation, say AFloat + AInt. Before constant
evaluating, the Resolver now converts AInt to AFloat if necessary.

Bug: chromium:1350147
Change-Id: I85390c5d7af7e706115278ece34b2b18b8574f9f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98543
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-10 20:01:17 +00:00
Antonio Maiorano 90d5eb6128 tint: Add RemovePhonies transform to spir-v backend
This will be needed by an upcoming CL that fixes call statements to
builtins that return a constant value. Without this transform, the
constant value reaches the backend, where we don't currently deal with
abstract numbers. Note that the other backends (HLSL, MSL, GLSL) already
use this transform.

Bug: chromium:1350147
Change-Id: Icc1f1416a07db228f8e3f39851a9ac079c48319f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98740
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-10 19:32:23 +00:00
dan sinclair b91d7e1b31 Spit `expect_variable_ident_decl` into helper and calling methods.
This Cl spits the `expect_variable_ident_decl` apart to only accept
the `variable_ident_decl` grammar element. A
`expect_ident_or_variable_ident_decl` is added for the ident optional
version and a helper used by those two methods.

This makes it a lot clearer at the caller side how the calls relate
to the grammar.

Bug: tint:1633
Change-Id: I50aa4852926ff217129fe728e434255ed008da61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98661
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
2022-08-10 18:54:43 +00:00
Antonio Maiorano 7058a17bda tint: refactor ConstEval API to accept vector of constants rather than of expressions
This is needed for a follow-up change to apply implicit conversions for
AFloat to AInt.

Bug: chromium:1350147
Change-Id: Id903322d01b7aa420452c3e0fc1fa4e1c480c794
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98683
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-10 18:06:43 +00:00
Antonio Maiorano a8e9a6ef2b tint: Fix Resolver erroneously materializing matrices of abstract numeric type
ShouldMaterializeArgument must check that the deepest element is not
abstract numeric to support matrices.

This CL also enables the "no materialize" tests for binary ops, as
constant evaluation of binary addition was recently landed, and that's
what the test uses. The fix in this CL is also necessary for this test
to pass the matrix addition case (it would fail because it erroneously
materialized).

Bug: tint:1581
Change-Id: Id55341c05604c1ac560127826fc415eb38792503
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98682
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-10 14:32:19 +00:00
Jiawei Shao 6f81e13a20 Metal: Enable Toggle::ApplyClearBigIntegerColorValueWithDraw on Intel GPUs
This patch enables Toggle::ApplyClearBigIntegerColorValueWithDraw on
Metal backends using Intel GPUs to workaround an issue about clearing
int32 and uint32 formats with big integer values that cannot be represented
by float.

Bug: dawn:1109, dawn:1463
Test: dawn_end2end_tests
Change-Id: Idb77f57ea5909ad67fa2a79956634bacfc2a2e15
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98480
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2022-08-10 06:44:13 +00:00
Jiawei Shao 76eeb828c8 Align offset to 512 when writing into depth stencil textures on some platforms
On the D3D12 platforms that don't support programmable sample positions,
the source box specifying a portion of the depth texture must all be 0,
or an error and a device lost will occur. This patch adds a workaround
for this issue by alignning the offset of internal staging buffer to 512
when calling Queue.WriteTexture() with depth stencil textures

Bug: dawn:727
Test: dawn_end2end_tests
Change-Id: I6bc5843d62d0aec3964ee5b544a06c0b2657031a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98601
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2022-08-10 05:12:16 +00:00
Jiawei Shao 7267d99251 D3D12: Apply big integer clear color values with draw
This patch implements the use of big integer values (>2^24 or <-2^24) as
the clear values of a render pass with an internal draw call as D3D12 API
only supports using float numbers as clear values.

Bug: dawn:537
Test: dawn_end2end_tests
Change-Id: Id0a7835d611f598fb77950915f69919f804a8702
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98104
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-08-10 04:25:34 +00:00
Antonio Maiorano 50bc60359e tint: Add unit test for HasSideEffects for builtins
Change-Id: I7f2546c36a06cd9646ddf39601636954b9da0459
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98541
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-08-09 18:18:22 +00:00
Antonio Maiorano f7e2de7971 tint: make RemovePhonies remove call statements to builtins that return a constant value
If the return value of a builtin is a constant value, it may be an
abstract number, and our backends currently do not deal with abstract
numbers. As these builtins have no side-effects, and the return value is
unused, we can just drop the call altogether.

This is needed for the follow-up CL that fixes calls to builtins with
abstract args of different type.

Bug: chromium:1350147
Change-Id: Iebd853372fdb9242fe0f28706944eabe9df03459
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98542
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-09 18:14:12 +00:00
Austin Eng 8830991b41 Cache WGSL -> GLSL compilation
Fixed: dawn:1480
Change-Id: I5c1453a4e37d0e97805391a6c807091d0a8fc1c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98281
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-09 17:22:22 +00:00
dan sinclair e62fbbc75c Syncing WGSL grammar to Tint.
This CL syncs some more grammar changes into Tint. The `break if`
statement is stubbed out to be completed later.

Bug: tint:1633
Change-Id: I9223278288383698f9cdecc1ae854720cc55dd2c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98660
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-09 16:52:42 +00:00
Corentin Wallez 6d5542d703 Fix compilation error in delete_statement.cc
There seems to have been a race between changes and
SwitchStatement::body is no longer an std::vector but a utils::Vector.

Bug: tint:1110
Change-Id: I84d19049ecd54b1eba3f826e6c8c7d07ad3746ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98641
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-08-09 14:15:30 +00:00
dan sinclair 11e415d0bd Add some CMake build target updates.
This CL adds the `dawn_headers` into the `webgpu_dawn` library in order
to find the generated `dawn/webgpu.h` and `dawn/webgpu_cpp.h` header
files during the build.

An alias is added for `dawncpp` called `webgpu_cpp` so it can be used to
link instead of referencing dawn directly

Change-Id: I93fa97534e1e6e7aea349e5d7efb08807f6a0d61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98580
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-09 13:33:10 +00:00
Antonio Maiorano 1884c964d7 tint: Fix utils::Vector<T, 0>::Push segfaulting
Grow multiplies capacity by 2, but for a 0-sized Vector (i.e. no small
array), capacity is 0, so Grow wouldn't grow.

Bug: tint:1613
Change-Id: I6f2954cbfdb0c638e02b2f441e17a016c0198ad7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98540
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-09 02:57:00 +00:00
Shiyu Liu 953d610aa2 AST fuzzer: mutation that deletes statements
Adds a mutation that deletes a statement.

Fixes: tint:1110
Change-Id: I8a8595378481d12e7586103e2e88a0858d869ef9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88446
Commit-Queue: Alastair Donaldson <afdx@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-09 00:09:00 +00:00
Corentin Wallez 142141cdf2 Do simplifications assuming macOS 10.11 is the min version supported.
Bug: dawn:1397
Change-Id: I42a588b2a30e12eb7b6889a8954311b632547c58
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90243
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-08 17:42:41 +00:00
Jiawei Shao 5344184403 Add comma between non-undefined and undefined format in error message
This patch adds a missing comma between non-undefined and undefined
format in the error message for incompatible attachment states. In
previous implementation, when we output an "undefined" just after a
non-undefined format, we will always miss a comma as "needsComma" is
ignore before the output of "undefined".

Bug: dawn:563
Change-Id: I39ba4e33d88382df12d5de0271f1274559cf027d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98481
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-08-08 16:36:30 +00:00
Corentin Wallez 2e81814184 Suppress a failure with new (std::nothrow) on Mac ARM64.
This happens when trying to allocate the backing storage for an error
buffer when the allocation would cause an OOM.

new (std::nothrow) doesn't work on Mac ARM64. The code in libc++ that's
compiled into dawn_unittests seems correct, but macOS's libunwind
returns "end of stack" when trying to unwind.

Bug: dawn:1506
Change-Id: Ibc5d7251ea7a411b0e3cc91646a059270d965a90
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98122
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-08-07 11:59:19 +00:00
Corentin Wallez af908a3267 dawn: Make ASSERT() breakpoint on all supported platforms.
This moves the implementation of DAWN_BREAKPOINT() in the only file
that uses it and completes it for all supported architectures. If in
the future breakpoints are needed in other places, it would be possible
to expose the function in a header.

Add DAWN_PLATFORM_IS macros for all supported architectures so they can
be used for implementing Breakpoint() and add support for RISCV.

Bug: dawn:1506
Change-Id: Ib1b92c2d0c119cfc1b348fe905029fe366f5ad04
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98121
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-08-07 11:01:49 +00:00
Jiawei Shao 4b9ebb1465 D3D12: Workaround buffer-texture copy with depth-stencil on some platforms
On the D3D12 platforms that don't support programmable sample positions,
the source box specifying a portion of the depth texture must all be 0, or
an error and a device lost will occur. This patch adds a workaround for this
issue by splitting the original buffer-texture copy into two copies:
1. copy from the source resource into a temporary buffer at offset 0
2. copy from the temporary buffer at offset 0 into the destination resource.

In the next patch we will fix the corresponding issue in Queue.WriteTexture.

Note that on newer version of D3D12 the restrictions about
D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT and D3D12_TEXTURE_DATA_PITCH_ALIGNMENT
have all been lifted out, so the workaround added in this patch will also be
disabled on the platforms that don't support programmable sample positions
but the restrictions about D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT and
D3D12_TEXTURE_DATA_PITCH_ALIGNMENT are no longer available.

Bug: dawn:727
Test: dawn_end2end_test
Change-Id: I9f1d848a0eeac5bd52c9219af6992a2821307746
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97182
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-06 04:36:08 +00:00
Austin Eng a0df1384f2 Cache WGSL -> DXBC/DXIL compilation
Bug: dawn:1480
Change-Id: I858111f62be457c2e7cd5017bbf4c10e76395e83
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95340
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-05 20:09:07 +00:00
Zhaoming Jiang 20cddbf04c tint: Implement modf and frexp built-ins for f16 types
This patch implement modf and frexp built-ins for f16 types, and also
simplify their implementation for f32 in MSL and HLSL, and clean up
deprecated code in GLSL writer. Corresponding unittests are also
implemented, but end-to-end tests for f16 are not implemented yet.

Bug: tint:1473, tint:1502
Change-Id: I12887ae5303c6dc032a51f619e1afeb19b4603b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98102
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-08-05 15:11:44 +00:00
dan sinclair 1cd4706f85 Sync the `statement` grammar element.
This CL updates a few names in the statement element to match the
spec. The `body_stmt` is now `compound_statement`.

Bug: tint:1633
Change-Id: I23a622fc8587641d3b6c5ff2641f29a3471fa4e1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98280
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-08-05 14:53:47 +00:00
dan sinclair 7d8307122e Cleanup some strings; Reorder `attribute` rule.
This CL inlines some strings which were listed at the top of the
parser. In general, we've inlined the strings there were just a few
which ended up being declared at the top of file.

The `attribute` rule is re-ordered to sort the attributes in
alphabetical order so they're easier to locate.

The `expect_storage_class` rule is renamed `expect_address_space`

Bug: tint:1633
Change-Id: Ie659742b9758142b6971493be6d0d62a092999b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98262
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-08-05 14:47:57 +00:00
dan sinclair 69a9415084 Extract interpolation sample and type name parsing
This CL pulls the interpolation sample and type name parsing out
to methods to closer match the WGSL spec. This will also make it simpler
to convert to using generated parsing for these strings if desired.

Bug: tint:1633
Change-Id: Ib7b663a3eeef7f3ecacae8bf160d41641b5474f1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98260
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-04 21:21:37 +00:00
dan sinclair 737fd8223e Add `expression` into the WGSL parser.
The parser skipped over the `expression` node and went straight
to `logical_or_expression`. This CL adds `expression` which just
calls `logical_or_expression`. This will allow moving the rest of the
parser to more closely match the WGSL spec.

Bug: tint:1633

Change-Id: I994a186ea50f3b3196c9ded77d9c478cb08b019b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98220
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-04 21:06:07 +00:00
Antonio Maiorano 7e9f571814 tint: const eval of binary add
Bug: tint:1581
Change-Id: Ie34ee52bdd4a4c5d45a5f6c0d8d923cc690c8b2c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98021
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-08-04 19:48:27 +00:00
dan sinclair b8893b4c2f Sync the `global_decl` grammar rule
This Cl updates the parser implementation of the `global_decl` rule.
The `type_alias` rule is renamed to `type_alias_decl` and the `struct`
parsing is moved out of the synchronization to `;` code as a `struct`
no longer has a trailling `;`.

Bug: tint:1633
Change-Id: I44b25035cbe0ea0963ec73400986205e1623060e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98065
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-04 17:57:26 +00:00
Antonio Maiorano c2a052eaa4 tint: Allow ConstEval functions to fail
They now return a utils::Result so they can add an error to diagnostics
and return Failure. Returning nullptr still means cannot evaluate at
compile time, but not a failure.

Bug: tint:1581
Change-Id: Ic30d782fb9fa725ec2faf89a87f74de6282d0304
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98107
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-08-04 13:59:36 +00:00
Austin Eng 0671fe28bf Cache WGSL -> MSL compilation
Bug: dawn:1480
Change-Id: Ie2ef7860b38d7f350c99cf2c5451299b23413ec6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97882
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2022-08-04 01:12:56 +00:00
Antonio Maiorano 50bddbffca tint: Fix dxc on Linux
Fixes "dxc failed : unable to parse shader model.".

On windows the called program is responsible for splitting arguments
from one joined string. Command line arguments on 'nix systems need to
be passed as separate strings. This CL makes it so that we pass in the
arg separately, and support ignoring empty string args to make writing
this code easier.

Change-Id: Ia9618c2a743f8fdb49913572e2bbfc4bd1519d3a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98110
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-03 21:40:46 +00:00
Antonio Maiorano 50940aeef1 tint: add CheckedAdd AFloat overload
Bug: tint:1581
Change-Id: I3d346a5ced345dbd720cce3404b4a0a402e71838
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98106
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-08-03 21:20:26 +00:00
Jiawei Shao 3c797eba3b Add tests about clearing with big integer values
This patch adds several dawn_end2end_tests as a preparation to support
clearing color attachments with arbitrary 32-bit integer values on
D3D12.

Bug: dawn:537
Test: dawn_end2end_tests
Change-Id: I5e5232d4ebb2ed0e0da007fea101ed13f972ce9e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98103
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-08-03 15:54:35 +00:00
Ben Clayton f3015a81cc tint/reader: Parse static_assert
Bug: tint:1625
Change-Id: I440de9a5f0f6817520d59d0d918acc6ac0555c42
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97963
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-08-03 10:08:46 +00:00
Zhaoming Jiang 7d7976d590 tint: Add end-to-end tests for expressions using f16 types
This patch add DXC compile flag "-enable-16bit-types" and change profile
to SM6.2 when validating generated HLSL using DXC if f16 extension is
enabled in the WGSL program.
The patch add Tint end-to-end test cases for expressions using f16 type,
including constructor, binary operator, splat, zero-init, and others.
Testcases that use f16 types in uniform or storage buffer are SKIPped,
because such usage is not implemented yet.

Bug: tint:1473, tint:1502
Change-Id: I481ab3d12cbb822f11ef85ba807bca3f9770089b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96252
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
2022-08-03 08:45:25 +00:00