Commit Graph

3326 Commits

Author SHA1 Message Date
Austin Eng 3482a80bdd Rename DeviceDescriptor -> DawnDeviceDescriptor
This is preventing supporting DeviceDescriptor from upstream
webgpu.h because the name conflicts with the existing struct.

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

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

1: /* FXC compile flags */
D3DCOMPILE_PACK_MATRIX_ROW_MAJOR
D3DCOMPILE_OPTIMIZATION_LEVEL1

While a Debug build would output:

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

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

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

This CL remove *-srgb formats from supporting lists.

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

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

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

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

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

BUG=dawn:1167

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

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

BUG=tint:451
TEST=dawn_end2end_tests

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

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

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

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

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

Also makes duplicate pipeline constant entries an invalid
case.

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

ComputeDispatchTests.IndirectBasic
ComputeDispatchTests.IndirectOffset
ComputeDispatchTests.MaxWorkgroups

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

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

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

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

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

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

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

BUG=dawn:839
TEST=dawn_end2end_tests

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

BUG=chromium:1161355
TEST=dawn_end2end_tests

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

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

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

Bug: dawn:1186

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

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

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

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

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

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

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

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

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

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

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

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

Bug: dawn:1163
Change-Id: Ib3e45b533adaf510e1f9454a59ef1e821fc3eccd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68300
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-11-04 14:53:10 +00:00
Dawn Autoroller d0effc0a26 Add depth16unorm texture format
Bug: dawn:570
Change-Id: If5e636454f2728ccfed7a250e6e1fc3836c38c51
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62420
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-11-03 22:48:34 +00:00
Antonio Maiorano dc6af22f40 dawn_node: add "--backend=<name>" convenience parameter
Same as passing in "--flag=dawn-backend=<name>".
Also, if VK_ICD_FILENAMES env var is set, force backend=vulkan.

Bug: dawn:1163
Change-Id: If2def47e1af2a1eba7fbf897c8ed1ebf92ae4a15
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68183
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-11-03 13:55:43 +00:00
Yan e53b9ef3f9 Add more dst texture format for CopyTextureForBrowser
WebGPU community has decided how to handle color space conversion.
This also add more supported dst color format for
copyExternalImageToTexture.

This CL update the supported dst texture formats to align with
WebGPU spec. This is also the preparation for color space conversion.

Bug: dawn:1140
Change-Id: Ibf4386d5cec4acb086e111229dd8bba36a5f6bcd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67620
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-11-03 11:26:42 +00:00
Brandon Jones 2514566d82 Make validation error formatting more consistent
- Updates error message formatting to ensure they end with a newline to
   prevent errors from running together.
 - Updated all encoder/device context messages to normalize their format
   and include more information.
 - Update Abseil formatter to make objects indicate if they are an error
   object in the formatted string. (ie: [Invalid BindGroup])
 - Added fallback code in case a context message doesn't format
   correctly to aid in debugging.

Bug: dawn:1154
Change-Id: Id27b11305cf8efcca343597f90489dde5552c775
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68200
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-11-03 01:31:19 +00:00
Antonio Maiorano 0a873d8eb1 dawn_node: make server mode output stdout of each test in verbose mode
This change also makes sure that all three modes (serial, isolated
parallel, and server) all output stdout of tests only if verbose mode is
enabled.

Bug: dawn:1163
Change-Id: I9e9efcfa4b73571adac15179d2792fb745255fb8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68182
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-11-02 20:24:09 +00:00
Yunchao He cb9b2f9fdd Implement readonly depth/stencil attachment on D3D12
This change adds a end2end test for readonly depth/stencil
attachment and implements it on D3D12.

This change focuses on depth. If it is OK, I will add test(s) for
stencil.

The key points are:
  - Set DEPTH_READ transition barrier to replace DEPTH_WRITE barrier
    if it is readonly depth/stencil attachment.
  - Set appropriate D3D12_DEPTH_STENCIL_DESC (which is already correct)
    and D3D12_DEPTH_STENCIL_VIEW_DESC (which needs some particular
    flags). Otherwise, the underlying driver (validation layer) may
    think we still need DEPTH_WRITE transition barrier.

Bug: dawn:485
Change-Id: I64d30426ed8042a98b3fef084bb90b125320a6f8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67742
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-11-02 19:53:09 +00:00
Austin Eng 6abf1a1adb Remove deferred BufferLocation updates for drawIndexedIndirect
Instead of using BufferLocation as another layer of indirection,
the indirectBuffer can be set directly on the indirect command.
This makes the indirect validation a bit simpler, but introduces
additional lifetime dependencies in that the indirect draw validation
MUST be encoded while the DrawIndexedIndirectCmds it references
are still valid.

Bug: dawn:809
Change-Id: I1ef084622d8737ad5ec1b0247bf9062712e35008
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67241
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-11-02 18:23:49 +00:00
Brandon Jones d4b9cda056 Improve various error messages
Improves various error messages that have received feeback indicating
that they were too confusing or poorly worded.

Bug: dawn:1152
Bug: dawn:1157
Change-Id: If740300f31278ab04d4493887c03918a09cf0f86
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68100
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-11-02 15:39:49 +00:00
Antonio Maiorano e5b6bbc433 dawn_node: make run_cts accept "--flag=<flag>=<value>" argument
These flags are forwarded to the cts cmdline/server to configure dawn.node.
I also documented this in the README, along with examples.

Bug: dawn:1163
Change-Id: I6e213f1bd64700564c2e54dcd4edcf219ef2e829
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68060
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-11-02 13:47:09 +00:00
Corentin Wallez 983d13235d Add more / finer-grained OWNERS
This will help with review load and finding an owner once mandatory
owner review is enabled.

Change-Id: I1a90b83fed68f062c1406552aec218bf9c2092ce
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67821
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-11-02 09:30:52 +00:00
Jiawei Shao b78e8fb8f6 Add trace events on the creation of shader module and pipeline
This patch adds trace events on the creation of shader module,
render pipeline and compute pipeline so that we can measure how
expensive these tasks are in chrome://tracing

BUG=dawn:1167

Change-Id: Iffc37adea49d7e04b9f757bc8b3679769085a428
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67880
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-11-02 03:07:52 +00:00
Yunchao He 05946d01e3 Add more validation tests for readonly depth/stencil attachment
If the texture attachment doesn't have a stencil aspect, we can
set stencilReadOnly flag in RenderPassDepthStencilAttachment as
we want. And it is totally ignored and it doesn't impact whether
the depth/stencil attachment is readonly or not.

That's true for depthReadOnly flag upon a stecil-only format like
stencil8, but we haven't support stencil8 yet.

Bug: dawn:485

Change-Id: If0a21250ce7cc7a1ad9cc17a05ecf64d05342cd0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67962
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-11-02 00:22:03 +00:00
Loko Kung ff9a1f7b20 Adds/refactors destroy handling for Buffer and QuerySet.
The changes should pass through the destroy changes such that when the device is destroyed, the respective destroy functionality currently existing in the backends should be called.

For buffers, destroy no longer causes validation errors since even error buffers may need to be destroyed in the case of mappedAtCreation.

Bug: dawn:628, dawn:1002
Change-Id: I42a475af5d67cc60f86d95ac53c2b377a9fd2e82
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65863
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2021-11-01 23:42:52 +00:00
Ben Clayton 32e9dd2dfd dawn_node: Improve error handling for run-cts
Rebuild if the `out-node` directory is missing.
Actually check the server's status code.
Fix error handling for bad statuses.

Change-Id: I2164bba528036d39f10852f4ffd8ace76f145dba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67780
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-11-01 22:06:12 +00:00
Loko Kung e1e9fd0722 Reland "Adds destroy handling for simple objects without new backend changes yet."
This is a reland of 9901c710d1

Original change's description:
> Adds destroy handling for simple objects without new backend changes yet.
>
> Simple objects are defined here as objects that do not already have a destroy or destroy-like API available. They include:
> - BindGroups
> - ComputePipelines
> - PipelineLayouts
> - RenderPipelines
> - Samplers
> - ShaderModules
> - SwapChains
>
> Changes include:
> - Adds necessary constructors for testing and caching
> - Adding mock objects, mock constructors, and tests
>
> Bug: dawn:628
> Change-Id: I26a5e37bc5580b9064db299a75ef1243521b266a
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65864
> Commit-Queue: Loko Kung <lokokung@google.com>
> Reviewed-by: Austin Eng <enga@chromium.org>

Bug: dawn:628
Change-Id: I19492ad6b1660e205d123b2d1fdf53c772564cfe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67961
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2021-11-01 18:14:21 +00:00
Austin Eng 1722f9e78e Unmark DispatchIndirect as an unsafe API
Validation is now implemented.
end2end_tests added in https://dawn-review.googlesource.com/c/dawn/+/67142
CTS tests enabled in https://chromium-review.googlesource.com/c/chromium/src/+/3254613

Fixed: dawn:1039
Change-Id: I03ae6bba4f11d6fa0aa2a83f3b6d72aa43c5e2df
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68040
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-11-01 18:01:32 +00:00
Loko Kung b19556e907 Revert "Adds destroy handling for simple objects without new backend changes yet."
This reverts commit 9901c710d1.

Reason for revert: Breaking dawn roll due to include in ShaderMock

Original change's description:
> Adds destroy handling for simple objects without new backend changes yet.
>
> Simple objects are defined here as objects that do not already have a destroy or destroy-like API available. They include:
> - BindGroups
> - ComputePipelines
> - PipelineLayouts
> - RenderPipelines
> - Samplers
> - ShaderModules
> - SwapChains
>
> Changes include:
> - Adds necessary constructors for testing and caching
> - Adding mock objects, mock constructors, and tests
>
> Bug: dawn:628
> Change-Id: I26a5e37bc5580b9064db299a75ef1243521b266a
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65864
> Commit-Queue: Loko Kung <lokokung@google.com>
> Reviewed-by: Austin Eng <enga@chromium.org>

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

Bug: dawn:628
Change-Id: Ic727106f3dc701dc25418adf9824fbc5397aa656
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67960
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2021-10-29 21:01:54 +00:00
Austin Eng bcfa7b1253 Implement GPU-based validation for dispatchIndirect
Bug: dawn:1039
Change-Id: I1b77244d33b178c8e4d4b7d72dc038ccb9d65c48
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67142
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-29 18:52:33 +00:00
Corentin Wallez deb4057d27 Remove the use_tint_generator toggle
We now always use Tint.

Bug: dawn:571
Change-Id: Ic65669a9e00493292ed60cde00af6fa3f6e55ec2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65665
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-29 13:17:27 +00:00
Jiawei Shao 94d1678c67 Implement ConcurrentCache
This patch implements the template class ConcurrentCache which will
be used to implement all the thread-safe object caches in Dawn (e.g.
PipelineLayout, ComputePipeline and RenderPipeline).

BUG=dawn:529
TEST=dawn_unittests

Change-Id: Ia6f75191110a93285bdb23fdc1d275444d1ee866
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67760
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-10-29 01:12:25 +00:00
Loko Kung 9901c710d1 Adds destroy handling for simple objects without new backend changes yet.
Simple objects are defined here as objects that do not already have a destroy or destroy-like API available. They include:
- BindGroups
- ComputePipelines
- PipelineLayouts
- RenderPipelines
- Samplers
- ShaderModules
- SwapChains

Changes include:
- Adds necessary constructors for testing and caching
- Adding mock objects, mock constructors, and tests

Bug: dawn:628
Change-Id: I26a5e37bc5580b9064db299a75ef1243521b266a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65864
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-28 17:33:25 +00:00
Austin Eng 1de83e56f7 MaxLimitTests: workaround i32 maximum for size annotation
by clamping the binding size for uniform buffers and using
a dynamically sized array for storage buffers

