Commit Graph

8578 Commits

Author SHA1 Message Date
Ben Clayton 567a53e87c tint/utils: Add Vector::Any(), Vector::All() and predicates
Can be used to write simple whole-vector comparision checks.

Change-Id: I441a7e8d6b626a5a32ef3db9043e771f792900d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131746
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-09 15:10:05 +00:00
James Price 13ca70fa08 Reland "ir/spirv-writer: Emit entry point declarations"
Emit the OpEntryPoint instruction with the pipeline stage. Interface
variables will be done later.

Emit OpExecutionMode instructions for the workgroup size and fragment
shader origin, depending on the pipeline stage.

This is a reland of commit 90789ea1f8
with compilation fixes for MSVC.

Bug: tint:1906
Change-Id: If5290df504ebc8925b3c52510acab123edfd1073
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131800
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-05-09 12:25:07 +00:00
James Price 81fc109822 [tint] Fix unshadowing of abstract const users
Unwrap sem::Materialize as well as sem::Load when looking for users of
a renamed declaration.

Fixed: tint:1934
Change-Id: I7d5ade1f902dbdb4cf3b4f7552b78359f5b3ea9a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132060
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-05-09 10:59:58 +00:00
James Price e162a1adee [spirv-writer] Don't emit abstract accessor source
When traverseing an accessor expression, stop as soon as we hit a
source object that has a constant value. This prevents us from trying
to emit expressions that have abstract types and no materialization
nodes.

Bug: chromium:1442551
Change-Id: I8296ae58e63624e647052cdf966dbff15630a4d8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132040
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-05-09 10:57:21 +00:00
James Price f91b77dd6d [spirv-reader] Use builtin matrix aliases
This makes the generated WGSL more concise and readable.

Change-Id: I78a722b9a86264d3bbf219445628dc5597cbfd62
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132141
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
2023-05-09 10:40:06 +00:00
James Price 114bae24b0 [spirv-reader] Use builtin vector aliases
This makes the generated WGSL more concise and readable.

Change-Id: Ia486a74796a4029aaac1c4d051d304d05f1d5ea2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132140
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-05-09 10:36:41 +00:00
Austin Eng 5696997251 Improve runtime minBindingSize validation message
The message now reports the group/number of the binding that failed
validation, as well as the buffer.

Bug: dawn:1604
Change-Id: Ib08a3eace5ec5ebaf9eecce01eb397b5c0681bd1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131843
Reviewed-by: Brandon Jones <bajones@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-05-09 02:37:54 +00:00
jchen10 46014f69a0 d3d11: enable CompressedTextureFormatTests
Bug: dawn:1801
Bug: dawn:1705

Change-Id: I4b63d865ceb3a20a16917030b608309452aeb045
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131844
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2023-05-09 02:27:41 +00:00
jchen10 f083783f7e d3d11: VertexBufferTracker
This introduces VertexBufferTracker to correctly track pipeline's
vertex buffer state.

Bug: dawn:1799
Bug: dawn:1705
Change-Id: I06f32b501a3637b22318ec201b1953eba6ed0cf2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131700
Reviewed-by: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2023-05-09 02:22:42 +00:00
jchen10 b4425f537c d3d11: enable FirstIndexOffsetTests
Bug: dawn:1803
Bug: dawn:1705

Change-Id: I54ee08aa79da6c37c4c9b70db1f815d2d52e7756
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131940
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-09 01:25:25 +00:00
Austin Eng 1a8bb02624 Ensure commands are submitted before exporting the last signaled event
Consumers of the event expect it to be signaled after all work
enqueued thus far. Ensure that commands are flushed to ensure this.

Fixed: dawn:1691
Change-Id: I1409c668119a12e5e50a1ce2924ebc16d0470a4d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131880
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2023-05-08 19:43:35 +00:00
James Price a187e9e281 spirv-reader: Error for OpSpecConstantComposite expression
This is not currently supported, so produce a meaningful error message
instead of crashing.

Bug: oss-fuzz:55819
Bug: tint:111
Change-Id: Ib245a47edbbe6ef972844f940ea1d674e6b08a76
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131222
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: James Price <jrprice@google.com>
2023-05-08 17:48:30 +00:00
Peng Huang a3a0b3299b d3d11: enable more passed end2end tests
Bug: dawn:1705
Bug: dawn:1768
Change-Id: I1999b1f3029d9121e1851b3006836417017f159b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131860
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-08 15:34:43 +00:00
jchen10 8b2ab40c39 d3d11: enable BufferZeroInitTests.Copy2DArrayTextureToBuffer
This fixes the dst buffer initialization for Texture2BufferCopy.

Bug: dawn:1799
Bug: dawn:1705
Change-Id: Ibd4d2db9e6e0b025acf3385591f285edd2aa64ec
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131701
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Peng Huang <penghuang@chromium.org>
2023-05-06 06:20:08 +00:00
jchen10 331ef65fed d3d11: enable BufferZeroInitTests
Bug: dawn:1799
Bug: dawn:1705
Change-Id: I59ea4ba6bdbb200e1263c9a35d4aaa2b50bb08f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131502
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-06 03:02:02 +00:00
Stephen White b9e12716c6 Add FeatureLevel to AdapterBase; implement Compat.
This introduces the notion of FeatureLevel, currently consisting of
Core or Compatibility. Each AdapterBase is now constructed with the
FeatureLevel it supports.

When discovering PhysicalDevices, create an AdapterBase for each of
the FeaturLevels which that PhysicalDevice supports. For most of the
backends, this will mean Core and Compatibility, while OpenGL and
D3D11 support only Compatibility.

Bug: dawn:1796.

Change-Id: I828247ef43e2220805ccf6c08827aa5e2382a026
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118240
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-05-06 01:26:25 +00:00
Peng Huang 3ee4f6af41 d3d11: fix indirect indexed draw
Bug: dawn:1791
Change-Id: If2fe2df3fdd5d719070e07afd1d7c7b68b42e1ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131801
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-06 01:14:18 +00:00
Loko Kung 743ceb017a Adds a check and message for when encoding on a finished encoder.
Bug: dawn:1736
Change-Id: I1b968823deb23b1b047f9430b3410b8b5279eb52
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131504
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-05 23:14:42 +00:00
Peng Huang 300ec34c72 d3d11: fix indirect draw and dispatch
Bug: dawn:1716
Bug: dawn:1791
Change-Id: I6027a9ab8b33bfaf80d32300eed11fe7df5135e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131760
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-05-05 21:50:39 +00:00
Peng Huang 283b3a042f d3d11: fix and enable ComputeStorageBufferBarrierTests
The problem is becasue a resource can not be set as input and
output at same time on device context. So we have to track used
slots and unset related slots before binding a group.

This CL also unset all affect slots when a render pass or compute
pass is end, so all related resources could be unref from the
device context.

Bug: dawn:1705
Change-Id: I597762ad8afa3b8df7139b0070f0b457d7319836
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131380
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-05 20:07:24 +00:00
Ben Clayton b703afc061 tint/utils: Support hetrogeneous hashmap key lookups
Allows map with std::string keys to be looked up, using a c-string or
stringview without incuring a temporary heap allocation.

Change-Id: Id5b7fd5ac1ab7febf545472f9767273f8637a0de
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131623
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2023-05-05 18:55:15 +00:00
Ben Clayton 4204bb3ef1 tint/writer/spirv: Fix build on MSVC / some clang builds
For some reason, only a handful of compilers complain about the implicit cast of an enum to a uint32_t.
Make the cast explicit to fix these builds.

Change-Id: Ib57026cbbb28e330055a5c64eaf1ae05ea3ff7dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131744
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2023-05-05 17:00:52 +00:00
Ben Clayton 1dd578ad35 Revert "ir/spirv-writer: Emit entry point declarations"
This reverts commit 90789ea1f8.

Reason for revert: Compilation errors on MSVC and some linux machines.

Original change's description:
> ir/spirv-writer: Emit entry point declarations
>
> Emit the OpEntryPoint instruction with the pipeline stage. Interface
> variables will be done later.
>
> Emit OpExecutionMode instructions for the workgroup size and fragment
> shader origin, depending on the pipeline stage.
>
> Bug: tint:1906
> Change-Id: Ieeeda5f17da48a8cf0d3344d3b254542c7198cb9
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131381
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
> Commit-Queue: James Price <jrprice@google.com>

TBR=dsinclair@chromium.org,bclayton@google.com,jrprice@google.com,noreply+kokoro@google.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: If828577648a585a51568eabc79f41e1735b72b8a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: tint:1906
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131743
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2023-05-05 13:40:23 +00:00
Ben Clayton 146b67e0cd tint/ir: Replace getter with raw fields for more classes
There's an odd mix of IR classes that use raw fields, and others that
have getters. Migrate a bunch of those getters to raw fields.

Change-Id: I5c80abe16d3b4e6e5e9dc8f985611f9edfe5cdc6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131621
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-05 12:12:16 +00:00
Ben Clayton 895d240fbf tint/ir: Replace Converter with FromProgram() free function
ToProgram() will most likely be conditionally compiled as a separate .h
and .cc file. With just one static method, ir::Converter doesn't make a
lot of sense to be a class. Just replace with a free-function.

