This patch fix the GLSL writer issue that emit only one helper function
when using both `v % s`, `s % v` and `v % vs in the shader, where `s` is
of `f32` and `v` is a vector of `f32`. Unittests are added for GLSL.
Bug: tint:1614
Change-Id: Ia89ae010341b9c88b8101cc6febab7d83c96bb17
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96085
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This has been replaced with module-scope const.
Change-Id: I03d5e076cf150d2931c9cfb1c6025e98200d91a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95947
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This patch adds a toggle to force initializing depth stencil textures
to 0 on Intel D3D12 drivers as a driver issue will occur when we
create and copy into a depth stencil texture that is just created with
CreatePlacedResources() on Intel D3D12 drivers:
- For the depth stencil textures with RenderAttachment usage, they will
always be cleared with ClearDepthStencilView() instead of copy, then
the following copies will be correct.
In next patch we will handle the situation when the depth stencil
texture is not created with RenderAttachment usage.
Bug: dawn:1487
Test: dawn_end2end_tests
Change-Id: I0f7db86a2e6db55e4b82defb510ccc829c6b0d38
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95989
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This helps output in the headers information about which structure can
be used to extend which. In the future it could also be used to generate
helpers that validate that the chain for a root structure contains only
allowed extension structs.
Fixed: dawn:1486
Change-Id: I6134332d477503e242b3bec9f8e9bedeeb352351
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96000
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
• Add `intel-hd-630-family` to the list of GPU tags (crbug.com/dawn/1444).
• `[ Skip ]` all the `inputSource="const"` expression tests for now (crbug.com/tint/1613).
• Reorder / normalize the rest of the expectations with `./tools/run cts update`.
Bug: dawn:1444
Bug: tint:1613
Change-Id: I39efc454ecff6e804417bcade744a4251acbda07
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95842
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
The `el_count` will match the WGSL declared array size *before validation*.
Fuzzers have started triggering out-of-memory cases by constructing large constant arrays, just to then error out.
Bug: chromium:1343963
Change-Id: I537ff3a570fe56b40e510b3bc6dfcd9b9752386a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96102
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This code uses `_uuidof` (single undescore) instead of `__uuidof`
(two underscores), only the latter is documented as the officially
supported operator by Microsoft:
https://docs.microsoft.com/en-us/cpp/cpp/uuidof-operator?view=msvc-170
I suspect `_uuidof` and `__uuidof` are the same under the msvc compiler,
but in other compilers (Zig/clang/MinGW) only the officially supported
`__uuidof` is exposed. This change improves compatability with such
compilers.
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Change-Id: If2850a1a98507161739fcd5f52ebd4ceaefffe75
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87309
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
D3D12 objects can have implicit dependencies on device resources that
are not captured by holding ComPtrs:
"Direct3D 12 uses COM-style reference counting only for the lifetimes of
interfaces (by using the weak reference model of Direct3D tied to the
lifetime of the device). All resource and description memory lifetimes
are the sole responsibly of the app to maintain for the proper duration,
and are not reference counted. Direct3D 11 uses reference counting to
manage the lifetimes of interface dependencies as well."
Source: https://docs.microsoft.com/en-us/windows/win32/direct3d12/important-changes-from-directx-11-to-directx-12
ExternalImageDXGI can outlive the device it was created on e.g. the D3D
shared image backing holds on to the ExternalImageDXGI for its lifetime.
ExternalImageDXGI destructor can invoke code that depends on D3D12
resources that might have already been destroyed. In particular, this
shows up as ComPtr::Release for ID3D12Fence crashing mysteriously, and
is also speculated as the cause for a racy invalid function pointer
dereference in crbug.com/1338470.
This CL makes the D3D12 backend device destroy the ExternalImageDXGI's
resources on device destruction making it effectively a weak pointer.
This unblocks landing https://crrev.com/c/3700811 and hopefully fixes
crbug.com/1338470 as well.
This CL also deprecates unnecessary WGPUDevice param to ProduceTexture,
and adds an IsValid() method so that the shared image can check it and
decide to recreate the ExternalImageDXGI if needed.
Bug: dawn:576, chromium:1338470
Change-Id: I2122cf807587cf3b1218ba29ea291263df0cf698
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95860
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch make WGSL writer support emitting f16 types, f16 literals,
f16 constructor and convertor. Unittests are also implemented.
Bug: tint:1473, tint:1502
Change-Id: Id2a5eec54b95add330366cf141b36999e604a63b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95990
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
SPIRV-Val has tightended up validation around input / output interpolation decorations.
This change ensures that the parser and writer do the right thing.
Change-Id: I29c97fdcc48c62aa77b106c42e64fbc54204d607
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96020
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
If the process exits with a non-zero status (like crashing), then don't pretend the test passed.
This would only occur if the test result had already been printed.
Change-Id: I29e81362b6e09f1fca48c55b1798ba409e9a703e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95942
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This patch make SPIRV writer support emitting f16 types, f16 literals,
f16 constructor and convertor. Unittests are also implemented.
Currently SPIRV writer will require 4 capabilities in generated SPIRV:
`Float16`, `UniformAndStorageBuffer16BitAccess`,
`StorageBuffer16BitAccess`, and `storageInputOutput16`.
Bug: tint:1473, tint:1502
Change-Id: Ia1af04f1f4a02bf1b1c2599a5d89791854eabc16
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95920
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Fixes a breakage compiling dawn_unittests in a Chromium checkout.
These tests have started testing passing public Tint structs like
tint::sem::BindingPoint to Dawn internals.
Bug: dawn:1480
Change-Id: I41a30abbf73384c86b966223f5f689bd3339ce06
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95986
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
This argument was getting dropped, so the default descriptor was
always used.
Bug: chromium:1343047
Change-Id: I521e00a3c390ff193fcc18072a037c069e98c680
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95982
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
In Mach engine we compile Dawn's d3d12 backend using Zig as a C/C++
compiler, effectively clang with MinGW windows headers. Unfortunately,
this `static constexpr` fails to compile:
```
error: constexpr variable 'kD3D12PromotableReadOnlyStates' must be initialized by a constant expression
```
As kangz previously noted, the reason appears to be because `D3D12_RESOURCE_STATE_COPY_SOURCE`
is not `constexpr` [in MinGW headers](1de9cc347d/mingw-w64-headers/include/winnt.h (L682)).
The thought process is that making this just `const` is fine because
constant propagation would make it a constant anyway.
If we're comfortable merging this, it'd be one less change we have to
maintain on our side - and probably no impact otherwise. On the other
hand, I understand the most-correct fix would be in MinGW headers
themselves. I'd love to land this change, but it's no big deal if you
prefer not.
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Change-Id: I772f1cb7e2b4f1b200820cd50f6b7df45850abbb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87381
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Add an internal usage option for copyTextureForBrowserOption
allowing internal calls from call to use canvas context
texture as source/destination.
Bug: chromium:1331139
Change-Id: Ida8421b3962a6434e8ef57c581c7a2e1d607954c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94985
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
The code was checking the equivalence in one direction but not the
other, leading to a case where passing a TextureView instead of an
ExternalTexture passed validation and lead to crashes in the backends.
Bug: chromium:1343099
Change-Id: I428252796df375e7cf3a6df1a03192d65364e370
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95944
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
ast::PipelineStage is private API. Duplicate the enum for the inspector.
Change-Id: Ib79600d2ef86cc13f409c7c800f98ea42bb3ace4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95943
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Before being destructed.
If the Destroy() method is not called, then the lost_promise_ is not resolved or rejected, triggering an assertion.
Change-Id: I0a7c06674bc58d2e7c4df4229452bd2de27ca2b5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95941
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Attempting to print a long string can cause output to go missing.
Split long strings up into 4k chunks.
Change-Id: Ibcb07459bd8fb4a1a11b6f8db41c8378274a6d09
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95940
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Textures with particular dimensions may corrupt on some devices for
copy and rendering. This change add a test to detect it.
Bug: dawn:949
Change-Id: Idcb346191c1c7beac4c5ff91464bd14d8eeba6f3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95680
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This patch make resolver reject using f16 types in uniform or storage
buffer, pipeline IO or overridable variable, since these are not
implemented yet. This can help prevent hitting invalid path in writers.
Bug: tint:1473, tint:1502
Change-Id: I5ea753e4254276a6d141d7012a6d0987423a61cf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95827
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Zhaoming Jiang <zhaoming.jiang@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Offset > 0 is already implicitly included in this if statement
(when `offset == 0` then `size > mDataLength` could safely assert it's invalid).
So we could remove it and use `offset > mDataLength` instead of `>=`.
Bug: chromium:1340654
Change-Id: Ieafe1ea6bef5aae29bc6ef2bd9702d6f7a92d8b5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95820
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
Materialize() was re-evaluating the constant values for the incoming
semantic expression, despite this already being evaluated. Just use the
sem::Expression::ConstantValue().
resolver.cc already has all the semantic pointers, so pass them in
instead of pointlessly hitting the ast -> sem map.
Change-Id: If2bc7cd10f79079fb811e9d83c5150dd3c0c244c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95764
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>