Commit Graph

588 Commits

Author SHA1 Message Date
Loko Kung ca11c03824 Add render pipeline cache key generation for Vulkan.
Bug: dawn:549
Change-Id: I0c0607984193ddcc2add05594517638e5370484d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85863
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-04-13 02:48:41 +00:00
Loko Kung c083d65a0c Adds device-side cache key generation.
- Note that the device-side cache key will be prepended to object cache keys to prevent incompatible adapter/device cache clashes.
- Adds a new template file to auto=generate these cache serializers based on arguments.

Bug: dawn:549
Change-Id: I24b9d11eb38c579acfcc173a5dced9e1b649cf2c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86081
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-04-12 23:50:56 +00:00
dan sinclair d53cb2ae67 Fixup explicit on some constructors.
This CL adds explicit to various single argument constructors. The
explicit is removed from zero argument constructors. None of these
changes required call sites to change.

Bug: dawn:1339
Change-Id: I7dfcf1b393e7dd379e29cd9bc613cb0626a9a967
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86365
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-04-12 17:44:41 +00:00
dan sinclair 012098a86b Add explicit in include/dawn
This CL adds some explicit notations to single argument constructors in
the include/dawn folder.

Bug: dawn:1339
Change-Id: Ie4e31bf68f920acfcfb27828a465e45fe0977af6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86443
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-04-12 17:43:21 +00:00
Corentin Wallez b2fdd6402d Rework dawn/native/ProcTable.cpp's template to better handle functions.
This is a small rework to try to make the template better handle
functions that aren't associated with an object, when during an
unrelated patch I got confused that APICreateInstance didn't appear in
dawn::native.

Change-Id: If5a2aa3f9e348d1847e48fec4e90e5966ddd489d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86530
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-12 16:46:01 +00:00
Corentin Wallez 48585f3c15 dawn.node: Make run-cts --print-stdout print the run's stdout/err
Add a new muxWriter and use this for stdout writing to ensure
that stdout printing does not tear.

Bug: dawn:1123

Change-Id: Iec1ba16e5524c11bfc00ba38b3e4de3c06627fb1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85366
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-12 12:17:23 +00:00
dan sinclair eff8e00d97 Fix missing copyrights in src/dawn.
This CL adds the two missing copyright headers to files under src/dawn
and enables the lint flag by default.

Bug: dawn:1339
Change-Id: I3c3ec47b7f93dabadd0934fb93042f695e7e96fc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86360
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-12 06:58:24 +00:00
Yuly Novikov 736b33f059 Revert "Ignore VUID-vkCmdDraw-None-06538 VVL message"
This reverts commit 1e988b417c.

Reason for revert: Vulkan validation layers fixed in
https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/3938

Original change's description:
> Ignore VUID-vkCmdDraw-None-06538 VVL message
>
> To get vulkan-deps roll going
>
> Bug: chromium:1310052
> Change-Id: Ia47aa9a486256a9b3c96b90a66cd39bd2ec7c155
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84724
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

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

Bug: chromium:1310052
Change-Id: Icf676fca331ee8cde1b192d474745a3aac20c330
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86460
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-04-12 05:33:20 +00:00
Stephen White cedd55a9bf GLES: revert part of the view format reinterpretation on GLES.
View format reinterpretation doesn't work, but its implementation was causing failures on other content.

This patch came from: https://dawn-review.googlesource.com/c/dawn/+/84704/comments/339d5a75_5dce5ce3

Bug: dawn:1360
Change-Id: I76adc264d6f185f840d975b46b6e92a0e5a7b4a8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86362
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-04-12 03:31:16 +00:00
Brandon Jones 8085367233 Enable Queue, Device labels to be set. (Take 2)
Queue labels can be set by the defaultQueue.label member of the device
descriptor or the setQueue method.

Device labels can be set label member of the device
descriptor or the setQueue method.

D3D12 and VK backend label support included.

Bug: dawn:1323
Change-Id: Ic44f1fac268c20d5338220eaf959d949a5f66536
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85843
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-04-12 03:28:40 +00:00
Ben Clayton 7170b727c9 dawn/node: Fix GCC warning
About comparisons of different datatypes

Bug: dawn:1123
Change-Id: Iefdb8195041b824f63344a0b367fd5bebbe3ca85
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86308
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-11 21:50:40 +00:00
Ben Clayton 3f4b260264 dawn/node: Define NAPI_DISABLE_CPP_EXCEPTIONS
Wrap `napi.h` with a Dawn header that defines `NAPI_DISABLE_CPP_EXCEPTIONS`, and then includes the napi.h header.

Required now that CMake correctly disables exceptions with `-fno-exceptions`.

Change-Id: If31b28d331f2071a0119339c60cc3ab8ab801a98
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86301
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-11 20:10:10 +00:00
dan sinclair 479dc6b7eb Enable build/header_guard
This CL enables the build/header_guard lint check. The existing headers
which failed the check were updated, missing headers added. An exclusion
file for the generator templates was added as well.

Bug: dawn:1339
Change-Id: If572e460179ad501293d5d6cf01e0ea900daa979
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86207
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-04-11 18:30:50 +00:00
Corentin Wallez be352ea5b9 CMake: Add support with Swiftshader with DAWN_ENABLE_SWIFTSHADER
Change-Id: I2b3d906bac760a22f33104231a6341415cbff3b5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85365
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-11 16:48:43 +00:00
Corentin Wallez 6efd54e2ae Move samples/ under src/dawn/samples/
Bug: dawn:1339
Change-Id: I897df9889da62e4505ea98a780bd481e7855ec73
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86307
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-04-11 16:40:00 +00:00
dan sinclair 396b75cd29 Fixup include directory errors in src/dawn.
This CL adds the node-addon-api prefix to the napi.h includes. This
required updating the cmake files to have the dawn_third_party_dir as
part of their includes.

Bug: dawn:1339
Change-Id: I56d9f04462d040f6ed236fcef3c4cd85a9144d7f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86241
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-04-11 16:29:30 +00:00
dan sinclair 566d7f25b8 Enable empty_if_body lint.
This CL updates the one instance of an empty if body in Dawn to
remove the if. This allows enabling the empty_if_body lint check.

Change-Id: I5c05db828e8033b4f3155a34c3a6723bfd3181d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86082
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
2022-04-11 15:50:50 +00:00
Antonio Maiorano e0bee791cb Add ifdefs for Tint API usage that may not be available
Fixed Kokoro failures when building Tint with all readers and writers
disabled.

Change-Id: I9bd041339236488dd563bbe687da883035f2a4b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86181
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-04-11 15:21:41 +00:00
dan sinclair fd64b10b0d Fixup readability/braces lint warning.
This CL removes some trailing ;'s which aren't needed to enables the
readability/braces warning.

Bug: dawn:1339
Change-Id: I776267b4282b1345e6b4258d1aff3d7de9fecb8a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86210
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
2022-04-11 14:25:11 +00:00
dan sinclair 69347de37b Enable runtime/printf
This CL changes the single `sprintf` to an `snprintf` which allows the
runtime/printf lint check to be enabled.

Change-Id: Ieed654a8d5f23250e4bc8ee07001489a060f8dc5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86084
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
2022-04-11 14:10:40 +00:00
dan sinclair 13d88a6438 Fixup build/include issues in src/dawn
This CL fixes up a few include issues in the dawn folder allowing the
build/include lint rule to be enabled.

Bug: dawn:1339
Change-Id: I585c0b6a7e9c1f8bff466ea8c3765e2a1486e79c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86240
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
2022-04-11 14:01:50 +00:00
dan sinclair fcf56791c1 Create more targeted CPPLINT.cfg files.
This CL moves the filters out of the PRESUBMIT.py file and into specific
folder CPPLINT.cfg files. This allows having all the lints enabled in
the Tint code and specifically disabling in Dawn code as needed.

Bug: dawn:1339
Change-Id: Ieb0178b0aac0ea67c52cc5547984ea5696eef5a4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86208
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-11 13:05:40 +00:00
Stephen White ca4a8cf02a OpenGLES: simulate glTextureView() with texture-to-texture copies.
This is obviously a non-optimal solution, but works in all cases
except compressed textures.

Change-Id: I3fd5fd89ef4978a18917b068632f25f75527c594
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84160
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@google.com>
2022-04-09 18:27:50 +00:00
Loko Kung 23d09c6114 Add compute pipeline cache key generation for Vulkan.
- Adds dependency to vulkan-tools for pNext chain helpers.
- Adds extra caching to vulkan shaders to keep the spirv in the in-memory cache as well.
- Adds pNext chain serializer infra for Vulkan.

Change-Id: Ibe73183fbff15f7310eaaeae92fbd622be1ac096
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85022
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-04-09 00:10:08 +00:00
dan sinclair db9db31cab Fixup whitespace/comments issues.
This CL fixes a few tabs to be spaces which makes the whitespace/comments
lint check pass. The check is set to enabled.

Change-Id: I2a6c590aa3bfee888239adc89d1ce4c8c99f3e78
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86083
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
2022-04-08 19:23:36 +00:00
Ben Clayton 96e245e576 CMake: Fix sanitizer builds
The sanitizer flags need to be applied to all compilation units, and to all final link stages.

As this is whole-project (dawn + tint), these options have been promoted to DAWN_ options.