Bug: tint:1902
Change-Id: I305bf9cb73082a94848ec5b94129feabdb9b6fe9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131620
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-05 09:51:22 +00:00
Zhaoming Jiang 960918b1b6 Dawn: fix limit tiering for maxBufferSize and maxStorageBufferBindingSize
This CL fix an issue related to tiering the maxBufferSize and
maxStorageBufferBindingSize limits. In detail, this CL:
1. Fix the maxStorageBufferBindingSize tiers to [128MB, 1GB, 2GB-4,
   4GB-4] instead of the original last two 2GB-1 and 4GB-1, holding the
   guarantee that maxStorageBufferBindingSize is a multiple of 4 bytes.
2. Add a maxBufferSize tier 4GB, ensuring the guarantee that
   maxStorageBufferBindingSize must be no larger than maxBufferSize in
   case of it tiered to 4GB-4. Previously the largest maxBufferSize tier
   is 2GB, making this guarantee broken after tiering.
3. Move the adapter limits normalization logics in adapter initializing
   to Limits.cpp to allow unittest. Related unittests implemented.
4. Normalize tiered limits to ensure that tiered
   maxStorageBufferBindingSize and maxUniformBufferBindingSize are no
   larger than tiered maxBufferSize. Related unittests implemented.

Issue: dawn:1780
Change-Id: I4821f196fa89c7f18ebbf8e5e45df1c3268db895
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130120
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-05 02:14:31 +00:00
James Price 90789ea1f8 ir/spirv-writer: Emit entry point declarations
Emit the OpEntryPoint instruction with the pipeline stage. Interface
variables will be done later.

Emit OpExecutionMode instructions for the workgroup size and fragment
shader origin, depending on the pipeline stage.

Bug: tint:1906
Change-Id: Ieeeda5f17da48a8cf0d3344d3b254542c7198cb9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131381
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
2023-05-04 22:46:21 +00:00
James Price 436fffe2a1 ir/spirv-writer: Emit function declarations
Emit the return type, function type, and the OpFunction
instruction. The body is just a label and a hardcoded OpReturn for now
and will be emitted properly in a future patch, along with entry point
declarations and function parameters.

Bug: tint:1906
Change-Id: Id7117da078bccd77a00afb54a63c9c55b13236f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131600
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-05-04 21:26:58 +00:00
Loko Kung 0edb5204ab Adds AllowUnsafeAPIs toggle and fixes code-paths to use it.
- Note unsafe API paths currently check both AllowUnsafeAPIs and
  DisallowUnsafeAPIs toggle, allowing unsafe APIs if either is set to
  explicitly allow them. This will be removed once users have been
  updated.

Bug: dawn:1685
Change-Id: If322cc6dbe5ac3a02a31956df6fed0f5d3ec8e8f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131400
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-05-04 21:09:40 +00:00
dan sinclair c9734160bc [ir] Add tests for compound operators.
This CL adds tests for the compound assignment builder_impl. The ops
which can not be compound assigned have been moved to report diagnostics
messages.

Bug: tint:1718
Change-Id: Ia3dbbf706f0f074fd988a2b1c01f3fb5cc602c04
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131661
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2023-05-04 20:49:45 +00:00
dan sinclair eae9902c81 [ir] Add store test
This CL adds a simple test for the builder_impl for assignments.

Bug: tint:1718
Change-Id: Ia727ace4d01f107c6ac2ad1f8e430ef00ec43da9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131660
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2023-05-04 20:46:02 +00:00
James Price 02b5b224e3 ir/spirv-writer: Add support for scalar types
Also add a test helper header with some base classes that derive from
the IR builder.

Bug: tint:1906
Change-Id: If642bc64a50b6cae10363018a8dea8547ab9f542
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131441
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-05-04 18:50:49 +00:00
dan sinclair b169165633 [ir] Add tests for unary conversion.
This CL adds tests for the builder_impl unary conversion.

Bug: tint:1718
Change-Id: Ie0b6dae94e2c8d3d702331448daa0de54181851d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131582
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2023-05-04 18:15:42 +00:00
dan sinclair 63716c55cc [ir] Spit builder_impl tests.
This Cl splits apart the builder_impl test file in order to make it
easier to determine what has been tested.

Bug: tint:1718
Change-Id: Ib2f4d11a398b26fd774eb8c60555475053f20e0b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131581
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-05-04 18:01:26 +00:00
dan sinclair 34f41c7bad [ir] Change unary not to a binary equal
This CL removes unary `not` and instead emits `x == false`. When coming
back out of IR we can detect the `== false` and convert back to a `!`.

Bug: tint:1928
Change-Id: I905493182533ac2787ab9fe9245c8b53d51c1298
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131580
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2023-05-04 17:09:07 +00:00
dan sinclair e964f5163c [ir] Update type display in disassembly, remove string methods.
This CL consolidates the various ToInstruction and ToValue methods into
the disassembler. The type output is updated to prefix `:` instead of
surrounding by `()`.

Bug: tint:1718
Change-Id: I69e2d96ffbfe2113932740ce69d0967d29d41541
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131460
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-05-04 13:34:06 +00:00
James Price b298b6a222 ir/function: Add missing <array> include
Change-Id: I13c1d6d102e1fe11bd05320e8d363719b94f2552
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131540
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: James Price <jrprice@google.com>
2023-05-04 11:54:19 +00:00
Ben Clayton 29bff642fc ir: Use std::optional::value_or to simplify code
Change-Id: Iaf3ec58a70cd49c508c3279f62c029440b82c599
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131520
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-05-04 11:53:31 +00:00
Antonio Maiorano f789854a94 tint: fix undetected overflow in const-eval refract
Bug: oss-fuzz:58526
Change-Id: I59a2e9151036da6aba83c523605664b54002f3dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131342
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-05-04 08:42:15 +00:00
Jiawei Shao c81bc4521f D3D12: Disable the toggles about alpha blending on latest Intel driver
This patch disables all the toggles about the alpha blending issue on
the latest Intel D3D12 driver which has the fix against all the related
driver bugs.

Bug: dawn:1579
Change-Id: Ief8b08fd00df1b2872d663245d728374fb38a5b3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2023-05-04 08:07:28 +00:00
François Beaufort b22c5a465c Handle new errors to WGPUBufferMapAsyncStatus
This CL raises "mapping already pending", "offset out of range", and
"size out of range", and "validation error" error to make it easier
for developers to know why APIMapAsync fail in those cases.

Bug: chromium:1431622

Change-Id: I6f04751b2d67420a51d94aeac39ffbfd6e126fbf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129740
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Fr <beaufort.francois@gmail.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-04 06:46:19 +00:00
Brandon Jones 45b44fdb9f Remove DawnDeviceDescriptor code paths
This was listed as deprecated and has been for a while (at least a
year.) No code paths in Dawn make use of it and the few remaining
uses in Chrome are being removed in
https://chromium-review.googlesource.com/c/chromium/src/+/4501347

Bug: dawn:1797
Change-Id: Ifff4e5609e228080361e5d3a20a881eaf811ab6c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131321
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2023-05-04 02:01:52 +00:00
James Price 8f9ea96c20 tint/writer/spirv: Add path for generating from IR
This adds a GeneratorImplIr class and an option to the SPIR-V writer
to use it instead of the AST-based GeneratorImpl class.

The Tint exe now has a --use-ir flag which will use this path.

Bug: tint:1906
Change-Id: I34cc5c7468c8faf4a808669da8c44551ad01da8f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131341
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-05-04 01:31:36 +00:00
James Price 057b7f326e tint/writer/spirv: Use Diagnostics() for errors
Brings the SPIR-V writer in line with other writers.

Change-Id: Iaa261150de953b414f966dd004bd48f7315ceb0c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131221
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-05-03 23:25:01 +00:00
James Price cb8f3308a3 spirv-reader: Error for OpUndef image argument
We can't generate meaningful WGSL for this case, so just avoid
crashing.

Bug: oss-fuzz:58112
Change-Id: I6c02d9113c237171fdafcd06e063a62f26cae9c0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128900
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
2023-05-03 23:11:55 +00:00
James Price f885a90a5f tint/writer/spirv: Create Module class
Move the generic code for building up a SPIR-V module from Builder to
a new Module class. This can then be reused by the new IR-based SPIR-V
writer.

Switches to naming of methods to camel case to bring in line with the
rest of the codebase.

Bug: tint:1906
Change-Id: I7775edff6fe56328c6562559c016a19097b50805
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131340
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-03 22:54:15 +00:00
dan sinclair 09b02ffc7b [ir] Split the Terminator into two nodes.
This CL moves to having a `FunctionTerminator` and a `RootTerminator` so
we can assert if the IR is in a function depending on the terminator
seen.

Bug: tint:1929
Change-Id: Ie9e3aed71b7cf3b91439efbcca20885ec2cabe24
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131281
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2023-05-03 22:13:28 +00:00
dan sinclair 69bb5dd816 [ir] Add function return information.
This Cl adds information into the IR on the function return type and any
associated attributes.

Bug: tint:1915
Change-Id: I74cbf2613b4ae575e33a61d04d30b515df6ba796
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131300
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-03 21:31:51 +00:00
dan sinclair 9d9a38336e [ir] Add function attributes
This CL adds the pipeline_stage and workgroup_size attributes into the
IR function.

Bug: tint:1915
Change-Id: I245dbf0104a1784cff364535106b3e520322ac73
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130920
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-03 19:22:31 +00:00
dan sinclair 4cadbc4daf [ir] Handle IdentifierExpression
This Cl adds a scope stack into the IR builder and uses it to replace
IdentifierExpressions with the relevant IDs. If the IdentifierExpression
was const-eval'd then it will be replaced by the constant value.

