Commit Graph

3342 Commits

Author SHA1 Message Date
jchen10 0d415ff26c D3D12: Ignore the debug warning for vertex buffer out-of-bounds
This adds D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_BUFFER_TOO_SMALL to
the filter list of debug layer warning messages.

BUG=dawn:1261

Change-Id: Ifd0fdf9eb8314a1b2a4f9cd7d248daf0a92a6c17
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/76920
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2022-01-20 07:23:28 +00:00
Austin Eng 017f9cc855 Default dawn_use_swiftshader to true
SwiftShader is required to implement WebGPU fallback adapters.

Perf tests are skipped for CPU adapters since they easily timeout
for intensive benchmarks.

Bug: chromium:1266550
Change-Id: Ib6e91da1128baae1770c797a69cf9ad605ea324d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/76421
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-01-19 17:32:56 +00:00
Austin Eng aa9475e973 Add WGPUDawnEncoderInternalUsageDescriptor
This descriptor, when chained on WGPUCommandEncoderDescriptor makes
internal usages visible to validation.

This CL is to help implement WebGPU Swiftshader support in Chrome.

Bug: chromium:1266550
Change-Id: I7253fe45003e9ad5ac4d8ddd2d4782989e9b5c27
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/76440
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-01-18 21:54:25 +00:00
Austin Eng d0530a6e03 Use ErrorLog instead of InfoLog in InstanceBase::ConsumedError
Printing to stdout actually impacts Web Tests results which
makes managing expectations difficult, especially if logs
change.

Change InfoLog to ErrorLog:
 1) because this is ConsumedError, after all
 2) until we figure out if we can make Web Tests ignore stdout

Bug: chromium:1266550
Change-Id: I05f47f8b6d7a8e11568c5ee87eabab0cfd7c02d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/76680
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-01-18 19:40:35 +00:00
Yunchao He 0fe647b817 Add d3d12-render-pass toggle in readonly depth/stencil attachment test
Bug: dawn:485
Change-Id: I569a98d59b05fafbc4f594bfe9106d26258964d1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/76504
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2022-01-14 18:53:40 +00:00
Loko Kung 15e3592fd5 Guards explicit device.destroy() until tested.
Bug: dawn:628
Change-Id: Ib6a6be0e5467d3cdd6432834d6f9d5c2000b18be
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/76340
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-01-13 23:47:20 +00:00
Brandon Jones 4abe2a0b53 Add TRACEs to backend shader module creation
Specifically ensuring that Tint's generator is individually traced so
that we can better see how much time is going into Tint's transforms
vs the backend's compiler.

Change-Id: I9903cdca137d652ee400e94f0570eeeb17779207
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/76260
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-01-13 21:43:26 +00:00
Corentin Wallez 3148b49730 Start introducing a "backend" for vulkan image wrapping tests
Bug: dawn:221

Change-Id: I8077d6a873bbd4f4ed549b386014e10020ffc725
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75424
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-13 13:11:17 +00:00
Corentin Wallez 22bd21ef74 Add support for creating 1D textures.
However there are a lot more things to implement for full support:

 - Copies from/to buffers.
 - Copies from/to other textures.
 - WriteTexture
 - Lazy initialization (if needed)
 - Anything using views and 1D textures in shaders

So they are currently marked as unsafe API.

Bug: dawn:814
Change-Id: I3f1aac87bd5bc27f710d58e525938c1226d093d8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64542
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2022-01-13 10:53:36 +00:00
Austin Eng a78192741e Implement upstream RequestAdapter
Bug: dawn:160
Change-Id: Ifbce6f71fdf43a749c332bd691b63119929e0128
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75640
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-01-12 23:08:35 +00:00
Yunchao He b765c59c7d Implement readonly depth/stencil attachment on Metal
Bug: dawn:485
Change-Id: Ifb119361d8c383c43b4fad51f6a1f6b12ccea434
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/76040
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2022-01-12 19:21:35 +00:00
Corentin Wallez ec9cf2a85c Rename namespace dawn_native to dawn::native.
But keep a namespace alias to avoid breaking project that depend on the
previous namespace name while they get updated.

Done with through the following steps:

 - git grep -l dawn_native:: | xargs sed -i "" "s/dawn_native::/dawn::native::/g"
 - git grep -l "namespace dawn_native" | xargs sed -i "" "s/namespace dawn_native/namespace dawn::native/g"
 - git cl format
 - Manual fixups in generator/templates (and the addition of
   namespace_case in dawn_json_generator.py).
 - The addition of the namespace alias in DawnNative.h

Bug: dawn:824
Change-Id: I676cc4e3ced2e0e4bab32a0d66d7eaf9537e3f09
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75982
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2022-01-12 09:17:35 +00:00
Sunny Sachanandani 0114ade92a d3d12: Acquire/release keyed mutex around ExecuteCommandLists
D3D keyed mutex cannot be acquired recursively and therefore external
D3D textures cannot be concurrently read within Dawn (e.g. multiple
imports of the same video frame) or across Dawn and GL (e.g. both WebGPU
and WebGL importing a video frame).

Within Dawn, we can scope keyed mutex acquire/release to command list
submission so that Chromium can always guarantee that Dawn doesn't hold
access to any resources after running Dawn wire commands. We also check
that keyed mutexes aren't recursively acquired in Dawn by keeping track
of the acquire count per resource.

This solves the multiple acquire problem within Dawn and provides a path
for concurrent read access across Dawn and GL once the GL decoders are
changed so that they also don't hold access to resources after switching
contexts.

Bug: chromium:1241533
Change-Id: If88fd4a4f798b972836a134809e4fed8832ec89c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75644
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-01-12 00:28:37 +00:00
Corentin Wallez 5d846ab503 Rename namespace dawn_wire to dawn::wire.
But keep a namespace alias to avoid breaking project that depend on the
previous namespace name while they get updated.

Bug: dawn:824
Change-Id: I1e99c4d0d2acf7644a225a88d07806d1a64478e6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75540
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-11 09:57:33 +00:00
Corentin Wallez f07477a1ce Remove deprecated DawnNative Adapter getters.
Bug: dawn:824
Change-Id: I4e73598ccd8eb5ce85c8a0ed86629daef4b575c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75584
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-11 09:30:34 +00:00
Corentin Wallez 8bf8587eb3 Rename namespace dawn_platform to dawn::platform.
But keep a namespace alias to avoid breaking project that depend on the
previous namespace name while they get updated.

Some TraceEvent.h macro were using "platform" as an argument name so
that was renamed to "platformObj" to avoid conflicting with ::platform::

Bug: dawn:824
Change-Id: Iaf14853f02b0d9fcf866ce87788f87a3fdf8f364
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75541
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-01-11 02:10:53 +00:00
Sunny Sachanandani e53bfc561c d3d12: Use fixed key for keyed mutex acquire and release
Chromium has switched to using a fixed key (0) for quite some time.
Using a fixed key enables future work needed for concurrent access of
external textures both inside Dawn (e.g. importing a video frame twice)
or across Dawn and GL. We want to try scoping the Acquire/Release calls
to command list submission, but with a non-fixed key concurrent access
for the same resource becomes ambiguous.

Bug: chromium:1241533
Change-Id: Ia8ff473b8c9c731c411a3fd59d69213f2d903e61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75642
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-01-11 01:36:54 +00:00
Jiawei Shao 9acdbcba85 Vulkan: Add StoreOp to the computation of the key of RenderPassCache
This patch adds StoreOp to the computation of key of RenderPassCache,
which was missed in the last CL that fixes a failure of end2end test
on Windows Intel Vulkan drivers.

BUG=dawn:1151

Change-Id: Iec03d70303c89906154db5256fd8691cc018a91a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75860
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2022-01-11 00:19:54 +00:00
Ben Clayton 6fad9e9745 dawn_node: Add support for diffing against expectations file
Adds the command line flags:
*  `--output <path>` which will write the current test results to the given file
* `--expect <path>` will compare the current run against the given expectations file

Bug: dawn:1123
Change-Id: Ie1bfa4e0c0698a95922e350387f8493b7a6ac68b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75980
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-01-10 20:57:37 +00:00
Corentin Wallez 5bab76a64d run-cts: Hint to use --isolate on POST failures.
Bug: dawn:1123
Change-Id: Ifac813410b7ec36e48282875c5915a5d8cf89282
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75904
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-01-10 16:36:02 +00:00
Corentin Wallez 0275a4c83b Roll third_party/gpuweb/ 67edc187f..0aadaca4c (519 commits)
- Adds supports for the ETC2 and ASTC extensions.
 - Adds support for all texture formats supported by the spec.
 - Removes pipeline statistic queries.
 - Removes support for depthClamping since it has been reworked in a
   depthClipControl extension that Dawn doesn't implement yet.
 - Removes GPUCommandBuffer.getExecutionTime.
 - Adds support for GPUCommandBuffer.clearBuffer.
 - Removes writeTimestamp inside passes and adds TODO to add support for
   timestampWrites.

67edc187f5...0aadaca4c5