Bug: dawn:1339
Change-Id: I17beb5bd2a8f15de9d8f13d132356b5c663d71bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86143
Kokoro-Run: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-08 18:08:36 +00:00
Corentin Wallez f6bac0ca86 dawn.node: Detach buffer mappings on GPUBuffer.destroy.
Bug: dawn:1123
Change-Id: I662c60346a5c57030e932d636ea2f9d8519c5fc8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86142
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-08 14:58:25 +00:00
Jiawei Shao 9d27aaaaa1 Always use 0 for the Depth operand of OpTypeImage
This CL is based on the below one with changes on the unittests:
https://dawn-review.googlesource.com/c/tint/+/60860

Bug: dawn:1030
Test: tint_unittests

Change-Id: I4624a0abd3c4905137b6ce1b3f57e4d9a4510eb4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85324
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86065
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-08 08:33:28 +00:00
Corentin Wallez e17a13c60c Validate that alignment limits are powers of two.
Also changes enums to use the concept of "limit class" from the WebGPU
specification.

Fixed: dawn:1242
Change-Id: I328ce98c2eaaf3f4b7ff1c253ee5f3db5a2980f5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84762
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-08 07:04:26 +00:00
dan sinclair 9e9db88e32 Minor formatting changes.
This is the result of running clang-format over all of the files.

Change-Id: I196f0e628583f9d87d350d11d762ea9e98987a01
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86080
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-07 20:28:55 +00:00
Austin Eng f02bf9e76d Make texture view default format robust against invalid aspects
Computation of the default depends on the aspect, but the aspect
may be invalid. Make the default computation robust such that it
picks some valid aspect if a valid one is not provided. This will
make computing the default OK, but still fail validation of the
aspect later.

Bug: chromium:1314049
Change-Id: I2dcfe7962c7e30ac627605b6d0f1c269b3a6af6e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86020
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-04-07 20:20:14 +00:00
Corentin Wallez ebfbaf8f22 Add top-level OWNERS and scope Tint owners more tightly.
This is both a security/ACL best practice, but also to make the Gerrit UI
better suggest owners for CLs.

Bug: dawn:1339

Change-Id: Ia79b88d919707147d2726a7e4f3ff9080cd275b0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86067
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2022-04-07 17:59:14 +00:00
Austin Eng e1f2dcd3b3 Implement rendering with view format reinterpretation
Includes fixes for the backends to create and use a texture view
if reinterpretation is required. Multiple backends used the original
texture and its format instead of the view.

Bug: dawn:1276
Change-Id: Ic31231b2955314e90e011905c9048db6f7899299
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84704
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-07 12:14:55 +00:00
Corentin Wallez b28d6c8e1c Remove lintcpp from presubmits since it fails on all Dawn files
Also fixes some other lint issues.

Bug: dawn:1339
Change-Id: I19a212218db3249191deedc671fc6e36991ecad8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86061
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2022-04-07 11:36:06 +00:00
Ryan Harrison e87ac76f7d Merge remote-tracking branch 'tint/main' into HEAD
Integrates Tint repo into Dawn

KIs:
- Building docs for Tint is turned off, because it fails due to lack
  of annotations in Dawn source files.
- Dawn CQ needs to be updated to run Tint specific tests
- Significant post-merge cleanup needed

R=bclayton,cwallez
BUG=dawn:1339

Change-Id: I6c9714a0030934edd6c51f3cac4684dcd59d1ea3
2022-04-06 15:37:27 -04:00
Corentin Wallez a696d08c51 CommandBufferVk: Update an ASSERT with copy format compatibility.
Fixed: dawn:1354
Change-Id: Id5b8169113436debf7a8af71df9737d1e0d2dec5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85920
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-06 17:42:54 +00:00
Austin Eng aae6bce1fb Add regression test for crbug.com/1313172
This adds a test, and a toggle disable_resource_suballocation.
This enables testing the behavior discovered in the bug without
creating enormous resources.

Bug: chromium:1313172
Change-Id: I779aad50c051e5022a9c85ebfbf33c18173a748f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85861
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-04-06 01:21:43 +00:00
Austin Eng e8d5678b70 Fix use-after-free of committed resource heaps
Heaps were destroyed immediately instead of deferring destruction
until after all work using the buffer was complete. This is only
a problem on D3D12. Vulkan allocations already have deferred
deletion, and Metal allocations are managed by the driver.

Bug: chromium:1313172
Change-Id: I0ef43709949c9e86c40e766f7f2029b14c8a2e97
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85840
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-04-06 01:14:33 +00:00
Ryan Harrison 8d9d132f7c Revert "Enable Queue, Device labels to be set."
This reverts commit 0126761de8.

Reason for revert:
Causing Dawn->Chromium roll to fail

BUG=dawn:1346

Original change's description:
> Enable Queue, Device labels to be set.
>
> Queue labels can be set by the defaultQueue.label member of the device
> descriptor or the setQueue method.
>
> Device labels can be set label member of the device
> descriptor or the setQueue method.
>
> D3D12 and VK backend label support included.
>
> Change-Id: Id12dd6e1fc8f1519c55e4efb35e1ead67c085e46
> Bug: dawn:1323
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85540
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Commit-Queue: Brandon Jones <bajones@chromium.org>

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

Bug: dawn:1323
Change-Id: I62e4b508d2c55fd89f2f4c5cbe5d04d22681aeef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85700
Reviewed-by: Brandon Jones <bajones@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-04-05 22:09:43 +00:00
Brandon Jones 29b72c87e9 Updated the syntax for WGSL structs in all tests.
Change-Id: Ia80b1bed84aa7d16421d432d5da861e55175b335
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85841
Commit-Queue: Brandon Jones <bajones@chromium.org>
Auto-Submit: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2022-04-05 18:41:23 +00:00
Corentin Wallez 40b4ece211 Add more information on renderBundle<->pass attachment state mismatch
Bug: dawn:563
Change-Id: I8f68f27bf0f4864018ec8c58eae6754671031db8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85761
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
2022-04-05 17:19:53 +00:00
Yunchao He 7ee6bf3dda Disable a flaky T2T copy test on Intel Windows D3D12
Bug: chromium:1312066
Change-Id: Ia31496cdf9178a860e44503d81eda5be10c3d4e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85681
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-04-05 16:48:33 +00:00
Corentin Wallez 91c25df838 dawn.node: Add TODOs for implementing unhandlederror.
Bug: dawn:1348
Change-Id: I3b3d10a1ff1828f602087f8b17610749c60b6e49
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85801
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-05 16:27:43 +00:00
Corentin Wallez 4d68bcbd9d dawn.node: Implement bundle encoder depth/stencilReadOnly
Bug: dawn:1325
Change-Id: Iffe8b316038d639d68fa57dfb448e7242fd1f087
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85802
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-05 16:25:23 +00:00
Corentin Wallez bb6997214d dawn.node: Update for attachment "value" renames.
This silences some deprecations warnings.

Bug: dawn:1123
Change-Id: Ic6c12c6ad7606a85be8a17177b55a53f61d1136d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85760
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-05 12:50:13 +00:00
Austin Eng e8498e7f04 Validate texture view format is supported
Fixed: chromium:1312780
Change-Id: I29f13a2df3ef1db6961a5760a6c1bb05ab3fa89b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85680
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-04-04 20:28:37 +00:00
Corentin Wallez 2787a4c64c Rely on Tint to validate shader IO and bindings have decorations.
This removes a little bit of noise from the reflection of shader
metadata in Dawn. Tests are added to make sure that Tint does the
correct validation (it does).

Bug: None
Change-Id: I334e7c23b723cf5b5985c9914cc9f8d79a7c0568
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85502
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-04 18:57:52 +00:00
Corentin Wallez 2f2977b728 dawn.node: Handle \0 in entryPoint names.
Bug: chromium:1215024
Change-Id: I88fd8b513fbda9b6c55575616afaa0c65882fc1a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85505
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-04 16:21:32 +00:00
Corentin Wallez a2f7d02c5e Validate ShaderModule limits at pipeline creation time.
A list of errors, `infringingLimits`, is added to EntryPointMetadata.
During shader reflection, instead of directly bubbling limit errors up,
they are stored in this list and check only later during pipeline
creation.

Several ShaderModule tests are reworked to create a pipeline to check
for the validation of these limits. For the IO variable limits the tests
needed to be reworked to check for strings in the error messages because
since IO structs have to match between VS and FS, if one failed the
other failed too. (so it's no possible to target the validation of one
of these in particular)

Bug: dawn:986

Change-Id: I689e16454488d4a3c746ece53828555ed72ed561
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85501
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-04 16:11:42 +00:00
Corentin Wallez 8033af0947 dawn.node: Implement the [Clamp] and [EnforceRange] WebIDL attributes.
These are implemented by wrapping the integer types in transparent
ClampedInteger<> and EnforceRangeInteger<> structures.

Some parts of the core needed to be updated after this, either to
disambiguate conversions, or because of bugs (u32 vs u64).

To make the CTS tests checking for this pass, the errors returned when
conversion FromJS failed needed to be updated to TypeError and not just
the generic Napi::Error.

Bug: dawn:1123
Change-Id: Ife1d0baa7687e43d735a1814ec41883c49ae74a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85640
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-04 14:46:12 +00:00
Corentin Wallez e56b5f1097 dawn.node: Check for OOB in setBindGroup's typed array variant.
Bug: dawn:1123
Change-Id: I9ded6c76d50183ff14158e573b2c1a36a1becb3a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85641
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-04-04 12:22:52 +00:00
Corentin Wallez e6359d6058 dawn.node: Implement writeBuffer up to spec.
Bug: dawn:1132
Change-Id: I5b088283c85305f8c8b662478a5a46169a0217fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85503
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-04 09:09:51 +00:00
Brandon Jones 0126761de8 Enable Queue, Device labels to be set.
Queue labels can be set by the defaultQueue.label member of the device
descriptor or the setQueue method.