Bug: tint:1919
Change-Id: I54e38d56bd24e2ced1818c509115dd5a5149cb40
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130900
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-05-03 19:20:48 +00:00
Austin Eng 94bc4cf046 Log HLSL for dump_shaders even if HLSL compilation fails
Fixed: dawn:1681
Change-Id: I56abb56c47d97105fac541a49c377cc0222feb10
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130460
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-05-03 19:19:19 +00:00
Peng Huang a246d8d3c2 d3d: remove external image related name alias from d3d12 namespace
Bug: dawn:1705
Bug: dawn:1724
Change-Id: Idd62c8f0a4f77ec975161fad7e981efb8326a2a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131220
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-05-03 18:03:27 +00:00
Austin Eng 249f8d5aa2 d3d: match maxStorageBufferBindingSize and maxBufferSize
Fixed: dawn:1751
Change-Id: I77303bf23a9a64e38acc72d9f039097b4d901306
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131280
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
2023-05-03 17:41:29 +00:00
Albin Bernhardsson 42b688bcff Fix Vulkan swapchain synchronization
It is necessary to use a semaphore to synchronize rendering and
presenting even when the graphics and present queues are the same.

This fixes rendering artifacts encountered on a Mali-G78 device.

Bug: dawn:269
Change-Id: Ieb0240d3668b7f9f68857ed3cf8d3bfea18cf33a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130221
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Albin Bernhardsson <albin.bernhardsson@arm.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-05-03 17:06:13 +00:00
Ben Clayton 1545ca191b tint: Remove Program|ProgramBuilder::FriendlyName()
Now that we don't need the symbol table to get the names of the types, we can just call FriendlyName() on the type directly.

Change-Id: I39478f5b8847ee032e77c15fd0de0665ddbf4811
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130220
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
2023-05-03 16:26:40 +00:00
dan sinclair 6ac51c1c57 [ir] Update binary and unary names.
This CL removes the LogicalAnd and LogicalOr binary kinds, and updates
the names in binary and unary to drop `bit_` and `log_` prefixes.

Bug: tint:1718
Change-Id: Ie180549ee5ecfad65fff9e4b4db86dd8a8b54833
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130800
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-05-03 16:25:44 +00:00
Antonio Maiorano fa00fe9d41 tint/hlsl+glsl: fix workgroupUniformLoad polyfills
The BuiltinPolyfill transform expects the DirectVariableAccess transform
to run after it, but this regressed as part of
https://dawn-review.googlesource.com/c/dawn/+/122203

Add unit test along with e2e 1926.wgsl test.

Bug: tint:1926
Change-Id: I5107453ce152b12e6f2f36930846e1fffa775708
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131020
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-05-03 15:30:54 +00:00
dan sinclair e903396ff2 [ir] Emit short-circuit as an `If` node
This Cl removes the `&&` and `||` logical binary nodes and replaces them
with a var declaration and if node.

Bug: tint:1925
Change-Id: I9f25411a9b9c909fa25f2f37cbd51181ac584acc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130500
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-05-03 14:59:03 +00:00
Loko Kung 2966d3ad08 Adds pass labels into the commands and plumbs through for Metal.
Bug: dawn:1784
Change-Id: Ie71360d83c4f3c47821916ebf8a187662e3f286f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131100
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-03 07:33:18 +00:00
Loko Kung 2552dd3c9f Plumbs labels for the following Metal objects:
- Buffers
- Pipelines
- QuerySets
- Samplers
- Shaders
- Textures

Change also includes:
- Metal debug name utilities

Bug: dawn:1784
Change-Id: Iddd2546f842c794570c225577d35c82e56809c6c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130940
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-05-03 05:57:06 +00:00
Loko Kung b27e2bfa71 Adds generation for WGSL descriptor to rename source->code.
- Adds a deprecation warning for the incorrect usage.
- Adds test to verify that the warning is emitted and that the results
  are equal.
- Fixes all existing tests to use the newer code path.

Change-Id: I01bf85137ad1c66966e1aa0259ae03fc5247ba25
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130320
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-03 02:23:25 +00:00
Stephen White fed6b6b35b Turn AdapterBase into a wrapper class.
Change AdapterBase from an alias to PhysicalDeviceBase to a thin
wrapper class holding a ref to a PhysicalDeviceBase. This way,
mutiple AdapterBases can point at the same PhysicalDeviceBase.

For now, InstanceBase wraps all PhysicalDeviceBases discovered by a
backend in a single AdapterBase. In the future, this relationship will
become many-to-one.

Since Devices now maintain a ref on the AdapterBase wrapper (in order to
query toggles, etc), PhysicalDeviceBase::CreateDeviceImpl() now takes
the AdapterBase as an argument, so that the PhysicalDeviceBase knows
which AdapterBase to vend a Device for.

Note that the Toggles also still remain on the PhysicalDeviceBase, to
be moved up to the AdapterBase in a future change.

Bug: dawn:1774
Change-Id: Idef5d24fbd66d8552959230e246e453abddcc736
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131001
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-05-03 01:29:44 +00:00
Austin Eng 5eb3619d3e Add error context to clarify which depth/stencil function/op is validated
Fixed: dawn:1735
Change-Id: I5e3e3e67bb6fd01c10257a2a8c39ba29b49e0933
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131081
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <toji@google.com>
Kokoro: Austin Eng <enga@chromium.org>
2023-05-03 00:51:08 +00:00
Austin Eng e89f88b600 Add error context on Queue::API* methods
Fixed: dawn:1747
Change-Id: Icc8f4dbc6fcf69c117f880b5ef9d54cf256f7062
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131080
Reviewed-by: Brandon Jones <toji@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-05-03 00:43:42 +00:00
Peng Huang 80cf5e51cc d3d11: enable some compute shader tests
Known issues:
 d3d11 buffer cannot be uniform and storage at same time.
 DispatchWorkgroupsIndirect doesn't work correctly.

Bug: dawn:1705
Bug: dawn:1791
Bug: dawn:1792
Change-Id: I14df33c441198fcde9063ad85251da30c4b12c6a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131060
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-02 22:29:23 +00:00
Brendon Tiszka 1f8413f50a Add Dawn Wire Server LPM Fuzzer [3/N]
Add ability to define custom protobuf structures for commands that
need to be hand written.

Bug: chromium:1374747
Change-Id: I69d5c55d69c3544835a23e4e0360900b991ccbd3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114643
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brendon Tiszka <tiszka@chromium.org>
2023-05-02 21:41:22 +00:00
Stephen White ebafab6556 Rename vulkan::Adapter -> vulkan::PhysicalDevice.
Bug: dawn:1774
Change-Id: Iad2896033fc4ae04513444db1a0c941c6c1681ae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131000
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-02 20:48:09 +00:00
dan sinclair c970e806db [ir] Emit `var` and `let` into the IR
This CL adds a nodes for `var` variables. In order to support
global var a new module level block is added, the `root_block`. It only
exists if there are declarations which are emitted into it. The
initializer for the `var` is assigned through a `store` instruction.

A `let` declaration is just the initializer result.

Bug: tint:1897
Change-Id: Icb949699ef643988151cc52026f9ad6a12cdd93f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130761
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-05-02 15:47:29 +00:00
jchen10 1b01b665d7 Workaround for UpdateSubresource1 16-byte alignment
In case of misalignment, we write to a temp staging buffer first,
and then copy to the dest buffer using CopySubresourceRegion.

Bug: dawn:1776
Bug: dawn:1705
Change-Id: Iba44dd79d9ee4b02f8cc83263bcfc911e1cce136
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130140
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2023-05-02 08:36:10 +00:00
dan sinclair 642a4f1d8c [ir] Make dump output more consistent.
This Cl updates the dump output for the IR to be a bit more consistent.
Brackets are removed, named calls are used in place of symbols. Trailing
commas cleaned up. Values have their type appended to make it clearer
what they are when a literal is emitted.

Bug: tint:1718
Change-Id: Ie202d4a4f8267d00b9af4864063b7133f4c7f324
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130000
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-05-02 08:27:28 +00:00
Austin Eng 7b82609894 Make TextureComponentType an internal enum
Fixed: dawn:1682
Change-Id: Iadbe7e2829805fed9a7f7e3bb0925544f4318380
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130440
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-02 04:34:55 +00:00
Loko Kung ba242e53cc Removes remaining V1 deprecation utilities.
- Note: Any future deprecations should directly use
  device->EmitDeprecationWarning and switch to a ValidationError after
  the deprecation period if applicable.

Bug: dawn:1685
Change-Id: Ia2e51eca32a9645ce362718200c50240d51d6ea0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130840
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-02 00:38:56 +00:00
Stephen White 9091b46278 Rename AdapterD3D* -> PhysicalDeviceD3D*.
Bug: dawn:1774

Change-Id: I9eca75c75c1ec162112915af3bd8371e808c2d60
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130421
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-01 23:10:47 +00:00
Peng Huang 5c2f1678be d3d11: add tests in AdapterDiscoveryTests test suit for d3d11
Bug: dawn:1705
Change-Id: I0841e00b9595651882c7b1c5ae21f00d0201c5a9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130680
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-01 23:05:42 +00:00
Stephen White 8076b2ad73 Rename AdapterGL -> PhysicalDeviceGL.
Bug: dawn:1774

