Use it everywhere, and inline some simple uses for brevity.
Change-Id: I27727feedfb1eaa3e811241a420c3fbed404e5b1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115381
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This fixes the google3 build, which compiles headers in isolation.
Change-Id: I3c9a91caa75c6da1d9dcc17bb6d2aeb5834c197e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115440
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
The metal validation layer complains when copying from a 3D texture to
a buffer if the stride for the destination buffer is larger then 2048
bytes.
Bug: dawn:1430
Change-Id: I6ba4508d71610c35dfb0fab7d2bebc91d37504e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113426
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Gregg Tavares <gman@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Use std::initializer_list<std::string_view> for the tags passed to
CreateNode, and only concatenate them if debug mode is enabled.
Change-Id: Ida3662c52d72ba71bae3f91766dca6aaca89ee50
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115380
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
This change is a necessary to support workgroupUniformLoad in a
following patch. Otherwise, there is no change to the set of shaders
that are accepted or rejected by the analysis.
We now distinguish between uniformity requirements on the contents of
a pointer parameter versus the pointer value itself when generating
tags for function parameters.
Whilst processing an expression, if we see a sem::Load node we pass a
flag down through child expressions to indicate that we will be
loading from the result. When processing an identifier expression, we
can then select between adding an edge to the source of the
pointer/reference versus the contents of the root identifier that it
corresponds to.
Since the pointers passed to atomic builtins can be uniform, we
special-case them to capture the fact that their return value is
always considered non-uniform.
The arrayLength builtin no longer needs special-casing.
Added many tests to cover various cases that are now captured
differently in the graph. There are two cases that are disabled as
they require variable pointers to trigger the uniformity violation.
Bug: tint:1780
Change-Id: I03edb65f22a6ffb0e7daf8b2f590f5de898e6262
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114861
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Variables declared inside a loop block were not visible to the
continuing block. Special-case the continuing block by processing it
inside the loop-body block statement, instead of afterwards.
Change-Id: I05bc906bd98b24295dc91116b9ef8d8ef02c3af3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114860
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Variables declared in for-loop initializers were not being tracked
properly across iterations as a check was wrongly determining them to
be declared inside the loop body.
Also fixes an issue where variables declared in for-loop initializers
were still considered to be in scope after loop exit.
Change-Id: I2ce3a519be45c8daba31bf00e8b2614f0bd6a2de
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114364
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
When useing Bitcast to or from a class type, gcc warns even if the type
is trivially copyable. Fixed this by static_asserting that both types
are trivially copyable, and casting the pointers to std::byte*.
Change-Id: Ibb420f2dcdd35cfb187d74983fa8ab9b50d10c85
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115180
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Previously this toggle was implemented only for the Metal backend, but
a need for it was identified on Android as well. This change moves the
implementation to the backend-agnostic command encoder recording so that
it works for all backends. Fundamentally it's still doing the same
thing, however: Swapping resolve targets that point at a non-zero mip
level or layer with a temporary texture and then performing a copy once
the render pass has ended.
Bug: dawn:1569
Change-Id: I292860cc74f653b2880e727d2ef3a7dfa3f10b91
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106040
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Virtual methods are expensive to call, and hashes are frequently tested.
The hash must be immutable, so just calculate it once in the constructor and store it as an immutable field.
Change-Id: I9d29fb3fc074e57e7af91367768a47193baa40f1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114780
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
The generator_lib.py processing of file renders would check that the
output directory doesn't exist and if needed, would create it. However
by default makedirs errors if the path already exists. This caused
issues when multiple generator_lib.py generators with the same output
dir would run in parallel in builds, because there can be a race where:
- GeneratorA: Check os.path.exists -> returns False
- GeneratorB: Check os.path.exists -> returns False
- GeneratorB: os.makedirs -> Ok
- GeneratorA: os.makedirs -> Exception, fails the build.
Instead use os.makedirs(exist_ok=True) inconditionally to remove this
racy behavior.
Bug: None
Change-Id: I5cb401a1df11a3640faeea94c15cb54236edc05a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114521
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This immediate rejection has been implemented in Native but
hasn't been yet in Wire. This commit adds the implementation
to Wire.
Also the commit changes the MapAsync callback firing timing
if pending map buffer is unmapped or destroyed. With this
commit the callback will be fired immediately Unmap or
Destroy is called to match the WebGPU spec. Currently the
callback is fired when the client receives a response from
server but it mismatches the spec.
Change-Id: Ia48d62be31912fd0384e23271e9de516f9d71d6c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113607
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Takahiro <hogehoge@gachapin.jp>
Reviewed-by: Austin Eng <enga@chromium.org>
The code that was ifdef'd out no longer compiled.
Change-Id: I6243cc6a3584c555505c4bee68ec02bbb96801c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113430
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
The resolver now wraps sem::Expression objects with a sem::Load object
anywhere that the load rule is invoked. sem::Expression provides an
`UnwrapLoad()` method that returns the inner expression (or
passthrough, if no load is present), which is analaguous to
Type::UnwrapRef().
The logic for alias analysis in `RegisterLoadIfNeeded` has been folded
into the new `Resolver::Load` method.
Fixed up many transforms and tests. The only difference in output is
for a single SPIR-V backend test, where some IDs have changed due to
slight re-ordering of when expressions are generated.
There may be further clean-ups possible (e.g. removing unnecessary
calls to `UnwrapRef`, and simplifying places in the SPIR-V writer or
transforms that deal with memory accesses), but these can be addressed
in future patches.
Fixed: tint:1654
Change-Id: I69adecfe9251faae46546b64d0cdc29eea26cd4e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99706
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2D array texture may corrupt on some Intel devices, making out-of-bound
texture access and memory information leak. It's a critical security
issue. Intel driver team suggested the 24K extra memory approach in
order to mitigate the security issue before.
However, the texture corruption issue (and even the correctness issue)
can be worked around via allocating a few extra layers. And patches
have already been merged in Dawn, with a lot tests for verification. The
24K extra memory for each texture is actually incorrect and unnecessary.
So this patch removes relevant code in Dawn.
This patch mainly reverts some code of this patch below:
https://dawn-review.googlesource.com/c/dawn/+/96220
Bug: dawn:1507
Change-Id: Ic3239115ad4c74bdee928577ccbb20f1e35d13c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114641
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Don't use dynamic casting in hashing and equality. These should be fast, and dynamic casting is expensive.
Add type::UniqueNode for things that need de-duplicating and bin the types on construction.
Replace some use of SFINAE with constexpr.
Also fixes a build failure for x86.
Bug: oss-fuzz:54184
Change-Id: Ic1b0708394f9f5703fc179a2c31ce18bd07e196c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114760
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Without this, the next update will rebuild these expectations, without the Skip.
They appear to be flakey, preventing rolls from landing.
Change-Id: I09eacf9596fd4d984e2c6ac600076dbaeafe5347
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114700
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>