Device labels can be set label member of the device
descriptor or the setQueue method.

D3D12 and VK backend label support included.

Change-Id: Id12dd6e1fc8f1519c55e4efb35e1ead67c085e46
Bug: dawn:1323
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85540
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-04-02 04:45:41 +00:00
Loko Kung c96ef43684 Updates remainder of references to old vulkan headers and removes them.
Change-Id: I7b0563a9bd3a98c08b81569be04a9c45dbb61f0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85420
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-04-02 03:02:40 +00:00
Yunchao He 2a87c84c56 Add end2end tests to expose buffer size error on D3D12
When we do B2T or T2B copy from/to a buffer with paddings,
D3D12 may wrongly calculate the required buffer size.

For example, if copySize = {1, 1, 2}, offset = 0, bytesPerRow =
256, and rowsPerImage = 2 (there is 1-row padding for every image),
and we are copying a non-compressed format like rgba8unorm,
the required minimum buffer size should be:
offset + bytesPerRow * rowsPerImage * (copySize.depthOrArrayLayers - 1)
+ bytesPerRow * (copySize.height - 1) + bytesPerBlock * copySize.width.
It is 0 + 256 * 2 * (2 - 1) + 256 * (1 - 1) + 4 * 1 = 516.

The required minimum buffer on D3D12 (including WARP) size is:
offset + bytesPerRow * rowsPerImage * (copySize.depthOrArrayLayers - 1)
+ bytesPerRow * (rowsPerImage - 1) + bytesPerBlock * copySize.width.
Or offset + bytesPerRow * rowsPerImage * copySize.depthOrArrayLayers
+ bytesPerBlock * copySize.width - bytesPerRow.
It is 0 + 256 * 2 * (2 - 1) + 256 * (2 - 1) + 4 * 1 = 772.

It looks like D3D12 requires unnecessary buffer storage for
rowsPerImagePadding in the last image. It does respect
bytesPerRowPadding in the last row and doesn't require storage for
that part, though.

You can verify the buffer size requirement on D3D12 backend with the
new tests via --enable-backend-validation. The validation layer
says that D3D12 requires 772 bytes but we only provide a 516-bytes
buffer, and leads to E_INVALIDARG (Error code 0x80070057) when run
mD3d12CommandList->Close() in CommandRecordingContext::ExecuteCommandList
and causes device lost.

Bug: dawn:1278, dawn:1288, dawn:1289
Change-Id: Icfb792dec60ff7444cb20b3c283709cdb165f80a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85341
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2022-04-02 00:18:00 +00:00
Austin Eng 42e76ba82a TextureView defaults and validation updates
Spec PR: https://github.com/gpuweb/gpuweb/pull/2687

Fixed: dawn:682
Bug: dawn:1276
Change-Id: Ifa8f94fa4c1a27fb40d0ccfb9f032ca4a28ed24e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84520
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-04-01 23:04:50 +00:00
Corentin Wallez 595e20085d Separate entry point reflection in its own function.
This allows adding as an error context the name of the entry point, and
dedents the code a little bit.

Bug: dawn:563
Change-Id: I1ea9760fc1aca506826ca7ef5a65d40f8370136d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85500
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-04-01 22:04:30 +00:00
Corentin Wallez d1cdb61aa1 dawn.node: make popErrorScope reject on validation errors.
The semantic of popErrorScope was changed from raising an exception on
validation errors to instead reject the promise.

Bug: dawn:1123
Bug: dawn:1324
Change-Id: I34322d8293e112eb2d1bfea784e2b2d6be33b604
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85506
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-04-01 18:18:22 +00:00
Corentin Wallez 359b82da43 dawn.node: Make run-cts disable disallow_unsafe_apis
Bug: dawn:1123
Change-Id: I2696dedf8249f5cfd8fe0138b7ee43e567a4ddf5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85504
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-01 17:14:56 +00:00
Corentin Wallez 60e5ab281c dawn.node: Do not expose non-WebGPU interfaces at global scope.
This remove some interfaces like OffscreenCanvas from the global scope
because dawn.node is not capable to usefully create them. The CTS
uses the absence of these interfaces to skip tests when needed.

Bug: dawn:1123
Change-Id: I6d57600ba6b41be58c541d1f8091e7e88781f04f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85364
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-01 13:11:58 +00:00
Corentin Wallez 63fe6e11cd dawn.node: Make GPUDevice.lost [SameObject]
Previously a new promise was created and new promises were never
resolved on creation, only on loss/destruction of the device. This made
the following code wait forever:

  device.destroy();
  await device.lost();

Bug: dawn:1123
Change-Id: I1e31cf9ccd466672eed4cad464c38cb9f8b3d724
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85362
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-01 12:22:36 +00:00
Corentin Wallez ecc3fe6f0f dawn_node: Implement the [SameObject] IDL attribute
This is done by moving the set up of these attributes to the place where
the wrapper objects are created, by doing:

  jsObject.DefineProperty("foo", impl->getOnceFoo());

Three alternatives that weren't chosen are:

 - Caching a weak reference to the member's Napi::Value on the wrapper
   struct, and recreate it only as needed. This is good because it
   doesn't risk using the value after it is GCed, but it can result in
   multiple calls to the getters, which could be unexpected (for example
   for GPUDevice.lost in a follow-up CL).
 - Caching a persistent reference to the member's Napi::Value on the
   wrapper struct. This calls the getter once and doesn't risk using the
   value after it is GCed. However if Javascript does something like
   `myGPUDevice.limits.device = myGPUDevice`, a cycle is created that
   the GC doesn't have visibility into, and that can't be collected.
   (the origin of the edge of the reference graph that persistent
   references make is unknown to the GC).
 - Caching the member on a hidden variable of the JS object. I didn't
   find a way to do this. The closest would have been to do
   jsObject[Symbol(...)] = cachedValue but even symbols can be retrieved
   with Object.getOwnPropertySymbols.

Bug: dawn:1123
Fixed: dawn:1144
Change-Id: I1bc82dd9d10be95bf2bdca73bdfb843bc556d2df
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85361
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-01 11:39:26 +00:00
Corentin Wallez f880b2e8d5 dawn.node: Fix astc-12x10-unrom-srgb
Bug: dawn:1123
Change-Id: Ib1f278d0e74283e20ec77bd44aa802309904057e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85363
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-01 07:55:07 +00:00
Corentin Wallez 5234f46a37 Add instructions for debugging dawn.node with gdb/lldb
Bug: dawn:1123
Change-Id: I25dd0b724903a6dcce276bd7744fd12a21a9137e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85360
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-01 07:46:37 +00:00
Loko Kung 09100b79d0 Try to use the vulkan-headers from vulkan-deps instead of third_party/khronos.
Change-Id: Ic4af5ec86e4ea2ec404a6e32e49068fc5993d55a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85300
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-04-01 05:22:55 +00:00
Loko Kung c53bc6f698 Fixes cache key generation to handle binary data.
Bug: dawn:549
Change-Id: Ie6b3ceb610b362adfed96a0982d7541002660809
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84920
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-04-01 00:44:35 +00:00
Jiawei Shao eab5300e87 Set depthWriteEnabled to default in ExpectAttachmentDepthStencilTestData
This patch sets depthWriteEnabled to its default value (false) in the
helper function DawnTest::ExpectAttachmentDepthStencilTestData() as all
the tests can pass with depthWriteEnabled == false on the Linux Intel
bots now.

Note that previously using depthWriteEnabled == false and writing into
FragDepth will cause Linux Intel Mesa driver crash on Mesa 19.0.2.

BUG=dawn:821
TEST=dawn_end2end_tests
Change-Id: I22cc0dcdb8521fd8eae436d99a7c06167af89b09

Change-Id: Id0dd1c31099c6aafad175bde038ba9662b02a160
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85322
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2022-03-31 23:37:05 +00:00
Loko Kung f57867264a Adds a generated file with the dawn git hash encoded at build time.
Bug: dawn:549
Change-Id: I5d6306f33b7ad2247ee75a0c5387a2bc6fac0497
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/83901
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-03-31 05:09:04 +00:00
Austin Eng 8e02ebf6c6 Implement WGPUTextureDescriptor.viewFormats and sampling reinterpretation
Reinterpretation for render/resolve attachments not yet implemented.

Bug: dawn:1276
Change-Id: I43d73ce5c943c4ba49df06c6865867f378f2de25
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84280
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-31 03:53:04 +00:00
Austin Eng 10ec4ee7ef Disallow creating a 2D-array view on a multisampled texture
Spec issue: https://github.com/gpuweb/gpuweb/issues/2715
Spec PR: https://github.com/gpuweb/gpuweb/pull/2716

This is invalid in the Metal API because MTLTextureType2DArray is
imcompatible with MTLTextureType2DMultisample, even if the layer
count is 1.

MTLTextureType2DMultisampleArray is not supported until macOS 10.14
and iOS 14.0.

Further, the view type must match between the API and the shader.
a 2D view array requires texture2d_array in MSL.
It would be inconsistent to allow 1-layer 2D arrays which internally
get translated as (non-array) MTLTextureType2DMultisample. You would
expect to need to use texture2d_ms_array in the shader.

Change-Id: Ib9268c1276d3d31e90d6c61118e27fa2afd0617d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85200
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-31 01:26:49 +00:00
Antonio Maiorano e5474a4efc run-cts : default "cts" arg to third_party/webgpu-cts if found
Change-Id: Ia052e92d17be5ce2068a14d74b5cdc2c43cf625f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85160
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-03-30 18:42:19 +00:00
Stephen White 9be06c8d23 GL: fix clear-on-init of depth/stencil textures.
Disable the scissor test during clear.