Bug: dawn:685, dawn:1172
Change-Id: I2222b98d7c2a67cdb420441837e2acfaa8185c73
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67566
Auto-Submit: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-10-28 02:49:54 +00:00
Brandon Jones f33afcdba6 Improve validation errors for encoders
Improves the validation messages in ComputePassEncoder.cpp,
ProgrammablePassEncoder.cpp, RenderBundleEncoder.cpp, and
EncodingContext.cpp/h to give them more contextual information.

Bug: dawn:563
Change-Id: I3807c30fb0de8e766fbc35b98ef9c059f9d441ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67603
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-28 00:13:17 +00:00
Shrek Shao 5e2e2d863e Pipeline constants: validate if any uninitialized overridable constants exist
Now an overridable constant need to be initialized, either via value specified
in shader, or via constant entry from pipeline stage. Otherwise it is invalid.

Together fix the bool 32bit initialize problem on vulkan and re-enable the
overridable constants shader test, and use assigning to _ instead of
ignore() in tests.

Bug: dawn:1041
Change-Id: I49e7885c8d6134647b09926ceb15234ac21ee35d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67560
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-10-28 00:04:07 +00:00
Austin Eng 3faa478ed2 Add FromAPI / ToAPI helpers for dawn_native
Helps to avoid explicitly using reinterpret_cast

Change-Id: I4df0e7094c7d8460385c6f23dac529ace9df9bdc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67605
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-27 19:07:37 +00:00
Austin Eng 346b58cfba Reland "Populate some D3D12 limits from the backend"
This is a reland of 167d299916
It skips MaxLimitTests.MaxBufferBindingSize on 32-bit Windows
until we have a way to test more reliably on that platform, or
until Dawn no longer allocates enormous staging buffers for zero
initialization.

Original change's description:
> Reland "Populate some D3D12 limits from the backend"
>
> This is a reland of aa8fcfc64b
> It changes MaxLimitTests to use at most a 512MB buffer on 32-bit
> platforms.
>
> Original change's description:
> > Populate some D3D12 limits from the backend
> >
> > Also bumps the required D3D feature level to 11.1
> >
> > Bug: dawn:685
> > Change-Id: I40bc3a162e0aee596d61118ba0dfe0bf9cb60d93
> > Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65120
> > Commit-Queue: Austin Eng <enga@chromium.org>
> > Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
> > Reviewed-by: Corentin Wallez <cwallez@chromium.org>
>
> Bug: dawn:685
> Change-Id: I2e1df5f7ac0c9bbb6476ca2e1964a9af4afd89b6
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67145
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
> Commit-Queue: Austin Eng <enga@chromium.org>

Bug: dawn:685
Change-Id: Ie20a58d73ebfcd64a8c5e58d29d7fb35ee9fba0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67565
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-27 15:05:14 +00:00
Austin Eng 3c786cd418 Revert "Reland "Populate some D3D12 limits from the backend""
This reverts commit 167d299916.

Reason for revert: Still failing the roll because of OOM on x86.

Original change's description:
> Reland "Populate some D3D12 limits from the backend"
>
> This is a reland of aa8fcfc64b
> It changes MaxLimitTests to use at most a 512MB buffer on 32-bit
> platforms.
>
> Original change's description:
> > Populate some D3D12 limits from the backend
> >
> > Also bumps the required D3D feature level to 11.1
> >
> > Bug: dawn:685
> > Change-Id: I40bc3a162e0aee596d61118ba0dfe0bf9cb60d93
> > Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65120
> > Commit-Queue: Austin Eng <enga@chromium.org>
> > Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
> > Reviewed-by: Corentin Wallez <cwallez@chromium.org>
>
> Bug: dawn:685
> Change-Id: I2e1df5f7ac0c9bbb6476ca2e1964a9af4afd89b6
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67145
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
> Commit-Queue: Austin Eng <enga@chromium.org>

TBR=cwallez@chromium.org,enga@chromium.org,rafael.cintron@microsoft.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Ibad5ac7f28015da6a7334ba074aa975198591318
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:685
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67564
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-26 18:13:46 +00:00
Austin Eng f45478d65e Populate some Metal limits up from the backend
Bug: dawn:685
Change-Id: Idd36423e0f1f65c46ff835bfe90632b68505050c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64983
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-26 16:56:36 +00:00
Austin Eng 167d299916 Reland "Populate some D3D12 limits from the backend"
This is a reland of aa8fcfc64b
It changes MaxLimitTests to use at most a 512MB buffer on 32-bit
platforms.

Original change's description:
> Populate some D3D12 limits from the backend
>
> Also bumps the required D3D feature level to 11.1
>
> Bug: dawn:685
> Change-Id: I40bc3a162e0aee596d61118ba0dfe0bf9cb60d93
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65120
> Commit-Queue: Austin Eng <enga@chromium.org>
> Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>

Bug: dawn:685
Change-Id: I2e1df5f7ac0c9bbb6476ca2e1964a9af4afd89b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67145
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-26 16:48:36 +00:00
Ben Clayton 9b92a7cbc2 Fix overridable constants
dawn:
* Zero-initialize the SpecializationDataEntry. For booleans, the first
  byte may be initialized, while the 3 other bytes may contain garbage.
  This can cause boolean specializations to be 'true' when 'false' was
  specified.

dawn_node:
* Implement conversion of GPUProgrammableStage's constants.
* Fix Napi::Object -> unordered_map conversion.
* Fix member name in error messages generated by
  'DictionaryMembersFromJS'

Bug: dawn:1041
Change-Id: I016ec4916fc73226dfe1bd8e7dc52a1e88e46a6b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67383
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-26 10:40:46 +00:00
Shrek Shao f4c8a6ac9b Mark pipeline overridable constants as unsafe
Until all backend implementations are done.

Bug: dawn:1169
Change-Id: I16d184bec03bbc9a255ad33cf11aa615b1986389
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67422
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-26 02:06:36 +00:00
Austin Eng ec60b17964 Revert "Disable DrawIndexedIndirect"
This reverts commit d84d7f1ea3.

Reason for revert: CTS tests for this are now enabled.

Original change's description:
> Disable DrawIndexedIndirect
>
> Not passing CTS yet
>
> Bug: dawn:809
> Change-Id: Ib7c240372a8fdbd45803230292c374e2957c8d15
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65601
> Reviewed-by: Ben Clayton <bclayton@google.com>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

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

Bug: dawn:809
Change-Id: I3018fec67c278343956a6da68041bc6ec24d55f4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67420
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-25 16:16:53 +00:00
Ben Clayton 066ab14e34 wgsl: Remove unnecessary phony-assignments
A call-statement can now be made on a function that returns a value.

Bug: tint:1256
Change-Id: I9a3cc4e330f7441e09dc408bdc1cfa515adac392
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67382
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-10-25 15:27:52 +00:00
Ben Clayton 5c4ce7bd9b wgsl: Migrate from ignore() to phony-assignment
The rules have been relaxed about function values always needing to be
consumed, so a bunch of these phony-assignments can be replaced with the
RHS, but this will be done as a follow-up.

Bug: tint:1213
Change-Id: Ie7c4280f87b4ad7e5a429994b0b88ac22c2f3a9f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67300
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-10-25 15:14:23 +00:00
Brandon Jones eb0d900506 Improving Metal backend validation messages.
Improves validation messages in various Metal backend files:

 - SamplerMTL.mm
 - ShaderModuleMTL.mm
 - SwapChainMTL.mm
 - TextureMTL.mm

Bug: dawn:563
Change-Id: I076c08bb3dbecc430d5d4d7fbfeea48166070688
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67320
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-10-22 17:39:20 +00:00
Brandon Jones 4ce84fcfe1 Improving Vulkan backend validation messages.
Improves validation messages in various Vulkan backend files:

 - vulkan/DeviceVk.cpp
 - vulkan/ShaderModuleVk.cpp
 - vulkan/SwapChainVk.cpp
 - vulkan/TextureVk.cpp
 - vulkan/external_memory/MemoryServiceDmaBuf.cpp
 - vulkan/external_memory/MemoryServiceOpaqueFD.cpp
 - vulkan/external_memory/MemoryServiceZirconHandle.cpp
 - vulkan/external_semaphore/SemaphoreServiceFD.cpp
 - vulkan/external_semaphore/SemaphoreServiceZirconHandle.cpp

Bug: dawn:563
Change-Id: I521fecc29e7919413aa6210eff050848689296a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67122
Commit-Queue: Brandon Jones <bajones@chromium.org>
Auto-Submit: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-21 23:45:54 +00:00
Brandon Jones c19f27b80d Revert "Improve validation errors for encoders"
This reverts commit c7e6bb0d8d.

Reason for revert: clusterfuzz identified issue https://bugs.chromium.org/p/chromium/issues/detail?id=1262112

Original change's description:
> Improve validation errors for encoders
>
> Improves the validation messages in ComputePassEncoder.cpp,
> ProgrammablePassEncoder.cpp, RenderBundleEncoder.cpp, and
> EncodingContext.cpp/h to give them more contextual information.
>
> Bug: dawn:563
> Change-Id: I87c46c4bfda1375809fae93239029ea4e3b9c0a2
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67000
> Commit-Queue: Brandon Jones <bajones@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>

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

Bug: dawn:563
Change-Id: I259ccde1735c4201ff2736562cfe4689e9a22f62
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67321
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-10-21 23:14:54 +00:00
Antonio Maiorano ceb46e788c dawn_node: add "enable/disable-dawn-features=<comma-separated-values>"
Same as Chrome's args, this allows us to set the
DeviceDescriptor::forceEnabledToggles and forceDisabledToggles when
creating the GPUDevice.

Example: node cmdline.ts ... --gpu-provider-flag=enable-dawn-features=dump_shaders ...

Bug: dawn:1163
Change-Id: Ib5db71355f72e5d08f8fe87313c5e3d63ee236c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66963
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-21 23:02:34 +00:00
Antonio Maiorano c6745901f0 dawn_node: add "dlldir=<path>" flag
Only used on Windows builds for now, this flag adds the input path to
the DLL search paths. The main purpose is to ensure we load the right
version of D3D dlls, such as d3dcompiler_47.dll from the Chrome output
dir, rather than the default one in the Systems directory.

Bug: dawn:1163
Change-Id: I8e696dd877ec715e1e54d8589af8275e62c90937
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66962
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-21 21:46:44 +00:00
Antonio Maiorano 821f1a8a60 dawn_node: add "dawn-backend=<value>" flag
As an alternative to setting the "DAWNNODE_BACKEND" env var.

Bug: dawn:1163
Change-Id: I33ace14e7603b97caf7286a109a31160853f62e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66961
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-21 20:56:34 +00:00
Brandon Jones 1d55306255 Improving D3D12 backend validation messages.
Improves validation messages in various D3D12 backend files:

 - CommandBufferD3D12.cpp
 - ShaderModuleD3D12.cpp
 - SwapChainD3D12.cpp
 - TextureD3D12.cpp

Bug: dawn:563
Change-Id: I00607012f5bec81780c419993fc32dc0984dad27
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67143
Commit-Queue: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-21 20:21:54 +00:00
Antonio Maiorano e772615b53 dawn_node: add support for input flags
This change replaces the ".gpu" export with ".create()" function that
accepts an array of flags. These will be used by cmdline.ts to set flags
such as what dawn backend to use. We currenly environment variables, but
this will be more flexible.

Bug: dawn:1163
Change-Id: If2fb35811cac45e16121fbd828f997ef3d795f36
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66960
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-21 19:34:34 +00:00
Brandon Jones 7dc906a4c9 Improve validation messages for surface/swap chain
Updates validation messages with more contextual information in:
 - ChainUtils.h
 - Device.cpp
 - SpirvValidation.cpp
 - Surface.cpp
 - SwapChain.cpp