Change-Id: Ic137524027eb519af4cb46396b9a8cea9e4cb7f4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130420
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-05-01 21:51:16 +00:00
Stephen White 556147c333 Rename null::Adapter -> null::PhysicalDevice.
Bug: dawn:1774
Change-Id: I05f4578e08175c4ce5703c5555689ba517b4590d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130780
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-05-01 21:37:44 +00:00
Stephen White be4b208ab6 Rename metal::Adapter -> metal::PhysicalDevice.
Change-Id: I558b7a22359437dd2a54f05a55a4128a806c7783
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130760
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-05-01 21:04:15 +00:00
Austin Eng b15d853239 Split MakeVertexDesc so it is const
Fixed: dawn:1384
Change-Id: I6071097e8d78b8462459623443b66f3afa42d9d8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130480
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Brandon Jones <toji@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-05-01 19:57:35 +00:00
Loko Kung 4e9ebeff02 Deprecates PopErrorScope returning a bool.
Bug: dawn:526
Change-Id: Ia4e985fbe4fcb5edb3fe80849f5b0df0190eea00
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130340
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-01 19:25:18 +00:00
Peng Huang fab65123e1 d3d11: remove the workaround in DeviceOutlivesInstance
Bug: dawn:1705
Change-Id: Ic10965ee246b197f72f2be063b6bf70122c5a4ed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130700
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-01 19:16:33 +00:00
Peng Huang 765cdc283a d3d11: enable render related end2end tests
Set Toggle::ApplyClearBigIntegerColorValueWithDraw for device,
since D3D11 can only clear RTV with float values. It workarounds
issues for clearing some RTV with really big integer values.

Bug: dawn:1705
Change-Id: I2e7ec7f527b9a41edc28a004f7989842c6ced3b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130600
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-05-01 18:06:39 +00:00
Stephen White e4877b7e68 Rename AdapterBase -> PhysicalDeviceBase.
AdapterBase will become a (thin) wrapper class in an upcoming patch,
allowing a single PhysicalDeviceBase to be wrapped in multiple AdapterBases,
each with different toggles and flags.

For now, alias AdapterBase to PhysicalDeviceBase.

Design doc: https://docs.google.com/document/d/1Ag3UAD6D1OVt9-MwKltzLefVhwKRdX0RqML2etrYVS4/edit

Change-Id: Ie77e99508be5285b651aa24ccb412bc9ff8b0111
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130300
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-05-01 16:39:04 +00:00
Peng Huang 0e2a833da8 d3d11: enable entrypoint tests for d3d11 backend
Bug: dawn:1705
Change-Id: Ie8f29132726c015cbe4f552eb77afc1ecbc4a325
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130660
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-05-01 16:29:15 +00:00
Peng Huang 925b77605e d3d11: enable d3d11 by default if it is not built with chromium
Bug: dawn:1705
Bug: dawn:1778
Change-Id: I8d84582f6f9e84676572ecb9c174d0117468888b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130580
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-01 16:13:00 +00:00
Peng Huang 6ffec70123 d3d11: fix link errors
Bug: dawn:1724
Change-Id: If27342937e450d11a54f1d36f4378feb69d5e98e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130400
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-29 00:57:59 +00:00
Brandon Jones df6cb23649 Change D3D12 Descriptor Allocator To Invalidate Submitted Descriptors
Changes D3D12 descriptor allocator to invalidate existing descriptors
after the descriptor heap was submitted for use. This fixes a
synchonization issue where stale descriptors were seen as valid because
command list execution ran long.

Bug: dawn:1701
Change-Id: Ibfd450b3be6cf91d66e8dce4ffd19ecf1a37f7f5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129920
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
2023-04-28 22:31:33 +00:00
Peng Huang 948ef4292f d3d11: fix Queue::WriteTexture() and enable queue related tests
Bug: dawn:1705
Change-Id: I63540d46335401aeaa46efe157fdb7a191aa4637
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128860
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-28 19:01:32 +00:00
Peng Huang 85d98a91f7 d3d11: fix and enable viewport end2end tests
Bug: dawn:1705
Change-Id: Ie75f301465b5000c9ebdd58ab0cb1901d251730e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128862
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-28 19:01:18 +00:00
Peng Huang e5a4cfb935 d3d11: enable some CopyTests
To make B2B, B2T and T2B testes work, this CL implements several
missed functions:
 - Texture::Clear() is need for initializing texture data
 - Texture::Read() is need for readback data from 2d and 3d textures

Bug: dawn:1740,dawn:1768
Change-Id: Ib9e354c82fcdc8cc4e86b1699fa652cfc4a50721
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128621
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-28 17:22:03 +00:00
Peng Huang d7a4483148 d3d: move some external image related code to d3d namespace
Expect ExternalImageDXGIImpl, most external image related code can
be shared between d3d11 and d3d12. This CL move those code into
d3d namespace

Bug: dawn:1724
Change-Id: I6c32cfd36880d4d009b272886a9369dc99dffbe6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130100
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-04-28 16:53:28 +00:00
Austin Eng 220aa01153 Fix name of libdawn_webgpu_dawn to libwebgpu_dawn
Fixed: dawn:1298
Change-Id: I7a32b644349837fcfc5e258232285b591f7e99a8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129860
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-04-28 15:14:37 +00:00
Corentin Wallez 96b61c56fa Remove support for macOS 10.11 and 10.12
Fixed: dawn:1397
Change-Id: I58c899bb58c445d56c544828a52eddd720bc4847
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129840
Reviewed-by: Brandon Jones <bajones@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2023-04-28 11:55:21 +00:00
jchen10 c755ec54aa d3d11: enable BindGroupTests
The cases can pass now with a few fixes.

Bug: dawn:1776
Bug: dawn:1705
Change-Id: I4a38887c51d003b4e9b782fd9217c9ce2c7dd423
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128980
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-28 02:40:48 +00:00
dan sinclair f26b1269bd [ir] Move `ir::Bitcast` to inherit `ir::Call`.
This CL moves `ir::Bitcast` from `ir::Instruction` to `ir::Call`. The
`bitcast` is, essentially, a templated call instruction.

Bug: tint:1904
Change-Id: Iab8ccffaa484767318433f5fc6c33670c5f6375e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129940
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-27 20:28:01 +00:00
dan sinclair 4a2e0ad36b [ir] Make `ir::Discard` a child of `ir::Call`.
The `discard` statement is, essentially, a function call. This CL moves
the `ir` node from being under `Instruction` to be under `Call`.

Bug: tint:1905
Change-Id: I8098dfc6047286b1c5249679139bcc83aa1cb21d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129681
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-27 20:02:17 +00:00
Ben Clayton bc6720b9f6 tint/type: Remove Source from Struct & StructMember
type::Struct is the base class of sem::Struct.

type::Struct does not have a Declaration() member, so it does not make sense for it to have a Source.

Given that sem::Struct has a Declaration() method, use this to obtain the source.

Same logic applies to StructMember.

Change-Id: I693f659c35216ebe5eac5ea2a5b6457773077ddc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129480
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
2023-04-27 19:29:45 +00:00
Ben Clayton bc9e422728 tint: Use type::Struct where possible
type::Struct does not have an ast::Struct declaration, so use that for
builtin structures.

Fix up logic that assumed sem::Struct for both user-declared and builtin
structures to use type::Struct instead.

Assert in the sem::Struct and sem::StructMember that the AST node is not
nullptr.

Change-Id: Ic8fcf27d5610c814ea3b504694c6a94db6cf1191
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129483
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2023-04-27 18:31:44 +00:00
Ben Clayton 576ba1c493 tint: Add StructMember attributes to sem.
Removes the need to examine AST attributes.

Change-Id: Iaaa6b10fd56baf732057c4c3960c1bfc5bbdeaa6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129621
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-27 17:58:25 +00:00
Ben Clayton 333cea405c tint/resolver: Clean up attribute resolving
Attributes resolving was done ad-hoc throughout the resolver, with the
validator ensuring that attributes were only applied to the correct nodes.

The ad-hoc nature meant that attributes were inconsistently marked and
resolved, and the attribute arguments were not always validated
(especially when used internally).

This change inlines the attribute processing into the appropriate places
in the resolver, and uses a standardized error message for attributes
that cannot be applied.

Change-Id: Ic084820949bbf8276fb2d33c103fa29b77824a69
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129620
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-04-27 17:21:58 +00:00
dan sinclair fe8a76cbbc [ir] Use the const eval results for expressions.
If an expression has a `sem::ValueExpression` attached we can use it to
directly obtain the result of the expression and stop emission. This Cl
updates the IR builder to pull the expression result if possible.

Several of the tests have been updated to go through a function in order
to stop const-eval from removing all the test content.

Bug: tint:1924
Change-Id: I6458cc297efc7789ac200069c18f75e8eb70c63b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129680
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-27 15:45:56 +00:00
Colin Blundell a406959e50 Add transient attachments and initial Metal support
This CL does the following:

* Adds a "transient attachment" bit to texture usage. This bit
  specifies that the created texture will be used only during
  this render pass.
* Adds a TransientAttachments Feature that gates the usage of
  transient attachments.
* Adds support for transient attachments on Metal, where they're
  used to create textures as memoryless.
* Adds validation tests and an E2T test of the feature.

A followup CL will add support in Vulkan.