Change-Id: Ia6945304c257867ed5cb6a6ae0c2c49998a33ca7
Bug: dawn:1340
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85143
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-03-30 10:26:44 +00:00
Brandon Jones bf0f2c1849 Stencil8 support fixups
Addressing issues that showed up after the initial stencil8 CL landed.

D3D12:
 - Selecting the `all` aspect of a `stencil8` texture was ASSERTing

Metal:
 - Using the `stencil` aspect of a `stencil8` texture was hitting an
   UNREACHABLE().

Bug: dawn:666
Change-Id: Ic2931dbb915e109727ca24e3216a661fba84e508
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85021
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-03-29 23:01:54 +00:00
Corentin Wallez 982188ac16 Rename Surface::Type::Xlib to XlibWindow for consistency.
Bug: None
Change-Id: I2750c2fc86cc893d6f124cf7d539a85458bd4105
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84761
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-29 19:32:23 +00:00
Stephen White fd41f30c0b OpenGL: refactor FramebufferTexture* calls.
Change-Id: Iee67027431d791d6425e0cc502f6b6a23bc160d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85141
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-03-29 18:52:23 +00:00
AlexVestin 1e627e23f3 Android: Fix incorrect variable name
Bug: dawn:286

Change-Id: I2ad301a243112db1cc11ef83e241eab0812a197f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85062
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-29 18:10:13 +00:00
Stephen White b5c5df50ab Implement support for depth24stencil8 on OpenGL.
Covered by existing tests.

Change-Id: Ibb6daf8cd195474560a306e830d69c484579ae1c
Bug: dawn:1338
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85140
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-03-29 16:34:23 +00:00
Corentin Wallez dad225a896 Fix last reantrant object creation.
Fixed: dawn:723
Change-Id: I9697686a3a8a8d31539c04cd3e6073744152ff68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85120
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-29 16:13:53 +00:00
Stephen White f32ae5b680 GLES: fix texture-to-texture copy with offset src or dest region.
glBlitFramebuffer() takes min and max coordinates, not min and size.

Bug: dawn:1084

Change-Id: I7b8b53ecd9c5ade20d4d7a909bd134c13a2d960b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85081
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-03-29 16:11:34 +00:00
Stephen White 3c44ba8376 OpenGL: refactor texture allocation.
Move texture allocation in an AllocateTexture() local.

Use the GL target to determine the choice of allocation call, not
the Dawn TextureDimension. This leaves TargetForTexture() and
TargetForTextureViewDimension() as the authorities on Dawn -> GL
conversion.

Change-Id: Ia31fbba9a8e71a9ce8dd9c89676dbc51d8848bb5
Bug: dawn:593
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85080
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-03-29 12:24:16 +00:00
Corentin Wallez e690a6654a Make SwapChain use a CreateView() instead of APICreateView()
This simplifies reference management and make the swapchain's reentrant
code avoid APIEntryPoints.

Bug: dawn:723
Change-Id: I6c456b9ec349c73d783dbb12a284f322d0be4e1a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84763
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-03-29 09:35:53 +00:00
Shaobo 8e414a140b Release D3D11on12Resource Cache after Texture::Destroy() has been called
On D3D12 backend, external texture holds mD3D11on12Resource which caches
D3D11on12Resources and guarding by refptr. The texture will released this ref
until destructor works.

This model leaks the gpu memory if client fails to release all the ref to
the texture.

Instead, external texture also provides a method called "Destroy". It is
called more eagerly and means the external texture is in the end of lifecycle.

So thid CL moves the ref reset of D3D11on12Resource into Destroy(). This prevents
unexpected gpu memory leak caused by client missing ref release call.

Bug: 1308405
Change-Id: I253e1eda192256e4bd1c470e26dcc6af3c234447
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85000
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2022-03-29 08:14:53 +00:00
Corentin Wallez e055ae5b52 Make reeantrant creation calls returning Ref for command encoding.
Fixed: dawn:723
Change-Id: I953e0aa7d663f68e15c021448a90ecf799fef891
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84766
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-03-29 08:10:03 +00:00
Corentin Wallez 46d5480d20 Metal: Add ASTC and ETC2 texture compression support.
Fixed: dawn:1176

Change-Id: I7655ef98151a1bb78d23be0357a68cdd90e5078a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84481
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-03-29 07:58:23 +00:00
Corentin Wallez fc1a2ae904 dawn_node: Implement requesting limits
And reject the device creation promise with an error that looks like an
OperationError to make the CTS happy.

Bug: dawn:1242
Change-Id: I43ec3ebc030cb4178520c9174e164a42b94f6bf8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85060
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-03-29 07:45:03 +00:00
Loko Kung b8a4f34ed9 Enables device.destroy API now that CTS tests have been implemented.
Bug: dawn:628
Change-Id: I52e9c2d04c605b64a5fd80762891fc44e2c2c53a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84921
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-03-29 01:23:22 +00:00
Brandon Jones 8fa1eaf840 Better errors for incompatible attachment states
Now the message will report the details of both the expected and
incompatible attachment states, helping developers see what the source
of the error was.

Bug: dawn:563
Change-Id: I58eea166cb2da634f0295fb4660c982f96c62a2d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84940
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-03-28 20:07:16 +00:00
Ben Clayton 6f8ff744da dawn/node: Fetch and use node 16.13
Fixed: dawn:1329
Change-Id: Ifbc97961f1cafa804908d24d61da72ce0f59dae0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85061
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-03-28 19:55:42 +00:00
Corentin Wallez ac0f60c307 Fix one APICreateBuffer use in CommandBufferVk.
Bug: dawn:723
Change-Id: I48c1c2594ee8b86dfe11b5dcaedcdd8170868def
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84765
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2022-03-28 18:47:02 +00:00
Corentin Wallez 45b4893326 Remove TODOs that BGLD3D/Vk need updates for external textures
External textures are handled purely in the frontend so there is no need
to update the backend BGL to handle them. The TODOs can just be removed.

Bug: dawn:728
Change-Id: I319cf2a79bdc06a1457f3ec5746b07b5d05eef62
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84767
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2022-03-28 18:38:14 +00:00
Shaobo 0a6c2b0f99 Wrap multiplanar iosurface in wgpuTexture
This CL supports wrapping multiplanar iosurface in wgpuTexture.
It also provides mechanism to create TextureView on each planes.

Bug:1307194

Change-Id: I5e82f47944fdea542abba097240c880628b1181f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/81482
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2022-03-28 06:59:22 +00:00
Brandon Jones 2977100ee1 Format texture sample types and aspects in errors
Should help make a couple of previously ambiguous error messages clearer
for developers.

Bug: dawn:1259
Change-Id: I09a4598153d3340407c5a318dcf6be6d03efd2bd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84780
Commit-Queue: Brandon Jones <bajones@chromium.org>
Auto-Submit: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-26 01:44:16 +00:00
Stephen White 57b7db9c74 OpenGL: refactor texture-to-texture copies into UtilsGL.
Change-Id: I6210b192c0676dacecc0d0b1026905b31e869d72
Bug: dawn:593
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84440
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-03-25 17:29:57 +00:00
Alexander Vestin f2556ab35c Initial Android surface
Bug: dawn:286

Change-Id: I50b45706f031254ac5beba5c07c3c4c3d7f9ea12
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84200
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-03-25 13:18:46 +00:00
Jiawei Shao 59f4320f83 Add missing space in the description of Toggle::DisallowSpirv
BUG=chromium:1214923

Change-Id: Iac9dce87c86c38175f9081de9fc8611a3b0040f5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84800
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-03-25 07:08:07 +00:00
Yuly Novikov 1e988b417c Ignore VUID-vkCmdDraw-None-06538 VVL message
To get vulkan-deps roll going

Bug: chromium:1310052
Change-Id: Ia47aa9a486256a9b3c96b90a66cd39bd2ec7c155
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84724
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-24 23:54:36 +00:00
Corentin Wallez 0bf63577d2 Implement the stencil8 format.
Rolled in changes made by cwallez@ as part of
https://dawn-review.googlesource.com/c/dawn/+/75983, which was
originally based on this change.

Bug: dawn:666

Change-Id: I5d6ad592294ee8302f3b18f7f31bbfd982297251
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68280
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-03-24 17:54:56 +00:00
Austin Eng cbdde604b8 Fix ForceSetToggle to only warn when an overriden toggle is forced
The condition was partially wrong, causing lots of spurious warning
messages when the default toggle (not user override) was forced to
another value by the backend.

Change-Id: Ie69e275fa3d4ceaeb7c3379dfdc8d8cbb91cf04a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84601
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-24 16:01:55 +00:00
Loko Kung a9386f3060 Fixes popErrorScope to match the specs.
- Prepares for removal of unnecessary bool return, and just call callbacks appropriately. For now always returns true until all users are updated.
- Removes PushErrorScope from handwritten commands now that we no longer need to do anything special.
- Updates tests to reflect the change and make sure to set EXPECTs before calling functions to make tests easier to follow.

Bug: dawn:1324, dawn:526
Change-Id: I90b09c54f9adbf2d6d50ad20dcedf68b5ed0b1fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/83942
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-22 14:45:34 +00:00
Brandon Jones c86f28cb84 De-duplicate ExternalTexture Dummy Textures
Avoid recreating 1x1x1 dummy textures for single-plane external texture
by just caching one and reusing it.

