Commit Graph

3119 Commits

Author SHA1 Message Date
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