Bug: dawn:1695
Change-Id: I3c7322dd1e4bee113062aae2e0494d292ee8cbc3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129080
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-27 14:55:09 +00:00
Sunny Sachanandani c820dcc53e d3d12: Remove keyed mutex support
Keyed mutex support was deprecated and the only known client using it,
Chromium, has migrated to fences. Remove all related keyed mutex related
code and tests. The useFenceSynchronization field is still present in
the external image descriptor since it's set by Chromium (to true) -
it'll be removed once Chromium stops setting it.

Bug: dawn:1612
Change-Id: Iaec3c16b18bb8ddbde55a7f54eaf4b944d0f06c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129300
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-04-27 14:46:56 +00:00
Ben Clayton df218948ba Run clang-format
Change-Id: I9f93208a6670d9dc32a8900d03e0cfbc076adc41
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129800
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-04-27 14:00:57 +00:00
dan sinclair f00679fd72 [ir] Make ir::Instruction a ir::Value.
This CL removes the `ir::Runtime` and inherits `ir::Instruction` from
`ir::Value`. This means that any `Value` can be an `Instruction`. The
instruction id is used for debugging purposes.

Bug: tint:1895
Change-Id: I2b79cd6721268712d78a47d383a30f82aa3aa07e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129660
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-27 14:00:06 +00:00
Takahiro 5e4aad952e Make maxBindingsPerBindGroup 1000
To follow the WebGPU spec update
https://github.com/gpuweb/gpuweb/pull/4050

Bug: dawn:1767
Change-Id: Iec5c60de7af5cb8b8e1baa7fc378a6551c6b5bd1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129380
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Takahiro <hogehoge@gachapin.jp>
2023-04-27 13:51:54 +00:00
dan sinclair 5e344a338f [ir] Split AST and SEM sources out of core ir.
This CL moves the need to pull in SEM and AST into a specific
`libtint_ir_builder_src` library. This will make it a GN error if we
accidentally try to use the SEM or AST inside the IR after the initial
construction.

This required move the `ToProgram`/`FromProgram` methods out of
`ir::Module` and into an `ir::Converter` class.

Bug: tint:1921
Change-Id: I2e6ae195f9a100030b43f35a2c5dad634433147f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129661
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-04-27 11:56:58 +00:00
Austin Eng 3a0a827ebe Revert "Disable SamplerTests on NVIDIA D3D11"
This reverts commit f8ef5e95ac.

Reason for revert: Not the cause of flakes.

Original change's description:
> Disable SamplerTests on NVIDIA D3D11
>
> Suspect to be causing flakes in D3D12 sampler tests
>
> Bug: dawn:1779
> Change-Id: I7a8518683142191e05c7befed078d69abdaf9b77
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129280
> Reviewed-by: Loko Kung <lokokung@google.com>
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Austin Eng <enga@chromium.org>

Change-Id: I72630f21d861acd9e266a0ac0c80e917f4f440bb
Bug: dawn:1779
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129600
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-04-26 22:21:23 +00:00
James Price 9d3af6521b tint/ir: Add GN option for building the IR
This currently requires that we are not building with Chromium.

Bug: tint:1911
Change-Id: I6c37afe6c2b8250b30d244e8cc2274253b6ce8f6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129560
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-04-26 22:05:42 +00:00
Brandon Jones 1040f0e087 Show encoder in command buffer/render bundle messages
Having labels like [CommandBuffer from CommandEncoder "B"] will
provide greater context when developers don't provide labels to
every tier of object.

Bug: dawn:1746
Change-Id: Ibf72f97e054ff943b33c210e457422466e46a013
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127120
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-26 21:19:29 +00:00
Ben Clayton 47dd30117d tint/resolver: Resolve builtin structs
Allow the resolver to understand builtin structures, like
__frexp_result_f16. This allows backend transforms to declare the types,
even if they're "untypable" by the user.

Bug: chromium:1430309
Change-Id: I392709118182a058f737ccf1b7b46fc6b0b7264d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129482
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-04-26 18:27:53 +00:00
Ben Clayton d3b09b90e3 tint/resolver: Add builtin_structs.h / .cc
Contains the builtin structure creation logic moved out from
intrinsic_table.cc.

Bug: chromium:1430309
Change-Id: I2207f9ae42c6d7343c2f2ffa81effde59e6023fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129481
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-26 18:25:03 +00:00
Loko Kung aae9f6bc5f Fully deprecates DawnTogglesDeviceDescriptor.
Change-Id: I81ac6e70e086e1f5839733d2dd35c283ed6eba68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128681
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2023-04-26 17:50:55 +00:00
James Price 72d1ea4ac2 tint/resolver: Remove duplicate nullptr check
Change-Id: If4226d5427c2be270701b7b8d29e9f2ba5aa5ed5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129500
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-26 17:35:51 +00:00
Le Hoang Quyen 759238b962 Suppress MultithreadTests.Device_Dropped*OnAnotherThread
These tests seem to cause flakiness in other sampling tests on NVIDIA.

Bug: dawn:1779
Change-Id: Ide341033a4f13d8294021752ad3d18850a7369d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129400
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-26 17:18:13 +00:00
dan sinclair 135ab2b39f [ir] Rename instr.
This Cl renames the `instr` variables to `inst`.

Bug: tint:1718
Change-Id: Icf3b8c2f612c8dfe4b469d90327fef90ad813a0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129460
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-26 14:46:03 +00:00
Loko Kung abfa45baa4 Deprecates use of filter mode for mipmap filters.
Change-Id: I77044ee7f0ce1b066dd8c8a1ee1b34e07f5e9766
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128660
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-26 08:03:20 +00:00
David Neto 97d3554f99 dawn/node: fix binding for GPUBufferMapState
This fixes a linking problem.
The conversion function should be a member of the Convert class,
not a freestanding function.

Change-Id: Ifa351e4ba6fb0e95fed311a11e9dc56e13eb1a0b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129260
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-26 00:34:53 +00:00
Austin Eng f8ef5e95ac Disable SamplerTests on NVIDIA D3D11
Suspect to be causing flakes in D3D12 sampler tests

Bug: dawn:1779
Change-Id: I7a8518683142191e05c7befed078d69abdaf9b77
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129280
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-04-26 00:21:14 +00:00
dan sinclair aa97bb5327 [ir] Add assignment statements
This CL adds Assignment and CompoundAssignment statements to the IR
builder.

Bug: tint:1718
Change-Id: I3037da0115c7f4fe68941565b7e48866d421bbbf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129201
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-26 00:15:31 +00:00
dan sinclair 5b541ff3c2 [ir] Mark const variable as skipped.
The const variables should all have been const-eval'd and turned into
`constants` at the usage sites. This CL updates the IR to skip constants
when emitting.

A TODO is added to validate they aren't used when identifier expressions
are supported.

Bug: tint:1718
Change-Id: I77328a0cbd3d7f6692d1d1057d6953fcf762cfd7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129240
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-26 00:10:40 +00:00
dan sinclair 5aa7ef2bc0 [ir] Add Unary expressions
This CL adds support for UnaryOpExpressions and converts them into Unary
instructions in the IR.

Bug: tint:1718

Change-Id: I736e29cec5e722b7c7f1b0f4f22ce55a3d3e4109
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129221
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-26 00:08:35 +00:00
Loko Kung d2aaf76eb9 Removes maxFragmentCombinedOutputResources limit and tests.
Bug: dawn:1756
Change-Id: I1fe73eb7987cdffdb2653e1072c4946b5bc3ef4c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127660
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-04-25 22:46:23 +00:00
dan sinclair 339719967e [ir] Remove internal `bool` returns.
This CL updates the IR builder implementation to remove the `bool`
return values and use the diagnostics as the source of truth for if the
conversion works.

This requires disabling a couple tests as they depend on identifiers
which aren't implemented. Previously the `worked` because it would just
return an ID value that would be emitted, but now they end up being an
error.

Bug: tint:1718
Change-Id: I00bc8845393cf4fae7b3eb0f5cfffb8c5fc1dec0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129220
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-25 22:02:22 +00:00
Austin Eng d0d6fc911c Return a pointer to a global static for zero-length GetMappedRange
Bug: chromium:1430985
Change-Id: Iaca7a21487a5a7e2b41dd9a363a7efd913a0f208
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129180
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Brendon Tiszka <tiszka@google.com>
2023-04-25 21:33:22 +00:00
dan sinclair 69108d048b [ir] Add ir::Discard
This CL adds support for discard into the IR. The `discard` statement is
handled as an instruction in the current block. The `discard` is a
`demote_to_helper` in WGSL so control flow has to continue after the
discard, it just predicates writes. So, an instruction seems like the
most logical way to express.

Bug: tint:1718
Change-Id: I0d2fb029631523d72a7811d0be0715732427c302
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129200
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-25 20:44:18 +00:00
Peng Huang 65786ac998 d3d11: unmmap staging buffer before copy from it
D3D11 requires that buffers are unmapped before being used in a copy.

Bug: dawn:1772
Change-Id: I58c6d587538836a6aa70abecd8a764fc50c1e9ec
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128740
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-25 19:33:04 +00:00
James Price ae39e6d628 spirv-reader: Declare multiuse constant composites
When an OpConstantComposite result is used by multiple instructions,
declare it as a module-scope `const` instead of inlining the constant
at each use site. This fixes an issue whereby the spirv-reader was
massively inflating the size of the WGSL it produces, which was caught
via an OOM fuzzer bug.