Bug: dawn:563
Change-Id: I486512791caaf1acf4607539aa5ad11daf1ab9be
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67140
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-21 19:25:04 +00:00
Brandon Jones fc5cae6a19 Improving OpenGL backend validation messages.
Improves validation messages in various OpenGL backend files:

 - BackendGL.cpp
 - BindGroupGL.cpp
 - CommandBufferGL.cpp
 - DeviceGL.cpp
 - PipelineGL.cpp
 - QueueGL.cpp
 - ShaderModuleGL.cpp

Bug: dawn:563
Change-Id: Idd5751b6f68ea435e5f3c045dcbfd0e5c049fce6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67144
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@google.com>
2021-10-21 16:37:45 +00:00
Aleksi Sapon 08b9654751 Zero the index offsets before an indirect draw
Prevent reusing offsets from a previous direct draw.
Update test to verify that values are updated correctly
for each draw. Add tests for indirect draw offsets.

Bug: dawn:548
Change-Id: Ice8325a8a41b8a4375767156dbaba3ee3d714f3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67121
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-21 14:29:44 +00:00
Austin Eng 05a3187b41 Revert "Populate some D3D12 limits from the backend"
This reverts commit aa8fcfc64b.

Reason for revert: Failing the Dawn->Chromium roll
https://ci.chromium.org/ui/p/chromium/builders/try/dawn-win10-x86-deps-rel/18903/overview

Original change's description:
> Populate some D3D12 limits from the backend
>
> Also bumps the required D3D feature level to 11.1
>
> Bug: dawn:685
> Change-Id: I40bc3a162e0aee596d61118ba0dfe0bf9cb60d93
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65120
> Commit-Queue: Austin Eng <enga@chromium.org>
> Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>

TBR=cwallez@chromium.org,enga@chromium.org,rafael.cintron@microsoft.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I17b44455f3b46f1855ab59808ece1e11bf73275d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:685
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67141
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-20 21:19:49 +00:00
Brandon Jones 520539f8f9 Various validation error improvements
A grab bag of validation error message improvements in the following
files:

 - Adapter.cpp
 - BackendConnection.cpp
 - BindGroup.cpp
 - CommandBuffer.cpp
 - CommandBufferStateTracker.cpp
 - ComputePipeline.cpp
 - Device.cpp
 - Instance.cpp
 - Limits.cpp
 - Queue.cpp

Bug: dawn:563
Change-Id: Ied9f660fc22302d3fd5af4796de32efec529ca05
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67001
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-20 17:42:38 +00:00
Brandon Jones c7e6bb0d8d Improve validation errors for encoders
Improves the validation messages in ComputePassEncoder.cpp,
ProgrammablePassEncoder.cpp, RenderBundleEncoder.cpp, and
EncodingContext.cpp/h to give them more contextual information.

Bug: dawn:563
Change-Id: I87c46c4bfda1375809fae93239029ea4e3b9c0a2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67000
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-10-20 17:13:48 +00:00
Austin Eng aa8fcfc64b Populate some D3D12 limits from the backend
Also bumps the required D3D feature level to 11.1

Bug: dawn:685
Change-Id: I40bc3a162e0aee596d61118ba0dfe0bf9cb60d93
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65120
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-10-20 16:32:48 +00:00
Jiawei Shao 1349ca182e D3D12: Support [[num_workgroups]] for Dispatch
This patch implements [[num_workgroups]] on the API side for
Dispatch() calls by setting num_workgroups.xyz as root constants.

This patch also adds a temporary validation that on D3D12 backend
using a compute pipeline with [[num_workgroups]] in a
DispatchIndirect call is not supported.

BUG=dawn:839
TEST=dawn_end2end_tests

Change-Id: Iaee2ffd162e9420e4e80944fbb222f10a4600c6a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66580
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-10-20 00:58:48 +00:00
Austin Eng d97b29cd86 Populate supported Vulkan limits from the backend
This commit also unifies the initialization process for Adapters.
InitializeImpl() initializes the actual backend adapter.
InitializeSupportedFeaturesImpl() checks base WebGPU features and
discovers additional supported features.
InitializeSupportedLimitsImpl() checks base WebGPU limits and
queries the adapter's maximum supported limits.

Some of these limits from the backend are still overriden in the
frontend because they are limited by internal Dawn constants.

Bug: dawn:685
Change-Id: I43efb0b678dd45f8f89cd62d13104dd00b197da1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64980
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
2021-10-19 22:52:14 +00:00
Loko Kung bf9b3cc5a9 Moves DestroyApiObject call into ApiObjectBase::DeleteThis
- Moving the call into DeleteThis should make it so that derived classes don't need to explicitly implement a destructor that calls DestroyApiObject.

Bug: dawn:628
Change-Id: I145f42e7e4c144cc0d2d7c7f609744399d514fe1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66840
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-19 22:43:13 +00:00
Ben Clayton 74635bc6e9 dawn_node: Use the new CTS server runner
This allows tests to be streamed to N node processes, without incurring the cost of re-scanning the test lists for each case.
It also means that there is an increased chance of state leakage. `--isolate` is a new flag that uses the old behavior of running each test in a separate process.

Depends on: https://github.com/gpuweb/cts/pull/789

Change-Id: Ifc92d1cc07a9de3b2751bed0971f3424d0c247ae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66920
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-10-19 21:27:23 +00:00
Yunchao He d2c9cd369d Add validation rule for depth/stencil between bundle and pass
If we use render bundle, the compability validation between
writeDepth/Stencil in DepthStencilState in render pipeline and
depth/stencilReadOnly in DepthStencilAttachment in render pass
will become two steps:
  1. validation between render pipeline and render bundle during
    RenderBundleEncoder's SetPipeline().
  2. validation between render bundle and render pass during
    RenderPassEncoder's ExecuteBundles().

So, render bundle is like a bridge for this compability validation
between pipeline and pass.

The first step has been done in previous patch. The patch does
the second step.

Bug: dawn:485

Change-Id: I1226494e901c07bdb9f565bce7b9073d420f2fe2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66842
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2021-10-19 21:10:23 +00:00
Ben Clayton 4168780f81 dawn_node: Run CTS serially if --j 0 is specified
Spinning up new devices for each test can take a long time.
Specifying --j 0 will run a single instance of node, with the given query to run.

Change-Id: I27c161bb76f5deaaa505ab5ae361ea6a0942a130
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66880
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-10-19 20:32:32 +00:00
Ben Clayton 06b827ee92 dawn_node: Only rebuild CTS if something has changed
https://github.com/gpuweb/cts/pull/788 significantly improves the performance of incremental builds, but it can still take around 2 seconds to do that incremental build.

Have the run-cts tool scan the CTS source tree for the most recent modification, and only rebuild if the timestamp is more recent than the last build time.

Significantly reduces startup overhead of the tool.

Change-Id: I7e9227127c02e6d4dc8875a577178956bf5e2481
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66822
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-19 20:07:15 +00:00
Antonio Maiorano 1bf932e7b4 D3D12: dump disassembled DXBC when dump_shaders is enabled
Useful for debugging FXC bugs.

Bug: dawn:1162
Change-Id: If4fc7d0f16370d15235a6c872309fe1536dd9edc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66900
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-19 19:42:22 +00:00
Ben Clayton e9cbd4896a dawn_node: Track promises
These should always be resolved or rejected.
The Fatal() call, when a promise is not resolved or rejected, is currently disabled due to https://github.com/gpuweb/cts/issues/784.

Bug: dawn:1123
Change-Id: Ie0e8ac187ad70be0fea41cd66956d0bfd9c53212
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66821
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-19 19:18:42 +00:00
Ben Clayton 0e3d4fcbd4 dawn_node: Prevent setImmediate() being queued multiple times
The AsyncRunner will enqueue a call to `Device::Tick()` when the runner count moves from 0 async tasks to 1.

It has been observed that some 'async' tasks are actually synchronious, which results in multiple tick callbacks being enqueued before the first has a chance to run.
Fix this by using another boolean to track whether the function has been queued.

Bug: dawn:1127
Change-Id: I7dd81d33d601bf1d3cefb5c4dad6c237883e51ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66820
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-19 18:42:29 +00:00
Brandon Jones 538f795e6c Improve errors in BindGroupLayout, BindingInfo
Updates all validation messages in BindGroupLayout.cpp and
BindingInfo.cpp to give them better contextual information.

Bug: dawn:563
Change-Id: I7166dce65c93d7c8ac4dd72555fff34c9202e041
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66841
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-10-19 16:14:51 +00:00
Austin Eng 26ae0ea4c5 Add tests for some limits
tested:
 - maxComputeWorkgroupStorageSize
 - maxUniformBufferBindingSize
 - maxStorageBufferBindingSize

Two of these limits are exposed as configurable to the JS API
so it's important they are tested to work before we expose
them. maxUniformBufferBindingSize came along as well because
the test for storageBufferBindingSize was easy to parameterize.

Bug: dawn:685
Change-Id: I08de6df9d70a22aca0f48ac3fef0038f7aec727b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66480
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-19 16:06:21 +00:00
Peter Kasting 40b73c646e Fix an unused variable warning on Android.
Bug: chromium:1203071
Change-Id: Iebd5443626f5dbfafc4e01c77190b67d1ef5f7aa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66800
Commit-Queue: Peter Kasting <pkasting@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Peter Kasting <pkasting@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-10-18 20:14:11 +00:00
Yunchao He e43eaabac9 Add validation rule for depth/stencil between pipeline and render bundle
This change also adds a unittest to validation colorFormatCount in
RenderBundleEncoderDescriptor, and fixes a style issue as well.

Bug: dawn:485

Change-Id: I642f0e250835d76288ac42fa18a8dabf2db30047
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66621
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2021-10-18 16:57:31 +00:00
Zhaoming Jiang 2a5b981a87 Deprecation of using 0 as default size in buffer mapAsync
For size parameter in mapAsync, use wgpu::kWholeMapSize rather than 0 to
indicate using the default size, i.e. remaining buffer size after
offset. Using size=0 is still available but will cause a deprecation
warning.

Bug: dawn:1159
Change-Id: I474d87ecae4a54ceb28d636f883a6233c91f16fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66284
Auto-Submit: Zhaoming Jiang <zhaoming.jiang@intel.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-18 05:30:39 +00:00
Yunchao He 79d2099125 Add depth/stencilReadOnly and validations in RenderBundleEncoderDescriptor
This change adds two arguments depthReadOnly and stencilReadOnly
into RenderBundleEncoderDescriptor in order to follow WebGPU spec.
It also adds one more validation rule: depthReadOnly must be equal
to stencilReadOnly if depthStencilFormat has both depth and stencil
aspects in RenderBundleEncoderDescriptor. We have already had a
similar validation rule in RenderPassDepthStencilAttachment in
RenderPassDescriptor.

Bug: dawn:485

Change-Id: I32c45b2bd90c7041aa881d8589720a9146d6ac7e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66501
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2021-10-15 16:56:13 +00:00
James Price 17dd734e54 dawn_node: Document `npm install` step for CTS
If you have a fresh checkout of CTS and miss this step, you get errors
when running the CTS scripts that are hard to figure out.

Change-Id: I12c63455a165d2c37beae75fedd34a4da6c30f28
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66640
Commit-Queue: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-15 16:40:12 +00:00
Austin Eng 4948c81344 Reland "Add deps to enable performing the cmake build of dawn_node on CQ"
This is a reland of ecbdd8fbe7
It prefixes the DEPS variables with "dawn_". Because they are globals,
they may collide with other variables in other projects.

