Implement materialization of abstract-numeric typed expressions to
concrete types.
TODO: Validation to ensure that the abstract-numeric values actually fit
in their materialized types.
Bug: tint:1504
Change-Id: I72b3a6a8801d872a4c4dfb85741073a05847ad48
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91028
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
The reformatting has taken place so the namespace no lint entries
are no longer required. Removed.
Bug: dawn:1381
Change-Id: I200f540ad5464e5f1ff103919cca71daf13c505c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91380
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Textures with more than one arrayLayer will now default to 2DArray
rather than 2D.
Change-Id: I34dd58aae27c4add65166343641777b3ac4dabcb
Bug: dawn:1380
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87306
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This member should not be cleared after Destroy() since the application
may ask for it if it still has a reference to the device.
Instead, only clear the member after the application has dropped their
last reference to the device.
Bug: chromium:1327865
Change-Id: I282482fec5db11b4c75b91ba5995d7e2599b89a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91281
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Chromium creates gbm_bo buffers without the
GBM_BO_USE_SW_WRITE_RARELY flag to hold the video frames from VAAPI
decoder. The added case could better cover this and catch the recent
mesa regression:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/5940
Bug: chromium:1258986
Change-Id: Ib8313b35fe90928aae03791560d80fdb47bcea32
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91081
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Changes the yuv-to-rgb constant matrix to be optional during external
texture creation because it is not necessary for single-plane scenarios.
Bug: dawn:1082
Change-Id: I543f4009e58f1571b0be80abb6b464b2b8c9d749
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91280
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This will later be used to remove GLFW from the direct DEPS of Chromium,
which will help update GLFW at the same time as the BUILD.gn file change
for GLFW in Dawn.
Bug: dawn:1246
Change-Id: If39575c9a4bbc84c58a63a23dfbe1cb812ff3562
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91162
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
The shared library build of Tint is currently broken with CMake, since
we set -fvisibility=hidden and do not export any of Tint's publicly
used APIs.
Change-Id: I7e4478a3a060fef3e5775dc32bae944363188ec5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90740
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
These are the first intrinsics to support abstract-integers and
abstract-floats.
Nothing can use these yet, as the resolver hasn't had abstract numerics
enabled in production builds.
Bug: tint:1504
Change-Id: I2760f72f5d3c68c30c2e7de5ae5fb290dce64d3f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91027
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
And expand the handling to include matrices.
Bug: tint:1504
Change-Id: I6fd9ce239d13acf0e2f74b8ea19dfac3457e348c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91026
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Attempting to emit shader code from an invalid program is unsafe.
The WGSL writer is used for dumping information which is valuable for debugging bad programs, so this has not been changed.
Bug: chromium:1327461
Change-Id: I4497fcb19d126ef6c872e2bcda8e9b79044aeb68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91163
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
When enabled, unsuffixed literals will be treated as abstract numerics.
By having this disabled by default, we can build up the tests without
the risk of breaking production code.
This flag is enabled for resolver unit tests. This can safely be done
with no change in tested behavior, as all tests use the '_i' or '_u'
literal suffixes, so currently there are no tests that exercise abstract
numerics.
Bug: tint:1504
Change-Id: I39523ff6e235a12533b1dd98587b580bed98300f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91025
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
This will test the same path currently exercised by the
WebGPU/Compat prototype in Chrome.
Suppress failing tests.
Bug: dawn:1420
Change-Id: Ie3d55e387ece292a98ec15eeaa04b6fad25e3be7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90080
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Update child objects to ref the device. This allows them to outlive
the device, making the implementation more robust such that it is OK
to drop the device before other objects.
Dropping the last external reference to the device is currently an
implicit device.destroy(). This destruction breaks possible ref cycles
where the device refs internal objects which have a back ref to the
device.
Bug: dawn:1164
Change-Id: I02d8e32a21dcc5f05e531bd690baac4a234b5f6b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90360
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
• Add sem::SwitchStatement::Cases()
• Add sem::CaseStatement::Selectors()
• Add ast::SwitchStatement -> sem::SwitchStatement mapping
Removes a bunch of hopping between the AST and SEM to get at this data.
Change-Id: If48d78e7a386aa0b34c6d00ad9af1d53cb236f12
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91024
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
• Add Name() method so we can print the type name without having to
create a ProgramBuilder.
• Add a DataType for f16.
• Add AST() methods on DataType<AInt> and DataType<AFloat> which return
nullptr.
Change-Id: I130648655e114c658a0c2985822630a71a683dd6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91023
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This patch implements PipelineLayoutD3D12::DestroyImpl() where we
call ReferenceUntilUnused() to all the root and command signatures
so that they won't be destroyed when they are referenced by GPU
operations in-flight on command queue.
BUG=dawn:1422
TEST=dawn_end2end_tests
Change-Id: I54df7b53645c9beaaa2e7b74aef54e0f6d37c440
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90940
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
These two functions in HLSL only accept and return uint. Thus, if the
result of these calls is passed to a function that wants int, it will
fail, or call the uint overload if one exists. Fixed by casting the
result to int if the arg is int.
Bug: tint:1550
Change-Id: Id4c0970a29ac4c83ee5b78be8d2762e05e4a3f03
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91001
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
• Rename the 'friendly names' for the abstract numeric types so they match
the style in the intrinsic table.
• Fix a comment so the literal type is correct.
Change-Id: Ie8d7363743c8c359340de3bc6db9a3456d299d34
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91021
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
• Add sem::Type::Common() which returns the 'common' type for the list of
types.
• Migrate intrisnic table to use this.
• Add a whole-lotta-tests.
• Deduplicate and improve the EXPECT_TEST() macro. Move it to a common home.
Bug: tint:1504
Change-Id: I1564f67ecf87fc594f3f54274da906ff0d822795
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91020
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Add:
• sem::Type::is_abstract_or_scalar()
• sem::Type::ElementOf()
Use these to clean up some code in src/tint/sem/constant.cc.
Bug: tint:1504
Change-Id: I78e06b580a750c97ac654af4b0b364ddd3de6596
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90534
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
With abstract materialization, any ast::Expression may map to the new
sem::Materialize node. Because of this, we can't assume that an
ast::CallExpression maps to a sem::Call, as it might be wrapped by a
sem::Materialize.
Remove the mapping, and fix up all the code that was relying on this.
Fixes are done by either:
• Calling `UnwrapMaterialize()->As<sem::Call>()` on the semantic
expression. This is done when the logic may assume it's possible for
the expression to be a Materialize node.
• Using the explicit sem::Info::Get<sem::Call>() template argument to
cast the semantic type to sem::Call. This is done when the logic
either knows it is impossible for the expression to be a Materialize.
The backends have been stubbed, as we'll want to emit the constant value
for these nodes. It's likely that we'll just use the FoldConstants
transform to strip all Materialize nodes from the tree. For now, be
defensive.
Bug: tint:1504
Change-Id: If9231b300fc30c7fe886c17a804ead8ee2988285
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90533
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
• Split type_ctors_ into array_ctors_ and struct_ctors_. These are the
only two type constructors that we need to cache in the Resovler. All
other types are cached in the IntrinsicTable. By making these two
separate fields, there's no way we can accidentally put other types in
there. This is slightly more optimized too, as each map is smaller,
and the keys hold less data.
• Drop the 'const' on vectors that are std::move()'d. A const object
cannot be moved, and this results in a silent copy. Fix the logic of
BuiltinCall() and FunctionCall(), as these were happily using the
vectors that had been moved.
• Extract the messy Texture-Sampling collection logic out into two
functions.
The rest of the changes are tweaks required to handle abstract numerics
and materialization, which will be put up for review shortly. Landing
the no-op refactoring now reduces review noise later.
Bug: tint:1504
Change-Id: Iffc8039360d6138c3ac9b456be6ca7b8451ede9f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90532
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
A new semantic expression node that wraps another semantic node. Used to
indicate the point at which compile-time, abstract numeric typed
expressions are implicitly converted to a concrete type.
Bug: tint:1504
Change-Id: I52e256bbbdeaa9d9eff4cb93b6f937dd00bdc5cb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90531
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>