Bug: oss-fuzz:57795
Change-Id: Iac8c6a2147a7e2ebfddbaacae9fcb1dbe0b59e9d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128881
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2023-04-25 19:16:25 +00:00
James Price a41693babb tint/msl: Avoid cloning a built-in struct
This prevents us from crashing when a module-scope private variable
has an inferred type that is a built-in struct. We instead fail to
resolve the generated code.

Bug: chromium:1430309
Change-Id: I71c6eacf28096380227ed1043821ecc3d33ffb40
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129140
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-04-25 18:15:40 +00:00
James Price 99a0ded622 tint: Use type::Struct::Name in CreateASTTypeFor
The declaration may be nullptr, so doing this avoids a potential
nullptr deref when the struct is an internal type (e.g. frexp
result). In these cases we will now fail to resolve the resulting
code, which is a little better than just crashing.

A future change will update the resolver to allow us to use the
internal struct names from our transforms.

Bug: chromium:1430309
Change-Id: Ic72b5105bf3159c448c20dd9228d73b25a632b69
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129120
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-25 18:10:19 +00:00
Austin Eng 2dc9fe842d Return static pointer address for zero-length GetMappedRange
Bug: chromium:1430985
Change-Id: I0d13fce695bd999dd9e6a8127b91cea15276df22
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128960
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-04-25 16:46:40 +00:00
Le Hoang Quyen 648db6cfb2 Add "MSAA resolve to mip lvl 1" multithread test.
Bug: dawn:1662
Bug: dawn:462
Change-Id: I13743fcd6f66c515c43b380b00b9235a24fa5a65
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127080
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-04-25 16:19:30 +00:00
dan sinclair 03f9f5f538 [ir] Rename ir::Temp
This CL renames ir::Temp to ir::Runtime to better reflect that this is a
runtime generated ID.

Bug: tint:1718
Change-Id: I24edbe0e2e19303f50355117ec7cd4b5b8f45aef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129100
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-25 15:07:26 +00:00
Ben Clayton 41428ad681 dawn/node: Updates for latest IDL
Change-Id: I5028187160fabe8217a39ffc0d20a6fbb59d3cc8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129001
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-04-25 14:45:38 +00:00
Peng Huang 96b09d29b2 d3d11: enable ColorStateTests and CommandEncoderTests
Bug: dawn:1705
Change-Id: I2d477ea3d9a42332f21c61c9b2b1d2ac48d8e631
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128760
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-25 10:58:29 +00:00
Yan,Shaobo 90d5154b5f Fix Cmake build on Android
Update CMakeList.txt for Dawn cmake build on Android platform

Bug: dawn:1765
Change-Id: I559dddcf378ccaa0868bfccac904b627e3ea22c5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128780
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Albin Bernhardsson <albin.bernhardsson@arm.com>
2023-04-25 10:12:48 +00:00
Corentin Wallez 154bb3460c Use a reasonable workgroup size for ComputeBoids.
Bug: None
Change-Id: I7fb1d37173fe234e5bcdc33645d0cbc7b7ca3021
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129000
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2023-04-25 10:05:18 +00:00
Le Hoang Quyen 20e3e34ce7 Disable some whitebox tests if implicit device sync is enabled.
Whitebox tests call internal functions directly. However, when
implicit device synchronization feature is turned on, some of these
functions will expect that the device is already locked. Thus leading
to assertion failures.

So we need to disable the tests when this feature is turned on.

Bug: dawn:1662
Change-Id: I1d65b4779c933313b5835f1bddbc57703b3ced53
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127180
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
2023-04-25 09:08:34 +00:00
Peng Huang c1b3c74316 d3d11: use Texture::Copy for copy data to staging texture used in CopyTextureToBuffer
Bug: dawn:1768
Change-Id: I7f6488cf54764585eef61766c3d2a829ef186783
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128580
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-25 03:08:31 +00:00
Le Hoang Quyen 23f4396177 Add more multithread tests.
Bug: dawn:1662
Change-Id: I2b2c66c6f9a7b512ae9f8010a082e7306feaa6f3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122060
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-24 20:12:00 +00:00
Peng Huang 653e99478e d3d11: enable some d3d11 end2end tests
Bug: dawn:1705
Change-Id: Id990739ec3905f146aeff2086b4c019b21798fdf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128761
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-24 19:48:47 +00:00
James Price d36740509f spirv-reader: Error on multiple Position built-ins
Produce a meaningful error instead of just crashing.

Bug: oss-fuzz:55170
Change-Id: I09d94a910835839ce9407849446cf2928231a114
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128540
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
2023-04-24 19:48:23 +00:00
dan sinclair bdc2d24900 Fix MSL invariant translation.
When `invariant` is enabled on MSL was was incorrectly setting
`@invariant` instead of `[[invariant]]`. We test with metal1.2 which
does not have invariant, so this only showed up when using metal2.1 or
higher.

Bug: chromium:1439273
Change-Id: Iab866608195e697b0370d465f350b25277d904a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128880
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-24 19:41:41 +00:00
Le Hoang Quyen c5c2fce3ed Lock ApiObjectBase::APIRealease()
Normal behavior of ApiObjectBase's APIRelease() which only locks the
device when last ref dropped is not thread safe if the object is cached
as raw pointers by the device. Example of cached objects: bind group
layout, pipeline, sampler, shader module.

The following scenario could happen:
 - thread A:
    - shaderModuleA.APIRealease()
    - shaderModuleA.refCount.Decrement() == true (ref count has reached zero)
    - going to call shaderModuleA.LockAndDeleteThis().
 - thread B:
    - device.CreateShaderModule().
    - lock()
    - device.GetOrCreateShaderModule()
    - shaderModuleA is in the cache, so return it.
    - unlock()
 - thread A:
    - starting to call shaderModuleA.LockAndDeleteThis()
    - lock()
    - erase shaderModuleA from the cache.
    - delete shaderModuleA.
    - unlock()

This CL fixes this bug by locking the entire APIRelease() method until
we find a better solution.

Bug: dawn:1769
Change-Id: I1161af66fc24f3a7bafee22b9614b783e0dc4503
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128441
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-24 17:33:37 +00:00
Peng Huang 0c33c143dc d3d11: implement copy between non-mappable buffer and texture
Also enable TextureFormatTest

Bug: dawn:1768
Change-Id: I7bf54e05cd8510c28ea57304d084b93386d6c502
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128340
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-24 16:21:47 +00:00
dan sinclair 378a1f51a2 Use optional in Lexer.
This Cl updates the lexer to only create tokens when needed, in the case
of no match an empty optional is returned.

Change-Id: Ie4ba45d72cfb263beb8d9c83e3098ff11beeecd2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128620
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-24 16:20:43 +00:00
dan sinclair 889edb18b2 Add simple program for perf testing.
This CL adds a simple program which can be set to loop over specific
parts of the tint pipeline to generate profiling data.

Change-Id: I6375940619b7ef2f7e66540d4f740e6e0b9b3132
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128541
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-24 16:17:56 +00:00
Peng Huang 11822d9c63 d3d11: enable MemoryAllocationStressTests end2end test
Change-Id: I295ee3aa32e7b7edd4f7edbf64fd1da5fdf33977
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128861
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-24 15:59:50 +00:00
Ben Clayton d14a9fbb6e tint/resolver: Fix null deref
When attempting to member-access a non-value expression.

GetVal() ensures the expression resolves to a value expression, and errors accordingly.

Bug: chromium:1436467
Change-Id: I77ebb44f836be3b99db4b5c26ff41db2ee3fe30a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128840
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-04-24 13:49:00 +00:00
jchen10 2fd411f7fe d3d11: Fix the failing BufferMapping cases.
This adds buffer usage tracking and corrects the usage of pending
command context.

Bug: dawn:1705
Change-Id: If327169429d4e0909bbcaa87a14bac9ef01ac2ad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128180
Reviewed-by: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-04-22 02:33:45 +00:00
dan sinclair 9b726858ff Fast path ASCII in unicode decode.
In the case of ASCII characters, which a lot of WGSL source is, the
decoder can early out after a checking the value.

Change-Id: Iff655565dde23b143fddb95c6c353a917e25e916
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128120
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-22 01:04:40 +00:00
Loko Kung 89c89b7640 Removes deprecation period code for renamed APIs (i.e. endPass/dispatch)
- Note that by default these are already errors, not warnings.

Change-Id: If35284041963cd387839fe102efe4dca73e594dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128064
Reviewed-by: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-04-22 00:33:51 +00:00
Stephan Hartmann ca1b904456 IWYU: add stdint.h for int types in tint::utils
Bug: chromium:957519
Change-Id: I867cdff638388c3f2a35f58b67763413a4e50df2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128520
Auto-Submit: Stephan Hartmann <stha09@googlemail.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-21 22:32:17 +00:00
Ben Clayton de42feb949 tint: Add vec2(), vec3(), vec4()
Fixed: tint:1892
Change-Id: I3e823dd84cb7feb58b16c7763b520f149714576e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128380
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-04-21 12:19:49 +00:00
dan sinclair 5a5b7dfe92 Add builtin information to Symbol.
This CL extends the Symbol class to store if the content of the symbol could parse as a builtin.

