During some transforms we may move an entry point parameter to
a global variable. This means the global may now have a Location
attached where it isn't permitted by the WGSL spec.
This CL adds a `location` to the GlobalVariable sem value and
populates it in the resolver.
Bug: tint:1633
Change-Id: I684f715fe52d39a0f890fe76c627c1ae543fc746
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101462
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
To support concurrent readers on multiple command queues/devices, Dawn
must support importing via wait multiple fences and also export a signal
fence. The previous implementation of using a single fence for waiting
and signaling doesn't work for concurrent reads across queues.
This CL adds support for specifying multiple wait fences for
ExternalImageDXGI via a BeginAccess method that's meant to replace
ProduceTexture. There's also an EndAccess method that returns a signal
fence for the client.
For performance reasons, we use the same fence as the signal fence that
the Device uses internally, and record its value on the texture after
ExecuteCommandLists. Therefore, the CL also makes the Device's internal
fence a shared fence so that we can export it to the client.
This CL also expands the ConcurrentExternalImageReadAccess test so that
it tests fence synchronization across multiple devices. A number of test
helpers also now take an optional device parameter so that we can use
pixel value expectations with secondary devices.
Bug: dawn:576
Change-Id: I6bc86808ede9b5aacf87667106cbd16731a12516
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99746
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Currently only raised if Tint produces an Internal Compiler Error
(ICE). These were previously surfaced as validation errors.
Bug: dawn:1531
Change-Id: I9a10549b3e0bc2cbf962c99d157aa6dbe8032a3c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101500
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
These can be used in all sorts of places which are not tracked by sem::Function::TransitivelyReferencedGlobals().
As they're not emitted as variables by any backend, just preserve them.
Fixed: tint:1598
Change-Id: I2696486cb2ffe8408bd5dd3090d7d600ca1d170f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101481
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
This patch disables Toggle::D3D12DontSetClearValueOnDepthTextureCreation
on Intel Gen11 GPUs as we find it not needed after further tests.
Bug: dawn:1487
Test: dawn_end2end_tests
Change-Id: I2c378568328b758e83484cff514073b052cf5004
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101300
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Just adds the appropriate extensions for AHardwareBuffer support on
Android doesn't yet attempt to expose any.
Bug: dawn:286
Change-Id: I1345d98044bbcaf91cb31235bffbdc28a163c6e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
I forgot to fold this into crbug.com/tint/100861
Bug: tint:1581
Change-Id: I8f8faef7765b525316e2c927504cce88a93d24ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101303
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>