Original change's description:
> Add deps to enable performing the cmake build of dawn_node on CQ
>
> (and the cmake build of Dawn in general)
>
> Bug: dawn:688
> Change-Id: If7c037a03d237372739aed1f5dc78bffb7975a24
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65603
> Reviewed-by: Ben Clayton <bclayton@google.com>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

Bug: dawn:688
Change-Id: I81ec3d5298efea54b1417ff58569cf1c615ea372
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66400
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-15 14:28:32 +00:00
Yunchao He daffd22b68 Add validation rule for depth/stencil between pipeline and pass
depthWrite/stencilWrite in DepthStencilState in RenderPipeline
should be compatible with depthReadOnly/stencilReadOnly in
DepthStencilAttachment in RenderPass. Otherwise, you may need
to generate validation errors.

Bug: dawn:485

Change-Id: I7b541056dafc4dee4eb31f4cefbac48c0ffc4b18
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66240
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-10-14 04:09:21 +00:00
Austin Eng 91851e23a8 Remove several compile-time constants in favor of limits
Bug: dawn:685
Change-Id: Ifac25116c741fdab7b6a8093b4230065beca4773
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65483
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-13 18:57:18 +00:00
Jiawei Shao e0390b8967 Fix compilation error after ComputePipelineBase becomes virtual
This patch fixes a compilation error after the CL "Avoid redundant
creation of ComputePipelineBase in GetCachedComputePipeline" is
landed after "Adds destroy handling for BindGroupLayout without
new backend changes yet" is merged into upstream.

BUG=dawn:529

Change-Id: I5dcb2370093a96703ceb0618f3590364b4eff382
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66283
Reviewed-by: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-13 04:19:26 +00:00
Jiawei Shao 8fd1eb5443 Avoid redundant creation of ComputePipelineBase in GetCachedComputePipeline
This patch removes a redundant creation of ComputePipelineBase object
in GetCachedComputePipeline(). Instead, we directly compute the blueprint
hash from the uninitialized backend compute pipeline object.

BUG=dawn:529
TEST=dawn_end2end_tests

Change-Id: I9b982664aa140ab385418a202270b9988cfcb9f3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66221
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-10-13 00:43:05 +00:00
Loko Kung 2f3fe95ad5 Adds destroy handling for BindGroupLayout without new backend changes yet.
- Start tracking BindGroupLayout objects at construction
- Utilizes untrack tag for blueprint layouts for caching purposes
- Adds dawn native test file for testing utilities that require static dawn native lib
- Adds testing macros and mocks for simple sanity unit testing

Bug: dawn:628
Change-Id: Ic85b60e9574e67cc5fc1804cc5300cd1f3a0f6fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65862
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-12 18:53:57 +00:00
Loko Kung fc5a7d414f Adds remaining setup logic to implement destroy in Device and ObjectBase.
- Renames some of the Device functions to be consistent with documentation
- Reverts change in https://dawn-review.googlesource.com/c/dawn/+/64820 for overloading mDevice == nullptr to determine if objects are alive because device is needed for error propagation. Instead, use list existence to determine if objects are alive
- Updates destroy api to return bool upwards in case we need to further process the extending objects
- Adds tracking functions in ObjectBase
- Adds final tag to all backend Device implementations
- Adds MoveInto LinkedList support to move list elements in O(1)

Bug: dawn:628
Change-Id: Iff70f4f7d55f46ee52d1bd0e02e3671819f2eed4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65861
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-12 17:46:26 +00:00
François Beaufort a4c8c8d5bf Remove "extension"
Now that Chrome uses [1] "feature" instead of "extension", this CL
removes all occurrences of "extension".

[1] https://chromium-review.googlesource.com/c/chromium/src/+/3205514

Change-Id: Ibbaaf5d6e99be62453604c71d8110eea9820c803
Bug: dawn:1149
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65900
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-10-12 13:21:56 +00:00
Loko Kung 6fd28ba4cb Adds iterators and a check to avoid segfault when removing node in LinkedList.
Bug: dawn:628
Change-Id: I1250ffe303155004572c2476ec357daa78b7bb3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65860
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-11 23:29:30 +00:00
Ben Clayton 34206ec07b dawn_node: Use wgpu::SupportedLimits
Query the Adapter / Device for limits instead of hardcoding them.

Bug: dawn:1143
Change-Id: Ib6d47bdb81df8e5e6eb767d35d346bbf34c5877a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65722
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-11 15:42:12 +00:00
Corentin Wallez 008cba9b29 Reenable timestamp queries on Metal macOS 11
They were previously disabled due to some new Metal alignement
constraint that has now been upstreamed in WebGPU and implemented in
Dawn. So we can reenable them.

Bug: dawn:940
Change-Id: I96e5ac57342fbc0cab09989fe90a6bc4c8f9f40d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66120
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Hao Li <hao.x.li@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-11 13:50:29 +00:00
Corentin Wallez 2d1762049b Make Dawn's feature name casing match WebGPU (- instead of _)
Bug: dawn:550
Change-Id: I1017b4a2e93a75925e8762f2d09ace9a8d5d7b49
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65802
Reviewed-by: François Beaufort <beaufort.francois@gmail.com>
Reviewed-by: François Beaufort <fbeaufort@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-10-11 10:18:09 +00:00
Li Hao daf1cdbb28 Fix resolve range of resolveQuerySet on Metal
The second parameter of NSMakeRange(NSUInteger loc, NSUInteger len) is
length, here we just need to pass queryCount.

Bug: dawn:434
Change-Id: I3dfa82e523310258c81c45c4e1c3af80a3df8704
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66220
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2021-10-11 09:09:22 +00:00
Nico Weber 9a8099eb8b Fix Wbitwise-instead-of-logical warnings
`a && b` only evaluates b if a is true. `a & b` always evaluates
both a and b. If a and b are of type bool, `&&` is usually what you
want, so clang now warns on `&` where both arguments are of type bool.
From what I can tell, in Dawn it wasn't important if we evaluate both
branches or not in the places where this fired, so I went with `&&`
everywhere.

Bug: chromium:1255745
Change-Id: Ifa196a7150d5bdfb8527fe8b6f40d7e2e957d609
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66200
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
2021-10-08 14:39:39 +00:00
Corentin Wallez 5497aad240 Improve validation errors for ShaderModule
Bug: dawn:563
Change-Id: I3c0809742f87517456fd8a5f7645005af636fa75
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65801
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-10-08 10:16:27 +00:00
Ryan Harrison 43d5849408 Replace usages of BoundArrayAccessors w/ Robustness
BoundArrayAccessors is an alias to Robustness, and removing it from
Tint will make code easier to read and search.

BUG=tint:1212

Change-Id: I31aabfcef396290178eff6ea8db7e5bb70b031ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66061
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-10-07 03:40:51 +00:00
Antonio Maiorano 22da31cf43 run-cts: add "log" arg to log test results to file
Bug: dawn:1123
Change-Id: Id9ad62dde8f7988cb66e39ca0d543c23d0fad341
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65781
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-05 21:18:10 +00:00
Ben Clayton 78632a644f dawn_node/interop: Return a Result instead of a bool
Provides a place to put error messages.
Helps actually figure out when an overload doesn't match, a dictionary is missing a field, etc.

Bug: dawn:1143
Change-Id: Ibca177f9f42676061511d27898a5c522d1e6cd8f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65721
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-10-05 19:44:09 +00:00
Ben Clayton bc6d30a2f8 dawn_node: Use IDL default parameter values
If the IDL provides a default value for a interface method parameter, then use that default value if no argument is provided.

Removes a bunch of std::optional<T>'s from the C++ interfaces, and simplifies binding implementations.

Also fix some defaults of buffer size from 0 to kWholeSize. This was partially done in an earlier CL, but it seems I missed a few.

Bug: dawn:1143
Change-Id: Ifc1bb29a5e7ead42dd015d2333c743165f2459a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65663
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-05 19:32:34 +00:00
Ben Clayton 01c6a44358 dawn_node: Fixes for GPU.cpp
Check the result of std::getenv() before constructing a std::string.
std::string cannot be constructed with nullptr.

Fix ambiguous overload resolution of std::tolower(), by wrapping it in a
lambda that explicitly takes a 'char' argument.

Bug: dawn:1123
Change-Id: I8a44524a6c0e71f7d2a49a5a9f730115c32df577
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65960
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-05 19:25:09 +00:00
Antonio Maiorano f71f843944 dawn_node: set default GPU adapter and override with env var
Bug: dawn:1123
Change-Id: I95e09477f7c5a5a4c49560aecdf7ee2b8dbce766
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65780
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-10-05 18:19:29 +00:00
Ben Clayton a12ac48f64 dawn_node: Add -j option to run-cts
Running with too many threads can cause device initialization failures.

Bug: dawn:1143
Change-Id: Ie8010ab7a95e88f560dc14ed8b96919313218062
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65662
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-10-05 16:47:45 +00:00
Ben Clayton 2c9fe21308 dawn_node: Make StaticValues property-like
Makes them appear in Object methods like length().

Fixes a number of webgpu:idl,constants,flags tests.

Bug: dawn:1123
Change-Id: I2f1baf9c3c51915ce0b0a5dc392cf86aac761676
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65661
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-05 16:33:19 +00:00
Ben Clayton d611aebc10 dawn_node: Add README.md
Includes info on how to build, known issues, remaining work.

Bug: dawn:1123
Change-Id: I0a1fe827a1aba06eea7e3574de4a7d1e0fd3f0ab
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65161
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-10-05 15:43:59 +00:00
Corentin Wallez 575a198764 Improve validation errors for Sampler
Bug: dawn:563
Change-Id: I4bc774fd89c1a0b7adfca2b5bd7734751257b18b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65800
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-05 01:09:00 +00:00
Brandon Jones a089e8c4f2 Improve validation errors in CommandValidation
Updates all validation messages in CommandValidation.cpp to give them
better contextual information.

Bug: dawn:563
Change-Id: I6af5b0a0d99218c09ef564039218b3a7fb6a74db
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65607
Auto-Submit: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-10-05 00:34:30 +00:00
Sven Zheng 01466b2bb6 Revert "Add deps to enable performing the cmake build of dawn_node on CQ"
This reverts commit ecbdd8fbe7.

Reason for revert: https://ci.chromium.org/ui/p/chrome/builders/official.infra/chrome-branch/977/overview
AssertionError: dep:src/third_party/dawn key:cmake_version value:version:3.13.5 != version:3.16.1

Original change's description:
> Add deps to enable performing the cmake build of dawn_node on CQ
>
> (and the cmake build of Dawn in general)
>
> Bug: dawn:688
> Change-Id: If7c037a03d237372739aed1f5dc78bffb7975a24
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65603
> Reviewed-by: Ben Clayton <bclayton@google.com>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

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

Bug: dawn:688, chromium:1255538
Change-Id: I4c44b511c6fc3ff177785adcaad5f01d2857a2c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65822
Reviewed-by: Sven Zheng <svenzheng@chromium.org>
Reviewed-by: Leonard Grey <lgrey@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-04 23:35:49 +00:00
Brandon Jones da1a78db3b Improve validation errors in CommandEncoder
Updates all validation messages in CommandEncoder.cpp to give them
better contextual information.

Bug: dawn:563
Change-Id: I0aa2063c4805225a5124fdd07e350ee1a74a5f3c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65609
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-04 21:44:19 +00:00
Jiawei Shao afe9138408 Reland "OpenGL: delete shaders and pipelines when they are not used any longer"
This is a reland of a57c1db878

in current Dawn implementation RenderPipelineGL and ComputePipelineGL
will be destroyed before calling their initialize() function when we
can find a proper pipeline object in the front-end cache, so mProgram
may not be assigned to a valid GL program ID when the destructor of
PipelineGL is called.