Change-Id: I7e14ad944c1c9c43d900f9ccf8be6539ac9ea667
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127460
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-21 11:54:23 +00:00
Peng Huang cc7028ba3f d3d11: suppress BufferMappedAtCreationTests.NonMappable*
BufferBase uses a staging buffer to upload data for non-mappable
buffer created with mappedAtCreation. However BufferBase doesn't
unmap staging buffer before copy data from it.  But d3d11 debug
layer complain this illegal usage. It causes test failures.

Bug: dawn:1772
Change-Id: Id1c386ac7c45f41487f9cc7ef4e431eab87ba1c2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128480
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-21 11:15:39 +00:00
dan sinclair d1d1bf7135 Split base_src apart.
This CL splits the base_src set in the GN build into a symbols_src and a
utils_src.

Change-Id: I39036a4ba5163aa816233b42d9a2ebfe34ddf038
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128361
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-21 10:54:13 +00:00
Loko Kung 2f845021d8 Removes/unifies deprecation period code for depthStencilReadOnly ops.
- Note that by default these are already errors, not warnings.

Change-Id: Iab9ecf3cfd54c0219777c2d1587a7752c3173595
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128102
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-21 10:44:13 +00:00
Loko Kung c421a4b0ce Removes deprecation period code for maxBufferSize.
- Note that by default these are already errors, not warnings.

Change-Id: I46afa6e54e7915ba54aa6990cd641288609108c1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128101
Reviewed-by: Shrek Shao <shrekshao@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-04-21 08:40:54 +00:00
Loko Kung 003e879fd9 Removes deprecation period code for multisampled float sample type.
- Note that by default these are already errors, not warnings.

Change-Id: I4eadbb6f71b2d2a39efe5755dbb6b8c329f1674f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128063
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Shrek Shao <shrekshao@google.com>
2023-04-21 05:57:20 +00:00
Loko Kung f9719b7588 Removes deprecation period code for maxColorAttachmentBytesPerSample.
- Note that by default these are already errors, not warnings.

Change-Id: I33202a0cca8167c4c79e4aeee680b6b7cf1ff830
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128062
Reviewed-by: Shrek Shao <shrekshao@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-21 04:43:13 +00:00
Quyen Le 87f51237b4 Revert "Disable frontend cache when implicit device sync is on."
This reverts commit 8cc6205bf7.

Reason for revert: Graphite actually reuses the bind groups between
draw calls using different pipelines and this change prevents it
from happening.

Original change's description:
> Disable frontend cache when implicit device sync is on.
>
> Normal behavior of ApiObjectBase's APIRelease() which only locks the
> device when last ref dropped is not thread safe if the object is cached
> as raw pointers by the device. Example of cached objects: bind group
> layout, pipeline, sampler, shader module.
>
> The following scenario could happen:
>  - thread A:
>     - shaderModuleA.APIRealease()
>     - shaderModuleA.refCount.Decrement() == true (ref count has reached zero)
>     - going to call shaderModuleA.LockAndDeleteThis().
>  - thread B:
>     - device.CreateShaderModule().
>     - lock()
>     - device.GetOrCreateShaderModule()
>     - shaderModuleA is in the cache, so return it.
>     - unlock()
>  - thread A:
>     - starting to call shaderModuleA.LockAndDeleteThis()
>     - lock()
>     - erase shaderModuleA from the cache.
>     - delete shaderModuleA.
>     - unlock()
>
> This CL disables caching when ImplicitDeviceSynchronization is turned on
> until we find a better solution.
>
> Bug: dawn:1769
> Change-Id: Ideb2a717ece0a40e18bd1c2bef00817262bd25da
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127900
> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>

TBR=cwallez@chromium.org,enga@chromium.org,noreply+kokoro@google.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com,lehoangquyen@chromium.org

Change-Id: Ib13bba8005402d06963865fae919388a91e718f0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:1769
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128440
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
2023-04-21 03:10:12 +00:00
Jiawei Shao cd4b42b5a2 dawn/node: Implement Adapter.GetAdapterInfo()
Bug: dawn:1761
Change-Id: Ia1bf7841052897b69de50d6db41b05ee5645be47
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128104
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-21 01:49:38 +00:00
Jiawei Shao 2d1136281e Add missing default return values to slience Wreturn-type
This patch adds two missing default return values to slience the
compilation warning "Wreturn-type" when building dawn.node.

Bug: dawn:1761
Change-Id: I87c8566cabba4c2e14174bf9f38f53ed3c0fdb74
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128103
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-21 00:29:43 +00:00
Peng Huang cf5aa73f81 d3d11: remove a noreached `break`
Bug: dawn:1795
Change-Id: I32e1407a5d9054ac81d672202b0597334aa7721e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128400
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-20 23:52:56 +00:00
Ben Clayton 7883a0cb8d tint: Add two-token form for diagnostics rule names.
Fixed: tint:1891
Change-Id: Ia3737c29b111d7b6e6b00fbd68da7f85a5a49bca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128301
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-20 23:51:53 +00:00
Brandon Jones 6cb055b6aa Retain descriptor labels for error objects
Since these objects are more likely to be included in error messages
it's important that we keep the labels that the developer has given
them.

Bug: dawn:1771
Change-Id: I78f4ccc23ce40d8eeceed8ca7dd563dff949b4fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128420
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>
2023-04-20 23:35:14 +00:00
Le Hoang Quyen 8cc6205bf7 Disable frontend cache when implicit device sync is on.
Normal behavior of ApiObjectBase's APIRelease() which only locks the
device when last ref dropped is not thread safe if the object is cached
as raw pointers by the device. Example of cached objects: bind group
layout, pipeline, sampler, shader module.

The following scenario could happen:
 - thread A:
    - shaderModuleA.APIRealease()
    - shaderModuleA.refCount.Decrement() == true (ref count has reached zero)
    - going to call shaderModuleA.LockAndDeleteThis().
 - thread B:
    - device.CreateShaderModule().
    - lock()
    - device.GetOrCreateShaderModule()
    - shaderModuleA is in the cache, so return it.
    - unlock()
 - thread A:
    - starting to call shaderModuleA.LockAndDeleteThis()
    - lock()
    - erase shaderModuleA from the cache.
    - delete shaderModuleA.
    - unlock()

This CL disables caching when ImplicitDeviceSynchronization is turned on
until we find a better solution.

Bug: dawn:1769
Change-Id: Ideb2a717ece0a40e18bd1c2bef00817262bd25da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127900
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-20 21:12:25 +00:00
Le Hoang Quyen 335573116c Add Device::GetSupportedSurfaceUsage() method.
This method will return supported usage flags that can be used to create
a swap chain.

Bug: dawn:1760
Change-Id: I7699c2c4ef7142c6bd06e72239d6e4f9112f15a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127440
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-20 20:42:05 +00:00
Ben Clayton 7eb37948ab tint/reader/wgsl: Have expect_identifier return an ast::Identifier
Instead of a std::string. This avoids unnecessary string allocations, and follows the pattern of all other AST nodes.

Change-Id: I3faf534090a2033d671b2ef463d8b9ed3e47eecd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128300
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2023-04-20 20:08:44 +00:00
Peng Huang 91a23a3ac3 d3d11: CommandBuffer: implement render pass
Bug: dawn:1705
Change-Id: I21c6a8550f098cb1e97d5f0c9a93da53600fa8a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127700
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Auto-Submit: Peng Huang <penghuang@chromium.org>
2023-04-20 18:07:20 +00:00
AlbinBernhardssonARM ce2cdb4b4d Fix Dawn Native Android build
Fixes 2 CMake issues:
1. GLFW subdirectory was added regardless of
   DAWN_SUPPORTS_GLFW_FOR_WINDOWING.
2. Android uses the AHardwareBuffer implementation of
   memory service. But in the CMake MemoryServiceOpaqueFD.cpp
   was added instead of MemoryServiceAHardwareBuffer.cpp .

Bug: dawn:286
Change-Id: I6d81976a5c12717b3e565c4d9f8d5ae54f4e0446
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128260
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-20 17:58:59 +00:00
Peng Huang bd696e91d2 d3d11: fix several OOM end2end test on trybot
BufferTests.CreateBufferOOM/D3D11_Intel_R_UHD_Graphics_630 fails on
trybots due to buffer size overflow UINT which is used as size for
create ID3D11Buffer.

This CL fixes above issue and also uses CheckOutOfMemoryHRESULT()
to handle hresult from texture and buffer creation. It makes OOM
an allowed error.

Bug: dawn:1705
Change-Id: I2c4a4841cac15934fe83b7f7d6e568e9f3c8d210
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128280
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-20 17:27:17 +00:00
dan sinclair 45ff7a8c4a Remove extra work from `is_reserved`
Currently the `is_reserved` method in the WGSL parser uses the
`operator==` on the token to check the reserved words. This ends up
re-doing a bunch of work as it checks the token type, then gets the
`string_view` or `string` from the variant, then compares.

This CL adds a precondition that the token is an identifier (which is
true in the only case we call this method) and then extracts the string
from the token once and uses that for all the comparisons.

Change-Id: If425afea38e727169de7991a84f6fa1e47f660ef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128140
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-20 16:50:29 +00:00
Peng Huang 03d68fa33f d3d11: CommandBuffer: implement compute pass
Bug: dawn:1705
Change-Id: I0d935a9ce42b08e436d68f1400ee9faf1ab00cc3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127560
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-20 15:27:01 +00:00
dan sinclair 517278ac08 Move text/unicode into utils.
This CL consolidates the unicode code into utils. These are utility
libraries, so the extra namespace doesn't add much.