Bug: dawn:1082
Change-Id: Ia1fc3520a1b503d4491a256353277400ba90f344
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/80462
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
2022-03-21 19:02:53 +00:00
James Price 3b5415f53a Remove usages of the @stride attribute in tests
Support for @stride is about to removed from Tint.

Bug: tint:1381
Change-Id: I6e30ed67d61ab82fd50843caf14216274b1e05fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/83960
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-03-21 16:48:23 +00:00
Loko Kung 4d8352542a Adds strformat code-gen for helping auto-generate readable strings for structs.
- Adds generator infra for absl::StrFormat for bind group structs and types.
- Uses absl::ParsedFormat to avoid multiple parsing for format strings.

Bug: dawn:549
Change-Id: Ida4ca65eb85c4474c492161c8ae34f53bd692a3c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/81944
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-03-19 00:21:48 +00:00
Brandon Jones 39c2029063 Allow CopyBufferToTexture with Depth16Unorm
Removes the validation logic that was blocking this copy from being
valid and update tests to ensure that it works properly.

Copy logic worked with this format as-is, so no updates were necessary.

Bug: dawn:1251
Change-Id: Id0ca503ed0f82e79e75f63ad6870389f7f647d22
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/81024
Reviewed-by: Shrek Shao <shrekshao@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-18 20:40:08 +00:00
Antonio Maiorano 67efacb67f Fix CMake build
Change-Id: I765fa78a47861cdb4445211a437a34ae2a189bda
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/83940
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-03-17 15:24:47 +00:00
Loko Kung 2391382b14 Implements a cache key serializer and tests.
- Introduces necessary infra to support cache key serialization templating and extensibility.
- Tests cover basic use cases of the infra.

Bug: dawn:549
Change-Id: Idc0bbcb07a3037e9c59841bb3ad7d1040d7b401f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/83121
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-03-17 00:27:26 +00:00
shrekshao ed840583eb Relax vertex stride requirement
Relax validation of last stride of vertex buffer according to the
updated spec.

Bug: dawn:1287
Change-Id: I7a58401933b48c5cb121ba73c592575ada3e7151
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/83203
Auto-Submit: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-11 01:09:02 +00:00
Shrek Shao 5b9b9867cd Rename SurfaceDescriptorFromXlib -> SurfaceDescriptorFromXlibWindow
As suggested by
https://github.com/webgpu-native/webgpu-headers/pull/150#discussion_r822311773

Bug: none
Change-Id: I4f611a1c345eb644168cf923c6c0c1672114b9d9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/83201
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2022-03-09 19:04:21 +00:00
Austin Eng 74d4e53fc6 Make loapOp/storeOp undefined valid
It is valid for depth/stencil attachment if the attachments are
readonly. It is not valid for color attachments. Make the enum valid,
and update validation.

Caught in CTS roll
https://chromium-review.googlesource.com/c/chromium/src/+/3499286

Bug: dawn:1269
Change-Id: Ib849ed757ccca145f85cadea6f92a1f2a5082d49
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/82540
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-09 18:43:51 +00:00
Austin Eng 154bcbbf4d Metal/GL: Make new texture view for non-2D view of single-layer texture
Fixed: dawn:1309
Change-Id: Ide68f6498fc5fe9dd9e06c6c5caf7d3fff74e526
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/83060
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-09 01:07:20 +00:00
Austin Eng 5073fb5685 Fix BindGroupLayoutEntry validation message for no bindings types set
Fixed: dawn:1318
Change-Id: I9c5953d77c9758f0814fa50a98f5f813daf5e705
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/83061
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-09 00:07:31 +00:00
Austin Eng 1a73be4107 Update shader validation message to reflect new @ binding syntax
Fixed: dawn:1317
Change-Id: Ib8eb4068ae9c52513945a51fe0a7a88a6e3fa43e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/83062
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-09 00:06:30 +00:00
Austin Eng 4f1596134e Use GetInternalUsage in vulkan::TextureView::Initialize
We need to consider the real usage the texture was allocated as, not
the public API usage.

Fixes VVL violation in canvas_composite_alpha_bgra8_unorm_opaque_copy
CTS ref test.

Bug: chromium:1083478
Change-Id: I4461458f98750c1632b823536ff3846a9b31796b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/83041
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-09 00:05:40 +00:00
Shrek Shao 1554a7d8f9 Fix dawn.json for upstream webgpu-headers
- Add disabled_tags 'dawn' to webgpu_headers_gen
- Rename WGPUSurfaceDescriptorFromXlib to sync with upstream
- Other sync with upstream: surface wayland and android enums

Bug: dawn:269
Change-Id: I5ca5c5362c54018f9d217af6a6ab4e3e84a5d780
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/83000
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2022-03-08 20:56:10 +00:00
Jiawei Shao 345bf87c35 Vulkan: Use Zero Initialize Workgroup Memory extension if possible
This patch adds a toggle to enable/disable workgroup memory
initialization with OpConstantNull according to the Vulkan extension
VK_KHR_zero_initialize_workgroup_memory. This toggle is by default
enabled when VK_KHR_zero_initialize_workgroup_memory is supported by
the Vulkan driver.

BUG=dawn:1302
TEST=dawn_end2end_tests

Change-Id: Ie04484c2d0944ead082bd22a436b1c52bc7d93bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/82400
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2022-03-08 02:23:19 +00:00
Austin Eng ea287f5b48 Remove WGSL readonly-storage to storage binding type promotion
Fixed: dawn:1188
Change-Id: Ied8e1fb8a47884456de3d56e049a361fdbcaf640
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/82403
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-05 01:37:25 +00:00
Shrek Shao 6d205fcb5d Allow sparse color attachments
Add implementations and related tests reflecting the spec update.

Bug: dawn:1294
Change-Id: I2c20af313259e1d6d6049189cb8adebe4c2436af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/81922
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2022-03-05 01:34:02 +00:00
Li Hao 131c422489 Add timestampWrites on render/compute passes
The timestampWrites in render/compute pass descriptor store the
timestamps at the beginning and end of passes, this requires validating
all timestampWrite members in BeginXxxPass and inserting the
timestampWrite cmd as close as possible to the BeginXxxPass and
EndXxxPass. To do that, we first record only the querySets and
queryIndexes that need to be used in BeginXxxPassCmd and EndXxxPassCmd,
then insert timestampWrite cmd after the native BeginXxxPass and before
the native EndXxxPass in backends.

This CL adds timestampWrites in render/compute pass descriptor
including the validation and tests first.

Implement timestampWrites in backends in following CL.

Bug: dawn:1250

Change-Id: I39b50975aa03cc1afe7a736c3b39df284f54d163
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/82100
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2022-03-05 01:22:52 +00:00
Ben Clayton db8666fa71 Roll WebGPU IDL, update dawn/node bindings.
Bug: dawn:1123
Bug: dawn:1286
Change-Id: I3ffeea82fda381905ee8f02f9f2768c81c7e6d6d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79761
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-03-03 21:13:51 +00:00
Loko Kung ba70fac14d Extends current CachedObject interface to allow setting and getting cache keys.
Bug: dawn:549
Change-Id: I52d9321207d67b0214a52acc75456ee8d7943e8c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/81943
Reviewed-by: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-03-03 20:08:22 +00:00
Austin Eng cab7419338 Vulkan: Skip newLayout transition on import if not specified
Fixes vulkan validation layer assertions on Linux in CTS reftests:
 canvas_complex_bgra8unorm_copy.https.html
 canvas_size_different_with_back_buffer_size.https.html

Bug: chromium:1083478
Change-Id: I36580184d15fe36423e5f759eaf959191c6b571c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/82480
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-03-02 23:28:17 +00:00
Shaobo a24acf2fbc Validate destination texture states for CopyTextureForBrowser
Current implmentation of ValidateCopyTextureForBrowser has a bug
to verify destination texture states.
This CL fix the simple bug and add noop copy in unittest to catch this
issue.

Bug: dawn:1306
Change-Id: I193105ced89db5092873d604c7dbf43d7ea4fba0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/82101
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2022-03-02 02:44:01 +00:00
Loko Kung 44f039d3c2 Adds new chained struct for device creation to specify cache options.
- Adds isolation key option, DawnNative support, and relevant unit tests.

Bug: dawn:549
Change-Id: I16344581c7956ce8576c0a4c14655fbdb4e15a54
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/81920
Reviewed-by: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2022-03-01 22:59:40 +00:00
Yang Gu 6a9f9bd1ff Skip the check of maxFragmentCombinedOutputResources for Mesa llvmpipe driver
The Mesa Gallium llvmpipe driver is a software rasterizer that uses LLVM
to do runtime code generation. It seems to put incorrect value for
maxFragmentCombinedOutputResources, like we see on desktop GPUs.

Some relative values are as below.
vkLimits.maxFragmentCombinedOutputResources: 8
kMaxColorAttachments: 8
baseLimits.v1.maxStorageTexturesPerShaderStage: 4
baseLimits.v1.maxStorageBuffersPerShaderStage: 8

This CL will skip the check of this limit on llvmpipe, like we did for
desktop GPUs.

BUG=dawn:1311
Change-Id: I1698f6e26dd62b56f3819980fa2dcc986c9c5ba3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/81941
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Hao Li <hao.x.li@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-02-25 18:30:47 +00:00
Jiawei Shao ec3e4b0510 Fix use-after-free issue in Create*PipelineAsyncTasks::Run()
This patch fixes a use-after-free issue in Create*PipelineAsyncTasks
that when pipeline->Initialize() returns error, the pipeline object
will be deleted, while we still attempt to call its member function
after it is deleted.