In this CL we always initialize mProgram to 0 in the constructor of
PipelineGL so that it won't be a garbage value in the destructor of
PipelineGL (0 is safe for glDeleteProgram() according to OpenGL SPEC).

Original change's description:
> OpenGL: delete shaders and pipelines when they are not used any longer
>
> Previously on OpenGL backend the GL pipelines and shaders are never
> deleted. With this patch the GL pipelines and shaders will be able to
> be destroyed correctly after they are not needed any longer.
>
> BUG=dawn:529
>
> Change-Id: I4f7f22c7b536825363fe1ecc0f5ffd1bb86fd774
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65140
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Stephen White <senorblanco@chromium.org>
> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>

Bug: dawn:529
Change-Id: Ie04ab069b9d26658f2b0d1b070d86bb650f3c878
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65486
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-10-04 12:31:22 +00:00
François Beaufort 3f689a4c5a Rename "extension" to "feature"
This CL renames "extension" to "feature" to follow WebGPU. It still
supports both. A future Chromium CL will pick this change, then all
"extension" occurrences will be removed.

Change-Id: I070e32d7ae042f9b846df01f200b39f6741a0a14
Bug: dawn:1149
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65664
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
2021-10-04 11:30:02 +00:00
Corentin Wallez bf8c40b4f1 Vulkan: Implement StoreOp::Discard
It wasn't implemented because Discard wasn't implemented for a long
time.

Bug: dawn:1151
Change-Id: Ie26559dd65a2c97a32df418521ca93c1021dd837
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65720
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
2021-10-04 11:02:17 +00:00
Brandon Jones bb417ace11 Validate index formats in SetIndexBuffer
Fuzzer discovered that it was possible to send invalid IndexFormats
to SetIndexBuffer and cause IndexFormatSize to hit an UNREACHABLE().
This validates that the passed format is part of the enum before
doing any further operations on it.

Bug: 1254571
Change-Id: I1e4075f8d26afdb8e4bcae3cfc72e6219ff28f78
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65610
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-02 01:54:31 +00:00
Brandon Jones 2f1d02b94b Improve validation errors in Texture
Updates all validation messages in Texture.cpp to give them
better contextual information.

Bug: dawn:563
Change-Id: Ibae48b6842c80253c82b63989d08dac95c4b5759
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65602
Commit-Queue: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-10-01 19:10:40 +00:00
Corentin Wallez 2bf51560eb Improve validation errors for Buffer
This required adding a version of device.ConsumedError that takes a
MaybeError and a formatted string context.

Also removes an unused method.

Bug: dawn:563
Change-Id: I7a2139cc47945d1f29bdfe926db3c932bf17c6d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65564
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@google.com>
2021-10-01 18:15:40 +00:00
Corentin Wallez 16b4246266 Improve validation errors for CopyTextureForBrowser
Also simplifies the call graph of the validation a bit (some functions
were called to do a single check, some others were doing redundant
checks).

Bug: dawn:563
Change-Id: I0c9c09832139ff33055292e6bfa22b3ef6719819
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65563
Reviewed-by: Brandon Jones <bajones@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-10-01 17:05:55 +00:00
Austin Eng ecbdd8fbe7 Add deps to enable performing the cmake build of dawn_node on CQ
(and the cmake build of Dawn in general)

Bug: dawn:688
Change-Id: If7c037a03d237372739aed1f5dc78bffb7975a24
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65603
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-10-01 16:21:05 +00:00
Yunchao He 698bb821c7 Refactor/remove dawn-defined buffer and texture usages
This change refactors dawn-defined buffer and texture usages.
It groups buffer usages together, and groups texture usages
together, in order to avoid values conflict. It also removes
kReadOnlyStorageTexture because its definition has already been
removed.

Bug: dawn:485
Change-Id: I8c772ebadd3d276905fbcdb3283f0d5d89f74dd6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65680
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2021-10-01 16:20:35 +00:00
Corentin Wallez d85bbb6128 Improve validation errors for CreateExternalTexture
Also adds a label to ExternalTextureDescriptor to match the pattern of
all other descriptors.

Also adds missing validation that the planes must not be multisampled
(with a test) and fixes the validation unittests to not leak state from
one test to another (so they test exactly what they need to).

Bug: dawn:563
Change-Id: I88a4d7a859e67e5af85efd5ba16572c9014df6ad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65562
Reviewed-by: Brandon Jones <bajones@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-10-01 15:34:25 +00:00
Ben Clayton 14d33c36c1 dawn_node: Implement setlike keys()
Used by a number of CTS tests (webgpu:idl,constants,flags:*)

Bug: dawn:1143
Change-Id: Idd76c35a4debf54d5c53df11f59419de90f90162
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65660
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-10-01 12:42:45 +00:00
François Beaufort 7a93485410 Improve validation errors in Adapter
Updates all validation messages in Adapter.cpp to give them better
contextual information.

Bug: dawn:563
Change-Id: I71381f56b51ef69c3064af837fe20d6afa7ce271
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65581
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@google.com>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
2021-10-01 08:54:47 +00:00
Yunchao He 5ad5250a3b Track read-only depth/stencil attachment as read-only usage
If a depth/stencil texture view is used as sampled texture and
read-only render attachment in the same render pass, it should be fine.
Because both usages are readonly. However, Dawn doesn't distinguish
read-only render attachment from writeable render attachment. So, this
situation is thought to be invalid.

This change fixes the issue and allows these read-only usages in one
pass, with a validation test for verification.

Bug: dawn:485

Change-Id: I0df5a4209651cddd6122487d96b1810717e4eb22
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65485
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-10-01 01:45:14 +00:00
Ben Clayton 75911ca2b5 dawn_node: Fix Windows build
Generate exported node symbols via a generated .lib file, and link against this, so the linker knows these are declared by node.exe.

Bug: dawn:1123
Change-Id: Id8c9c5de6bf5e6b925f26e2a1dbb85dd1e40668c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65565
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-30 18:51:40 +00:00
Austin Eng d84d7f1ea3 Disable DrawIndexedIndirect
Not passing CTS yet

Bug: dawn:809
Change-Id: Ib7c240372a8fdbd45803230292c374e2957c8d15
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65601
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-09-30 18:47:21 +00:00
shrekshao 99be407367 Improvement validation errors: Pipeline.cpp
Bug: dawn:563
Change-Id: Iac05390ab8e8dac9737974c3a9015110b9e55730
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65481
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-30 18:40:50 +00:00
Ben Clayton 72e3ba6b54 dawn_node: Fix macOS build
Generate exported node symbol stubs with weak linking. This keeps the linker happy, and these are replaced by the real node symbols at runtime.

Fix clang warnings.

Have WGPUBufferMapAsyncStatus_DestroyedBeforeCallback reject the promise with an AbortError.

Bug: dawn:1123
Change-Id: I503f889b027b6cfc0e458abf434d4888990fb67b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65560
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-30 18:04:01 +00:00
Corentin Wallez 547c4ed0ca Improve validation errors for CreateQuerySet
Bug: dawn:563
Change-Id: I7ed446f9fed3e8e9c2fdf367ea8cedcbbff334b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65561
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-30 17:55:50 +00:00
Ben Clayton 200ed613ba dawn_node: Add a tool to run the CTS
Bug: dawn:1123
Change-Id: I00e875727f7a130af2025b89346380d4ea944fe1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65160
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-30 17:08:41 +00:00
Ben Clayton 8bbcd8018d dawn_node: Move cmd/idlgen under a src directory
Creates a more idiomatic golang source tree.

Change-Id: Ifdb701e5aa2f391ca23d957bee59412a8cf7139d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65420
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-30 15:23:53 +00:00
Corentin Wallez 8f87d8af80 AdapterVk: Remove redundant VkPhysicalDevice limit check
Fixed: dawn:1147
Change-Id: I8bbd46b82cad27174ccc7cae79a592ff992070a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65540
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-30 15:13:00 +00:00
Ben Clayton ffe5114fed dawn_node: Fix conversion of BlendState
A silly typo was causing a large number of blending tests to fail.

Bug: dawn:1123
Change-Id: Ib6423ad6c58baab2db15034633f95bab7b0c7912
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65401
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-30 13:53:44 +00:00
Ben Clayton 7c9294584e dawn_node: Add message support to UNIMPLEMENTED()
Have UNIMPLEMENTED() take a variadic set of message arguments which are printed with the fatal error message.

Bug: dawn:1123
Change-Id: Idfa7ca71a8c59565434651a310d9e049349bb227
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65400
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-30 13:09:24 +00:00
Ben Clayton 7ed0624337 dawn_node: Begin implementing GPUSupportedFeatures
Requires setlike interface interop.

Bug: dawn:1123
Bug: dawn:1143
Change-Id: I1451f72b32b99858be871db99888f86872b53fd0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65245
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-30 07:17:33 +00:00
Ben Clayton 3e122818a2 dawn_node: Fix stack overflow with Write()
In review, the variadic overload of Write() was changed, which adjusted the overload resolution priorities W.R.T the single argument overload:

https://dawn-review.googlesource.com/c/dawn/+/64747/3..7/src/dawn_node/utils/Debug.h#b96

This caused the variadic overload to be picked for the single-argument case, leading to stack overflows when calling Write().

Fixed by using perfect forwarding for the single argument case of Write().

Bug: dawn:1123
Change-Id: I21ab290e9c2e4b92ab472552f809484fb7426a45
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65244
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-30 07:12:33 +00:00
Brandon Jones 4d2bc396ea Improve validation errors in RenderPipeline
Updates all validation messages in RenderPipeline.cpp to give them
better contextual information.

Bug: dawn:563
Change-Id: Iccf2714c781c2e1d52eaf00bf81f1d5643635cf7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65484
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-09-30 01:30:12 +00:00
Brandon Jones d6d2584480 Add debug group logging to validation errors
Updates the formatted error messages to display as:

Error message text.
 - While context 2.
 - While context 1.

Debug group stack:
 > "Debug Group Label 2"
 > "Debug Group Label 1"

Bug: dawn:563
Change-Id: I66f5ed59d3e6960722c0d1faf7eaa770d9774eb6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65480
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-29 19:39:02 +00:00
Brandon Jones 9b643b72f7 Improve validation errors, Part 3
Modified ConsumedError and TryEncode methods to allow for top-level
error context messages. Applied them to:
 - ComputePassEncoder
 - ProgrammablePassEncoder
 - RenderEncoderBase
 - RenderPassEncoder
 - Device

Bug: dawn:563
Change-Id: I4a989763f57afbcf6b1cfe87ccaaba502ebd29fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65101
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-29 18:39:23 +00:00
Ben Clayton d6ecf83c19 dawn_node: Add Module.cpp
This is the node plugin entrypoint

Bug: dawn:1123
Change-Id: I4a48b047482a7c9f1a0f10cc2a5a02721d103b8a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64940
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-29 09:51:21 +00:00
Corentin Wallez cac3e7e110 Revert "OpenGL: delete shaders and pipelines when they are not used any longer"
This reverts commit a57c1db878.

It produces a GL_INVALID_VALUE in ColorStateTest.ColorWriteMask

BUG=dawn:529

Change-Id: I3511057daf24baaf895b86cbda2a3a21e58d77fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65384
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-09-29 09:15:02 +00:00
Ben Clayton bc207f7193 dawn_node: Add binding/GPUDevice.cpp
Bug: dawn:1123
Change-Id: Ied4baca4d5eea41ad13ee488978a8f2354d5f8d0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64919
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-29 08:48:43 +00:00
Jiawei Shao 3c0925b480 Avoid redundant creation of RenderPipelineBase in GetCachedRenderPipeline
This patch removes a redundant creation of RenderPipelineBase object
in GetCachedRenderPipeline(). Instead, we directly compute the blueprint
hash from the uninitialized backend render pipeline object.

BUG=dawn:529
TEST=dawn_end2end_tests