Change-Id: Id0de612b6be036392a3cb018bfe66733f2f1ebcb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127403
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-20 10:06:25 +00:00
Peng Huang 9e9c456075 d3d11: CommandBuffer: implement buffer and texture related cmd
This CL also enables several buffer end2end tests

Bug: dawn:1705
Change-Id: I16c23346a60f3f15dbfbb96b2cb8dc0f5ba8c89c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127405
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-20 03:24:55 +00:00
dan sinclair 12fa303899 Move castable into utils.
The Castable class is used by utils/. This Cl moves the implementation
into the utils/ folder. The `Is` and `As` methods are added into the
`tint` namespace to make usage shorter.

Change-Id: I0decedb92ebed01b6aa12d2e3efa7190742e9a33
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127402
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-19 23:52:33 +00:00
Shrek Shao a965f520f9 Add alphaToCoverage validation aligning with WebGPU V1
Add alphaToCoverage validation regards to targets[0] has alpha channel.

This change reflecting WebGPU V1 spec update is aimed to ship together
with WebGPU in Chromium.

Bug: dawn:1759
Change-Id: I0aef60cf8c4dc828e05d6027644ffed35b33f652
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128061
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Auto-Submit: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
2023-04-19 23:42:36 +00:00
Peng Huang ff75ab9a87 d3d11: set object labels
Change-Id: I26b7accf973b03cef7ba113b0ee3672b99e41338
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126861
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-19 23:26:15 +00:00
dan sinclair e6e5998e2b Cleanup GLSL writer.
This Cl removes the boolean return values from most of the GLSL
writer methods. The diagnostics are used to determine if the generation
was successful. The writer itself just continues until complete.

Change-Id: Ia64968eaa6a0aa39a9713fa78f3e743f2de38b44
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127020
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-19 20:32:13 +00:00
dan sinclair c480632ed6 Setup ArrayLength transform for MSL benchmark
Some of the benchmark shaders when run with the MSL backend are
currently failing because the robustness transform is injecting the
arrayLength method but there is no configuration for running the
arrayLength transform.

This Cl adds some default configuration to the MSL bench to make a slot
available for each possible value. It just always makes them available
such that all shaders work correctly.

Change-Id: Ie8a15abc0b7da7d2f46be11274e66302406be019
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128060
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-19 20:14:50 +00:00
dan sinclair e16ed7ccc2 Make more SymbolTable methods string_view.
This CL updates more of the SymbolTable to use string views.

Change-Id: I0d9c7817ba4e3b0d0e73cfc02406481eb796c3c2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127320
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-19 16:58:12 +00:00
dan sinclair 0559005494 Move traits into utils.
This CL moves the tint/traits file into tint/utils/traits. Traits is one
of the few items not in utils which is referred to by utils.

Change-Id: Ie955398f24e949b7618fdc868dbcb903fe20b3f1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127400
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-19 16:52:46 +00:00
Peng Huang b7285f3c9e d3d11: implement Buffer
Bug: dawn:1705
Change-Id: I4542cc2e0f4f6a7f0d13c5f071bfb25897350008
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126440
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-19 15:52:32 +00:00
dan sinclair d21e2d64ec Convert VariableUser vector over to utils::Vector.
This vector was causing a lot of small allocations to happen, this CL
converts over to a utils::Vector to take advantage of the better
allocation strategy

Change-Id: Id740bd2a50a8d0bdd84f4b6e7c7ad4607436c7f4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127500
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-19 15:06:24 +00:00
Ben Clayton 8fc9b86214 CMake: Add TINT_EXTERNAL_BENCHMARK_CORPUS_DIR
If specified, CMake will glob all the .wgsl files in this directory, and add these to the list of benchmarks to run.

Change-Id: I75b2754a6561dcd931c42bd47649c4f625e1c581
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127980
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-04-19 15:03:19 +00:00
Ben Clayton 5f4847c23e tint/sem: Make BindingPoint optional
Reduces hops from sem -> ast, just to know whether the variable has a binding point.

Change-Id: I5620198e6f08b73d5a0171d95874f1a2dae5d93e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127060
Reviewed-by: James Price <jrprice@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-04-19 13:24:27 +00:00
Loko Kung c47e05ae50 Rolls third_party/gpuweb to 2e75d5e
- Needed to remove maxFragmentCombinedOutputResources limit.

Bug: dawn:1756
Change-Id: Ia7c87d845a79fafee45ab7d1e2b7798e3157945f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127940
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-19 09:08:42 +00:00
Jiawei Shao f4b9f95b68 dawn/node: Implement GPUBuffer.getMapState()
Bug: dawn:1761
Change-Id: Id01789a2df8afd5726f6fc776e7d825153fd0f85
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127722
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2023-04-19 01:47:52 +00:00
Ben Clayton 692846d0a0 tint/resolver: Fix use after move
Bug: chromium:1434271
Change-Id: Ib70f9468c60fe00ca7bf9346b6ee8a71a819b59d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127681
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-04-18 21:15:44 +00:00
Antonio Maiorano bacf44f964 Workaround dawn_wire_server_and_frontend_fuzzer ASAN false positive
When discovering Vulkan adapters, if none is found, the vulkan loader
DLL is loaded and then unloaded, which results in ASAN false positives
when the loader's previously allocated memory is re-used, which happens
in fuzzer::TracePC::ClearInlineCounters.

Bug: chromium:1427723
Bug: chromium:1038952
Change-Id: Idb205607426a0af22daba363e2679afaa33204b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127840
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2023-04-18 20:10:51 +00:00
dan sinclair d026e13f48 Remove `SymbolTable::NameFor`
This CL removes the `NameFor` method from SymbolTable and accesses the
symbols name directly.

Change-Id: Ic4ad6eecfa78efb946d97aeaecf2d784af2e6f16
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127301
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-18 19:38:25 +00:00
dan sinclair b353ebe752 Add an allocator to store the symbol names.
This CL adds an allocator, owned by the SymbolTable, which stores the
names of all the symbols in the table. The Symbols then have a
`string_view` to their name.

Change-Id: I28e5b2aefcf9f67c1877b7ebab52416f780bd8c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127300
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-18 19:31:21 +00:00
dan sinclair fa3c08d112 Add a bump allocator.
This CL adds a simple allocator which will provide a chunk of memory of
the given size. It allocates out of slabs of memory.

Change-Id: I9acf59fac88cd6bef260b7ebae7d7b77fd939754
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127302
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-18 16:15:44 +00:00
shrekshao 8f0607a8c8 Fix D3D12 shader interstage truncating transform
Don't skip the TruncateInterstageVariables transform when
user defined interstage attribute input for fragment stage
is empty. Because builtin inputs could also cause register
mismatch for D3D12 HLSL compiler.

Add a boolean flag to Tint hlsl generator option to indicate
whether to run TruncateInterstageVariables or not.
This defaults to false in Tint, while Dawn always set
this to true for vertex stage.

Bug: dawn:1733
Change-Id: Ie4c3648b226513bf15f0e03ae4ce7f3cc09fdef4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127206
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2023-04-18 01:34:41 +00:00
Austin Eng 6a7bba54fa Add basic Dawn microbenchmarks using Google benchmark
The initial test tests bind group layout creation of
different sizes, cache / no-cache hit, with and without
multiple threads.

Change-Id: Ic9ed6c6f1c298d35cd1358c7ff492027c83649a7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127346
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-17 18:11:51 +00:00
Ben Clayton 559e5a2cde tint/transform: Fix ICE in HLSL backend
When referencing a pointer parameter with a 'let', but not using that
let.

Also fix a bunch of places where we used the old names for the pointer
transforms.

Bug: chromium:1433499

Change-Id: I8decefeacd6150bd6f7637f80e62b9cb62936235
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127540
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-04-17 14:24:58 +00:00
Le Hoang Quyen 7532f6665e Disable OOM tests when TSAN is enabled.
Bug: dawn:1725
Change-Id: I83ddaaf0d98d2831f95abbfbf5adfad268ebdba5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127380
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
2023-04-14 22:38:28 +00:00
Peng Huang f5966b09e1 d3d11: enable d3d11 if dawn is not build with chromium
This CL enable build d3d11 by default, if dawn is not build with
chromium. d3d11 backend is not full implemented yet, so no tests
will run against d3d11 backend.

Bug: dawn:1705
Change-Id: Id689ab5168511af0f75f0b3537f246713de5ca45
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127260
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-14 02:05:17 +00:00
Peng Huang 34d52ffa4c Revert "d3d11: add d3d11 backend in end2end tests"
This reverts commit 3fcf96dd8c.

Reason for revert: want to enable end2end test piece by piece on bots for d3d11

Original change's description:
> d3d11: add d3d11 backend in end2end tests
>
> Right now, many tests are not passed becasue unimplemented
> features in d3d11 backend. HoweverD3D11 backend is disabled on
> bots by default, so this CL will not break out bots.
>
> Bug: dawn:1705
> Change-Id: I57321b86a404bc245b71c467479fdee0464dee9b
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126260
> Commit-Queue: Peng Huang <penghuang@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>

Bug: dawn:1705
Change-Id: I95a1cc9a0962b01a6b31ea32b6129f109f4b3e42
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127240
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-13 22:45:28 +00:00