BUG=dawn:1310
TEST=dawn_unittests

Change-Id: I57d5ca98d6c97b14df1d7c3bf2941c9cc87adeff
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/81800
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-02-25 16:28:39 +00:00
Jiawei Shao a84791a955 Ensure non-renderable formats don't support multisampling
This patch removes the support of multisampling on the below 4
formats as they are not renderable according to the discussions at
https://github.com/gpuweb/gpuweb/issues/2465.
- R8Snorm
- RG8Snorm
- RGBA8Snorm
- RG11B10Ufloat

BUG=chromium:1299154, dawn:1244
TEST=dawn_unittests

Change-Id: I3837f2aee322a71c90772322dc01fae410f03e57
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/81801
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-02-24 17:46:46 +00:00
Shaobo 6084407b21 Change texture state validation in CopyTextureForBrowser() to report meaningful errors
CopyTextureForBrowser() will support all uploading paths for WebGPU
CopyExternalImageToTexture(). The validation checks for texture states
should report accurate errors to meet CopyExternalImageToTexture() validate
rules.

Bug: dawn:1306
Change-Id: Ie3b25ec82246d53e6c82968b5dc2f8a253c560c1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/81240
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2022-02-24 02:26:26 +00:00
Li Hao 7abcadfce6 Add toggle to disable the tick->ns conversion of timestamp query
Although the error rate of timestamp tick->ns conversion is very small
(3e-5), some profiling scenarios, such as CPU/GPU timestamp calibration
on Windows, require absolutely accurate timestamps.

Add new toggle to resolve timestamps to ticks for those cases where zero
error is required.

Add an end2end test for GPU timestamp calibration on D3D12 backend.

Disable timestamp period calculation on Device when the
DisableTimestampQueryConversion is enabled.

Bug: dawn:1305
Change-Id: I31ee6b4c1686d5dd2ac29ccb0bd398e650481c26
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/81023
Reviewed-by: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-02-23 17:50:35 +00:00
Ryan Harrison b3e6d37055 tint->dawn: Shuffle tint repo layout
BUG=tint:1418

Change-Id: Iee47f1846be63bbd829067b3d818d2603647d4e6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/80481
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
2022-02-21 17:56:32 +00:00
Jiawei Shao 68d44a7006 Add validations on the format of a resolve target
This patch adds the validations on the format of a resolve target
according to the latest updates in WebGPU SPEC. WebGPU SPEC only
supports the below texture formats being used as the resolve target
of a render pass encoder:
- R8Unorm
- RG8Unorm
- RGBA8Unorm
- RGBA8UnormSrgb
- BGRA8Unorm
- BGRA8UnormSrgb
- R16Float
- RG16Float
- RGBA16Float
- RGB10A2Unorm

BUG=dawn:1244
TEST=dawn_unittests

Change-Id: I16f9c3984f4ffb4641f4f43ecdb3cc76be6a562a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/81080
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2022-02-19 02:53:32 +00:00
Brandon Jones 6e8c473fa5 Updating names of attachment clear values
Renames multiple attachment clear values to match their new names in the
spec, deprecating the old ones.
 - GPURenderPassColorAttachment.clearColor -> clearValue
 - GPURenderPassDepthStencilAttachment.clearDepth -> depthClearValue
 - GPURenderPassDepthStencilAttachment.clearStencil -> stencilClearValue

Additionally, the old names are marked as deprecated with appropriate
warnings if they are used during the deprecation period.

Bug: dawn:1269
Change-Id: I6649184d65578118942c1f51a41f350719665272
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/80941
Reviewed-by: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-02-19 00:44:12 +00:00
Yan,Shaobo 893889b0bb CopyTextureForBrowser(): Validate src/dst texture state
The validation of CopyTextureForBrwoser() fails to valid src and dst
texture state. And a bug has been caught by cts
webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,state:*
after changing CopyExternalImageToTexture() to use CopyTextureForBroswer()
to upload CPU resource.

The CL fix this.

Bug: dawn:1306
Change-Id: Ie4cfd174dc9f54f6cf2099226c4e1cc00ed1d446
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/80900
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2022-02-18 06:26:11 +00:00
Brandon Jones df70004c52 Add Validation For External Texture Bind Group Layout Mismatch
Adds validation to ensure that external texture binding entries match
the bind group layout. This should fix an issue found by the fuzzer.

Bug: dawn:1082
Bug: chromium:1296935
Change-Id: I1cc542ed9105dbe29d775e01e52475a7d6c8d393
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/80460
Reviewed-by: Loko Kung <lokokung@google.com>
Auto-Submit: Brandon1 Jones <brandon1.jones@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-02-17 19:20:31 +00:00
Li Hao a73050795e Fix QueryInternalShaderTests
1. The left cases will be not checked if the first value is 0 in Check
function.
2. All timestamps are the same value at initialization.
3. Update 83.33 to 83.333 which is closer to the actual period on Intel.

Bug: dawn:1250
Change-Id: I7378cf45453682a3d364b6930072ccc229085f0c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/80901
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-02-17 16:12:41 +00:00
Jiawei Shao ab1a2b7407 Add validation on format when creating a multisampled texture
This patch adds the validation on the texture format when we create
a texture with sample count > 1 according to the latest updates in
WebGPU SPEC.

Below formats can't be used to create a multisampled texture:
- R32Uint, R32Sint, RG32Uint, RG32Sint, RG32Float, RGBA32Uint,
  RGBA32Uint, RGBA32Sint, RGBA32Float
- All compressed formats
- RGB9E5UFloat

BUG=dawn:1244
TEST=dawn_unittests

Change-Id: I71743281ce12158be4b1904732934fad95f39cee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/80240
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2022-02-17 00:48:26 +00:00
Christopher Cameron be72f76c23 Expand GetFormatEquivalentToIOSurfaceFormat
Add support for IOSurface formats for:
- RGBA16Float
- RG16Float
- R16Float
- RGB10A2Unorm

Bug: chromium:1241369
Change-Id: I8d3ed2c7575fe651406cb470383f3d4d23fb7aeb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/80820
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: ccameron chromium <ccameron@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2022-02-16 20:38:50 +00:00
Austin Eng 15bc24eeb8 Don't try to load libvulkan on Mac
Only SwiftShader would be available on Mac.

Bug: chromium:1297154
Change-Id: I943a39dfdde4215ba0ea880bf08294f37f08ee42
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/80720
Reviewed-by: Shrek Shao <shrekshao@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-02-16 17:32:20 +00:00
James Price 0fe8d27903 Roll Tint and update WGSL syntax for overrides
The syntax for pipeline-overridable constants has changed in
WGSL. Since this feature is still hidden behind the
disallow-unsafe-APIs flag in Dawn, we removed support for the old
syntax in Tint. This commit rolls Tint forward to get that change, and
updates the WGSL syntax in affected tests at the same time.

Bug: tint:1403
Change-Id: I1d081d9dea0c1de9def5cd123020700df3419f35
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/80500
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2022-02-15 18:36:10 +00:00
Austin Eng 7a8006033a Add additional guards in counter set feature checks
- Don't use for..in since some crashes show that NSFastEnumeration
   in those loops is doing something wrong.
 - Check that the receiver actually supports the selector before
   calling it. Crashes indicate an unrecognized selector is being
   used.
 - Add a ref to MTLCounterSet to be sure it is not somehow freed
   between when it is stored, and when we use it as the receiver for
   [MTLCounterSet counters].

Bug: dawn:1102
Change-Id: I882045ba09547df62a98a862e6e64c5a7d656e80
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/80461
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-02-15 18:18:26 +00:00
Li Hao 3a60f96079 Reset root descriptor table for samplers when descriptor heaps are changed
When shader-visible heap switch happens, we re-populate all bindgroups
and change the descriptor heaps, which need to reset root descriptor
tables, but for the samplers which are cached in
mBoundRootSamplerTables and not changed, they won't be reset, which make
shaders cannot access the sampler heaps.

Bug: dawn:1255

Change-Id: Icc142206121af9daf8b9352b4c639f7d7ef8f1d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/76780
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2022-02-15 02:05:06 +00:00
Brandon Jones fe994f74ff More verbose BindGroupLayout error messages
Begins including the expected BindGroupLayout in validation messages
where a BindGroup descriptor does not match the BindGroupLayout. This
is especially helpful in cases where the BindGroupLayout was implicitly
created by the pipeline.

Bug: dawn:1258
Change-Id: Icbf27b4a2ac9b4dc1716feed47e3e63cf99929a7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/80380
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-02-14 19:06:55 +00:00
Stephen White a52abab38c Nuke SPIRV-Cross.
Change-Id: I1fc58d50ba3999e3a9b6f4e30a0799be301893de
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79481
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-02-11 00:45:51 +00:00
Stephen White 96b72c262c OpenGL: use Tint for GLSL generation.
Change-Id: Ibced679fa6568f1eb33707f0157d03505e6f8a1c
Bug: dawn:1263
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67540
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-02-10 22:17:41 +00:00
Brandon Jones 31f60e3a40 Remove accidental unused Transform Manager
Removes an unused tint::Transform::Manager that was accidentally merged
as part of commit "Integrate Multiplanar External Texture Transform".