Change-Id: I3c7a2acfc01ab9e1e631793030ea06c9ae908aa2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65000
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-29 00:49:01 +00:00
Jiawei Shao a57c1db878 OpenGL: delete shaders and pipelines when they are not used any longer
Previously on OpenGL backend the GL pipelines and shaders are never
deleted. With this patch the GL pipelines and shaders will be able to
be destroyed correctly after they are not needed any longer.

BUG=dawn:529

Change-Id: I4f7f22c7b536825363fe1ecc0f5ffd1bb86fd774
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65140
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-29 00:48:22 +00:00
Ben Clayton 126dc7d20f dawn_node: Add binding/GPUBuffer.cpp
Bug: dawn:1123
Change-Id: I4ba8d69bcd91a1fa0ed43a5ca063c7ff14d7d031
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64918
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-28 21:51:28 +00:00
Brandon Jones ea5d768f94 Improve validation errors, Part 2
Updated validation messages in:
 - CommandBufferStateTracker
 - RenderBundleEncoder
 - RenderEncoderBase
 - RenderPassEncoder

Bug: dawn:563
Change-Id: I0e8f133333bf759921e5db1b1908ee2dc882c504
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64982
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 21:35:43 +00:00
shrekshao e99ad765ae Overridable constants vulkan implementation and tests
Add vulkan backend implementations and tests.
Disabled some tests that fail due to tint missing
features and issues.

Bug: dawn:1041, tint:1155
Change-Id: Iac161317450cff59627e08b1228bffde4cef71da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64981
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-28 20:15:52 +00:00
Ben Clayton 5d1613db8e dawn_node: Fix Converter<Napi::TypedArrayOf<T>>::FromJS
The conversion should only pass if the element type matches.

Bug: dawn:1123
Change-Id: I700a445e8d281afdc36d1b6f9be73767ca89d4ea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65240
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 18:08:13 +00:00
Ben Clayton 5a18c2aab8 dawn_node: Add binding/GPURenderBundleEncoder.cpp
Bug: dawn:1123
Change-Id: Id2d8e77456869562a680a5bd7eb2056b1e319311
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64912
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-28 17:30:11 +00:00
Ben Clayton c6b786e0fc dawn_node: Add binding/GPUAdapter.cpp
Bug: dawn:1123
Change-Id: I5eee0036acf4db18dd103f863c4f07511a0cee25
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64917
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 16:56:31 +00:00
Ben Clayton ffcebe8c2c dawn_node: Add binding/GPUCommandEncoder.cpp
Bug: dawn:1123
Change-Id: Iadc53f1e5629fb58f12c5305cba965b1ef38ffea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64915
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 16:46:12 +00:00
Ben Clayton 334714b312 dawn_node: Add binding/GPUComputePassEncoder.cpp
Bug: dawn:1123
Change-Id: Ied735455b04f52ba214b3ef9ef41edb78d9ed6fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64914
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 16:16:41 +00:00
Ben Clayton c5d9650308 dawn_node: Add binding/GPU.cpp
Bug: dawn:1123
Change-Id: I9d962a149c4bbb0fc8749fdb77c6ad29c59f0111
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64916
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-28 16:14:21 +00:00
Ben Clayton 6104800416 dawn_node: Add binding/GPUQueue.cpp
Bug: dawn:1123
Change-Id: I629008de8b096da537737df18d7173e96d433394
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64913
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 16:07:32 +00:00
Ben Clayton c06b8132ec dawn_node: Add binding/GPURenderPassEncoder.cpp
Bug: dawn:1123
Change-Id: I0f288e1b3c19f0063f346e5801be7e07eaf1818a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64911
Reviewed-by: Corentin Wallez <cwallez@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-28 16:02:46 +00:00
Corentin Wallez 347a597f7d Only call WillBeginRenderPass when encoder is current
Fixes an ASSERT when a render pass is started while another pass is
already current.

Bug: chromium:1253090
Change-Id: I085c1de225f9ba30a7f368fad3b1d8a97ed92c63
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65241
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-09-28 15:55:42 +00:00
Loko Kung 8d195d511d Refactors dawn_native objects for list tracking and adds destroy skeleton API.
Adds generated headers in dawn_native for object type tracking similar to that used in dawn_wire. Splits ObjectBase into ObjectBase and ApiObjectBase for clearly differentiation, and adds virtual function to identify the type of ApiObjects. Updates error generation to utilize new object typing for generating messages.

Bug: dawn:628, dawn:840, dawn:563
Change-Id: Ia4f831fcbfb29a70ed5a35d47ed622921e744c84
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64820
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-28 15:40:01 +00:00
Ben Clayton 7b04930aa0 dawn_node: Add binding/GPUShaderModule.cpp
Bug: dawn:1123
Change-Id: I0b0bd50314c656a527913d5dffa73032e6cdcdf2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64910
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 14:09:40 +00:00
Ben Clayton 05944b0f97 dawn_node: Add binding/GPUTexture.cpp
Bug: dawn:1123
Change-Id: I2858cc2b86aa9189a92a2f4a9f0988a9f7b36953
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64909
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 13:58:00 +00:00
Ben Clayton ca9bc676aa dawn_node: Add binding .cpp files for trivial types
All UNIMPLEMENTED()s are TODO.

Bug: dawn:1123
Change-Id: Ie51b807d8a2a2ba376416d77de383dd627d04a07
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64908
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 13:56:01 +00:00
Ben Clayton 118d2dd19e dawn_node: Add binding/Converter.[cpp,h]
The interop -> Dawn conversion utility class.

Bug: dawn:1123
Change-Id: I8a2a352eb730a4a528f6a0262d5b21e08d85b413
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64907
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 13:18:40 +00:00
Ben Clayton 3e5848a4de dawn_node: Add all the headers for the binding classes
Nothing includes these yet.

Bug: dawn:1123
Change-Id: Ia2178d4bc9bf2c8f8f586493568b2864063d3fc7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64906
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 13:09:30 +00:00
Ben Clayton a35156b732 dawn_node: Add binding/AsyncRunner
Used to poll a wgpu::Device with calls to Tick() while there are asynchronous tasks in flight.

Bug: dawn:1123
Change-Id: Ieee75b983df836a6df09ae4ff81f7382f4be4995
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64905
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 13:01:41 +00:00
Ben Clayton af48bbc460 dawn_node: Add binding/Errors.[cpp,h]
Errors contains static helper methods for creating DOMException error messages as documented at:
https://heycam.github.io/webidl/#idl-DOMException-error-names

Bug: dawn:1123
Change-Id: I5fcf4e146c91cde37f5514d8a4a426b17de6a701
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64904
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 11:59:10 +00:00
Kai Ninomiya 51791e0409 Add 'reason' argument to device lost callback
Breaking change, but it should only require small changes in any project
that relies on it, so just doing this instead of a two-stage deprecation.
Will require a manual roll into (at least) Chromium.

Bug: dawn:1080, chromium:1253721
Change-Id: I6699e0629c3b2fe63e7f9d5ba0a928f00316a588
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64520
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-28 11:52:17 +00:00
Ben Clayton affb7a3ab9 dawn_node: Begin working on the CMake rules
This is enough to compile the interop code. This doesn't do anything as we need to emit the NodeJS module entry point, and actually hook up the interop to the Dawn bindings.
This comes next.

Bug: dawn:1123
Change-Id: I754b4bcb0532c8446031622d8e8e64e2faaff585
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64903
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-28 11:14:42 +00:00
Ben Clayton 897cdeeb61 dawn_node: Add template files
Templates used to generate the NodeJS interop classes for the WebGPU IDL.

Also includes a stub `Browser.idl` file that provides stub definitions for browser IDL declarations referenced by the WebGPU IDL.

Bug: dawn:1123
Change-Id: I4067cb186f63436a502c3516a879ed1c5cd30731
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64902
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 10:01:02 +00:00
Ben Clayton 6d8a03e707 dawn_node: Add interop/Core.[h,cpp]
Core hand-written interop classes, which the template-generated code makes heavy use of.

There's currently no build rules for these files.
These will come in a followup change.

Bug: dawn:1123
Change-Id: Id56f96533070acc8ee581d6f44f83b5374662215
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64901
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-28 09:58:41 +00:00
Zhaoming Jiang 2be4b8483c Deprecate size=0 for default in setIndexBuffer and setVertexBuffer
For size parameter in setIndexBuffer and setVertexBuffer, use
wgpu::kWholeSize rather than 0 to indicate using the default
size, i.e. remaining buffer size after offset. Using size=0 is still
avaliable but will cause a deprecation warning.

Bug: dawn:1058
Change-Id: I4c4f6ca6fc7346c225815bdcd607fed110ce2b9a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65020
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-28 02:05:00 +00:00
Austin Eng 8411a12ab1 Add a mechanism for finding the best tier for a set of limits
Multiple groups of limits may be defined via macros.
ApplyLimitTiers degrades the incoming limits such that
each limit value within a group is clamped to the
best possible tier. A device may be in Tier 2 for one
limit group, but Tier 1 for another limit group.

Also adds equality operators to dawn_native generated structs
for comparison of expected limits in the test.

Bug: dawn:685
Change-Id: Ibdf947f2ccd44f70d66f48bed472ff5681230633
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64720
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-09-28 01:04:10 +00:00
Ben Clayton a3c387a6a2 dawn_node: Add utils/Debug.h
Contains macros used for logging and marking code as unimplemented.

Bug: dawn:1123
Change-Id: I861348b0cc53eb1dc80ed5b477ab33af45d1acd9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64747
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-27 21:56:19 +00:00
Ben Clayton cea792f971 dawn_node: Add idlgen tool
A go WebIDL parser and template generator tool.
Will be used to generate the NodeJS bindings for Dawn.

We may wish to reimplement this in Python some day. Not today.

Bug: dawn:1123
Change-Id: I31c868efcd8ba00084a6c25a1fc0e3ad774dfa53
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64746
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-27 20:41:15 +00:00
Michael Tang 029d67f2c8 D3D12: implement WGSL pipeline cache key generation
Since spirv_to_dxil does not generate HLSL, to support pipeline caching,
we need to generate a cache key from the WGSL instead.

A new type, ShaderCompilationRequest, is added to isolate the
compilation inputs to help ensure that the cache key contains all
relevant information.

Bug: dawn:1103
Change-Id: Ic2f09326dc3ac254cecf35098dcfe95aa396796f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61160
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Michael Tang <tangm@microsoft.com>
2021-09-27 17:15:09 +00:00
Jiawei Shao 0e3aa3c8d0 Metal: Support creating render pipeline asynchronously
This patch implements the asynchronous path of creating render
pipeline on Metal backend.

BUG=dawn:529
TEST=dawn_end2end_tests

Change-Id: I3f40949f35f6cbc340bebf481bd4e204b12d86c2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64880
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-24 00:40:59 +00:00
Jiawei Shao 525039ddc6 Vulkan: Support creating render pipeline asynchronously
This patch implements the asynchronous path of creating render
pipeline on Vulkan backend. This patch also makes the access to
the member mCache of Vulkan::RenderPassCache thread-safe as it
can be accessed in different threads simultaneously.

BUG=dawn:529
TEST=dawn_end2end_tests

Change-Id: I74c799935ef46405275585cb5dccfcb552a48aa4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64840
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-24 00:40:57 +00:00
Brandon Jones ba66295033 Improve validation errors, Part 1
Begin's using Abseil's string formatting and new error context tracking
to dramatically improve the usefulness of validation messages. In
addition to putting in place several utilities to enable better messages
this change also updates the BindGroup buffers bindings validation
messages as a test for the new mechanisms.