$ git log 67edc187f..0aadaca4c --date=short --no-merges --format='%ad %ae %s'
2022-01-07 dneto Clarify fract (#2485)
2022-01-07 dneto Clarify fract (#2485)
2022-01-07 dneto Clarify fract (#2485)
2022-01-06 dneto Behaviors: Ban obviously infinite loops (#2430)
2022-01-06 dneto Fix declaration-and-scope section for out-of-order decls (#2479)
2022-01-06 dneto Behaviors: Ban obviously infinite loops (#2430)
2022-01-06 dneto Fix declaration-and-scope section for out-of-order decls (#2479)
2022-01-06 dneto Behaviors: Ban obviously infinite loops (#2430)
2022-01-06 dneto Fix declaration-and-scope section for out-of-order decls (#2479)
2022-01-06 dneto Move Limits section to under "WGSL Program" (#2480)
2022-01-06 dneto Move Limits section to under "WGSL Program" (#2480)
2022-01-06 dneto Move Limits section to under "WGSL Program" (#2480)
2022-01-05 dneto [editorial] Rename "built-in variable" -> "built-in value" (#2476)
2022-01-05 dneto [editorial] Rename "built-in variable" -> "built-in value" (#2476)
2022-01-05 dneto [editorial] Rename "built-in variable" -> "built-in value" (#2476)
2022-01-05 dneto Only define image format names usable for storage textures (#2475)
2022-01-05 dneto Only define image format names usable for storage textures (#2475)
2022-01-05 dneto Only define image format names usable for storage textures (#2475)
2022-01-04 dneto Remove 'read','read_write','write' as keywords, image formats as keywords (#2474)
2022-01-04 dneto Remove 'read','read_write','write' as keywords, image formats as keywords (#2474)
2022-01-04 dneto Remove 'read','read_write','write' as keywords, image formats as keywords (#2474)
2022-01-04 jrprice [editorial] wgsl: left shifts are logical (#2472)
2022-01-04 jrprice [editorial] wgsl: left shifts are logical (#2472)
2022-01-04 jrprice [editorial] wgsl: left shifts are logical (#2472)
2022-01-04 dneto Deploying to gh-pages from @ gpuweb/gpuweb@7371fbf6d3 🚀
2021-12-30 kvarkus Texture format caps for MSAA and resolve (#2463)
2021-12-30 kvarkus Texture format caps for MSAA and resolve (#2463)
2021-12-30 kvarkus Texture format caps for MSAA and resolve (#2463)
2021-12-30 kainino Fully describe validation of render attachments (#2458)
2021-12-30 kainino Fully describe validation of render attachments (#2458)
2021-12-30 kainino Fully describe validation of render attachments (#2458)
2021-12-29 kainino Rework encoder state and mixins (#2452)
2021-12-29 kainino Rework encoder state and mixins (#2452)
2021-12-29 kainino Rework encoder state and mixins (#2452)
2021-12-29 kainino1 Deploying to gh-pages from @ gpuweb/gpuweb@68fe77316d 🚀
2021-12-29 mehmetoguzderin Fix examples classes, globals, and previews (#2412)
2021-12-29 mehmetoguzderin Fix examples classes, globals, and previews (#2412)
2021-12-29 mehmetoguzderin Fix examples classes, globals, and previews (#2412)
2021-12-28 kainino Clarify that attachments may not alias (#2454)
2021-12-28 kainino Clarify that attachments may not alias (#2454)
2021-12-28 kainino Clarify that attachments may not alias (#2454)
2021-12-28 shaobo.yan Add source image orientation to copyExternalImageToTexture (#2376)
2021-12-28 shaobo.yan Add source image orientation to copyExternalImageToTexture (#2376)
2021-12-28 shaobo.yan Add source image orientation to copyExternalImageToTexture (#2376)
2021-12-28 kainino1 Deploying to gh-pages from @ gpuweb/gpuweb@e7224b9949 🚀
2021-12-24 kainino Restore the box around algorithm divs (#2453)
2021-12-24 kainino Restore the box around algorithm divs (#2453)
2021-12-24 kainino Restore the box around algorithm divs (#2453)
2021-12-24 kainino Define GPUTextureViewDimension values (#2455)
2021-12-24 kainino Define GPUTextureViewDimension values (#2455)
(...)
2021-10-14 dneto Deploying to gh-pages from @ gpuweb/gpuweb@6f239ffda6 🚀
2021-10-14 lokokung Add ETC2 and ASTC texture formats and feature name documentation (#2180)
2021-10-14 lokokung Add ETC2 and ASTC texture formats and feature name documentation (#2180)
2021-10-14 lokokung Add ETC2 and ASTC texture formats and feature name documentation (#2180)
2021-10-14 kvark Deploying to gh-pages from @ gpuweb/gpuweb@ab71f65a80 🚀
2021-10-13 dneto describe builtin functions as prototypes (#2178)
2021-10-13 dneto describe builtin functions as prototypes (#2178)
2021-10-13 dneto describe builtin functions as prototypes (#2178)
2021-10-13 dneto Integral pipeline IO must be specified interpolate(flat) (#2183)
2021-10-13 dneto Integral pipeline IO must be specified interpolate(flat) (#2183)
2021-10-13 dneto Integral pipeline IO must be specified interpolate(flat) (#2183)
2021-10-12 mehmetoguzderin Fix render by closing table (#2177)
2021-10-12 mehmetoguzderin Fix render by closing table (#2177)
2021-10-12 mehmetoguzderin Fix render by closing table (#2177)
2021-10-12 mehmetoguzderin Allow syntactic navigation and styling (#2143)
2021-10-12 mehmetoguzderin Allow syntactic navigation and styling (#2143)
2021-10-12 mehmetoguzderin Allow syntactic navigation and styling (#2143)
2021-10-12 dneto Deploying to gh-pages from @ gpuweb/gpuweb@59d839d767 🚀
2021-10-06 dneto wgsl: remove ignore, add phony-assignment (#2127)
2021-10-06 dneto wgsl: remove ignore, add phony-assignment (#2127)
2021-10-06 dneto wgsl: remove ignore, add phony-assignment (#2127)
2021-10-06 dneto wgsl: editorial cleanup: memory vs. storage (#2155)
2021-10-06 dneto wgsl: editorial cleanup: memory vs. storage (#2155)
2021-10-06 dneto wgsl: editorial cleanup: memory vs. storage (#2155)
2021-10-06 mehmetoguzderin Make hex exponent suffix optional for floats (#2164)
2021-10-06 mehmetoguzderin Make hex exponent suffix optional for floats (#2164)
2021-10-06 mehmetoguzderin Make hex exponent suffix optional for floats (#2164)
2021-10-06 dneto wgsl: Add limits section, and "spurious" failure (#1997)
2021-10-06 dneto wgsl: Add limits section, and "spurious" failure (#1997)
2021-10-06 dneto wgsl: Add limits section, and "spurious" failure (#1997)
2021-10-06 alanbaker Clarify memory locations accessed when writing a vector component (#2152)
2021-10-06 alanbaker Clarify memory locations accessed when writing a vector component (#2152)
2021-10-06 alanbaker Clarify memory locations accessed when writing a vector component (#2152)
2021-10-04 jrprice Fix inequality symbol in compute shader grid bound (#2153)
2021-10-04 jrprice Fix inequality symbol in compute shader grid bound (#2153)
2021-10-04 jrprice Fix inequality symbol in compute shader grid bound (#2153)
2021-10-04 jimb Fix some misplaced characters in the `select` description. (#2154)
2021-10-04 jimb Fix some misplaced characters in the `select` description. (#2154)
2021-10-04 jimb Fix some misplaced characters in the `select` description. (#2154)
2021-09-29 dneto wgsl: Function call statement may call non-void functions (#2148)
2021-09-29 dneto wgsl: Function call statement may call non-void functions (#2148)
2021-09-29 bclayton wgsl: Update README.md (#2150)
2021-09-29 dneto wgsl: Function call statement may call non-void functions (#2148)
2021-09-29 dneto Deploying to gh-pages from @ gpuweb/gpuweb@7e87583853 🚀
2021-09-28 kainino Remove no-op minBindingSize text (#2141)
2021-09-28 kainino Remove no-op minBindingSize text (#2141)
2021-09-28 kainino Remove no-op minBindingSize text (#2141)
2021-09-28 kainino Clarify copies into -srgb formats (#2146)
2021-09-28 kainino Clarify copies into -srgb formats (#2146)
2021-09-28 kainino Clarify copies into -srgb formats (#2146)

Created with:
  roll-dep third_party/gpuweb

Fixed: dawn:1130
Bug: dawn:1123
Change-Id: I9a9539696fbd0a4d15a7e3369959ac97b262d9d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75902
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-10 15:26:31 +00:00
Corentin Wallez 6d9ee4254b dawn_node: handle literals on typdef'd interface members
Bug: dawn:1123
Change-Id: Ie7f388a0322b195937aa76ab30b1513ca642b572
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75901
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-10 15:23:21 +00:00
Corentin Wallez 4fe5d65446 dawn_node: Allow Include and Mixins to come out of order in idlgen
Bug: dawn:1123
Change-Id: I120e6234e194f46954e3c7e75a3a8cc667df9611
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75900
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-10 15:23:01 +00:00
Corentin Wallez 0d2c6c6215 dawn_node: Return undefined for "void" methods instead of null
Bug: dawn:1123
Change-Id: I38a5b160c12485ea23b34a6b3c8cdf44baee2ada
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75903
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-10 14:30:14 +00:00
Corentin Wallez 03b3594f79 Add C overload for dawn_native::Adapter::GetProperties
This helps Chromium move to using this method and stop using
dawn_native::AdapterType/BackendType.

Bug: dawn:824
Change-Id: I9e16edd271d3406bc45e3b9fd472bd94bbf53b30
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75583
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-01-07 17:30:48 +00:00
Ben Clayton 8b4d03d302 tint: Remove deprecated texel formats.
Issue: tint:1361
Change-Id: Id49ad89c439443ea30cc8693a10a23af52eb9ebf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75542
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-07 11:10:18 +00:00
James Price 72ba3039eb dawn_node: Fix default adapter selection
The Null adapter was always being used when no backend override was
specified, instead of the platform's default adapter.

Change-Id: I3d8ae62aacda1309a141c3ca39d6e03252fc5e94
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75700
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-01-07 09:19:08 +00:00
Shaobo Yan c40f04b85b Support *-srgb format as dst formats in CopyTextureForBrowser
Dawn allows texture-to-texture copy happens between the textures that
formats only have diff on srgb-ness.

CopyTextureForBrowser could align on this rule to achieve copying to
*-srgb dst texture and keep the bytes the same as copying to non-srgb
formats.

This CL add support for *-srgb textures as dst textures and using an
extra gamma decoding step for this.

Bug: dawn:1195
Change-Id: I665dbca473aa84b9d87b7a35c4f90ce1897ade7b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/74580
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2022-01-07 03:05:27 +00:00
Jiawei Shao e009ad7edd Vulkan: Compare storeOp when comparing the key of RenderPassCache
This patch adds the missing comparisons on the storeOp when comparing
the key of RenderPassCache as now we support more than one storeOp
(Store and Discard).

With this patch the following end2end test will pass on Windows Intel
Vulkan drivers:
- TextureZeroInitTest.IndependentDepthStencilLoadAfterDiscard

BUG=dawn:1151
TEST=dawn_end2end_tests

Change-Id: I44d6f3e589341bba761503b1a06c388db92d1295
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75482
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2022-01-07 00:02:57 +00:00
Austin Eng 3ac7b9ce79 Change uint32_t -> size_t in *Enumerate functions
Follows https://github.com/webgpu-native/webgpu-headers/pull/142

Bug: dawn:160
Change-Id: Ic8aa5868bf1a68ae5ff80ce6e5fc0e8d687c34bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75481
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-01-06 22:11:28 +00:00
Corentin Wallez 7f8fa04edc Use C++17 nested namespaces instead of manually nesting them.
This was done with these two commands and a couple manual fixups for
namespaces that had more than one space in the comment in the closing
brace, as well as vulkan_platform.h

git grep -l "namespace .* { namespace " | xargs sed -i "" "s/namespace \(.*\) { namespace /namespace \1::/"
git grep -l "}}  // namespace" | xargs sed -i "" "s%}}  // namespace%}  // namespace%"

Bug: dawn:824
Change-Id: I6f448b820c12fc1004ea5270bf8e1f466b0c0aab
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75400
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-06 09:22:17 +00:00
Corentin Wallez 5984d8d1a8 Use C++17 structured binding in more places.
Bug: dawn:824
Change-Id: Ie39d4f622bfb3dcc3a74b03d594efcea7139a9dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75069
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-06 09:17:57 +00:00
Corentin Wallez 1c49d1b43b Use C++17 structure bindings instead of some std::tie
Not all std::tie can be replaced because structured binding introduces
references names and cannot bind member variables.

Bug: dawn:824
Change-Id: Ie2b45834aac72fb063d4aaea5949a53457bc73c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75068
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-06 09:14:17 +00:00
Corentin Wallez a4357a7619 Add Window at the end of SurfaceDescriptorFromXlib.
Bug: dawn:1246
Change-Id: I1917056e9bb2bde0997c072ab76963e9dd079bb3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75420
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-06 09:10:00 +00:00
Corentin Wallez 31f12242da dawn_wire::server: Simplify ForwardToServer usage with C++17
This uses template parameter type deduction to pass the member function
pointer and then extract the types that compose it. Which means that the
member function pointer only needs to be written once.

The order of arguments of the Server::On*Callback methods is changed to
put the userdata first. This helps make template type deduction simpler.

Bug: dawn:824
Change-Id: I4e2bc33dfd52a11620dea51b40508eca6c878d72
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75071
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-06 09:09:49 +00:00
Corentin Wallez 2994d2e7b9 Use C++17 [[nodiscard]] and [[fallthrough]] attributes
Bug: dawn:824
Change-Id: Ied4f2eb736e0c3488a79e4872e7ffa3eb2fdaac5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75063
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-06 09:02:38 +00:00
Corentin Wallez 3f011e6807 SlabAllocator: Remove note about C++17
We can't use aligned_alloc because it is only available starting from
macOS 10.15 and above. Now that we have C++17 the only thing blocking
use from using aligned_alloc is the macOS version, so note that.

Bug: dawn:824

Change-Id: Icb3bc22047193c189932dea4d10073dabb0cf32a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75065
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-06 09:02:28 +00:00
Yan cf0e4fceb3 Support T2T copies between formats that have only difference on srgb-ness
In previous T2T copy, Dawn requires textures have the same formats. But
Vulkan/Metal/D3D12 have ability to copy between "compatible" formats textures.

Metal has the most restrict rules without setting interpreter flags when creating
textures. It defines "compatible" texture formats to the formats that only have
difference on srgb-ness.

This CL follow Metal's rule and release the validations for T2T copies. It supports
T2T copy between "compatible" texture format textures.

Bug: dawn:1204
Change-Id: I50bf04ea15e8026530b3a5bdb5725f56aa192d85
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/74301
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2022-01-06 09:01:58 +00:00
Corentin Wallez fa2fde1432 Use C++17 non-const string.data() in WindowsUtils
Bug: dawn:824
Change-Id: I9a7880bc38b15864364505f9f9399e440c048e7a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75064
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-06 09:01:48 +00:00
Brandon Jones cef2d17385 Prevent negative error message ranges
If an error message was reported from Tint that had a end line/position
that occurred before the start line/position then the range would have
a negative length, causing the unsigned length to underflow into a very
large value. Also, specifically, if the start line was non-zero but the
end line was zero (indicating no line, and the value ranges are
constructed with by default) the for loop that adds the line offsets
would underflow and cause it to read off the end of the line list.

Clamping the end of the range to always be less than or equal to the
start of the range avoids both of these problems.

Bug: dawn:1245
Change-Id: I780a1f5acc228297cbbea86f33679d00e9153b4c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75260
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-01-05 18:27:36 +00:00
Corentin Wallez 7c8bc94bee CMake: enable C++17
Bug: dawn:824
Change-Id: Ia8ac55d406a2b0b9c71f12b523058fa97aabf408
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75040
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-05 09:26:46 +00:00
Li Hao 538d8d5d1c Implement depth24unorm-stencil8 and depth32float-stencil8 formats
- Add format implementation on D3D12, Metal and Vulkan
- Add more formats in depth/stencil copy, sampling and load op tests and
  refactor them to test with parameters.

BUG=dawn:690

Change-Id: I829d1eea3ce35ffb39417ea23fb8afba6d542769
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/73180
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2022-01-05 01:31:16 +00:00
David Neto 622bc9732a Add -DDAWN_USE_X11=OFF for dawn.node build
Otherwise we gain a default dependency on X11, when on Linux.

Change-Id: Ief52603758f5808a47dde64b04b4f10d27e4c93a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/74880
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
2022-01-04 19:39:06 +00:00
Corentin Wallez 3343e3b29f Add missing space in a toggle description
Change-Id: Ic233a75cba31923d9fe320634ca6b2ea45432ceb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/73020
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-01-04 17:29:15 +00:00
Corentin Wallez e19e8356c1 Preliminary fixes for upgrading the MSVC toolchain
Fixes / suppresses a couple warnings raised by the updated MSVC and
silences all C++17 deprecation warnings since we can only fix them after
we update to use C++17.

Bug: dawn:824
Change-Id: I047985f26244ed3a42c73740617aee15546ca9dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75072
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-01-04 16:32:06 +00:00
Ben Clayton 76ff65f694 dawn_node: Error if the specified backend is not found
Defaulting to the 0'th adapter can silently use the Null adapter, which is no fun for anyone.

Bug tint:1354

Change-Id: I14e2379175cb90a48753bd81d096391d15d2dc22
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75070
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-01-04 14:36:25 +00:00
David Neto 680900a9ca Fix dawn.node compilation
Fix the use of DawnTogglesDeviceDescriptor.
The dawn.node GPUAdaptor binindg code is already in the wgpu namespace
so use DawnTogglesDeviceDescriptor directly instead of prefixing
it with wgpu::

Bug: dawn:160
Change-Id: I01ab76983aabe150df5769764735d90e4f1e73bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/74840
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-12-30 20:16:33 +00:00
Jiawei Shao 67a22dee01 Add a missing space in the error message of SetIndexBuffer
BUG=dawn:887

Change-Id: I108377328ce735a2daaca9512ded6b35e0bfaa14
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/74460
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-12-23 09:50:36 +00:00
fujunwei f001ef5505 Make the templates of webgpu_absl_format flexible
Move the manually parts to src/dawn_native/webgpu_absl_format.cpp/h.
Rename the template webgpu_absl_format.cpp/h to api_absl_format.cpp.h .

BUG=dawn:1201, dawn:563
Change-Id: Ibbeea43227f4fcf7f1d6b1d0bc3927226e79e6c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/74300
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
2021-12-23 05:16:04 +00:00
Austin Eng dc518772c6 Update tests to use wgpu::DeviceDescriptor
Bug: dawn:160
Change-Id: I2fce45c5cc6f9e95054ad5fa42acfeb42ad787c5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72062
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-12-22 19:04:33 +00:00
Austin Eng 2f218e2b21 Implement upstream RequestDevice, add native-only CreateDevice
This CL implements RequestDevice and also has changes for
Dawn to internally use wgpu::FeatureName enums, instead of
strings. Some of the string handling is kept for now to
support the deprecated creation path. GetFeatureInfo is added
to the instance to get a name and description of the feature,
for reporting in about://gpu.

Dawn device toggles are now passed in an extension struct off
of the device descriptor. This is only supported in dawn_native,
and not dawn_wire, for now, since dawn_wire doesn't have a way
to serialize lists of null-terminated const char*.

To enable the client to check whether the toggle descriptor is
supported, a `dawn-native` feature is added which is supported
all the time with dawn_native, but not supported with dawn_wire.

Feature `dawn-native` also enables a synchronous version of
CreateDevice for convenience.

Bug: dawn:160
Change-Id: Ifc195e7ea808c6c319021528ef4b36bd65583bff
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72020
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-12-22 19:02:23 +00:00
Corentin Wallez 7628489cf6 Reland "Bump maxUniformBindingSize to 2^16 from 2^14"
This is a reland of 1a57ee9d4e

Original change's description:
> Bump maxUniformBindingSize to 2^16 from 2^14
>
> This was upped in https://github.com/gpuweb/gpuweb/pull/2159
>
> Bug: dawn:1173
> Change-Id: I98d46b9b5a339280d21ddcb2ab039ce7ebce4ec3
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71608
> Commit-Queue: Brandon Jones <bajones@chromium.org>
> Auto-Submit: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Brandon Jones <bajones@chromium.org>

Bug: dawn:1173
Change-Id: Id86c6432e792a44bb231ae7778df1d38f4084f5b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/74302
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-12-22 16:18:36 +00:00
Yunchao He b9467591a4 Implement readonly depth/stencil without sample from it
This change add a couple end2end tests when readonly depth/stencil
attahcment is enabled in render pass and the pipeline doesn't
sample from the depth/stencil attachment. The pipeline only do
depth/stencil test.

This situation may not be useful in real world applications. But
it is possible that developers do it in this way. And it impacts
the implementation on some backend like Vulkan.

Bug: dawn:485
Change-Id: I8a81330659295cd4a2f00591b6ead719538babd9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71441
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2021-12-21 04:02:22 +00:00
Brandon Jones 67a2d57e3f Temporarily avoid error message formatting failure
For unknown reasons formatting of a error context message fails in
RenderEncoderBase::APISetBindGroup fails if the bind group is printed
as a string in the message. This despite the exact same code working as
intended in ComputePassEncoder::APISetBindGroup. Replacing it with a
static "[BindGroup]" to allow the rest of the message to format
correctly until the reason for the failure can be determined.

Bug: dawn:1190
Change-Id: I31105acff4d08849a34e406c6b8e85fab28f17b5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/73280
Auto-Submit: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2021-12-21 00:07:01 +00:00
Yan 36e86ee778 Remove AlphaOp
CopyTextureForBrowserOptions deprecated AlphaOp after supporting
color space conversion. AlphaMode for src and dst is the replacement.

Bug: dawn:1140
Change-Id: Id507bd7525d74be8a12d212b92cc22f0c7bc94b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/73141
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2021-12-17 03:49:48 +00:00
Austin Eng f6519cc4e5 Test requestAdapter and requestDevice on the wire
Bug: dawn:689
Change-Id: I032cfcba755be241126dfa8447a38625d7183334
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71523
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-12-15 23:06:17 +00:00
Austin Eng 07e766728a dawn_wire: Implement requestAdapter and requestDevice
This implements requestAdapter and requestDevice by
forwarding commands the the server and relaying back
replies. After an adapter or device is created,
limits/properties/features are queried and also sent
back to the client.

Bug: dawn:689
Change-Id: Ie0c2984b8ebb661efb0c284a14ae8b74ae4af2ea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71522
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-12-15 21:52:17 +00:00
James Price d4f8c39f52 Remove [[block]] attribute from all shaders
This has been removed from WGSL and is now deprecated in Tint.

Bug: tint:1324
Change-Id: Ic187ce3c5ce0723db6f3ca6483e9f5e73ce27acc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72880
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-12-15 13:13:26 +00:00
fujunwei 16ae3b8b95 Make the templates of mocking api flexible
Rename mock_webgpu to mock_api and define the function "GetProcTableAndDevice" to "GetProcTable" for removing the special arguments "WGPUDevice* device" that can be got with "GetNewDevice()".

BUG=dawn:1201

Change-Id: I4fc47e4497ba4b6d280cc8af8605f1d93f43497e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72761
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
2021-12-15 04:35:26 +00:00
Yan 5204053954 Support "length" in dawn.json could be a integer
Struct member defined in dawn.json could have a 'length' attribute
defines the length of the member if it is an array.

In previous, the 'length' could only be 'strlen' or other variable
which has 'uint32_t' types. It cannot support constant length.

CopyTextureForBrowserOptions transfers conversion parameters and
conversion matrix with a constant length. This CL adds this ability
to meet such requirements.

Bug: dawn:1140
Change-Id: I6eeabbc55cc3853fe15e33bdd44060b16f6096bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72580
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2021-12-15 04:08:56 +00:00
Austin Eng 18416ecdf9 dawn_node: Fix wgpu::ErrorFilter::None
This enum value was removed.

Bug: dawn:1206
Change-Id: Ifebceb01e817a29daec6629434d4dd792f343f74
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72940
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-12-15 00:29:46 +00:00
Austin Eng 89ddadcd1e Add feature queries to dawn_native/dawn_wire
This is so we can implement the adapter/device APIs fully
on dawn_wire.

Bug: dawn:689
Change-Id: I47f68157d081f359f871e0efe0d974dfe53de7d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71521
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-12-15 00:12:30 +00:00
Austin Eng 5397f9f9d0 Add basic or stub implementations of upstream instance/adapter APIs
Adds upstream instance/adapter APIs. In dawn_native, the basic APIs
to get limits and properties are implemented, but requestAdapter and
requestDevice are not. In dawn_wire, nothing is implemented, but the
stub definitions are put in place, as well the mechanism to inject
WGPUInstance into the wire.

There is a lifetime concern with WGPUInstance and WGPUAdapter on the
wire in that we need to ensure that the client cannot free the
instance or adapter while they are in use. In the near term, this is
not a problem because Chromium will always hold ownership of the
instance and adapters outside of the wire - i.e. it won't inject and
then release ownership.

Bug: dawn:160, dawn:689
Change-Id: Id904272983f23babc9177bc163d78c4fa1044da0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71520
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-12-14 23:22:46 +00:00
Austin Eng 0e6f443359 Remove dawn_native::DeviceDescriptor typedef
Bug: dawn:160, dawn:689
Change-Id: I9ec5f2056ac70c4150e6555291045690ee295403
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70582
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-12-14 22:35:35 +00:00
Li Hao 4682ae0034 Get counterSets and counters using Objective-C style
Bug=dawn:1102

Change-Id: I656938f180ac3436a40ba8720e54618c8921504b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72760
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-12-14 08:41:26 +00:00
Yan 483bead0e2 CopyTextureForBrowser: Support display p3 to Srgb color space conversion
This CL add color space conversion bases for CopyTextureForBrowser.
Theoretically, it could support any color space conversion. But
test cases only cover (Srgb, DisplayP3) to (Srgb).
It could be expanded to more color spaces conversions.

Bug: dawn:1140
Change-Id: I332e6d1f7cf2424fd5f5af83c71fa45c98d2d8ac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70780
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2021-12-14 04:51:45 +00:00
Corentin Wallez 88d5e07d73 Roll GN
Also fix a gn check failure with the new GN.

Bug: None
Change-Id: I0686dd5de7fc5804fbbe79f19db413cc67fa0aae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72484
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
2021-12-13 15:24:55 +00:00
jchen10 ffb0024a89 Support NV12 via ExternalImageDescriptorDmaBuf on CROS
On Intel platforms, all planes in fact have same dma-buf, so the
DISJOINT bit shouldn't be used to create the vkimage.
For multi-planar formats, VkImageDrmFormatModifierListCreateInfoEXT
has to be used instead of
VkImageDrmFormatModifierExplicitCreateInfoEXT.

Bug: chromium:1258986
Change-Id: I25306a438e7ba9fd981848e63068e486bbddf11d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68961
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2021-12-13 02:38:44 +00:00
Corentin Wallez 3b7e75865c Vulkan: make PNextChainBuilder require pNext==nullptr
This will hopefully help catch issues early when people forget to set
pNext before creating the PNextChainBuilder.

Bug: dawn:1223
Change-Id: Ic6b9704aeaa20731e4f7de4d1ac0207d4110c720
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71762
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-12-10 15:48:19 +00:00
Austin Eng 6ad6278bc5 Enable dynamic storage buffers
Validation is implemented with CTS tests added in
https://github.com/gpuweb/cts/pull/850

Fixed: dawn:429
Change-Id: Iee570c712f81fbafc158c0ceec89a28011a3fed8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71960
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-12-10 01:50:08 +00:00
Yunchao He 0e922b5995 Add validations for depth/stencil aspect requirement for DepthStencilState
In RenderPipelineDescriptor.DepthStencilState, if depth test or depth
write is enabled, the texture format must have depth aspect. Likewise,
if stencil test or stencil write is enabled, the texture format must
have stencil aspect.

Bug: dawn:1226

Change-Id: I9d7efb25675ff2c90704fa45703fb542bab6f1f5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72101
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2021-12-09 22:02:14 +00:00
Yunchao He 15fec68a4f Implement readonly depth/stencil attachment on Vulkan
It requires to revise quite a few flags in order to implement
readonly depth/stencil attachment on Vulkan. For example:
  - VkAccessFlags,
  - VkPipelineStageFlags,
  - VkImageUsageFlags,
  - and the most important: VkImageLayout.

These revised flags need to be applied to many Vulkan objects.
For examples:
  - VkImageMemoryBarriers,
  - IMAGE_LAYOUT revisions in descriptor set (bindings),
    render pass, and subpass,
  - and loadOp/storeOp revisions in render pass and subpass.

This change also does some workarounds in order to make Vulkan
validation layers happy. For example:
  - use DEPTH_STENCIL_READ_ONLY image layout for binding a
    depth/stencil texture,
  - add DEPTH_STENCIL_ATTACHMENT_BIT image usage for binding a
    depth/stencil texture.

Note that STORE_OP_STORE is used for depth/stencil's storeOp for
readonly attachment. It leads to Vulkan validation error. This
change igores that error and let it proceeds and it works well.

Bug: dawn:485
Change-Id: Ie247c9cbffbd837984b0933a905632ab5ad8862d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70280
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2021-12-09 21:32:28 +00:00
Austin Eng 63f65465f5 Add a build target for a webgpu_dawn library
This library binds directly to dawn_native and implements
webgpu.h. It may be built as a single library so it can
be easily used in other projects.

Bug: dawn:1220
Change-Id: I73be8c6455922fa526efd1600446cc46b07e82ed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53887
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-12-09 20:03:48 +00:00
Jiawei Shao b6d80e027d dawn_wire: Rename Write{Buffer|Texture}Internal to Write{Buffer|Texture}
BUG=chromium:1266727

Change-Id: I3cad4c7b6b09ef4475ff030a5d239f544dc1cdef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72066
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-12-09 02:42:47 +00:00
Loko Kung 79f62081c0 Fixes bad mem-read in Vulkan's ~DescriptorSetAllocator.
Bug was a result of an external BGL reference that lingered after device was destroyed leading to a bad read on the device's FencedDeleter when the BGL reference was finally released. Fix just makes sure that the previous code path runs during the device destruction instead of afterwards.

- Removes passthrough call in BGL to the allocator and instead has the device keep track of the allocator directly so that the list can be used to both deallocate bind groups and bind group layouts at the end.
- Makes the allocator an ObjectBase so that we can have an explicit copy of the device since getting it from the layout can be dangerous now that the allocator may outlive the layout.

Bug: chromium:1276928
Change-Id: Ibca5e3c313fc0c0980ecaaa9ad2c871e204ac153
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71860
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2021-12-08 20:27:14 +00:00
Brandon Jones 370e6bd734 Validate stripIndexFormat at draw time.
Updates validation logic to match the recent changes in
https://github.com/gpuweb/gpuweb/pull/2385 that allows stripIndexFormat
to be undefined at pipeline creation time, even for strip topologies.
Non indexed draw calls are valid with such pipelines. Indexed draw calls
fail validation at draw time.

Bug: dawn:1224
Change-Id: I28ff78eac726d46f99a099ffb2338b5da81a4a88
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72000
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-12-08 17:24:37 +00:00
fujunwei ed33e05db1 Move EnumClassBitmasks from wgpu to dawn namespace
The EnumClassBitmasks is used by dawn/api_cpp.h that needs to be common.
Define a macro to export the operators from dawn to other various namespace.

BUG=dawn:1201
Change-Id: I20badd54e844fead6ecf12546a2c9e0afa2fd83f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71900
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
2021-12-08 05:46:17 +00:00
Zhaoming Jiang 53137bd57d Remove wgpu::ErrorFilter::None
Remove wgpu::ErrorFilter::None from Dawn as it is removed from the
specification.

Bug: dawn:1206
Change-Id: If8ec2722cf1b2bad380011f191f296f0e591646d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71607
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
2021-12-08 02:42:17 +00:00
Corentin Wallez 0766ce6ed1 Vulkan: Load procs for VK_KHR_get_memory_requirements2
Bug: dawn:1223
Change-Id: I14f6bfd66ac35a2d80b70fd121bd3be5e9670352
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71761
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-12-07 09:32:08 +00:00
Corentin Wallez 87ef49c461 Require semicolon after DAWN_TEST_PARAM_STRUCT
Bug: None
Change-Id: I6b9fb69c6d02abb2a210f10d91b02c5b77b48cdc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71760
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-12-07 09:29:46 +00:00
Jiawei Shao 6a886b47de Align offset to 4 bytes in writeTexture on depth stencil textures
This patch fixes a bug in the allocation of internal staging buffer
for Queue::WriteTexture() that we must ensure the buffer offset to
be 4 bytes when calling Queue::WriteTexture() on depth stencil
textures as is restricted by Vulkan SPEC.

BUG=dawn:1213
TEST=dawn_end2end_tests

Change-Id: Ia2d073ef12d48baff42fca97005c1185c9560f1c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71605
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-12-07 01:33:36 +00:00
Loko Kung 4539a48355 Revert "Bump maxUniformBindingSize to 2^16 from 2^14"
This reverts commit 1a57ee9d4e.

Reason for revert: Swiftshader does not support 2^16 at the moment, and this is causing all Swiftshader tests to be skipped silently.

Original change's description:
> Bump maxUniformBindingSize to 2^16 from 2^14
>
> This was upped in https://github.com/gpuweb/gpuweb/pull/2159
>
> Bug: dawn:1173
> Change-Id: I98d46b9b5a339280d21ddcb2ab039ce7ebce4ec3
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71608
> Commit-Queue: Brandon Jones <bajones@chromium.org>
> Auto-Submit: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Brandon Jones <bajones@chromium.org>

TBR=cwallez@chromium.org,enga@chromium.org,bajones@chromium.org,bajones@google.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Ib7d6023adac3f99b8e7238035eed2a16f2ced6d0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:1173
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71840
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2021-12-06 23:06:09 +00:00
Austin Eng 58c655b6b3 Complete per-backend AdapterDiscoveryOptions
D3D12, OpenGL, and OpenGLES have their own backend-specific
AdapterDiscoveryOptions. Add the same for Vulkan and Metal so we can
selectively discover just Vulkan or Metal adapters.

The Vulkan options include a boolean forceSwiftShader to force
Dawn to discover only SwiftShader on the Vulkan backend.

Also, refactor D3D12's DiscoverDefaultAdapters to simply call
DiscoverAdapters to match the other backends.

Bug: chromium:1266550
Change-Id: I137f94b40084b2d0ddeda39b6b7ef20f033d8a4b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/69522
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2021-12-06 20:58:56 +00:00
Austin Eng 652293f14c Support multiple Vulkan instances in the Vulkan backend
This will allow the Vulkan backend connection to be initialized, and
then selectively discover adapters on just one of the instances.
This is needed so that discovery of the fallback WebGPU adapter can
avoid initializing any adapters other than SwiftShader.

Bug: chromium:1266550
Change-Id: Ia8b31c0239da89a41aa89f1c09a66e9e56e10d95
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/69980
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-12-06 19:31:12 +00:00
Corentin Wallez 1a57ee9d4e Bump maxUniformBindingSize to 2^16 from 2^14
This was upped in https://github.com/gpuweb/gpuweb/pull/2159

Bug: dawn:1173
Change-Id: I98d46b9b5a339280d21ddcb2ab039ce7ebce4ec3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71608
Commit-Queue: Brandon Jones <bajones@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
2021-12-06 16:17:21 +00:00
Kai Ninomiya 5db89fbd38 Fix typo in DmaBuf tests
Caused roll failure starting here:
https://chromium-review.googlesource.com/c/chromium/src/+/3314932/

Bug: None
Change-Id: I8f348a4fea243364fefc01f902add33abff66d1d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71700
Auto-Submit: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-12-04 01:51:49 +00:00
Corentin Wallez c6d3a840da Replace reinterpret_cast with FromAPI/ToAPI where possible
This brings more type safety to the code and is marginally more
readable.

Bug: None
Change-Id: I0330a8a8e95cd9b8b531af266acd8fdc50c50460
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71606
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-12-03 16:47:18 +00:00
Brandon Jones d3105bfa47 Implement GPUCommandEncoder::ClearBuffer
Implements ClearBuffer for all backends.

Bug: dawn:1170
Change-Id: Ifc687d55727821c4fc134bf95020794c9d325025
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68642
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-12-02 21:43:49 +00:00
Corentin Wallez 959f1da637 Roll Vulkan headers to 1.2.201
Also delete vulkan.hpp that we don't use, and vulkan_fuchsia_extras that
have since then been upstreamed.

Also updates the fuchsia external import code to use the non-temp
extension.

Bug: dawn:221

Change-Id: I23e1bfedc5a18731be1e58d0bae1bddf6b0f45fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71601
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-12-02 20:27:58 +00:00
Brian Sheedy 75f0f29507 Fix test suppression macros
Changes several DAWN_TEST_UNSUPPORTED_IF macros that were erroneously
used to DAWN_SUPPRESS_TEST_IF.

Bug: dawn:1216, dawn:1217

Change-Id: Iaa0d7eb1b3aad8c0b11ff395cebaff0f15631beb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71524
Commit-Queue: Brian Sheedy <bsheedy@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Brian Sheedy <bsheedy@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-12-02 20:25:58 +00:00
Austin Eng 2d0007ca8f Don't connect to backends that aren't needed
Change backend connection in Instance.cpp to store a bitset of
backends that have been connected. This lets us only connect to a
single backend if AdapterDiscoveryOptions are passed explicitly,
and track which connections have/have not been made. Later, we can
connect to the rest of the backends if more are requested.

This is part of some improvements to the existing code so we can
selectively discover adapters and control discovery of the
high-performance, low-power, and fallback WebGPU adapters.

Bug: chromium:1266550
Change-Id: Iceb0d3f71751f5aac6218996ace3cf89deda8a29
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/69521
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-12-02 18:12:57 +00:00
Zhaoming Jiang 3a036ab698 Validate that storage texture views have a single miplevel
Validate the storage texture views have a miplevel of 1 when creating
bind group. This validation is added in
https://github.com/gpuweb/gpuweb/pull/2285.
Also fix a bug in unittest BindGroupValidationTest.TextureBindingType.

Bug: dawn:1212
Change-Id: If32400ed1e4f3049b8b8979e6e6133bada36b45c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71380
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
2021-12-02 05:38:30 +00:00
Li Hao c871df0b19 Validate depth/stencil texture formats in image copies
- Update block size of depth/stencil formats in TextureUtils.h
- Allow to copy depth aspect for Depth32FloatStencil8 and disallow it
for Depth24UnormStencil8 in copyTextureToBuffer()
- Add Depth24UnormStencil8, Depth32FloatStencil8 and other depth/stencil
  formats in CopyCommandsValidationTests.

Bug=dawn:690

Change-Id: I3f645b838b8a8cdafe0880bbd1e4e8d17d994510
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71400
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2021-12-02 02:06:40 +00:00
Brian Sheedy b17ecc3835 Suppress GTX 1660 failures
Suppresses several failures in Dawn's C++ tests that were found on
Windows machines with GTX 1660s.

Bug: dawn:1216, dawn:1217

Change-Id: I1b9feddd742837d0f91118803103eecbaa9effc9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71560
Commit-Queue: Brian Sheedy <bsheedy@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Brian Sheedy <bsheedy@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-12-02 01:28:26 +00:00
Loko Kung 25e41622c8 Adds testing infrastructure in DawnTest for error testing.
Bug: dawn:628
Change-Id: I80ef132a3ff0998d30a25cc5024e86905d859fb0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71240
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-12-01 22:25:00 +00:00
Loko Kung 1d47bac0fc Moves remaining logic in BindGroup dtor into Destroy.
Bug: dawn:628
Change-Id: I2e6a403c89e450efc952c91a2d497b99aa60c298
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71244
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-12-01 19:32:00 +00:00
Loko Kung 6331f959c1 Refactors Destroy to be upward calls instead of overriding.
- Fixes all class and implementations to call upwards when necessary.
- Makes DestroyImpl full virtual at ApiObjectBase.
- Fixes mock classes to call default DestroyImpl upwards on mock calls.
- Adds back D3D12 optimization for buffer destruction.

Bug: dawn:628, dawn:1189
Change-Id: Id2c2c6483dc7ed93daf8e4648af26ac1307e3d90
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71243
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-12-01 18:54:40 +00:00
Loko Kung 2494c9be8f Expose device.destroy upwards and add end2end tests
Bug: dawn:628
Change-Id: I0820d6855ac928c25f5720a2ccf0f21ae3f88d79
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68120
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-12-01 17:55:30 +00:00
Brandon Jones e7efad0325 Copy from a zeroed-out buffer to clear in D3D12
When setting a buffer to zero now uses copies from a previously
allocated, zeroed out buffer to perform the clear rather than making new
allocations every time.

Bug: dawn:1160
Change-Id: I0c8e7e56b2afcb5961723e352d8bbdf276f4557c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70760
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-12-01 16:17:20 +00:00
Austin Eng dcf5743395 Use Tint HLSL options to pass dynamic storage buffer sizes
Dynamic storage buffer sizes are loaded from a uniform buffer
which is bound to a set of root constants in the D3D12 root
signature.

Bug: dawn:429
Change-Id: I3bf0d9bbdb7a5b0a8c0f624f18081c6bf8d45fca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68960
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-11-30 23:54:39 +00:00
Loko Kung f89824595d Suppress flaky order-dependent BufferZeroInitTest.PaddingInitialized.
- Only suppressing for Linux/Vulkan/Nvidia platforms for now as those are the reproducable ones. The issue could be larger though.

Bug: dawn:1214
Change-Id: I56f29fdef912b0857b33bb81d391a82702750b47
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71360
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2021-11-30 23:42:49 +00:00
jchen10 ba276a4f55 Bug fixes for VulkanImageWrappingTestsDmaBuf
VulkanImageWrappingTestsOpaqueFD already has the same fixes, but
sadly didn't get applied to VulkanImageWrappingTestsDmaBuf.
DawnTest::Setup() and TearDown() are missing so the device isn't
initialized.
The expected values in CopyTextureToBufferSrcSync are wrong.

Bug: dawn:1210
Change-Id: I3810a626d840573ab7c1fa75ba7ca239e7288c3e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71245
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2021-11-30 12:40:59 +00:00
Austin Eng 6e83e6284e Disabling inlining of counterSet checks
To help debug a suspect crash in these functions.

Also, change some of the counter checks to use more
Objective-C style checks instead of std::find.

Bug: dawn:1102
Change-Id: I693d1f2489116200b2c0608ca60bc3eb8ddb8571
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71242
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Hao Li <hao.x.li@intel.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-11-30 04:16:18 +00:00
Li Hao 66467a4d8f Add Depth16Unorm texture format in utils/TextureUtils.h
The Depth16Unorm format has been implemented at
https://dawn-review.googlesource.com/c/dawn/+/62420, we can add it to
kAllTextureFormats and kDepthFormats in utils/TextureUtils.h.

Bug=dawn:570

Change-Id: I5abf845341debc1d6881c639bc400c40b14fc3bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70900
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2021-11-30 03:36:49 +00:00
Austin Eng 633d40bd0f Revert "Add a guard for MTLDevice.counterSets being null."
This reverts commit 610f184fd9.

Reason for revert: Crashes still happen even with this guard.
Testing shows that counterSets being null does not cause crashes.

Original change's description:
> Add a guard for MTLDevice.counterSets being null.
>
> This is a tentative fix for a segfault that's happening on
> metal::Adapter initialization on some systems.
>
> Bug: dawn:1102
> Change-Id: Iff31e46420e60cd76ecbbfa92bd5b5906ca89cf4
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/69340
> Auto-Submit: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: dawn:1102
Change-Id: Ia7d7428acee552a107425c774ba15e97bf170e38
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71241
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-11-30 01:07:38 +00:00
Austin Eng e5b361d8ef Add D3D12 root constants to hold dynamic storage buffer sizes
All of these root constants are set when a bind group holding
dynamic storage buffers is applied. This could be improved by
using reflection data to only set constants that are needed
in the shader. This will require adding a way to store the
reflection information in the blob cache.

Bug: dawn:429
Change-Id: I3afce6b781ec5a82d5d0bafb6720d368b82c1b00
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68600
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-11-29 23:02:49 +00:00
shrekshao 23d877caa2 Add undef Bool for xlib_with_undefs.h
Add undef Bool for xlib_with_undefs.h
Also fix a link in perf_tests/README.md

Change-Id: I83718b2014b6fe2bdfbd82b248d358abbd463abb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65223
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-11-29 20:55:49 +00:00
Loko Kung 349062fb72 Fixes Dawn to use custom Vulkan loader on Linux systems.
- Adds system utility to get the module directory for dawn native.
- Updates Vulkan backend to use the module directory to find loader.
- Test ran on NVIDIA GTX 1660 here: https://chromium-swarm.appspot.com/task?id=576d77991add7c10.

Bug: dawn:1191
Change-Id: I7c577008b5252ac94f38c8cdb56f7e8d8a0aa956
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70860
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-11-29 18:18:58 +00:00
Antonio Maiorano db6aa8a4ad Add "fxc_optimizations" toggle set to false by default
FXC sometimes miscompiles code when optimizing (/O2), and there is no
discernable workaround. This change sets the optimization level to /O0
when compiling shaders with FXC.

Also, no longer default to enabling EmitHLSLDebugSymbols in Debug
builds, which disabled optimizations (/Od). This confused me a few
times, and is not necessary since we can set this toggle via command
line.

Bug: dawn:1203
Bug: tint:1175
Bug: tint:1112
Change-Id: Ide9e6ecd45adeca951b8836dee91a8367eca3769
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70700
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-11-25 13:24:50 +00:00
Li Hao a329997e27 Add features of depth24unorm-stencil8 and depth32float-stencil8 texture formats
The depth240unorm-stencil8 and depth32float-stencil8 are optional
features. Enable them and add validation tests for texture creation
and texture view creation.

They are unimplmented on backends, skip their end2end tests.

TODO: add validtion for copy commands.

BUG=dawn:690

Change-Id: I980631d2f3fa6397a6125221a76980a15c8cb2f5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68220
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2021-11-25 01:11:57 +00:00
Loko Kung 596e07f768 Suppresses SwapChainTests.ResizingWindowAndSwapChain for Linux/Vulkan/Nvidia.
See successful run here: https://chromium-swarm.appspot.com/task?id=576d23443b829010

Bug: dawn: 1191, dawn:1205
Change-Id: I45acffcd2b23d7aaf0634b89f1c63e5e7f4437b4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70880
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-11-25 01:11:27 +00:00
Antonio Maiorano 13712ba4f3 Fix dumping of FXC compile flags
The logic was incorrect, printing "D3DCOMPILE_OPTIMIZATION_LEVEL2" for
levels 0, 2, and 3.

Bug: dawn:1162
Change-Id: I6ab7d9d3d22556b6602c778bddd99e5f2274b02b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70705
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-11-24 20:05:57 +00:00
Shrek Shao 2ec09921cc Add include RenderPipeline.h in DeviceMock.h
To unblock g3 dawn roll.

Change-Id: I92ea111dc4c65d4b2ff0c44e7f17799026afd96c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70800
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-11-24 19:55:07 +00:00
Loko Kung f008bb3b7e Update Vulkan's shader module destruction to remove cache for cleanup.
- Turns internal cache into a pointer so that we can deallocate it earlier for the destroy.

Bug: dawn:628
Change-Id: I69fd1e4be5ed5d8b7a28efebd9c2852bab3224b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70182
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2021-11-24 19:46:17 +00:00
Corentin Wallez 4c10e82cf8 Vulkan: discover Vulkan instance versions higher than 1.2
Previously we would only discover 1.0 or 1.1, meaning that extensions
promoted to core in 1.2 wouldn't be properly discovered.

Bug: chromium:1269882
Change-Id: I38bc211a3358158ba5eccd6b361e4b1173e047fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70640
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-11-23 23:50:37 +00:00
Austin Eng 77ac40a7b0 Add adapterType to WGPUDeviceProperties
This Dawn-internal struct is used to send Adapter information from
the GPU to Renderer process. We need adapterType to determine the
isFallbackAdapter property of GPUAdapter in Chromium.

Bug: chromium:1266550
Change-Id: Ia0457119f45a165e7bdb5b85c43c120391c7001b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70580
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
2021-11-23 22:25:56 +00:00
Austin Eng 3482a80bdd Rename DeviceDescriptor -> DawnDeviceDescriptor
This is preventing supporting DeviceDescriptor from upstream
webgpu.h because the name conflicts with the existing struct.

A typedef using the original name DeviceDescriptor is added
until all embedders of Dawn are updated to use the new name.

Bug: dawn:160, dawn:689
Change-Id: Ib9cb7443b7e46e3ffe29d2ec109f2f1a831754e7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70581
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-11-23 18:03:16 +00:00
Antonio Maiorano 7e851c91dd Make dump_shaders output FXC compile flags
For example, a non-Debug build will now output:

1: /* FXC compile flags */
D3DCOMPILE_PACK_MATRIX_ROW_MAJOR
D3DCOMPILE_OPTIMIZATION_LEVEL1

While a Debug build would output:

1: /* FXC compile flags */
D3DCOMPILE_DEBUG
D3DCOMPILE_SKIP_OPTIMIZATION
D3DCOMPILE_PACK_MATRIX_ROW_MAJOR
D3DCOMPILE_OPTIMIZATION_LEVEL1

This will be useful when using the CLI (fxc.exe) to make sure we pass it
the right flags.

Bug: dawn:1162
Change-Id: Ifffa2a0d1d0ccbb67ee7f5e1d0608d5946235bc5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70680
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-11-23 17:31:36 +00:00
Yan aaaf70aee2 Remove *-srgb formats from CopyTextureForBrowser() supporting lists
Current implementation of CopyTextureForBrowser() uses sampler to
load and store values in shader to *-srgb format textures. This is
the wrong implementation because it cannot reserve the origin bytes.

This CL remove *-srgb formats from supporting lists.

This CL also refactor CopyTextureForBrowserTest to reduce duplication
and prepare for color space conversion test case.

Bug: dawn:1195
Change-Id: Ib00d863e99bde8c7bf86fbb8ff93f0c799babe23
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70040
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2021-11-23 02:18:28 +00:00
Brandon Jones 828f674bf8 Add label tracking for several object types (pt 2)
Adds label tracking for:
  - CommandBuffer
  - CommandEncoder
  - ComputePassEncoder
  - RenderBundleEncoder
  - RenderPassEncoder

It's not clear to me if these structures have labelable equivalents in
D3D12 or Vulkan, so no changes were made to the individual backends.

Bug: dawn:840
Change-Id: Ib1786ab45466a3d13fbd4c772f8e8af4cc1786af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70400
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-11-23 00:09:25 +00:00
Zhaoming Jiang cac96415aa Add size parameter check in buffer mapAsync in wire server
This patch add the size parameter check in buffer mapAsync in dawn
wire server to make sure that it is not WGPU_WHOLE_MAP_SIZE. Together
with validation in mapAsync in dawn native, we can ensure that the
size parameter deserialized in wire server is a valid actual size.
When using default size with dawn wire, the actual size is computed
by wire client, and WGPU_WHOLE_MAP_SIZE shall never be passed to server.

Bug: chromium:1270819
Change-Id: Ic0fe52efed15860bcc519a3881f0f649f7455435
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70260
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
2021-11-22 09:57:52 +00:00
Jiawei Shao 4e3ddbd955 Add label to the trace events for pipeline and shader module creation
This patch adds the object label to the trace events for the creation
of pipeline and shader module so that we can easily know which shader
module or pipeline creation task the trace event belongs to.

BUG=dawn:1167

Change-Id: Ic2de4542d0167437eea2fd600d0f0be3bdd225f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70041
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-11-21 11:18:19 +00:00
Jiawei Shao bd3e042383 Fix a warning in FirstIndexOffsetTests about "flat" interpolation
This patch fixes a shader compilation warning in FirstIndexOffsetTests
by adding "flat" interpolation types to the user-defined unsigned
integer vertex outputs and fragment inputs.

This patch also enables FirstIndexOffsetTests on Vulkan backends as
we have already correctly supported "flat" interpolation in WGSL.

BUG=tint:451
TEST=dawn_end2end_tests

Change-Id: I965572c8460494e3eaec5dcf83e2dc67c0771250
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70025
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-11-21 07:45:38 +00:00
shrekshao 36200d1943 Refactor D3D12 shader define strings code
Instead of using template functions, generate define string pairs
in std::string. For DXC path, convert them to std::wstring. It is
okay since shader generation is already expensive.

By the way generalize it to all kinds of defines in
ShaderCompilationRequest.

Bug: dawn:1137
Change-Id: I5518e992b56497e28c8ac7e818bf19b4853dee4a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70120
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-11-19 19:39:18 +00:00
Loko Kung 98e42aaa5a Updates destroy in Vulkan's BindGroupLayout.
Bug: dawn:628
Change-Id: I728e5bc8c96df3bfe3f19c1841df20e28b79d76e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70181
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2021-11-19 18:57:08 +00:00
Brandon Jones 88aeeae41b Add label tracking for several object types
Adds label tracking for:
 - BindGroup
 - BindGroupLayout
 - PipelineLayout
 - TextureView
 - ExternalTexture
 - Sampler
 - QuerySet

Labels are passed to Vulkan and D3D12 where applicable, though many of
the related structures don't appear to be labelable objects in D3D12.

Bug: dawn:840
Change-Id: Ic7073dc9c02c9fb05bb46f2f8a84e575d5ba5c16
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70180
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-11-19 18:26:08 +00:00
shrekshao c6c4588036 Pipeline overridable constants: D3D12 backend
D3D12 doesn't have native pipeline constants feature.
This is done by using #define. Add some new tests to make
sure these define approaches work as expected.

Also makes duplicate pipeline constant entries an invalid
case.

Bug: dawn:1137
Change-Id: Iefed44a749625b535bbafbb39f42699f0b42e06a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68860
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-11-18 17:47:45 +00:00
Brandon Jones edc20d1528 Suppress indirect compute Tests on Win/Nvidia
Failures in the following tests are preventing Dawn from rolling into
Chromium due to errors when run against D3D12_NVIDIA_Quadro_P400

ComputeDispatchTests.IndirectBasic
ComputeDispatchTests.IndirectOffset
ComputeDispatchTests.MaxWorkgroups

Bug: dawn:1196
Change-Id: Ie7188384656307ede0f467ead6fba9289d9db655
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/69920
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-11-17 21:55:45 +00:00
Jiawei Shao 829d165d7c D3D12: Support [[num_workgroups]] for DispatchIndirect
This patch supports [[num_workgroups]] on D3D12 for DispatchIndirect
by appending the values of [[num_workgroups]] at the end of the
scratch buffer for indirect dispatch validation and setting them as
the root constants in the command signature.

With this patch, for every DispatchIndirect call:
- On D3D12:
1. Validation enabled, [[num_workgroups]] is used
The dispatch indirect buffer needs to be validated, duplicated and
be written into a scratch buffer (size: 6 * uint32_t).

2. Validation enabled, [[num_workgroups]] isn't used
The dispatch indirect buffer needs to be validated and be written
into a scratch buffer (size: 3 * uint32_t).

3. Validation disabled, [[num_workgroups]] is used
The dispatch indirect buffer needs to be duplicated and be written
into a scratch buffer (size: 6 * uint32_t).

4. Validation disabled, [[num_workgroups]] isn't used
Neither transformations or scratch buffers are needed for the dispatch
call.

- On the other backends:
1. Validation enabled,
The dispatch indirect buffer needs to be validated and be written
into a scratch buffer (size: 3 * uint32_t).

2. Validation disabled,
Neither transformations or scratch buffers are needed for the dispatch
call.

BUG=dawn:839
TEST=dawn_end2end_tests

Change-Id: I4105f1b2e3c12f6df6e487ed535a627fbb342344
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68843
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-11-17 05:00:44 +00:00
Jiawei Shao 8ce15b3ce9 Fix a bug in the generation of expected data in CopyTests
This patch fixes a bug in the generation of expected data in CopyTests.
In function GetExpectedTextureData() we intend to initialize every byte
of the expected texture data, so we need to calculate the index of the
expected texture data with "bytesPerRow" instead of "texelBlocksPerRow".

BUG=chromium:1161355
TEST=dawn_end2end_tests

Change-Id: I05bcab629fc961c7425c10fcd534c451af199712
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/69600
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-11-17 00:31:38 +00:00
Austin Eng 09c308cfcf Improve ScopedEnvironmentVar to distinguish between null and empty
Found while investigating Swiftshader support. Some Vulkan loaders
fail to create an instance if VK_ICD_FILENAMES is empty string
rather than entirely absent. It was set to empty string because
Dawn did not distinguish between nonexistent environment variables
and the empty string. This CL adds distinguishing between the two,
including tests for the behavior.

Bug: chromium:1266550
Change-Id: I1680a281f62e6b340009e01da65db9d485e2975e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/69520
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-11-16 23:37:15 +00:00
Loko Kung 970739e4e3 Add/update destruction handling for command encoding objects
- Renames ProgrammablePassEncoder to just ProgrammableEncoder since it is also used in RenderBundleEncoder which is not a "pass"
- Adds testing infrastructure to further test device errors
- Ensures AttachmentStates are de-reffed when encoder objects are destroyed for proper cleanup
- Makes sure that both encoded and partial encoded commands are freed at destruction

Bug: dawn:628
Change-Id: Id62ab02d54461c4da266963035e8666799f61e9a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68461
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2021-11-16 22:46:34 +00:00
Corentin Wallez 61c853276f Make CompilationInfo extensible.
This adds overloads for WireCmd [De]serialization that don't take the
object id provider/resolvers and produce a fatal error as soon as an
object is encountered.

Bug: dawn:1186

Change-Id: I13e796a5d8f59c26279b9079d4496390506c739a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68941
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2021-11-16 09:25:35 +00:00
Yunchao He de014a8d0a Add end2end test for readonly stencil attachment on D3D12
The new test can pass without further implementation changes on
D3D12 because:
  - stencil aspect shares the same resource state with depth:
    D3D12_RESOURCE_STATE_DEPTH_READ.
  - stencil flag (D3D12_DSV_FLAG_READ_ONLY_STENCIL) for readonly
    DepthStencilView descriptor has already been added into Dawn
    in previous patch.

Bug: dawn:485
Change-Id: I87aaaac0f01744d3533f2d97f987ee23ad0a1f53
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/69300
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-11-16 00:59:34 +00:00
Austin Eng 7065c21fbb Add descriptive error contexts to adapter initialization
To help diagnose issues where Dawn fails to create or initialize
an adapter.

Bug: none
Change-Id: I0c757f99596e9b4ac0e559807654ffaf9cb03feb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/69420
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-11-16 00:50:04 +00:00
Corentin Wallez 610f184fd9 Add a guard for MTLDevice.counterSets being null.
This is a tentative fix for a segfault that's happening on
metal::Adapter initialization on some systems.

Bug: dawn:1102
Change-Id: Iff31e46420e60cd76ecbbfa92bd5b5906ca89cf4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/69340
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-11-15 17:34:14 +00:00
Zhaoming Jiang 90c30f7355 Remove deprecated zero default size of setIndexBuffer and setVertexBuffer
Remove deprecated usage of size=0 as default size in setIndexBuffer and
setVertexBuffer. Using size=0 now result in a zero-size binding instead
of default size.

Bug: dawn:1058
Change-Id: I2ef0afc8d8826aa87a17c037d4dd1baf14e09f89
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67744
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-11-15 08:15:34 +00:00
Zhaoming Jiang c38c4d32f4 Remove deprecated zero default size of buffer mapAsync
In this patch the deprecated usage of size=0 as default size is removed.
Using size=0 in buffer.mapAsync now result in a zero size mapping,
instead of the default size.

Bug: dawn:1159
Change-Id: Ie8badc5eb7440980d0df3d3d27867e710e77f44b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67743
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
2021-11-15 08:08:35 +00:00
Austin Eng e9ac87742d Test shader robust buffer access for dynamic buffer bindings
These tests are partially disabled while bounds clamping is
unimplemented on D3D12 for dynamic storage buffers.

Bug: dawn:429
Change-Id: Ia8b3ad3e3703b784cd51813c92ff1f2c731b7519
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68460
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2021-11-13 01:00:04 +00:00
Loko Kung e9c84c071f Renames DestroyApiObject* to Destroy* for simplicity.
- Also updates and adds tests for CommandBuffer since it is the last object with a Destroy name clash.

Bug: dawn:628
Change-Id: I028e0101a91a785aa90d2b656556d48fe0d6e736
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68101
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-11-11 01:39:52 +00:00
Loko Kung 2c67af9853 Adds destruction handling for "simple objects" in device.destroy
Simple objects are defined as per https://dawn-review.googlesource.com/c/dawn/+/65864 and include:
- BindGroups
- ComputePipelines
- PipelineLayouts
- RenderPipelines
- Samplers
- ShaderModules
- SwapChains

Bug: dawn:628
Change-Id: I4ad74a2c4a223cf45acdbe6bdd0ec74332c9a14a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67740
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-11-11 00:39:22 +00:00
Loko Kung 6b6262dde0 Adds destruction handling for Textures when device is destroyed.
Bug: dawn:628
Change-Id: Iaaa62507592e12a724673a0226783c0425b04f35
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67601
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-11-10 22:25:03 +00:00
Loko Kung 75c978f9b9 Fixes buffer unmapping issue in D3D12
- Ensures that the D3D12 buffer destruction implementation no longer handles unmapping as that is now handled in the frontend.
- Moves around when the frontend buffer state is set to MappedAtCreation so that it only happens when the staging buffer (when necessary) is created successfully. Note that if the staging buffer was not created successfully, we will never return that buffer and would instead return an error buffer anyways. We need the state to be Unmapped though since it needs to be properly destroyed.

Bug: chromium:1265923, dawn:628
Change-Id: I62f98f0f1379a9cf0af565adfb8256ffe592b1ad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68880
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-11-10 20:28:02 +00:00
Yunchao He 0994bbeee6 Revise readonly depth/stencil compability between pass and bundle
Bug: dawn:485
Change-Id: I4082d2c255ce24440f0d6a34b5cb6fe6cb2e9c63
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68462
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2021-11-10 02:06:05 +00:00
Austin Eng b019ca6906 Support FL 11.0 adapters if they have at least Resource Binding Tier 2
Bug: dawn:1185
Change-Id: I8f7798def463c9e2a18e1f855908afe05bae8e04
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68780
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-11-09 20:03:45 +00:00
James Price 3646019925 Add utils/WGPUHelpers.{cpp,h} to CMake build
These files were added in this recent commit:
https://dawn-review.googlesource.com/c/dawn/+/68282

Change-Id: I63a64cea1946b3fe48ac20d478f9b7664bc63de0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68560
Commit-Queue: James Price <jrprice@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-11-05 20:59:31 +00:00
Ben Clayton 2754900069 dawn_node: Add documentation on how you debug TS
Change-Id: Iadaec50162da6f958016ec22f69623ab58ff461b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66922
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-11-05 16:14:32 +00:00
Austin Eng a50efb961d Copy some WGPUHelpers into dawn_native to simplify reentrant code
Bug: none
Change-Id: I9d48951019f5e1cfeca3815245a8818d79c3d1da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68282
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-11-04 22:21:20 +00:00
Shrek Shao b0a5ed49b1 Pipeline overridable constants: Metal backend
Also gate Dawn metal behind MacOS 10.12+

Bug: dawn:1136, dawn:1181
Change-Id: Id7bfaa2953b1acf08f37e6a08ddeadd9cde44657
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67421
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-11-04 18:43:10 +00:00
Antonio Maiorano cb41115907 dawn_node: handle signals (e.g. ctrl+C)
In all three modes, this cancels the current operations as soon as
possible. For tests that hang, this ensures we can Ctrl+C the process
and get the stdout from those tests.

Bug: dawn:1163
Change-Id: Ib3e45b533adaf510e1f9454a59ef1e821fc3eccd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68300
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-11-04 14:53:10 +00:00