Bug: dawn:1082
Change-Id: I55b5eec8b17f27df22658a90912dec4d6d583cbb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/80100
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
2022-02-10 21:56:51 +00:00
Austin Eng e710706858 Remove old src/tests/BUILD.gn
Bug: dawn:1275
Change-Id: I1da086fb291551b0a437411b13285a097557e7de
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/80060
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-02-10 19:41:24 +00:00
Brandon Jones cff04b4d3f Integrate Multiplanar External Texture Transform
Introduces the majority of the logic associated with enabling
multiplanar external textures. Removes most backend logic associated
with external textures in favor of expanding them into their components
in the frontend. Includes a basic e2e test demonstrating multiplanar
YUV-to-RGB conversion.

Bug: dawn:1082
Change-Id: Ib5c042e5639b1a8efe2954680abc346c8c6c76d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/78248
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
2022-02-10 19:31:13 +00:00
Jiawei Shao 47f051984b D3D12: Only set root parameters for dynamic storage buffers when needed
This patch skips setting the items for dynamic storage buffer lengths
in root signatures when there is no dynamic storage buffer in the
pipeline layout so that we can avoid adding a root constant with
Num32BitValues == 0 in the root signature.

BUG=dawn:1262

Change-Id: I7d698425c94092299aefaf8cb6ef465745c8d194
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79742
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2022-02-10 00:05:01 +00:00
Corentin Wallez 82ca6096ac Mark 1D textures as safe.
Fixed: dawn:814
Change-Id: I216ebdb68cfb1634cfad8b44de998c2f1a87edaf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79320
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2022-02-09 18:40:51 +00:00
Corentin Wallez 9fc28cf3b6 Metal: Fix leak of MTLVertexDescriptor when using vertex pulling
Bug: dawn:1175
Change-Id: I1fd833fef830de4165a397e07c3ddaae0d7bdca8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79762
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-02-09 15:56:32 +00:00
Austin Eng 189b0cec37 tint->dawn: Move src/dawn_tests -> src/dawn/tests
Bug: dawn:1275
Change-Id: I79f2aeb0c54a74dd5becd90c46792705a28e87da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79100
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-02-09 14:54:31 +00:00
Brandon Jones 0fee4c180a Deprecate endPass(), replace with end()
Method was renamed in https://github.com/gpuweb/gpuweb/pull/2560

Bug: dawn:1286
Change-Id: I02a5da3f6ff56868c4d8f45a17433b6c5adf5c22
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79480
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2022-02-07 19:48:39 +00:00
Corentin Wallez a9a80ef386 Guard for [MTLDevice counterSets] being null.
Bug: dawn:1102
Change-Id: I1c8fffba65cba0b04ef72018013f027f0a814f90
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79361
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2022-02-07 16:12:00 +00:00
Corentin Wallez 31680a7ec0 Add validation of the max binding number.
Fixed: dawn:1283
Change-Id: I5efd0d5c92bd6c1a4cdfe91079a12a9f98ddfd61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79260
Reviewed-by: Brandon Jones <bajones@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-02-07 12:02:57 +00:00
Austin Eng 377ead9d44 Fix version check for timestamp queries - Mac 11.0+ AMD
Bug: dawn:545
Change-Id: I7cb48813e0a582a6b7314c6fa726800b146ea6be
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79243
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-02-05 03:30:05 +00:00
Ben Clayton 7b77855a87 tint->dawn Add src/dawn/CMakeLists.txt
Promote up some build rules from the root CMakeLists.txt file that are
specific to Dawn.

Bug: dawn:1275
Change-Id: I11e9261ac595f6d71742b20d54dc658a5fa7e996
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79105
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-02-04 18:59:15 +00:00
Ben Clayton c6ccd539e8 tint->dawn: Move src/fuzzers/dawn -> src/dawn/fuzzers
This has already been moved once, but with more consideration, there's far less fuzzer-related stuff to put in the same root directory here.

Bug: dawn:1275
Change-Id: Ic4bb556d9a9f104293cca3316cae84b66a6362b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79104
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-02-04 18:48:05 +00:00
Ben Clayton a6750751c7 tint->dawn: Move examples -> samples/dawn
Bug: dawn:1275
Change-Id: I4824aaabc2c2b55a609a6e1370959394b93463b8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79103
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-02-04 18:35:55 +00:00
Ben Clayton 9fb7a5146a tint->dawn: Move src/include -> include
Also simplify the target names.

Bug: dawn:1275
Change-Id: I2929b70897f64903b91b693b48c2e8dd7c11d07b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79102
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-02-04 18:18:18 +00:00
Ben Clayton 35940f9b83 gn: Trim target prefixes from src/dawn targets
Removes stuttering.

Bug: dawn:1275
Change-Id: Ie32929e0b0ca579d7eef13a43fd2d1c648140276
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79101
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-02-04 17:15:16 +00:00
Ben Clayton 818001d32e tint->dawn: Move src/dawn_native -> src/dawn/native
Bug: dawn:1275
Change-Id: Ic60a00107a015bc677ff929c492f1085ffc38482
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79083
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-02-04 17:07:46 +00:00
Ben Clayton b2c4d7a244 tint->dawn: Move src/dawn_platform -> src/dawn/platform
Bug: dawn:1275
Change-Id: I043c5e6d84e199fe2e753ac43181b125882439bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79082
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-02-04 12:51:25 +00:00
Ben Clayton 20cbe6d9e8 tint->dawn: Move src/dawn_wire -> src/dawn/wire
Bug: dawn:1275
Change-Id: I56535bf4d387c4bd423140705ea70812be073eac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79081
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-02-04 12:51:25 +00:00
Ben Clayton 902ad1f9b2 tint->dawn: Move src/dawn_node -> src/dawn/node
Bug: dawn:1275
Change-Id: I206287da7728788646929e696c756b43d53cf272
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79063
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-02-04 12:51:25 +00:00
Ben Clayton 1e657a6328 tint->dawn: Move src/utils -> src/dawn/utils
Also remove stuttering from the target names by dropping the 'dawn_' prefix.

Bug: dawn:1275
Change-Id: I3263f1236f71bf23795b4b12670ad3535822a537
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79062
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-02-04 12:51:25 +00:00
Ben Clayton d9ab69a9c1 tint->dawn: Move src/common -> src/dawn/common
Also remove stuttering from the target names by dropping the 'dawn_' prefix.

Bug: dawn:1275
Change-Id: Iac79f9927010b8e5edeb7e0949092b34431d54dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79061
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-02-04 12:51:25 +00:00
Kai Ninomiya 92d6e53e6d Fix CMake build failures after recent changes
- https://dawn-review.googlesource.com/c/dawn/+/62580
  Don't add_library for targets that just generate files.
- https://dawn-review.googlesource.com/c/dawn/+/64420
  Add missing file.

Build tested locally, on macOS (only).

Bug: dawn:1080, dawn:809
Change-Id: Ia07d040dd5d3f57aa422765270c961ea6e79e3cd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64702
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-21 01:07:35 +00:00
Kai Ninomiya 930e9186a6 Generate multiple variants of webgpu.h header
Adds a "tag" system so that entries of dawn.json can be conditionally
emitted in different configurations. With a few more dawn.json changes,
this will enable generating the exact upstream header.

Bug: dawn:1080
Change-Id: I3506dadd485e31786578a3a64c3603c964c5354f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62580
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-17 19:44:43 +00:00
Austin Eng a9e39e11a8 Add utilities for printing Dawn enums and bitmasks
This is a header-only utility so it can be easily included and
used anyhere. Include it in DawnTest.h to automatically pick up
definitions to print test parameters.

Also, work around bot limitations for very-long test names.

Bug: none
Change-Id: I940263ab0a4cc415b06fa04749694f16ff08335c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51841
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-06-01 18:49:12 +00:00
Austin Eng 16e01affcb Reland "Add a per-thread proc table using thread local storage"
This is a reland of b04a92f01b
with the deletion of a duplicate exported function in dawn_wire that
was causing a compilation failure on Windows.

Original change's description:
> Add a per-thread proc table using thread local storage
>
> In situations where both dawn_wire and dawn_native are used on separate
> threads (Chrome with --single-process or --in-process-gpu), it's
> desirable to have a per-thread proc table so that the WebGPU C++ API can
> still be used. This eliminates classes of bugs with manual
> reference/release errors.
>
> This also changes many of the GetProcs functions to return const
> references to the static proc tables known at compile time, instead of a
> copy.
>
> Bug: none
> Change-Id: I8775bb715b312dd9476a1903fbd797d4b1302614
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29240
> Reviewed-by: Stephen White <senorblanco@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

Bug: none
Change-Id: Id90e5372132cd93a2f8631c8185d0e71b01bc1af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29443
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-10-06 16:13:42 +00:00
Kai Ninomiya 326e14f34b Revert "Add a per-thread proc table using thread local storage"
This reverts commit b04a92f01b.

Reason for revert: Build failed on win-archive-dbg; see:
https://chromium-review.googlesource.com/c/chromium/src/+/2450792

Original change's description:
> Add a per-thread proc table using thread local storage
>
> In situations where both dawn_wire and dawn_native are used on separate
> threads (Chrome with --single-process or --in-process-gpu), it's
> desirable to have a per-thread proc table so that the WebGPU C++ API can
> still be used. This eliminates classes of bugs with manual
> reference/release errors.
>
> This also changes many of the GetProcs functions to return const
> references to the static proc tables known at compile time, instead of a
> copy.
>
> Bug: none
> Change-Id: I8775bb715b312dd9476a1903fbd797d4b1302614
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29240
> Reviewed-by: Stephen White <senorblanco@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

TBR=cwallez@chromium.org,senorblanco@chromium.org,enga@chromium.org