Bug: dawn:563
Change-Id: Ie5bf5ffb24a9013cebd67745dc4172dfbc901e9a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64201
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-23 21:26:33 +00:00
Brandon Jones a04663c13d Added Abseil as a third-party dependency (Take 2)
Another attempt at https://dawn-review.googlesource.com/c/dawn/+/63780
Depends on https://skia-review.googlesource.com/c/skia/+/451638

This version of the CL fixes the Cmake and Skia compatibility issues
from the previous CL.

Bug: dawn:563
Change-Id: I41a7ee0aef1924df08a9be41e94effb7cd0025df
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64600
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-23 20:36:03 +00:00
Ben Clayton c19329c832 CMake: Only require SPIRV-Cross when enabling OpenGL backend
Change-Id: Ie6be1301c3f2f9877a9dfb04ab5025559b90d926
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64741
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-23 19:24:43 +00:00
Ben Clayton 999cc24209 Fix all GCC 10 warnings
Change-Id: Ibabab265e734a4a421a38ab586e7e11905fa5da1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64740
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-23 17:34:53 +00:00
Ken Rockot ebf183bde4 Implement drawIndexedIndirect validation
Every render pass which invokes DrawIndexedIndirect, either directly or
through a RenderBundle execution, is now preceded immediately by at
least one validation pass.

All indirect buffer offests used with DII are validated, and their
validated values are copied into a separate scratch buffer (or zeroed
out there, in the case of validation failure). All encoded DII commands
are rewritten to use the validated parameters instead of the original
ones.

Bug: dawn:809
Change-Id: I5eead937f19536f84f89e2c8e6fed7f18f0aee9f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63461
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-23 00:15:19 +00:00
Austin Eng 1bca15969e Add dawn_native unittests for Limits
Adds some unittests for Limits to dawn_unittests.
Statically links dawn_unittests against dawn_native
to access the internals. Additional tests for dawn_native
can now be added to dawn_unittests as well.

Bug: dawn:685, dawn:1105
Change-Id: I1e67c2f673e43d0e07693f3a50920129f135440e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64780
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-09-22 14:50:30 +00:00
Jiawei Shao f84e7b4eda Remove prefix 'm' on mCreateInfo in ComputeVertexInputDesc
This patch removes the prefix 'm' on the local variable 'mCreateInfo'
in Vulkan::RenderPipeline::ConputeVertexInputDesc() in case we may
misunderstand that it is a member of Vulkan::RenderPipeline.

BUG=dawn:529

Change-Id: Ifa3302a58a88f9628f09787977b5157fb55f9c55
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64841
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-22 09:25:05 +00:00
Li Hao a10f5331f2 Update destinationOffset alignment to 256 in resolveQuerySet
From macOS 11+, Metal requires the minimum buffer offset alignment to be
256 bytes. We have updated the destinationOffset alignment of
resolveQuerySet to 256 in SPEC. This PR is changing the implementation.

Bug: dawn:940
Change-Id: Ie3c69d6a90adb76038dbac95ae2158a38da583f3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63762
Commit-Queue: Hao Li <hao.x.li@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-22 02:51:20 +00:00
Peter Kasting a928047b89 Force -Wno-shadow to avoid variable shadowing warnings.
Long term, ideally, these would be fixed and this flag can be removed.
For now, this is an expedient way to allow enabling -Wshadow in
Chromium.

Bug: chromium:794619
Change-Id: Idd3b6eaf61cc6e2a32eecf94d6cc6a41afb5f4eb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64761
Auto-Submit: Peter Kasting <pkasting@google.com>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-09-21 18:08:10 +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
Austin Eng 73d7c841fd Default initialize DeviceDescriptor in DawnTest.cpp
Bug: dawn:1120
Change-Id: I6cd2e9072e3579891793d2a352421a14d5ed0b89
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64662
Auto-Submit: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-09-20 23:47:55 +00:00
Austin Eng 1c85de6888 Clamp limits to the defaults if they are worse than the defaults
Bug: dawn:685
Change-Id: Ibae70390fae1d9bde2b625edf7de17e6aafb9cda
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64603
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-20 20:58:46 +00:00
Ken Rockot 44d729fc8c Introduce BufferLocation
This is a simple RefCounted holder of a Buffer ref and offset. Encoded
commands can store a ref to this object instead of directly storing an
inline Buffer ref and offset, allowing other commands to dynamically
patch in a different buffer+offset as needed, in a memory-safe way;
as opposed to e.g. retaining an unmanaged pointer to the encoded
command itself and modifying it in-place.

Validation commands will use this to rewrite buffer references in
encoded commands, so that they execute over validated inputs rather
than over their original client-provided inputs.

No net functional changes in this CL, just some groundwork for indirect
draw/dispatch validation.

Bug: dawn:809
Change-Id: I0570521a610fe3ea08190a525b4904749d7b7f24
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64420
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
2021-09-20 20:39:15 +00:00
Ken Rockot 6237c8a121 Introduce WriteBuffer command
This command copies data from host memory into a GPU buffer. It's
analogous to Queue::WriteBuffer, but executed in the context of a
command buffer, sequenced with other encoded commands. This is useful
for supporting a notion of a shared scratch buffer, with a single
allocation whose contents may need to be overwritten with new data
before each pass that uses it.

Bug: dawn:809
Change-Id: If58d49c52a41127e2980dd626fd687eb1c91fe28
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64001
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
2021-09-20 19:25:05 +00:00
Kai Ninomiya 4e37accdbb Add new items for Emscripten/webgpu-headers
Generates the exact upstream headers, except for a few Dawn and upstream
changes that have landed since I started this CL, and the "_TODO"s about
extensibility of compilation info/message.

Bug: dawn:1080
Change-Id: I2a6128a3e78cfef7b9f8feae84b7c7c207eb2826
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62861
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-17 21:13:33 +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
Michael Tang 0a4cb8d859 D3D12: Move transform/FirstIndexOffset outside of TranslateToHLSL
This is a minor refactor that runs transform/FirstIndexOffset in a
separate pass, outside of TranslateToHLSL. It should be functionally the
same as what currently exists.

This is to prepare for creating pipeline cache keys based on the WGSL.

Bug: dawn:1103
Change-Id: Ifc516079bafe2449d422f8bd8485b2459cd3d181
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63224
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Michael Tang <tangm@microsoft.com>
2021-09-17 19:23:33 +00:00
Kai Ninomiya fa9ca4482a Stub out depth16unorm texture format
Allows us to match the upstream header's format list more closely.

Bug: dawn:570
Change-Id: Iee5c6c0e45ab81fa335c3d8e63d8b2c5c455d26c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64522
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2021-09-17 18:25:53 +00:00
Austin Eng 2e48f011b0 Add an option for the Adapter to use tiered limits
Does nothing right now since Dawn always exposes the default limits.
In the future, setting useTieredLimits to true will bucket the
exposed adapter limits to minimize fingerprinting surface.

Disabled by default for native applications, but Chrome will always
enable it.

Bug: dawn:685
Change-Id: I0ecfefc93f7a554f8f8be7906cef9fa8d4745ac2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64524
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-09-17 17:24:44 +00:00
Corentin Wallez c389182758 Remove readonly storage textures
Bug: dawn:1025

Change-Id: I1759639142589470e278b4906d9cad5cb485f9a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63743
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
2021-09-17 17:07:43 +00:00
Yunchao He a6394ddc07 Fix a few comments in RenderPassDescriptorValidationTests.cpp
Note that all validation rules for RenderPassDescriptor (including
color attachments and depth/stencil attachemt) in the spec have
already been covered in the validation tests.

Bug: dawn:485

Change-Id: I8741b53677876515fe0f90f5db1e05728ef1a452
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64521
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2021-09-17 16:40:13 +00:00
Corentin Wallez bd04e15890 Remove deprecated APIs
Bug: None
Change-Id: I77ac6660318bef1f9a245b3aee06a8e89a67e518
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64540
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-09-17 16:05:40 +00:00
Austin Eng bffc966f17 Add wgpuDeviceGetLimits. Split Required/Supported limit structs
Bug: dawn:685
Change-Id: Ibb5dd0479f5e887d4b2ca864c014ebaafb674dba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64443
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-09-17 15:36:00 +00:00
Jiawei Shao 4ecfc58777 D3D12: Support creating render pipeline asynchronously
This patch implements the asynchronous path of CreateRenderPipelineAsync
on D3D12 backend.
1. Call the constructor of dawn_native::d3d12::RenderPipeline in main
   thread.
2. Execute dawn_native::RenderPipelineBase::Initialize() (a virtual function)
   asynchronously.
3. Ensure every operation in dawn_native::d3d12::RenderPipeline::Initialize()
   is thread-safe.
4. Save all the return values (pipeline object or error message, userdata, etc)
   in a CreateRenderPipelineAsyncWaitableCallbackTask object and insert this
   callback task into CallbackTaskManager.
5. In Callback.Finish():
- Insert the pipeline object into the pipeline cache if necessary
- Call WGPUCreateRenderPipelineAsyncCallback

This patch also removes FlatRenderPipelineDescriptor as it is not needed
right now.

BUG=dawn:529
TEST=dawn_end2end_tests

Change-Id: I7fd30339ab7bea599c483dea4bd1100359982409
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64440
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-17 07:39:00 +00:00
jchen10 b166b99f86 Treat 'mipLevelCount == 0' as error
It's no longer a valid default value.

Bug: dawn:1026

Change-Id: I9de656f29c8b7673de412cef35dcfb8a45121ac7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64165
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2021-09-16 05:29:44 +00:00
Jiawei Shao 8626b2142d Disable the workaround about the T2T copy issue on newer Intel drivers
This patch disables the workaround about the T2T copy issue (the Toggle
UseTempBufferInSmallFormatTextureToTextureCopyFromGreaterToLessMipLevel)
on the latest Intel Gen9 and Gen9.5 D3D driver (30.0.100.9864) which
contains the fix for this issue.

BUG=chromium:1161355
TEST=dawn_end2end_tests

Change-Id: I6e62b95d1cb92358482356901c541df02998a764
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64280
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-16 01:11:01 +00:00
Shrek Shao 2f8f2518e5 Revert "Added Abseil as a third-party dependency"
This reverts commit 020d69905e.

Reason for revert: Causing Dawn Skia roll build fails

https://task-scheduler.skia.org/job/AZXXBm9h9ozj3kKiRJM5

Original change's description:
> Added Abseil as a third-party dependency
>
> Using the version in the Chromium repo in order to make use of the .gn
> files it contains.
>
> Doing so also appears to require us to switch where we pull googletest
> from so that the directory structure matches what the Abseil build
> config expects. Fortunately this doesn't seem to cause issues in our
> tests.
>
> Bug: dawn:563
> Change-Id: I55831ad33f282b3d8b03b67826fd2776e5602d89
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63780
> Reviewed-by: Austin Eng <enga@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
> Auto-Submit: Brandon Jones <bajones@chromium.org>

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

Bug: dawn:563
Change-Id: I0fc4e5fc73ab9b0887591135ec01adde990edd6f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64361
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-09-15 19:22:19 +00:00
Ken Rockot 4646de90be Support flattening multiple CommandAllocators
This introduces CommandAllocator::AcquireCommandBlocks, which accepts a
vector of CommandAllocators and flattens them into a single iterable
sequence of commands. To support this, CommandAllocator is made movable.

Bug: dawn:809
Change-Id: I3984c243e4bd74568eccba1a8a58ec26324c8ffa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63822
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-15 18:29:00 +00:00
Austin Eng 5528d0edd2 Metal: Allocate threadgroup memory based on Tint reflection
Tint passes threadgroup memory in MSL as entrypoint arguments since
threadgroup memory at the module scope cannot be default initialized.
MSL lacks default constructors for matrices in threadgroup memory.