Change-Id: I4587b457b7b2dd5d3c7457065bf4e77b95af59d7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: none
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29442
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-10-05 22:35:40 +00:00
Austin Eng b04a92f01b Add a per-thread proc table using thread local storage
In situations where both dawn_wire and dawn_native are used on separate
threads (Chrome with --single-process or --in-process-gpu), it's
desirable to have a per-thread proc table so that the WebGPU C++ API can
still be used. This eliminates classes of bugs with manual
reference/release errors.

This also changes many of the GetProcs functions to return const
references to the static proc tables known at compile time, instead of a
copy.

Bug: none
Change-Id: I8775bb715b312dd9476a1903fbd797d4b1302614
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29240
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-10-05 19:53:58 +00:00
Corentin Wallez 19b910d796 Make dawn components support CMake's BUILD_SHARED_LIBS
Convention in CMake land is that libraries default to STATIC or
SHARED based on BUILD_SHARED_LIBS. Do that for Dawn components
that users will link against, but make sure to correctly set
macros used for the export headers.

Bug: None

Change-Id: I6a96cb95706b63c18942424baada11ff81691866
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28503
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-09-16 19:03:18 +00:00
Kai Ninomiya 6328356129 Autoformat everything except tests/examples
Done by:
- Appending an extra newline at the end of src/**/*.{cpp,h,mm,gn}
  except src/tests/*
- Running git cl format --full to format the full contents of every
  changed file

Bug: none
Change-Id: Id88fc5ed0c5efbbc93b2c6a305c2f98465fe646d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24641
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-07-10 18:19:38 +00:00
Corentin Wallez 797fa62b91 Remove temporary GN proxy groups.
It also changes remaining deps for internal targets
from libdawn_proc to dawn_proc.

Bug: chromium:1064305
Change-Id: I36df2b5d7793be9d6c878b6a1f2ec238603a8205
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19289
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-14 17:36:44 +00:00
Corentin Wallez 6574f92747 Fix the @rpath of dawn_components
When the libdawn_native target was renamed to dawn_native, the output
library name stayed the same (GN inserts a lib prefix if it isn't
present) but the @rpath annotation changed to be just dawn_native.dylib.

Fix this by adding the lib prefix in the rpath annotation. This requires
changing libdawn_proc to dawn_proc otherwise the rpath annotation would
be liblibdawn_proc.dylib.

Bug: dawn:380
Change-Id: Id8610a6318af3468dcc486ee8d3c035f0273fe0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19200
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-04-09 17:31:40 +00:00
Corentin Wallez 0074b6e710 Remove temporary GN groups after Chromium fix
Bug: chromium:1064305
Change-Id: I8e169de411500c4b618c0a91bb0d8fd0ffb490d5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19180
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-09 17:27:40 +00:00
Corentin Wallez 71b3dd56da Fix clean CMake builds
Headers only INTERFACE library with generated headers don't work in CMake
because the GENERATED property is local to a directory. Instead we make a
STATIC library with a Dummy cpp file.

INTERFACE libraries can only have INTERFACE sources so the sources get added
to the dependant's list of sources. If these dependents are in another
directory, they don't see the GENERATED property and fail to configure
because the file doesn't exist on disk.

Use this trick for both dawn_headers and dawncpp_headers that are header
only libraries with generated headers.

Bug: dawn:333
Change-Id: Ib0d6dcc5f351a638d1c5360214c0ce14a28fee3e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15921
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-02-14 19:09:33 +00:00
Corentin Wallez 7fe6efba4a Add initial CMakeLists.txt files
Adds CMake support for:
 - Generating the Dawn headers and C++ wrappers
 - libdawn_wire
 - libdawn_native with the Metal backend for now
 - All the examples.

Bug: dawn:333

Change-Id: I6ffbe090b0bd21d6a805c03a507ad51fda0275ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15720
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2020-02-05 17:16:05 +00:00
Kai Ninomiya 7b6246a2ad Generators for Emscripten
api_struct_info.json:
//* This generator is used to produce part of Emscripten's struct_info.json,
//* which is a list of struct fields that it uses to generate field offset
//* information for its own code generators.
//* https://github.com/emscripten-core/emscripten/blob/master/src/struct_info.json

library_webgpu_enum_tables.js:
//* This generator is used to produce the number-to-string mappings for
//* Emscripten's library_webgpu.js.
//* https://github.com/emscripten-core/emscripten/blob/master/src/library_webgpu.js

Change-Id: I4704509737cde4685a093eb484dd977e5a106d19
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15240
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-01-28 23:54:38 +00:00
Corentin Wallez 84d836295e Remove generation of proxy dawn.h and dawncpp.h
BUG=dawn:22

Change-Id: Iee8b93fddf2f4aced72bb12062ffae6dddc336ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14260
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-12-06 08:34:49 +00:00
Corentin Wallez 2c8b5c6370 Introduce the webgpu[_cpp].h headers.
webgpu.h is the "official" header for WebGPU in native and is being
developed in https://github.com/webgpu-native/webgpu-headers

dawn.h and dawncpp.h are changed to become webgpu.h and webgpu_cpp.h
respectively and use the new naming convention. New dawn.h and dawncpp.h
headers are created that just proxy the types, constants and functions
to their WebGPU counterpart.

Almost no naming change is done in Dawn in this commit, which help check
that the proxying headers work correctly. A couple changes were
necessary, in particular for tests of the internal of dawncpp.h, and a
workaround for a standard library bug for std::underlying_type was
removed because it is no longer needed and got in the way.

Finally since some templates were renamed to match the name of the file
they create instead of using the generic "api" name.

BUG=dawn:22

Change-Id: I12ee22d0b02ccb5b8a52ceccabb3e63ce74da007
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12480
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-21 20:04:10 +00:00
Austin Eng cc071e45bb Split generation of dawncpp headers from libdawncpp
libdawn_native also requires the dawncpp headers. When we separated
libdawn_cpp from the dawn_headers, libdawn_native lost the cpp headers
and caused a compile failure. This patch separates the dawncpp headers
as a separate target so both libdawncpp and libdawn_native can depend
on them.

Bug: dawn:22
Change-Id: I4172f1654377afac8c4314123ee8b5b81dc7c928
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12300
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-16 10:26:01 +00:00
Corentin Wallez 96496828a0 Split the libdawn target in components with a single purpose.
The functionality of the dawn_headers and libdawn targets are split into
the following targets:

 - dawn_headers: the new version only exposes the "dawn.h" C API and no
   longer includes the C++ API.
 - dawncpp: the header and implementation of the C++ API that wraps the
   C API. This is unbundled from the rest so the C++ API can be used
   with libdawn_proc or other libraries implementing the C API.
 - libdawn_proc: A DawnProcTable-backend implementation of the C API.

This is needed because in follow-up commit there will be three libraries
implementing the C API: libdawn_proc that trampolines where we want, and
libdawn_native/wire that don't have trampolines for better perf.

BUG=dawn:22

Change-Id: I5d941f0d98e5a4b633e14d67eb5269f7924f0647
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12160
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-10-15 11:44:38 +00:00
Corentin Wallez a9a84dfe1e BUILD.gn: Delete stale generated files in Dawn's gen dir.
This normalizes even more the directory structure of generated files in
Dawn and removes stale autogenerated files that could be included
wrongly using a GN action.

See comment on top of dawn_generator.gni in this commit for more
context.

BUG=dawn:22

Change-Id: I8ec038f949c048431b2b643af4462f98c4ae610b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11361
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-19 23:30:42 +00:00
Corentin Wallez 897ebc7a71 Normalize generated file paths to match main tree.
Previously dawn_native files were in src/dawn_native/ while generated
files were in dawn_native/. This makes some things complicated when
integrating in other source trees so normalize all generated files to be
in paths that match the main tree.

BUG=dawn:225

Change-Id: I5b3e04d37a16251143578dfb7a31445b229fe4ac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11300
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-18 04:33:12 +00:00
Corentin Wallez 031fbbbaa1 Generators: main.py is now dawn_json_generator.py
This merges all the files for main.py together again except
generator_lib.py because there doesn't seeem to be a good way to
separate the pure dawn.json generators and the dawn wire generator.

Also updates the GN templates to make it easier to define new generators
based on generator_lib, and move the Jinja2 template "stdlib" to
generator_lib.py

BUG=dawn:165

Change-Id: I1b5b2ef0a59cb142e214f3af9a58048a88ae949a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7880
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-11 18:03:05 +00:00
Corentin Wallez 4f5fc2d325 Nuke Builders part 4: headers, proctable and miscreferences
BUG=dawn:125

Change-Id: If1b2feb1b0880eb8ad168cfabb9d67ece4f02190
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6220
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-04-01 21:48:38 +00:00
Corentin Wallez 91e949292f BUILD.gn: put public include dirs in all_dependent_configs
The public include dirs for Dawn were in the dawn_public config but it
would only be added to targets as a part of public_configs. This meant
that second-level dependencies that ended up needing to include
dawn/dawn.h wouldn't know where to find it.

Fixed this by adding include dirs in all_dependent_configs and renamed
the config to be very explicit that it is for include dirs only.

BUG=chromium:938895

Change-Id: Iad70f3ce1f8a02b96bf341e7dd7d6068ce645af7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5920
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-03-26 17:16:28 +00:00
Corentin Wallez 579cf621f3 Split off common and libdawn / dawn_headers from BUILD.gn
This adds an option to dawn_generator to generate files in a different
directory so the generated stay at the same place. Otherwise compilation
errors occur because of stale versions of the headers on the CQ
builders.

BUG=dawn:61

Change-Id: I71ceb3172b5a4e35911973a03be29d90fa684416
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5304
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-03-07 01:46:39 +00:00