Bug: dawn:1110
Change-Id: I7462fa448c6ebdb3cc4dc24bd5ff0a99287cdba0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64240
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-09-15 18:16:50 +00:00
Corentin Wallez 49d794fbcc Use IterateBitSet in AddVertexPullingPass
BUG=dawn:529
Change-Id: Ibc05ee56f79c967b6dc8e08303ad726aff83c7a2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64300
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-09-15 15:35:43 +00:00
jchen10 4935c14eec Use WGPU_MIP_LEVEL_COUNT_UNDEFINED instead of 0
The follow up CL will remove 0.

Bug: dawn:1026
Change-Id: Ida62f8d8b0dd8f9722e40f3f95366d3db0c7ab52
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64164
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2021-09-15 06:27:25 +00:00
Zhaoming Jiang 857d4e62e3 Support vertex-only render pipeline
Support vertex-only render pipeline on D3D12, Vulkan, Metal, OpenGL
and OpenGL ES backends. Related validation tests and end to end tests
are also implemented.

Bug: dawn:136
Change-Id: If266fd441c1d39ccd940ea26b74b405f8abb351a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63080
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-15 03:17:42 +00:00
Jiawei Shao 43ce892284 Remove descriptor in RenderPipeline::Initialize
This patch removes the parameter "descriptor" from the function
RenderPipeline::Initialize() on D3D12, Metal and Vulkan backends as
a preparation of creating render pipeline asynchronously.

BUG=dawn:529

Change-Id: I6bdd74ad0af6a1924fac3703908cd5f66b75994b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64163
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-15 01:41:42 +00:00
Jiawei Shao 24cad6e2c3 Metal: Remove vertexState in the parameter of TranslateToMSL
This patch removes the parameter "vertexState" from TranslateToMSL
and ShaderModule::CreateFunction as we have already been able to
get the vertex states from the RenderPipelineBase object.

BUG=dawn:529

Change-Id: I2971438bfd5e0f3fbea900e1f06c1b33349571da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64140
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-15 01:28:23 +00:00
Brandon Jones 020d69905e Added Abseil as a third-party dependency
Using the version in the Chromium repo in order to make use of the .gn
files it contains.

Doing so also appears to require us to switch where we pull googletest
from so that the directory structure matches what the Abseil build
config expects. Fortunately this doesn't seem to cause issues in our
tests.

Bug: dawn:563
Change-Id: I55831ad33f282b3d8b03b67826fd2776e5602d89
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63780
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Brandon Jones <bajones@chromium.org>
2021-09-14 16:56:15 +00:00
François Beaufort 088071a5a7 Add device ID and vendor ID to device properties
This CL adds device ID and vendor ID to device properties so that WebGPU
can access it to help populate GPUAdapter.name.

Bug: chromium:1231163
Change-Id: I460e5a72ffba350f88d2649789a61eaea9670135
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64180
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
2021-09-14 16:15:35 +00:00
Corentin Wallez 77755b9f55 Remove deprecated wgpu::StoreOp::Clear
Bug: dawn:937
Change-Id: I80cdb3b6b3caecc83a6e8cc009bb494179808cd9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63742
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-14 16:02:00 +00:00
Corentin Wallez c7203ba890 Remove deprecated ComputePipelineDescriptor.computeStage
Bug: dawn:800
Change-Id: I8d9d2a7cdba328d1cf040f7c8c622d1d7d403be2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63741
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-14 11:42:27 +00:00
Corentin Wallez 1ac4565115 Remove deprecated RenderPass*Attachment.attachment
Bug: dawn:762
Change-Id: I86144f77ffd647d2e5c01742fb67367c7a5c914e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63382
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-14 10:42:22 +00:00
jchen10 96ac969a33 Use WGPU_ARRAY_LAYER_COUNT_UNDEFINED instead of 0
This seperates the undefined 'arrayLayerCount' from 0 to
WGPU_ARRAY_LAYER_COUNT_UNDEFINED. So 0 arrayLayerCount is treated
as a validation error.

Bug: dawn:1026
Change-Id: I7b4ae024b02ac0d2aa260b2a8c64b09bd967db87
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63660
Reviewed-by: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2021-09-14 02:41:49 +00:00
Brandon Jones 1934e56159 Disable multiple mip levels for r8/rg8unorm textures on Metal
Bug: dawn:1071
Change-Id: I2cc9173f0dff325e4bb2583bb27a98bbaaa61531
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63462
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-14 00:54:59 +00:00
Brian Sheedy cc3f16c437 Suppress Mac 11.5 failure
Suppresses LoadOpClearIntegerFormatsToLargeValues on Mac 11.5 with
Metal on Intel GPUs.

Bug: dawn:1109

Change-Id: Ia4316ee00ad790752fa3b5d1778d885c5eb3a188
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64160
Commit-Queue: Brian Sheedy <bsheedy@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Brian Sheedy <bsheedy@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-13 20:35:49 +00:00
Austin Eng 02fbf168e0 Add validation, storage, and querying of limits
Adds a way to store the limits on the Adapter and the
Device. For now, adapter limits are always the default
limits, and device limits are stored but not used.

This CL also adds usage of an ErrorObjectIdResolver and
Provider in the WGPUDeviceProperties serialization and
deserialization helpers. Serializing/deserializing this
struct should never have objects.

Bug: dawn:685
Change-Id: I1479b4407b0f9ec9f9b2bff62cad7caa693c99d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63983
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-13 18:49:09 +00:00
Bryan Bernhart caf6e8b3f0 Disable remap binding test on WARP.
Adds a supression to the failing test.

BUG=dawn:1106

Change-Id: Ib0cfd49b6d1af59c60d7bc4f2e3e1bec5ae80601
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64062
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2021-09-13 17:27:29 +00:00
Jiawei Shao 42448dafb4 Remove descriptor from the parameter of ComputePipeline::Initialize()
This patch removes the parameter "descriptor" in the function
ComputePipeline::Initialize() so that we don't need to define
FlatComputePipelineDescriptor right now.

For render pipeline, as descriptor->vertex is being used for vertex
pulling (passed into vertexModule->CreateFunction()), we will first
refactor the related code in vertex pulling before removing the
parameter "descriptor" in the function RenderPipeline::Initialize().

BUG=dawn:529

Change-Id: Ib172ac0c76fa24070e78c0e57c3262acad9399b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64000
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-11 09:04:34 +00:00
Michael Tang b21ccebac8 D3D12: Use a separate space for the index offset constants
Tint's HLSL writer can now map sets to spaces, so we can use a dedicated
space  and register to store the index offset constants. Currently, we
use the first space (0) and find a free unused register.

Bug: dawn:1103
Change-Id: Ie1fe95ec314097baf0e0952a0c78222cad493c95
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63223
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Michael Tang <tangm@microsoft.com>
2021-09-10 23:16:33 +00:00
Austin Eng 2092a66ab5 dawn_native: Add RequestDevice to the Adapter
Adds a basic RequestDevice method to the adapter, only in
dawn_native. We will revisit this when we implement adapters
in dawn_wire.

RequestDevice allows us to have tests of the limit bounds
because it receives a callback which can return status codes
and error messages.

Bug: dawn:685
Change-Id: I7a68922b078c6a436f49a16346cb41fb9df9cfee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63982
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-10 21:07:39 +00:00
Austin Eng dc7971ce58 dawn_wire: Support deserializing s->c chained structs
Chained structs *may* contain objects which means
deserialization may need an ObjectIdResolver.
However, in practice, we never need to send chained
structs from the server to the client that contain objects for
a valid command.

The one upcoming need for chained server->client structs is to
serialize limit structs.

Because limit structs never need objects, we provide a dummy
implementation of the ObjectIdResolver which always yields an error.
An analogous change is done for ObjectIdProvider.
These classes will be used in a follow-up CL.

Bug: dawn:685
Change-Id: I1c0f3f2d080377f2e1a77bc6e896f24d3d9ab931
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63981
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-10 20:36:20 +00:00
Corentin Wallez 8ee643c9d0 Remove suppression for fixed Tint issue
Bug: tint:449
Change-Id: I7a1ee41bbd149c211096d0ce84c35ab8a0f937f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63745
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-10 17:46:29 +00:00
Bryan Bernhart d9331035a6 Skip failing CopyTexture tests on WARP
BUG=dawn:1104

Change-Id: Ie4e870fd182bcf5ec0a0007317705a0555a76e0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63980
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2021-09-10 16:09:19 +00:00
Corentin Wallez 363c28e5d1 Remove typedefs for deprecated types.
Bug: dawn:762
Change-Id: I1581d80898d4a98010bb14c5823a1a343c229664
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63383
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@google.com>
Reviewed-by: Brandon Jones <bajones@google.com>
2021-09-10 15:50:19 +00:00
Corentin Wallez d4b85fbd76 Lift suppression for incorrect VVL image layout tracking
Fixed: dawn:785
Change-Id: I618d2d44c02ae5e256841392cb2359f3992e32dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64020
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@google.com>
Commit-Queue: Brandon Jones <bajones@google.com>
2021-09-10 15:02:24 +00:00
Corentin Wallez 7a446220a1 Reenable / delete DISABLED tests.
- We use Tint unconditionally so binding reflection is now correct.
 - WGSL disallows textureSampleCompare in compute shaders and is not
   likely to change.
 - We now support reading back stencil in tests.

Bug: dawn:439, dawn:667, dawn:216, dawn:704
Change-Id: I7ba0026bb906ce985abb495581b56977da7be2da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63680
Reviewed-by: Brandon Jones <bajones@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-09-10 14:56:09 +00:00
Jiawei Shao 6fa50b5e6c Vulkan: Support extension "depth_clamp"
This patch implements the extension "depth_clamp" on Vulkan, which
we need to test if we can correctly record "PrimitiveDepthClampingState"
in FlatRenderPipelineDescriptor - Currently FlatRenderPipelineDescriptor
fails to record this because we incorrectly ignore all the members in
"nextInChain".

BUG=dawn:529, dawn:716
TEST=dawn_end2end_tests

Change-Id: Iec407245a3f37d10a3d1428b0612f0e18e80c616
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63820
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-10 01:33:41 +00:00
James Price 6e1f01f32b metal: Use single-entry point transform
We only remap bindings for the target entry point, so we need to strip
all other entry points to avoid generating invalid bindings for them.

Bug: tint:1170
Change-Id: Ia1a73601e8d620341fb4f7170dfa856632a04245
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63880
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-09 20:40:31 +00:00
Jiawei Shao d7ddfb4a91 Add FlatRenderPipelineDescriptor for CreateRenderPipelineAsync
This patch implements the struct FlatRenderPipelineDescriptor to
save all the pointer members of RenderPipelineDescriptor in
CreateRenderPipelineAsync so that the render pipeline descriptor
is always valid when the render pipeline is created asynchronously.

BUG=dawn:529
TEST=dawn_end2end_tests

Change-Id: I99e06581f84c52d484f877ba29e8cc1ca50d68b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63368
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-09 00:59:29 +00:00
Zhaoming Jiang c6140d5c95 Initializing stencil reference for render pass in D3D12
When creating a new render pass in D3D12, call the OMSetStencilRef
to set the stencil reference value to zero.

Bug: dawn:1097
Change-Id: I5dd94691b1b354b601c06a02d3d5fa619d8b58ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63360
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-08 02:21:33 +00:00
Loko Kung 37a8649f92 Adds ASTC texture compression formats and Vulkan support for them.
The end to end texture tests with the binary information for the textures are generated using the open source astc-encoder tool.

Also: Refactors end2end compressed texture tests to allow for non-4x4 texel compression formats (ASTC formats are not all 4x4).

Bug: dawn:955
Change-Id: I5311a5aa7bd017de72300bf7c87fba6c869b1db5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63121
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-07 18:39:04 +00:00