Commit Graph

1917 Commits

Author SHA1 Message Date
Corentin Wallez d411726003 dawn_wire: Make ApiProcs call into objects directly.
This CL modifies code generation so that the generated client procs call
the handwritten methods on client objects directly.

Previously the flow was:
  - wgpuBarDoStuff
  - ClientBarDoStuff
  - ClientHandwrittenBarDoStuff
  - client::Bar::DoStuff

With this CL the flow is:
  - wgpuBarDoStuff
  - ClientBarDoStuff
  - client::Bar::DoStuff

This required adding Buffer creation methods on client::Device instead
of calling client::Buffer static methods directly.

Bug: dawn:445

Change-Id: I1b332b71ac7a03685afcf8fd0617d3d27da468cf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24062
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-06-30 18:01:50 +00:00
Corentin Wallez 9fa68833b2 dawn_wire/client: Encapsulate all queue/fence-related logic
This CL only moves code, renames client::Fence members, and introduces
client::Queue. Additional fence methods are added for the interaction
with the queue. There are no functional changes.

With this ApiProcs.cpp is almost passthrough and will be removed in a
follow-up CL.

Bug: dawn:445
Change-Id: I65544ef76b54614452cf7c74a948a96cb35a4cfe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24061
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-30 17:53:08 +00:00
Corentin Wallez 91904cdfde D3D12: Simplify the mapping logic.
This also removes the reliance on BufferBase::IsMapped to know whether
to unmap on destroy. This call was confusing because it was used by the
D3D12 backend to know if its own storage was mapped, but semantically
seemed to check for Buffer::State::Mapped (and not MappedAtCreation).

Bug: dawn:445
Change-Id: I3d6fde1d2996798d53264d5643545f0efb90551a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24060
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <brandon1.jones@intel.com>
2020-06-30 12:21:54 +00:00
Corentin Wallez 1325ab1251 Add Buffer::Get[|Const]MappedRange
This CL adds GetMappedRange reusing the existing GetMappedPointerImpl
call in dawn_native. In dawn_wire tracking is added to keep a
Buffer::mMappedData around.

Tests are added to test the result of Get[|Const]MappedRange in all
buffer states.

Bug: dawn:445
Change-Id: I3737dc4d36f31d392839952da0b5c0d10c7c8a88
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23861
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-06-30 11:51:14 +00:00
Corentin Wallez 2008d15326 Buffer: Always use MappedAtCreation state when applicable.
In a follow-up CL we need to know if the buffer is in the
MappedAtCreation state for validation of GetMappedRange. Having the
state not 100% reflect the state in the spec meant that validation if
GetMappedRange would fail for buffers mapped at creation for which
IsMapWritable is true.

Bug: dawn:445
Change-Id: I4a64335a708b838526da8d65f907b21c782816e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23981
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-06-30 11:05:44 +00:00
Corentin Wallez bae16b4df9 dawn_wire/client: Encapsulate all buffer-related logic in Buffer.cpp
This CL only moves code, renames client::Buffer members and does
additional casts where needed. No functional changes.

Bug: dawn:445

Change-Id: I2bf83ecc1c9b36d5965d0365360dd981fcd41aac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23860
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-30 09:48:14 +00:00
Corentin Wallez b231c7fb71 Null: Make Increment/DecrementMemoryUsage use uint64_t.
Otherwise on 32-bit platforms, creation of a buffer bigger than the max
size_t would overflow the check and no OOM would be produced.

Bug: chromium:1099621

Change-Id: I987a338b150d10c0eabc3eb5fb3b815a5c2a5ca2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23960
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-06-29 20:03:16 +00:00
Yunchao He 1c9e045024 Fix a bug in PassResourceUsageTracker.cpp
In a render/compute pass, if a texture is used as the same usages
across its subresources, and it is also used as different usages
across its subresources. We should mark that it is not used as the
same usages across its subresources for this pass, and we need to
visit every single subresource to track its usages transition.

Bug: dawn:462

Change-Id: Ide0770db62a3b7b85664757b21eb3280a0bb646c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23300
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-06-29 19:00:05 +00:00
Tomek Ponitka bf27bd7a5e Caching empty bind group layouts
Added Device::GetOrCreateEmptyBindGroupLayout which caches the result
after being run and modified PipelineBase::getBindGroupLayout to use
that instead of creating a new empty bind group layout each time.

Bug: dawn:466
Change-Id: I70a5719265784eb8f60c2eedf6db7596462b21bd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23980
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
2020-06-29 11:13:43 +00:00
Bryan Bernhart b7ece23ffc D3D12: Remove ComPtr from d3d12::Buffer::GetD3D12Resource
Creating lots of SRVs needlessly refcounts and floods PIX traces.

BUG=dawn:155

Change-Id: I26fd1019c8c1326f0e6db3e94240a29e4d466be1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24002
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-29 08:50:03 +00:00
Jiawei Shao 330c272fc4 Enable two cases in TextureZeroInitTests with swiftshader
This patch enables two tests with swiftshader after the fix in
https://dawn-review.googlesource.com/c/dawn/+/23200.

BUG=dawn:22
TEST=dawn_end2end_tests

Change-Id: I27ff5afe6735aff3c416cbe65d039006b1ceae55
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24040
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-29 08:30:03 +00:00
Corentin Wallez ff90599cdf Replace TextureCopyView::arrayLayer -> origin.z in backends
Also fix a misuse of VkBufferImageCopy that caused some Swiftshader
failures.

Bug: dawn:22
Change-Id: Ie812a590d70c7561dfcf2f78ce6c530187610e65
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23200
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2020-06-26 11:07:00 +00:00
Jiawei Shao 2a6cc4f8fb Optimize B2T and T2B copies with multiple array layers on Metal
This patch moves the computation of TextureBufferCopySplit outside of
the loop over each copy texture array layer so that we only need to do
the computation once for each B2T and T2B copy command.

BUG=dawn:453
TEST=dawn_end2end_tests

Change-Id: I1fcfc972504f845467af92a77bc37870ed7b52a7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23720
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-25 00:00:18 +00:00
Austin Eng 8ab3719fc4 Fix validation of multisampled BGL bindings
Bug: chromium:1097501, chromium:1097514
Change-Id: I18f03398488cc3b5adf6755989e787e117d8a004
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23640
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-06-23 00:22:24 +00:00
Jiawei Shao 92379bff49 Support copying multiple array layers in one B2T and T2B copy command
This patch adds the support of copying with multiple texture array
layers in one buffer-to-texture and texture-to-buffer copy command.

BUG=dawn:453
TEST=dawn_end2end_tests

Change-Id: If009dbb29f2b0ef0667715eed0d66053b1491fd4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23248
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-06-21 09:33:44 +00:00
Austin Eng 250f26229b Use TypedInteger for BindGroupIndex
Bug: dawn:442
Change-Id: I889a943cbaf2d349c31a15fdf126d66964bdd0a7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23247
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-06-20 01:30:32 +00:00
Jiawei Shao e5d94c31a0 Fix a bug in ComputeTextureCopyBufferSize with empty copySize
This patch fixes a bug in buffer-to-texture and texture-to-buffer copies
when copySize.height == 0 or copySize.depth == 0. Previously we miss the
checks if either copySize.height or copySize.depth is 0 before doing
(copySize.height / blockHeight - 1) and (copySize.depth - 1) thus we
will get incorrect results because of arithmetic overflows.

This patch fixes this bug by adding the missed check and adds the
related regression tests in dawn_unittests

BUG=dawn:453
TEST=dawn_unittests

Change-Id: I970e420c0fa7f0b61c656365bef079c123a59e6a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23520
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-06-19 22:39:53 +00:00
Idan Raiter f434fdc6ed Add minimum buffer size validation
Bug: dawn:459
Change-Id: I755cc0ada7be7b1cb71724cb410ab0c3a88cea24
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22421
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-19 21:39:23 +00:00
Austin Eng b75075ac7b Protect against huge buffer allocations on macOS 10.12, 10.13
|MTLDevice maxBufferLength| is not available until 10.14, so on
lower versions of macOS, try using |recommendedMaxWorkingSetSize|

Bug: dawn:450
Change-Id: I52dc4211cf3d7014771d580a9af9c72abe92a375
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23263
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-06-19 18:47:33 +00:00
Austin Eng 0e9e5ee8aa Skip Buffer OOM tests when using ASAN
ASAN throws when hitting OOM conditions which these tests intentionally
try to create.

Bug: dawn:450
Change-Id: I635480ae329cd5ace55287d77e2b79e663174f49
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23246
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-19 17:35:33 +00:00
Corentin Wallez 90abd47a28 dawn_wire: Factor the common command serialization pattern.
Bug: dawn:445

Change-Id: I15a99a126c0494fd06dd727ff5c9008cde675d76
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23560
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-19 16:49:43 +00:00
Austin Eng 8f9523eb38 Add support for multisampled sampling
This CL adds support for multisampled sampling on the D3D12 backend.
This was already working on other backends. It also adds tests that all
of the sample locations are correct.

Bug: dawn:431
Change-Id: I6849e5e2d708ad4824e6db2665d668d43a4ef5ea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23245
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-19 16:21:33 +00:00
Corentin Wallez 4e4ebe87ad Vulkan: Simplify PNextChainBuilder
Change mTailPtr to mCurrent that's a VkBaseOutStructure*.

Bug: dawn:464
Change-Id: Ic10a0abc95e279e1537786601d006cf18305687a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23540
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-19 16:08:43 +00:00
Corentin Wallez be637db589 Vulkan: Correctly request 16bit shader features.
All the querying of extensions was correctly handled for the WebGPU
ShaderFloat16 extensions, except that we forgot to request it when
creating the VkDevice.

In practice this doesn't crash as most drivers won't check if the
extension is enabled, and just compile the shader code correctly.
However the Vulkan Validation Layers complain. This CL fixes it by
requesting the features on device creation.

Bug: dawn:426
Change-Id: Id7307bb4f1d08a10bec9fc7bf0500c5761f96ff7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23203
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-06-19 14:41:23 +00:00
Austin Eng 693e88ae85 Vulkan: consider VK_ERROR_OUT_OF_HOST_MEMORY an OOM error
Bug: dawn:450
Change-Id: I89095a23a5bf7e17553b6945f79347ba31d732c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23480
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-19 07:30:13 +00:00
Corentin Wallez 581c407cd2 Fix TypedInteger hash compilation failure with stdlibc++
TypedInteger.h didn't include <functional> which made the reference to
std::hash cause a compilation failure. Fix this by moving TypedInteger
hashing to HashUtils.h so that TypedInteger doesn't include <functional>
in all of its users.

Bug: dawn:442
Change-Id: I5a0271bb187682616eb5ef3a13bb7f6271203453
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-18 09:00:48 +00:00
Austin Eng 7a4685f448 Add TypedInteger
This CL adds a TypedInteger helper which provides additional type
safety in Dawn. It is a compile-time restriction that prevents integers
of different types from being used interchangably in Debug builds.

It also adds ityp::{array,bitset,span} as helper classes to wrap std::
versions (not span). These accept a template paramter as the Index type
so that typed integers, or enum classes, may be used as a type-safe
index.

For now, bind group layout binding indices use TypedInteger. Future
CLs will convert other indices to be type-safe as well.

Bug: dawn:442
Change-Id: I5b63b1e4f6154322db0227a7788a4e9b8303410e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19902
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-06-17 22:35:19 +00:00
Natasha Lee 3f4f356611 Fix D3D12 Device Initialize calls NextSerial
Device shouldn't be used until after DeviceBase::Initialize so we need
to move the NextSerial call to after Device Initialization is completed.

Bug: chromium:1094477
Change-Id: I2ab317c1d75f853c022faac3fc0bbd66fbd7c14e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23261
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2020-06-16 23:55:08 +00:00
Bryan Bernhart 67cd013b62 D3D12: Workaround incorrect debug layer error handling
Retrieval filter was receiving errors that shouldn't be
stored or not storing new errors. Since these errors are
never reaching the storage filter or being stored without
being filtered, this workaround removes the storage
filter entirely and filters them upon being retrieved.

After the change, two new E2E tests fail
backend validation and require further investigation.

Bug: dawn:460
Change-Id: I92d8c55c71832064b94e8ff0307e7af57ea81fda
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23144
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-06-16 23:46:59 +00:00
Ryan Harrison 1b3ed54ffb Use Tint public header
Roll third_party/tint/ be45ff508..b8f493005 (12 commits)

https://dawn.googlesource.com/tint/+log/be45ff508124..b8f4930055df

$ git log be45ff508..b8f493005 --date=short --no-merges --format='%ad %ae %s'
2020-06-16 rharrison Make #define values public in BUILD.gn
2020-06-16 dj2 Cleanup formatting and linter.
2020-06-16 dneto [spirv-reader] Support ifbreak with other forward edge
2020-06-16 dneto [spirv-reader] Add Namer::MakeDerivedName
2020-06-16 dneto [spirv-reader] Update TODOs in test matrix
2020-06-16 dneto [spirv-reader] Add OpCompositeExtract
2020-06-15 dsinclair [spirv-writer] Allow emitting an array stride.
2020-06-15 dsinclair Determine types for module scoped variable constructors.
2020-06-12 dneto [spirv-reader] Add OpCompositeConstruct
2020-06-12 dneto [spirv-reader] First GLSL.std.450 instructions
2020-06-11 dneto [spirv-reader] Add fallthrough
2020-06-11 dneto [spirv-reader] Add switch-selection

Created with:
  roll-dep third_party/tint

Change-Id: Ia529ee3c49e426715b09d5e0c2546061d7979c17
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23280
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-06-16 19:24:18 +00:00
Natasha Lee 3fe84b5b33 Fix AssertAndIgnoreDeviceLossError to handle errors injected by fuzzer
Fuzzer recently started sometimes injecting errors with
CheckHRESULT returning E_FAKE_ERROR_FOR_TESTING, which needs to also be ignored
in AssertAndIgnoreDeviceLossError so that we can continue with destruction.

Rename AssertAndIgnoreDeviceLossError to IgnoreErrors

This CL also adds Austin's pretty printing of HRESULT results as hex values
and adds printing of "E_FAKE_ERROR_FOR_TESTING" error.

Bug: chromium:1094448
Change-Id: I6715a5eec02919a3e3b4c86d493b3f7e84c5e206
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23241
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-06-16 17:53:38 +00:00
Brandon Jones ac6bd4c98f Fix fuzzer hang when waiting for fence signal after device loss
When the fuzzer passes the command DeviceLoseForTesting, the
DawnWireServerFuzzer will hang forever when waiting for a fence signal
because the device was lost. This commit sets a callback on device loss
which gives an extra condition to break the hang.

Bug: dawn:444

Change-Id: I0157358ed6da39cc6fcab7e1be8a3d5fde74266f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23141
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Natasha Lee <natlee@microsoft.com>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2020-06-16 16:55:38 +00:00
Jiawei Shao 59cfe3ea03 Clean up CopyTests
This patch does several clean-ups in CopyTests as a preparation of
supporting buffer-to-texture and texture-to-buffer copies with multiple
texture array layers.
1. Remove the zero-initialization of textures in CopyTests_B2T
2. Use a big buffer that contains the pixel data in all the texture
   array layers instead of several small ones that only contains one
   texture array layer.
3. Make CopyTests_T2T::DoTest() also use CopyTests::TextureSpec as its
   input parameter.
4. Add tests for the copies with multiple texture array layers. In this
   patch we just copy the data once per texture array layer, while in
   the next patch we will be able to copy the data for all the related
   texture array layers in one copy command.
5. Move some helper functions for copy tests to WGPUHelpers.cpp

BUG=dawn:453
TEST=dawn_end2end_tests

Change-Id: Ia0150a6c55fffce3e24dda2cd45fd920b0873dc9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23120
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-06-16 12:26:38 +00:00
Corentin Wallez fefb452f29 Reland: Vulkan: Enforce fixed subgroup size for compute shaders.
Reland after a refactor of how the extension handling work in the Vulkan
backend.

The original author is David Turner <david.turner.dev@gmail.com>.

This CL ensures that, on architectures with a varying subgroup size,
compute shaders are always compiled with a fixed subgroup size to
avoid consistency issues when one shader writes data in a subgroup-size
dependent layout to GPU memory, to be read by another shader in a
future dispatch.

At the moment, only Intel ICDs are known to implement this [1],
and the code uses a heuristics to chose the size of 16, which seems to
be the sweet spot according to Intel engineers.

+ Update the PNextChainBuilder class to deal with the fact that
  VkComputePipelineCreateInfo::pNext is defined as a const void*,
  which created compiler errors in the previous implementation.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=108875

Bug: dawn:464
Change-Id: I035ee06084fcc964742f0bff4c54cff257c742ae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23202
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-06-16 09:17:48 +00:00
Corentin Wallez 5cef1162b9 Reland: Vulkan: Report and enable subgroup size control device extension.
Reland after a refactor of how the extension handling work in the Vulkan
backend.

The original author is David Turner <david.turner.dev@gmail.com>.

Certain Vulkan ICDs (Intel ones notably) will compile SPIR-V
shaders with an liberal, compiler-selected, subgroup size (i.e.
either 8, 16 or 32). For more context, see [1].

This can be a problem for compute, when one shader stores data
in device memory using a subgroup-size dependent layout, to be
consumed by a another shader. Problems arise when the compiler
decides to compile both shaders with different subgroup sizes.

To work-around this, the VK_EXT_subgroup_size_control device
extension was introduced recently: it allows the device to
report the min/max subgroup sizes it provides, and allows
the Vulkan program to control the subgroup size precisely
if it wants to.

This patch adds support to the Vulkan backend to report and
enable the extension if it is available. Note that:

- This changes the definition of VulkanDeviceKnobs to
  make room for the required pNext-linked chains of
  extensions.

- A helper class, PNextChainBuilder is also provided in
  UtilsVulkan.h to make it easy to build pNext-linked
  extension struct chains at runtime, as required when
  probing device propertires/features, or when
  creating a new VkDevice handle.

- This modifies VulkanDeviceInfo::GatherDeviceInfo() to
  use PNextChainBuilder to query extension features and properties
  in a single call to vkGetPhysicalDevice{Properties,Features}2.

Apart from that, there is no change in behaviour in this CL.
I.e. a later CL might force a specific subgroup size for
consistency, or introduce a new API to let Dawn clients
select a fixed subgroup size.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=108875

Bug: dawn:464
Change-Id: I01e5c28e7dac66f0a57bf35532eb192912b254fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23201
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-16 07:54:28 +00:00
Corentin Wallez 984493d0ac Deprecate TextureCopyView::arrayLayer -> origin.z
All existing tests and samples are updated and deprecation tests added.

CommandEncoder still encodes using arrayLayers so the backends are
unchanged. They will be handled in a follow-up CL.

Bug: dawn:22

Change-Id: Ib5346b46eb04d97349cab8f32ef8da5034726ca8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23104
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-06-16 03:05:17 +00:00
Austin Eng cf1fdf413c Handle OOM buffer allocations better
This CL checks buffer sizes before creating map read/write handles.
It is an error to map a buffer that can't be addressed on the CPU.

It also changes client-side synchronous errors on mapAsync to be
normal map failures, and not device lost errors. These should be
recoverable.

The CL adds additional testing for really large, but not UINT64_MAX
buffers, and fixes a VVL warning when buffer allocations exceed the
size of their memory heap.

Bug: dawn:450, dawn:398, chromium:1014740
Change-Id: Ieb34c04c3d01c429b7e3b7810729d5e91ecb6270
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22626
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-15 23:42:13 +00:00
Yunchao He e5be22e949 D3D12: use one barrier to transit states for all subresources
If a texture's old states of all subresources are the same, and its
new states are the same too, then we can use one barrier to transit
states for all subresources. We don't need to use one barrier per
each subresource.

This change can reduce barriers we dispatched, in order to improve
performance for particular situations.

Bug: dawn:441

Change-Id: I9fe9dabda725e05d4ce5a8e69ee7b40e6724a22a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23145
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-06-15 18:32:02 +00:00
Yunchao He 1c2a039e04 Optimize subresource tracking - use texture view
Bug: dawn:441

Change-Id: I5cdfc1d84b27eb0b127d34ee829ceedf15f1150c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22321
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-06-15 18:26:12 +00:00
Yunchao He ee7debf44d Refactor subresource related variables to a struct - backend
This patch put subresource related variables like baseMipLevel,
levelCount, baseArrayLayer, layerCount into a single struct at
backends.

Bug: dawn:157

Change-Id: I50c6bb0ed8ae7a184506c23cab4b64a472bbd75e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23163
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2020-06-15 17:24:42 +00:00
Corentin Wallez 8a5325ca9a Texture: Change to mArrayLayerCount to mSize.depth
This makes the tracking in TextureBase match the shape of
wgpu::TextureDescriptor.

GetSize() becomes a bit more surprising because the depth can sometimes
be the array size, so new getters GetWidth(), GetHeight() and GetDepth()
are added.

Some simplifications to the backend texture creation code are included
that will make it less error prone to add support for 1D / 3D textures.

Bug: dawn:22

Change-Id: I33b6ca99af9d58fc88f5f626cfd5e2e62a8b45cb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23103
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-15 09:57:51 +00:00
Corentin Wallez 4234d78201 Deprecate TextureDescriptor::arrayLayerCount -> size.depth
This updates CL:

 - Adds a deprecation warning to use size.depth instead of
arrayLayerCount.
 - Changes all tests and samples to use size.depth.
 - Adds deprecation tests for the change.

In particular the state tracking in TextureBase isn't changed yet
because it requires non-trivial changes in the backends. It will be done
in a follow-up CL.

Bug:dawn:22

Change-Id: Ic02dfb5baaba8d5b06cd339ce988e9b1d16cb5e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23101
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-15 09:46:01 +00:00
Jiawei Shao 6b3a974b42 OpenGL: Enable nonzero_clear_resources_on_creation_for_testing on buffer
This patch enables nonzero_clear_resources_on_creation_for_testing
toggle on buffer on OpenGL backends as a preparation of supporting
buffer lazy-initialization in Dawn.

BUG=dawn:414
TEST=dawn_end2end_tests

Change-Id: Ib49ad17a5d89e14dbdb08d2eb8d6441fadb68f10
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23143
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-06-13 01:04:53 +00:00
Jiawei Shao 2ef2be746d D3D12: Enable nonzero_clear_resources_on_creation_for_testing on buffer
This patch enables nonzero_clear_resources_on_creation_for_testing
toggle on buffer on D3D12 backends as a preparation of supporting
buffer lazy-initialization in Dawn.

BUG=dawn:414
TEST=dawn_end2end_tests

Change-Id: Id4f45ff5ccf906692c3855451b120aa56f68c7a9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23142
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-06-13 00:59:13 +00:00
Brandon Jones 1663b1d04d Make D3D12 Fuzzer Only Build On Windows
Prevents the d3d12 fuzzer from building on non-windows platforms.

bug: dawn:444
bug: chromium:1094230
Change-Id: I3ce20c645b3fe99b51e06b493ced34308d7cc21e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23162
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2020-06-12 17:56:31 +00:00
Yunchao He 4fd4aa1f19 Vulkan: use one barrier if we can for non-pass operations
When we do transition barriers for a texture view outside of a pass
(say copy, clear, initialization), if the texture view can cover all
subresources, and its old usages across all subresources are the
same, then we can use one transition barrier. We don't need to use
separate barrier per each subresource.

This patch can reduce barrier we delivered, and improve performance
for particular situations.

Bug: dawn:441

Change-Id: I2ae9b39793915553cbaaceacaf58bf87c9ba3bc6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23129
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2020-06-12 17:01:41 +00:00
Corentin Wallez f87b62a904 Don't store unnessary SubresourceRange members in TextureBase
This is preparatory change for a subsequent CL that will deprecate
TextureDescriptor::arrayLayerCount in favor of size.depth.

Bug: dawn:157
Bug: dawn:22
Change-Id: Id64556dc81056fbe7751073ffe9872026c145e77
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23102
Reviewed-by: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-12 16:51:51 +00:00
Corentin Wallez 5c9f7af77d Vulkan: Properly handle Device extension dependencies
The checks for dependencies of Device extensions were incomplete, makes
sure the transitive dependencies of the extensions we care about are all
known so they can participate in the dependency check.

Also removes a workaround for surprising Vulkan behavior with instance
extensions getting promoted as device functions. This should be handled
correctly now as DeviceExt contains the physical device extensions as
well.

Bug: dawn:457

Change-Id: I4b79729d809c9edfedcb075a0e6aa5b4dd473ab3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22942
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-06-12 08:19:31 +00:00
Brandon Jones 9435068a36 Track ShaderVisibleDescriptorHeap Upon Allocation
Fixes bug where a newly allocated ShaderVisibleDescriptorHeap would be
untracked in the residency LRU upon allocation, causing Dawn's residency
manager to become out of sync with D3D12's internal residency refcount
by calling MakeResident once more than needed.

Bug: dawn:193
Change-Id: I47804471b41df476db989634e50bded6006e05aa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23125
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-12 08:17:41 +00:00
Natasha Lee 82027bd8ac Fix ResourceMemoryAllocation null dereference
Moves last TickImpl call during ShutDown to only be called if the
device was fully created.

Bug: dawn:400, chromium:1093639
Change-Id: I25437e3b33d0fc57f21e82c63bfb0fd4d9384175
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23123
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-12 08:13:41 +00:00
Yunchao He 5fafb49c7b Refactor subresource related variables to a struct
This patch put subresource related variables like baseMipLevel,
levelCount, baseArrayLayer, layerCount into a single struct at
front-end. We have a lot more at backend too, a following patch
will do that.

Bug: dawn:157

Change-Id: Iab5633a4246b6ae89b80c39f5672dbb31d7a3e78
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22704
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2020-06-12 00:37:31 +00:00
Bryan Bernhart c7778a27cb Prevent size overflow for sub-allocation.
D3D/VK driver may return a size larger than requested and could cause
PowerOfTwo() to overflow. This change adds a check to ensure the size
is within the limit before attempting sub-allocation.

BUG=dawn:27

Change-Id: I2b2ce727abff953642a69b65c8f30be8e53e562d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23060
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-06-11 18:58:26 +00:00
Corentin Wallez 265fb062be Vulkan: handle Device extensions more programmatically
Similarly to the CL for Instance extensions, it makes each device
extension linked to an enum class and a bitset. Logic surrounding device
extensions is changed to take advantage of this to be more programmatic
and less error prone when adding support for a new extension.

Bug: dawn:457
Change-Id: Iecf623c40b890b7e00ba972d5eac0712866692b5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22941
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-11 17:35:26 +00:00
Yunchao He 2532a718c5 Vulkan: use one barrier to transit states for all subresources
If a texture follow this rule:
* old usages of all subresources are the same
* new usages of all subresources are the same
Then we can use one barrier to transit states for all subresources.
We don't need to use one barrier per each subresource.

This patch adds a flag at front-end to capture many (but not all)
situations which follow the rule above, then we don't need to loop
over every subresource at Vulkan backend.

Bug: dawn:441
Change-Id: I6124ee2cb09c9142fefd8f057dc6d2659301e2d4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22702
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-11 17:28:35 +00:00
Brandon Jones 1a15991c84 Add fuzzer for the d3d12 backend
Adds harness for fuzzing the d3d12 backend with a WARP device.

Bug: dawn:444
Change-Id: I3e5ca325b19eb8b6cfe53e4d833c5acbbd293a26
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22880
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-11 17:12:35 +00:00
Corentin Wallez ba3c6becdf Fix compilation error of MemoryServiceDmaBuf on ChromeOS
Bug: dawn:457
Change-Id: Id90d392470764b651bff8a804b8f3b54b6383047
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23100
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-11 13:37:36 +00:00
Corentin Wallez 0dc70785d8 Vulkan: handle Instance extensions more programmatically
At the moment each instance extension needs special handling
in 6+ places when added to the Vulkan backend. This is very
error-prone and makes it difficult to do changes in how they
are extensions are handled.

This CL makes instance extensions linked with an enum class
and a bitset to know which are available (instead of individual
booleans). A table of known extensions with more information like
`versionPromoted` so that they can be handled programmatically.

Bug: dawn:457

Change-Id: I266deb730eb2b7f3ab0ee7ada1b06ff9748a60e4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22940
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-11 11:48:05 +00:00
Xing Xu 667238b97d Add storage texture case reading from read-only then writing into write-only
This case verifies that reading from one read-only storage texture then
writing into another write-only storage texture in one dispatch are
supported in compute shader.

Bug: dawn:458
Change-Id: If1b4c13da067fa39b45a378b54c22a4162695c8d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23040
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2020-06-11 11:36:25 +00:00
Corentin Wallez 90ad1a34dd Add CopyB2B tests including for 0-sized copies
This catches a few driver bugs or validation errors when doing empty
copies.

Bug: dawn:446
Change-Id: Ibef50b0c03b2fa24bc00cf5c7b6d26b8ac6fae8a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19602
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-11 11:23:35 +00:00
Corentin Wallez 13f4650155 Add tests and fix (create) mapping zero-sized buffers
When creating a zero-sized buffer mapped, StagingBuffer creation
is skipped. This required adding a new MappedAtCreation state
since mStagingBuffer couldn't be used as a tag value for that.

Made the OpenGL backend always create non-zero-sized buffers.

Finally added tests for MapRead/WriteAsync and CreateBufferMapped
of zero-sized buffers.

Bug: dawn:446
Change-Id: I04f6fe98fd646f1867c21065cd1cd33a1595e19f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21481
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-11 11:07:05 +00:00
Hao Li b6eff5acf0 Query API: QuerySet
- Add QuerySet w/o backends implementation.
- Add validation tests

Bug: dawn:434
Change-Id: Id9fed4e42fac464b1254cd2e9cf5337a1d803089
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2020-06-11 00:34:14 +00:00
Jiawei Shao 70d75c8c00 Vulkan: Enable nonzero_clear_resources_on_creation_for_testing on buffer
This patch enables nonzero_clear_resources_on_creation_for_testing
toggle on buffer on Vulkan backends as a preparation of supporting
buffer lazy-initialization in Dawn.

BUG=dawn:414
TEST=dawn_end2end_tests

Change-Id: I7619d02ae898e30fd15438d35437802a09e959cc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22981
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-06-10 21:40:10 +00:00
Jiawei Shao 15cbb6b76a Enable CopyTests_T2T/CopyWithinSameTexture* tests on D3D12
This patch enables the tests CopyTests_T2T/CopyWithinSameTexture* on
D3D12 after the D3D12 texture subresource tracking has been supported.

This patch also changes the related comment in Vulkan as WebGPU CG has
already decided to disallow the overlaps among source and destination
subresources in texture-to-texture copies.

BUG=dawn:453
TEST=dawn_end2end_tests

Change-Id: Ibf008c800cfea62658050f565f321a391412c54c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23000
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-06-10 21:38:50 +00:00
Bryan Bernhart 18992f7be9 D3D12: Fix pipeline layout overflow when using dynamic offsets.
Pipeline layout incorrectly indexes into a root table array
when there are more root descriptors than root tables.
To fix, the array is dynamically sized where parameters
are appended instead of indexed into the root signature.

Bug: dawn:449
Change-Id: I6d7f65fb791d323704b1c3a3af9c871a79e32a30
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22960
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-10 16:09:45 +00:00
Natasha Lee 4aca14ccb6 Unify TickImpl called during Device shutdown.
Bug: dawn:400
Change-Id: I26ad1a739d123ebc81a2e7d309c8a42f517be06c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22662
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-10 14:45:20 +00:00
Xinghua Cao 527080ff03 Check FP16 support on Metal backend
Metal supports FP16 on both macOS and iOS, so we can
unconditionally enable this extension on Metal backend.

BUG=dawn:426
TEST=dawn_end2end_tests

Change-Id: I16c9c907bb112a66e76506ede9bc89a04313d7b3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22882
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
2020-06-10 03:29:34 +00:00
Jiawei Shao 14f20b0ab3 Metal: Enable nonzero_clear_resources_on_creation_for_testing on buffer
This patch enables nonzero_clear_resources_on_creation_for_testing
toggle on buffer on Metal backends as a preparation of supporting buffer
lazy-initializations in Dawn.

BUG=dawn:414
TEST=dawn_end2end_tests

Change-Id: Ia7106482922aeb0521affa206f459d40938a0131
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22861
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-06-09 17:09:04 +00:00
Jiawei Shao b6c8855e3a Output more details when pipeline layout mismatches shader declaration
This patch makes Dawn provide more detailed error messages when the
pipeline layout is not compatible with shader module, which is helpful
to debug such errors in WebGPU applications.

BUG=dawn:456

Change-Id: Ib5a870d8e66645481434c4d3dc6fdc1a585aac36
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22881
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-06-09 17:06:04 +00:00
Yunchao He 182af0a4c2 Implement texture subresource on D3D12
When we use a texture for different purpose, we need to add proper
barrier(s) in order to make it ready. Previously, the barrier is
done per entire texture. So it is invalid to sample/read/copy from
one subresource (say a mip/array slice) and render/write/copy to
another subresource of the same texture at the same time.

With this patch, barrier is set per each texture subresource. So it is
valid to use a subresource as source and use another subresource of the
same texture as destination at the same time.

However, planar slices like depth/stencil planes are not handled
gracefully. This is a TODO task. Another task is to combine barriers
into one if they can be combined. I will do this optimization in
another patch in near future.

Bug: dawn:157

Change-Id: I783a76cb88fcdffb60c307ddfb89d50f1583201a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22101
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2020-06-09 16:18:04 +00:00
Idan Raiter e5b40629ec Reset bind group aspect in SetBindGroup
Change-Id: Ic123578764266a913a3a9a814d5b6c01f47d4ff9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22860
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
2020-06-09 15:14:14 +00:00
Yunchao He 0a79bee135 Vulkan: Combine all pass barriers in a single call
This patch combines barriers in a render/compute pass into one
function call.

Previously, we need to dispatch barrier(s) for each buffer/texture
in a pass. So we may need quite a lot function calls to deliver
barriers in a pass in real web applications. One example is that
we did see that too many function calls to deliver barriers in
Aquarium (WebGPU porting) contributed to CPU usage and bottleneck.

Bug: dawn:441

Change-Id: Ibe44967fefd2e1e6e64df4587146c4fb7fbe8e73
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22700
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-06-08 22:27:18 +00:00
Xinghua Cao db8f804bc3 Reland "Check FP16 support on vulkan backend"
This reverts commit 0357eed7de
and reland commit bdc05c3d5f.

The Vulkan-Loader has a bug where if the instance is created
with Vulkan 1.1 and not the promoted extensions, it will skip
emulation and if the ICD doesn't support Vulkan 1.1 nor the
extensions. Enable the promoted extensions, even when creating
a Vulkan 1.1 instance.

Original change's description:
> Check FP16 support on vulkan backend
>
> This patch check FP16 support on vulkan backend, and introduces
> the shader_float16 extension.
>
> BUG=dawn:426
> TEST=dawn_end2end_tests
>
> Change-Id: Ie09568a416ce9eb2c11afeede3e7da520550d5fb
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21901
> Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>

Bug: chromium:1087896, dawn:426
Change-Id: I2c4465fb2fe957966b44d3e5840112219481c639
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22781
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-08 12:18:21 +00:00
Jiawei Shao e472c459b9 Add validations on the texture-to-texture copies within same texture
This patch adds validations on the texture-to-texture copies within the
same texture to align with the latest change in WebGPU SPEC: When the
source and destination textures are the same one, the source and the
destination subresources involved in the copy must not overlap.

Note that we don't enable the newly added end2end tests on D3D12
because when doing texture-to-texture copy within the same texture, we
need to set the source subresources into TRANSFER_SRC state and set the
destination subresources into TRANSFER_DEST state, while right now we
don't support subresource tracking on D3D12.

BUG=dawn:453
TEST=dawn_unittests
TEST=dawn_end2end_tests

Change-Id: I6408640d01beaf6ab9ef30b001e9c87cfecbdd65
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21601
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-06-08 11:30:01 +00:00
Austin Eng ee0516e398 D3D12: Properly compute rowsPerImage for lazy texture clear
This code was incorrectly passing 0 and dividing by zero for
non-renderable, unaligned-size textures.

Bug: dawn:451
Change-Id: Ic79183a7ccee712b9a9ee002056f090c8e9fae15
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22665
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-08 09:53:11 +00:00
Jiawei Shao a2fe305797 Add all formats used as writeonly storage texture in StorageTextureTests
This patch changes all the tests related to write-only storage textures
in dawn_end2end_tests StorageTextureTests to make them test all the
texture formats that support being used as storage textures in WebGPU.

BUG=dawn:267
TEST=dawn_end2end_tests

Change-Id: I4e49efc21f768a9b7645bf334bd41a97fd4838e7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22663
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-06-06 00:45:40 +00:00
Corentin Wallez 45aed839e9 CopyFromStagingToBuffer: ASSERT size is not 0
Zero-sized copies are invalid in a couple backends, and in follow up
CLs CreateBufferMapped will be change to handle zero-sized buffers
correctly.

Bug: chromium:1069076
Change-Id: Ieef62a13182bbe1e939a3847980c91339e42aa8f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22460
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-05 15:44:03 +00:00
Jiawei Shao 0a6a9d8692 Test all formats used as readonly storage texture in StorageTextureTests
This patch changes all the tests related to read-only storage textures
in dawn_end2end_tests StorageTextureTests to make them test all the
texture formats that support being used as storage textures in WebGPU.

BUG=dawn:267
TEST=dawn_end2end_tests

Change-Id: I4d6ddbee638a787a2dcfc626bd4963a9b9043772
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22640
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-06-05 01:02:57 +00:00
Natasha Lee 783cd5a79c Avoid processing already processed tick
To avoid overly ticking, we only want to tick when:
1. the last submitted serial has moved beyond the completed serial
2. or the completed serial has not reached the future command serial added
by the trackers (MapRequestTracker, FenceSignalTracker, ErrorScopeTracker).

Bug: dawn:400
Change-Id: Ie7c65acc332846ac1a27f9a18f230149d96d2189
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19062
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2020-06-04 02:26:46 +00:00
Austin Eng 62b08f845f Test that vertex attributes can overlap
Bug: dawn:433
Change-Id: I47d9ffe16d6ad7730628dc27ec6708006cf4384d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22560
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-06-03 22:47:16 +00:00
Brandon Jones 0395ca9b66 Try To Recover From MakeResident Failure
Per MSDN recommendations, Dawn should handle MakeResident failures by
evicting some more and attempting MakeResident again.

Bug: dawn:193
Change-Id: I0a9d326dcd000360f6eafb5691efb4987a77e8d5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22280
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2020-06-03 17:04:45 +00:00
Austin Eng 2f02207805 Generate specific error when BGL storageTextureFormat is missing
Some WebGPU CTS tests were failing with invalid WGPUTextureFormat
when really the format was simply missing. This CL updates
the validation code so it is more clear.

Bug: dawn:433
Change-Id: Ie7aacd01ea424d9f5df0078703a474e98b72ce41
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22543
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-06-03 16:43:35 +00:00
Austin Eng 0768ffa742 Metal: Handle Buffer allocation failure
Bug: dawn:433
Change-Id: I6549c4a1e31171257761397b018090d0eb7471e6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22424
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-06-03 16:14:35 +00:00
Corentin Wallez d586b079f2 Fix compilation failure with libstdc++
Queue.cpp was missing the <cstring> include for memcpy.

Bug:
Change-Id: Iaa498ec82c85dd6c7db7e7b09392baec08eb9e3c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22461
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-03 13:36:15 +00:00
Bryan Bernhart adbf9153d9 D3D12: Fix RO storage buffer mismatches.
If the shader declares a storage buffer RO but uses storage buffer in
the BGL, the shader compiler will be told to treat these bindings as
UAV instead of SRV to avoid PSO mismatches.

Bug: dawn:410
Change-Id: I3be3257449de55fd2d35e914233b48c6f7121b58
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22322
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-02 19:16:20 +00:00
Austin Eng 3fb9c1bbfb Add warning for non-c-typedef-for-linkage
This is blocking Skia from updating to newer clang

Tbr=cwallez@chromium.org
Bug: chromium:1064305
Change-Id: I7d894dba701ebe2fe0e1b78d5fb42032d88846aa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22522
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-02 18:54:20 +00:00
Austin Eng 5b3cdc66fd Skip creating the VkImageView if the texture usage is only Copy
Bug: dawn:399
Change-Id: Iedd097dc96b248499fefd0c259b13fb55fc39f0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22380
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-06-02 18:39:59 +00:00
Corentin Wallez 47a3341e07 Deprecate Buffer::SetSubData in favor of Queue::WriteBuffer
Bug: dawn:22
Change-Id: I00b3cd65ac4eb494b05918251f4b3b2bcaf24f71
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22200
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-06-02 09:24:39 +00:00
Austin Eng 3b7d0858bf D3D12: Skip dynamic buffer bindings with None visibility
This was hitting an ASSERT because D3D12 doesn't have an option
to set None as the shader visibility.

Bug: dawn:448
Change-Id: I3e056e531e7d1bb89da1736bc609bfe97a2fa194
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22324
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-06-01 23:42:57 +00:00
Corentin Wallez b730bfa356 Fix missing space in an error string.
TBR=enga@chromium.org

Change-Id: I7c543fa0f0fad721edd5a5de585ddd54e757535d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22401
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-01 17:27:32 +00:00
Austin Eng 2dfc42dd39 Fix ValidateEntireSubresourceCopied
This function was validating the depth of the copy which is
incorrect for 2D array textures. Remove this check for now
since it would be only relevant for 3D textures which Dawn
does not support yet.

Bug: dawn:424
Change-Id: I756080a899a7c5effe5843a530d4db0571bc10d5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22323
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-06-01 16:19:02 +00:00
Corentin Wallez 13110bff05 d3d12_platform: ensure windows.h macros don't cause compile errors
The windows.h macros were undefined only at the end of this platform
header previously but with the addition of d3d12sdklayers.h the
definition of ID3D12DebugQueue::GetMessage picked up the macro and
became GetMessageA or GetMessageW, but Dawn code referred to it as
GetMessage causing a compilation error.

Fix this by preemptively loading windows.h and undefing some of the
macros so that the D3D12 headers don't see them.

Bug:
Change-Id: I1985cc20a9bdec1d25619ac5088e918b2acf8ecb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22400
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-01 13:58:22 +00:00
Corentin Wallez 0357eed7de Revert "Check FP16 support on vulkan backend"
This reverts commit bdc05c3d5f.

Reason for revert: Likely culprit for crbug.com/1087896

Bug: chromium:1087896

Original change's description:
> Check FP16 support on vulkan backend
>
> This patch check FP16 support on vulkan backend, and introduces
> the shader_float16 extension.
>
> BUG=dawn:426
> TEST=dawn_end2end_tests
>
> Change-Id: Ie09568a416ce9eb2c11afeede3e7da520550d5fb
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21901
> Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>

TBR=cwallez@chromium.org,kainino@chromium.org,yunchao.he@intel.com,jiawei.shao@intel.com,shaobo.yan@intel.com,hao.x.li@intel.com,enga@chromium.org,jiajie.hu@intel.com,xinghua.cao@intel.com

Bug: dawn:426
Change-Id: I8a42cf01ab32b3504bc7c1a335307db761424bdd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22360
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-05-29 16:54:35 +00:00
Austin Eng f7a98fa854 Ensure dynamic buffer offset bindings are sorted in increasing order
A previous CL sorted bindings by binding number, but bindings were first
sorted by type. This means a bind group layout with mixed dynamic
storage and uniform buffers would not always have all dynamic bindings
in increasing order. Instead, it would be strictly increasing within
each section of uniform/storage buffers. This CL corrects the issue
by first sorting dynamic buffers by binding number.

Bug: dawn:408
Change-Id: I3689eb64ad8aa8768cebe266eebcba75a21894ce
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22303
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-05-29 16:19:58 +00:00
Enrico Galli 4c32bd0b7d D3D12: Silence known debug layer warnings
This will help remove noise in debug layer output. This patch also
 promotes warnings and higher to Dawn errors.

BUG: dawn:363, dawn:418, dawn:419, dawn:421

Change-Id: I3112c94aff71fc7e76dff48c82bafe9e051ed3b4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21702
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-05-29 08:29:58 +00:00
Corentin Wallez 6ced832d74 Fix unlinking nullptr error scopes if device init failed
When device initialization failed, DeviceBase::mCurrentErrorScope is
nullptr so we need to guard the call to UnlinkForShutdown.

Bug: chromium:1081998
Change-Id: I65a1948117fa9461f7fc8d2d1d70aef669bc375d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21685
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-05-29 08:04:48 +00:00
Jiawei Shao 0e5301c23e Add basic supports of storage textures on OpenGL
This patch adds the basic supports of read-only and write-only storage
textures on OpenGL backend. Currently on OpenGL backend we only support
using either a layer of a texture or the entire texture as either read-
only or write-only storage texture.

BUG=dawn:267
TEST=dawn_end2end_tests

Change-Id: I235b98d8d961a17739ea35eec9726dcc80889c4b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22180
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-05-29 07:51:08 +00:00
Corentin Wallez da6dccd7c5 Metal: Fix clearing of subresource mipmaps.
On Intel the lazy-clearing optimization that bundled multiple
subresources at once to lazy-clear failed when multiple different
mip-levels were bundled together. The rendering was "clipped" to the
size of the smalled miplevel, resulting in some mip levels not being
fully cleared.

Bug:
Change-Id: Icfafbeae25bd426119a0b499237052c87eafe93e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22341
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-05-29 07:37:48 +00:00
Corentin Wallez e4f8e19e72 Remove the defaulting for bytesPerRow = 0
Bug: dawn:432
Change-Id: I335cdc367c322764861878bfb604ecc6a146b732
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22340
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-05-29 07:28:38 +00:00
Austin Eng 295a4177ae Add ScopedEnvironmentVar class for setting env variables in BackendVk
In the Vulkan backend, we only need to set VK_LAYER_PATH and
VK_ICD_FILENAMES while we're gathering the device information. After
this, we should unset the environment variables or they will persist
and affect loading Vulkan again (from Dawn or another client) in the
future.

Bug: dawn:406
Change-Id: I30c38b0980e181126fcd7fa911bbf9e8aa35f3b8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22021
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-05-28 16:05:04 +00:00
Austin Eng f874525de3 OpenGL: Fix rendering to a layer of a depth/stencil texture
Bug: dawn:430
Change-Id: Ifb6c72374707a05054cfef021840bc8305b4f9d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22320
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2020-05-28 08:53:23 +00:00
Austin Eng 09987b88f1 Metal: Fix rendering to a layer of a depth/stencil texture
Bug: dawn:430
Change-Id: Ice053a44a0720055fe02b2589153a04ffaa87e65
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22302
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2020-05-28 08:51:23 +00:00
Austin Eng bf3611ce73 Add tests for using a subresource as output attachment
This adds tests that it is possible to render into a subresource bound
as an output attachment. Attaching a subresource as an output attachment
is still not implemented correctly on OpenGL and Metal.

This CL also adds a helper to DawnTest to allow checking stencil buffer
contents.

Bug: dawn:430
Change-Id: Ic8652dd9da8d3c7a47d7b0548306e2054f642e7d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22164
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-05-28 08:29:03 +00:00
Jiawei Shao a3636ed888 Support multiple array layers in one texture-to-texture copy command
This patch adds the supports of copying multiple array layers of a
2D array texture in one texture-to-texture call. Note that in D3D12
and Metal it is implemented by copying each array layer in a for-loop.

Note that we need extra validations when the source and destination
texture are the same one in a texture-to-texture copy. This CL does
not include these validations and we will add them in another one.

BUG=dawn:18
TEST=dawn_unittests, dawn_end2end_tests

Change-Id: I1239543e5692e140474b3c1de0b3579be449e283
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22140
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-28 01:01:32 +00:00
Jiawei Shao f62ab75a5c Disallow using cube or cube array texture views as storage textures
This patch adds validations to forbid using cube or cube array texture
views as storage textures in Dawn as they are not supported on D3D12.

BUG=dawn:267
TEST=dawn_unittests

Change-Id: Iafb705a4bedae25ee54cfa45f710b2f3b7aab912
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22166
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-05-28 00:17:08 +00:00
Hao Li 55c85f66d2 Query API: Extensions
Add extensions of pipeline statistics and timestamp queries.

Bug: dawn:434
Change-Id: I1a472ee4819bd36ce629034cf5175430bab1febc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22100
Commit-Queue: Hao Li <hao.x.li@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-05-27 05:15:18 +00:00
Xinghua Cao bdc05c3d5f Check FP16 support on vulkan backend
This patch check FP16 support on vulkan backend, and introduces
the shader_float16 extension.

BUG=dawn:426
TEST=dawn_end2end_tests

Change-Id: Ie09568a416ce9eb2c11afeede3e7da520550d5fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21901
Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-27 02:49:08 +00:00
Yunchao He 0cd6533d1a Implement texture subresource on Vulkan
This change implemented texture subresource on Vulkan. It added a new
function to handle barriers for texture subresource for bind groups.
It also simplified barriers which are set for texture clear and copy.

Before this patch, all barriers are done upon all mip levels and all
array layers. With this patch, barriers are done upon particular mip
level(s) and array layer(s).

We may need more texture subresource end2end tests for copy and clear
opterations. I will visit that later.

Bug: dawn:157

Change-Id: Ie2247c6315326494f2d3736334e84b2867a16c17
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22024
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-27 00:10:33 +00:00
Natasha Lee 04701f9f1e Fire map callback if map async operation fails
Bug: dawn:400
Change-Id: If656239714f2c088e52aff30ef27a20f2fc42ba8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21940
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-26 20:33:03 +00:00
Brandon Jones e370ec6de4 Allow Attempted Eviction When The Residency LRU Is Empty
Removes an assert when attempting to evict the residency LRU while
empty.

Bug: dawn:415
Change-Id: If346d0f2cc28ec089871b3c5aaf8f5641344f9fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22023
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2020-05-26 19:40:23 +00:00
Jiawei Shao 31c9c6949e Add tests for image2DArray
This patch adds the dawn_end2end_tests on the use of 2D array texture
views as read-only and write-only storage textures.

In HLSL neither RWTextureCube nor RWTextureCubeArray are supported, and
the HLSL function Load() also accept neither TextureCube nor
TextureCubeArray, thus we can neither support imageCube nor
imageCubeArray in the shaders used by Dawn.

BUG=dawn:267
TEST=dawn_end2end_tests

Change-Id: I0bce8bd3bff75baa14943b974ef3a6cc2b6d2434
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21980
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-25 00:19:51 +00:00
Austin Eng 65ee6497d6 Fix VulkanImageWrappingUsageTests.ClearImageAcrossDevicesAliased
In Vulkan, importing memory by file descriptor takes ownership of
the file descriptor. It is necessary to dup it in
ClearImageAcrossDevicesAliased because the texture is imported
twice. This fixes these tests on SwiftShader.

Bug: dawn:417
Change-Id: I08b6464c4b8bd31f738037678e29fd6d066e7888
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22020
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-05-22 00:23:39 +00:00
Ryan Harrison bd0ad7921d Add support for WGSL shaders via Tint
BUG=dawn:405

Change-Id: I7a79a0d7ce58ff995ec1ff917dd427875fb4deaf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21340
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-05-21 13:42:26 +00:00
Jiawei Shao 214c71769b Disallow using combined textures and samplers in shaders
This patch adds a validation to disallow declaraing combined textures
and samplers in shaders.

SPVC doesn't provide a way to extract the information of combined
textures and samplers from shaders, so currently we cannot add the
related validation when we use SPVC.

BUG=dawn:423
TEST=dawn_unittests

Change-Id: I81f05dc6adb57fbc981ee1a651e160c096315551
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22000
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-05-21 10:38:36 +00:00
Jiawei Shao 8a3cc5c4df Add adapter type in test name when the adapter is Microsoft Basic Render
This patch adds the adapter type in the dawn_end2end_test name when the
adapter is Microsoft Basic Render Driver. In a Windows Remote Desktop
session, there will be two adapters whose name is "Microsoft Basic
Render Driver" with one of the adapter type being "CPU" and another
being "Integrated GPU" on an Intel integrated GPU for example. To avoid
the conflicts in the name of end2end tests and causes ASSERT failures,
we add the adapter type to the test name when the adapter is Microsoft
Basic Render Driver.

BUG=dawn:396
TEST=dawn_end2end_tests

Change-Id: I26108ac106957ea7e72d531a366851fd71cbc2b0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21900
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-05-21 00:24:16 +00:00
Austin Eng 78f7e8640f Skip VulkanImageWrappingTests on SwiftShader
These tests hit a failing ASSERT in SwiftShader.
Suppressing to get the bots running and green.

TBR=cwallez@chromium.org
Bug: dawn:417
Change-Id: I2a2955650df0bb94206534ce1e401299eea6f26a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21960
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-05-19 23:20:04 +00:00
Brandon Jones e7b30fdbeb Descriptor Residency 2: Add Management Logic and Test
Adds logic to lock residency for bound descriptor heaps, then unlock and
insert into the LRU cache when no longer bound. Adds a basic functional
test.

Bug: dawn:193
Change-Id: Idfaaee6b873374c07a0b94b1982ad65353218799
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21400
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-05-19 21:45:13 +00:00
Austin Eng 7355460100 Skip window and surface tests if glfwInit fails
This skips tests that would fail on SwiftShader on systems with
no display.

Bug: dawn:283
Change-Id: Ie3aa46349df3116305712a5aa143d874cef0d4b4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21781
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-05-19 20:51:23 +00:00
Yunchao He 8d6b021a2a Fix a bug for texture subresource
Texture subresource total number is wrongly calculated. This change
fixed the tiny bug.

Bug: dawn:157

Change-Id: Id6dad7e60fa9fe63dac3567814486d3f9dfcee9e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21902
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2020-05-19 17:43:03 +00:00
Brandon Jones 9b54466be4 Descriptor Residency 1: Add Pageable and ShaderVisibleDescriptorHeap
Refactors ShaderVisibleDescriptorAllocator to use d3d12::Heap to
represent ID3D12DescriptorHeaps.

Bug: dawn:193
Change-Id: If0a9df0bc138c4d6f1ad110750ab1e6e8084b80f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20960
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-05-19 10:15:12 +00:00
Natasha Lee 949f1e45f1 Refactor MapRequestTracker to be its own class file.
All the buffer backend files had basically the same implemenations
of MapRequestTracker and the tracker was owned by device backends.
This refactor puts MapRequestTracker into its own file
and has the tracker be owned by DeviceBase and BufferBase.

Bug: dawn:400
Change-Id: Id28422b575e9c04d4435d5f119e0ffe08c2d1ce8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21760
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-19 01:29:32 +00:00
Jiawei Shao 2ae84e9461 Disallow the copies within the same buffer
This patch adds the validation that forbids the buffer-to-buffer copies
when the source and destination buffer are the same one as in D3D12 the
Source and Destination resource cannot be the same when doing a
CopyBufferRegion.

BUG=dawn:17, dawn:420
TEST=dawn_unittests

Change-Id: Ie3e0c5361919ff369240a65d6e7fbae05b8332b0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21780
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-05-19 00:11:11 +00:00
Hugo Amiard 216c10d270 D3D12: Implement UseDxc toggle to use DXC for HLSL compilation
Factor out common shader compilation logic to ShaderModuleD3D12
used by both RenderPipeline and ComputePipeline, and implement
a new compilation path using DXC when UseDXC toggle is enabled

Bug: dawn:402

Change-Id: I67d3ae0aecee11634af917735456ddbe10b3d86a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21840
Commit-Queue: Hugo Amiard <hugo.amiard@laposte.net>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-18 23:56:11 +00:00
Bryan Bernhart e25ee25e77 D3D12: De-duplicate sampler heap allocations.
Allows bindgroups that use the same samplers to share
a descriptor heap allocation. This is particularly important
for sampler heaps which incur expensive pipeline flushes
due to the smaller size requiring more frequent switches.

The device dolls out entries to a sampler heap allocation cache.
When the BindGroup is created, it does a lookup and refs the
allocation. This ensures the cache does not grow unbounded
or needlessly store unused entires.

This change is a follow-up of de-coupling heaps.

BUG=dawn:155

Change-Id: I3ab6f1bdb13a40905cb990cd7a2139e73da30303
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20783
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-05-18 23:25:31 +00:00
nihui 275a95c1dc Fix missing headers with libstdc++ (GCC 10.1)
Bug: None
Change-Id: I772bfbc6639162a51906e4f76685d89c2d34ef5f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21880
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-05-17 20:59:20 +00:00
Yunchao He a5d54d7091 Add end2end tests for texture subresource
The tests can pass on Metal and OpenGL backend as expected.
But they can't pass on D3D12 and Vulkan backend. I will work
on that soon.

Bug: dawn:157

Change-Id: I4fcf229f7a24369004d5594a3801f0acad804fd0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21341
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-05-16 00:34:57 +00:00
Austin Eng 40dc5d3f21 Cleanup: Remove unnecessary TestSetUp overload
Bug: dawn:396
Change-Id: I9d12fb983ea3ef3a01b569caff453a441ab86c70
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21700
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-05-15 22:06:35 +00:00
Austin Eng da722adec9 Run dawn_end2end_tests on all available system adapters
By default, the tests will run on all available adapters, so this
adds an --exclusive-device-type-preference flag which takes a list
of comma-delimited device type preferences (discrete,integrated,cpu).
Tests will run only on the first available device type.
This is useful because in Chromium's test infrastructure, the same
test arguments are passed to one machine on which we want to use the
discrete GPU, as well as one machine where we want to use the
integrated GPU.

Bug: dawn:396
Change-Id: Id936fff3356eef3c6d12dfd1407b0e1f0f020dc1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21202
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-05-15 20:28:05 +00:00
Austin Eng 25c747cf08 DawnTest: Gather adapters on environment creation for filtering backends
This moves the creation of the Instance and Adapter discover to
environment creation. It allows programatically filtering test
parameterizations based on what is available on the system instead of
relying on what is enabled at compile time.

Because of an issue with the Vulkan validation layers, the instance and
adapters are created twice. Once in environment creation, and once on
environment set up. The Vulkan validation layers use static global
mutexes which are unsafe when Chromium's test launcher forks the
launcher process between environment creation and SetUp.

Bug: dawn:396
Change-Id: Id79f0d274331e4ba95f75b2ca4e896ad0f7a31a8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21762
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-05-15 16:07:12 +00:00
Austin Eng 5133221139 DawnTest: Factor Instance creation, Adapter discovery, and config logging
Bug: dawn:396
Change-Id: Idae3f388cf001e97c7fb4c84c50bca6825a2020b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21761
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-05-15 16:04:32 +00:00
Jiawei Shao 0b8e319407 Add tests to verify storage textures are initialized before being used
This patch adds dawn_end2end_tests to verify any textures whose first
use is being used as read-only or write-only storage texture have been
cleared to 0.

BUG=dawn:267
TEST=dawn_end2end_tests

Change-Id: I26a1b6b46ba8fc87c6599870771192262ce07d83
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21740
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-05-15 03:24:41 +00:00
Bryan Bernhart 1888ae7857 D3D12: Enable GPU-based validation
Enables GBV by default when the backend validation layers are enabled.
This feature is particularly useful for catching mistakes in shaders
that otherwise pass when only using the debug layer.

BUG=dawn:363

Change-Id: I7b730ce8e43069dc3150e7a5857a0977b3147390
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21701
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-05-14 17:38:57 +00:00
Austin Eng 983211974b Reland "Support depth32float sampling on D3D12"
This is a reland of 071fe56ffe

It creates textures as TYPELESS if they may need reinterpretation
of the bit layout. Right now only sampled Depth32Float needs this
so it is special-cased.

Original change's description:
> Support depth32float sampling on D3D12
>
> Bug: dawn:367
> Change-Id: I026e718130cbd92427c6292045fd041c878d4f77
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20840
> Commit-Queue: Austin Eng <enga@chromium.org>
> Reviewed-by: Stephen White <senorblanco@chromium.org>

Bug: dawn:367
Change-Id: I8b0ad465915c4476099fc1097e0cd02b23bd21b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21640
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-05-14 17:24:36 +00:00
Austin Eng 75ef5963b4 Append the stack trace to the error message
This makes it much easier to understand where errors come from.

Bug: none
Change-Id: I345164177e6258a32bdc37d233bc5df8bba13132
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21660
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-05-13 23:10:36 +00:00
Corentin Wallez ecabfe8a78 Remove wgpu::BufferCopyView::rowPitch/imageHeight
They were deprecated in favor of bytesPerRow and rowsPerImage.

Bug: dawn:22
Change-Id: I5bd3262ee8ba2f891d01f6b8a3f5df86f7596686
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21684
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-13 17:26:05 +00:00
Corentin Wallez 2eca22f6d7 Remove ShaderModule::code/codeSize
It was deprecated in favor of chaining a
wgpu::ShaderModuleSPIRVDescriptor.

Bug: dawn:22
Change-Id: I210cd7c21c33c6ca8dd286ea64389b774a4355e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21683
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-13 17:23:35 +00:00
Corentin Wallez 437655216e Remove wgpu::Device::CreateQueue
It was deprecated in favor of wgpu::Device::GetDefaultQueue.

Bug: dawn:22
Change-Id: I28d7e616b2beb7de8eed3a3df501eb97a6475928
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21682
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-13 17:21:55 +00:00
Corentin Wallez b761fe1346 Remove wgpu::BindGroupLayoutEntry::textureDimension
It was deprecated in favor of viewDimension.

Bug: dawn:22
Change-Id: I8016d7440d98cc69acd1b48cb76f7ae1c1353896
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21681
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-13 17:13:35 +00:00
Corentin Wallez 84ae2bfe3b Remove deprecated "Binding" types and members
This removes the following types and members as well as fixup code
and depraction tests for them:

 - wgpu::BindGroupLayoutBinding
 - wgpu::BindGroupLayoutDescriptor::bindingCount
 - wgpu::BindGroupLayoutDescriptor::bindings
 - wgpu::BindGroupBinding
 - wgpu::BindGroupDescriptor::bindingCount
 - wgpu::BindGroupDescriptor::bindings

Bug: dawn:22
Change-Id: Ifc0e25107f3dcfbb850624cb362909f38c90bec2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21680
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-05-13 17:05:55 +00:00
Felix Maier 20ed6f42b3 D3D12: Add a toggle to use DXC for HLSL compilation
This patch adds the following:
 - UseDXC toggle
 - Loads DXC (and DXIL to sign the DXBC) in d3d12/PlatformFunctions
 - Adds GetModuleDirectory to SystemUtils

GetModuleDirectory was added to prevent loading issues regarding dynamic libraries when the executable is not in the same path as the dawn module.

This patch doesn't add DXC to RenderPipelineD3D12 nor ComputePipelineD3D12.

Bug: dawn:402
Change-Id: I2b8e4a2b7df31b9c766c748f92e11050c0aec3a0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21420
Commit-Queue: Felix Maier <xilefmai@gmail.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-05-13 16:57:55 +00:00
Corentin Wallez 60bb88d23c Fix remaining -pedantic warnings.
Wgnu-zero-variadic-macro-arguments is fixed by:

 - A previous googletest roll fixing the warning in gmock.
 - Adding a dummy argument to AddTraceEvent so that the __VA_ARGS__ is
never empty in TraceEvent.h and doesn't require __VA_ARGS__ token
pasting with a comma.
 - Extracting the first parameter in DAWN_INSTANTIATE_TEST with some
preprocessor tricks instead of singling it out, to avoid __VA_ARGS__
token pasting with a comma.

Wmicrosoft-enum-value is fixed by a previous spirv-cross roll that fixes
the warning upstream.

Bug: dawn:394
Change-Id: Icfe037ae9549087e9d62b6f42f91958addbb53ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21483
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-05-13 08:01:55 +00:00
Jiawei Shao f4df7916ca Add validation on the buffer-to-buffer copies within same buffer
This patch adds the validation on the buffer-to-buffer copies within the
same buffer. When the source and destination buffer are the same one in
CopyBufferToBuffer(), the copy region cannot overlap or it will cause
undefined behaviors on Metal and Vulkan.

BUG=dawn:17
TEST=dawn_unittests, dawn_end2end_tests

Change-Id: I63ab790787ec0a973ae22787a9348bddfb6a5373
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21602
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-05-13 00:17:15 +00:00
Austin Eng fce44b5fe1 Sort same-type bindings in the BGL by binding number
This fixes a bug where dynamic offsets were applied to the wrong bindings.
Dynamic offsets are applied in increasing order of binding number.

Bug: dawn:408
Change-Id: I3de6ee1bfd6e00239ddc46f820c3f81ba82815cb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21620
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-05-12 20:32:45 +00:00
Corentin Wallez b6eeee0aa3 Vulkan: Fix ResourceHeap leak for direct-allocated resources.
Bug: chromium:1081051
Change-Id: I1f68ebf21033fb9cf925b5cbc3915667b61290fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21460
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-05-12 17:44:23 +00:00
Ryan Harrison 4fa5ad4bf0 Rolling 5 dependencies and fix test slow down
Roll third_party/SPIRV-Tools/ 2e1d208ed..c8590c18b (2 commits)

2e1d208ed9..c8590c18bd

$ git log 2e1d208ed..c8590c18b --date=short --no-merges --format='%ad %ae %s'
2020-05-06 jaebaek Preserve debug info for wrap-opkill (#3331)
2020-05-05 jbolz Validate ShaderCallKHR memory scope (#3332)

Roll third_party/glslang/ b5f003d7a..4fa68edd6 (3 commits)

b5f003d7a3..4fa68edd68

$ git log b5f003d7a..4fa68edd6 --date=short --no-merges --format='%ad %ae %s'
2020-05-12 cepheus Address #2211: Improve the copy constructor of TVarLivePair.
2020-05-11 xilefmai Fix Web build
2020-05-08 sebastian.neubauer Explicitly mark some enums as unsigned

Roll third_party/shaderc/ 15a66d72f..00ac5d821 (4 commits)

15a66d72f3..00ac5d8217

$ git log 15a66d72f..00ac5d821 --date=short --no-merges --format='%ad %ae %s'
2020-05-11 rharrison Rolling 4 dependencies (#1062)
2020-05-11 chinmaygarde Only add -fPIC if supported by the compiler. (#1061)
2020-05-06 rharrison Remove Singleton pattern around access to glslang (#1059)
2020-05-05 rharrison Add .NET bindings to README.md (#1060)

Roll third_party/spirv-cross/ 92f7d36c7..d638d2df9 (4 commits)

92f7d36c72..d638d2df9c

$ git log 92f7d36c7..d638d2df9 --date=short --no-merges --format='%ad %ae %s'
2020-05-08 post Support gl_InstanceID in RT shaders.
2020-05-06 post MSL: Avoid packed arrays in more cases.
2020-05-06 post Add missing reference files from PR merge.
2020-05-06 lehoangq Fix #1359: MSL: If the packed type is scalar, don't emit "pack_" prefix.

Roll third_party/tint/ 1f1f08f94..0bbf1e746 (6 commits)

https://dawn.googlesource.com/tint/+log/1f1f08f94a11..0bbf1e746093

$ git log 1f1f08f94..0bbf1e746 --date=short --no-merges --format='%ad %ae %s'
2020-05-11 rharrison Small fix for BUILD.gn
2020-05-08 dneto Rolling 6 dependencies
2020-05-07 dneto [spirv-reader] Find if-selection internal headers
2020-05-07 dneto [spirv-reader] Rename Edge::kToMerge to kIfBreak
2020-05-07 dneto [spirv-reader] Classify kSwitchBreak from deep in control flow
2020-05-07 dsinclair Rename brace and bracket to match spec

Created with:
  roll-dep third_party/SPIRV-Tools third_party/glslang third_party/shaderc third_party/spirv-cross third_party/spirv-headers third_party/tint

Change-Id: I8d9ca3e29b4fa8907147fffacb3905acd48a9c0b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21603
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-05-12 17:26:42 +00:00
Austin Eng 02beecaec5 Fuzzer: Wait for all commands to complete before destroying the wire
Bug: chromium:1074739
Change-Id: I32591efe42559299234053f112a2f846d43612ab
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21366
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-05-11 20:55:22 +00:00
Austin Eng a1800c04f3 Make fence descriptor optional
Bug: dawn:22
Change-Id: I5d14aa8e12899eb577d7c50081a6ee6f7ec248a0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21365
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-05-11 20:29:22 +00:00
Corentin Wallez a6cf7b5b1d Make error scope shutdown iterative instead of recursive.
This avoids a stack overflow when many error scopes are pushed on device
shutdown. It also changes the error scopes to return a Unknown error
type on shutdown instead of NoError.

A regression test is added.

Bug: chromium:1078438
Bug: chromium:1081063
Change-Id: Ibfab8dd19480414c1854ec2bd4928939663ba698
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21440
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-11 20:26:12 +00:00
Yunchao He c2542cde3e Fix a bug for multi-writes in ResourceUsageTrackingTests.cpp
It is valid to have race condition for multiple writes on the same
resource in some situations in render pass. These situations are:
1) multple storage buffer bindings on the same buffer,
2) multiple writeonly storage texture bindings on the same texture.

This change fixed a bug in tests and added a new test, in order to
make sure that validation code in Dawn allows this kind race condition.

Bug: dawn:407

Change-Id: I42332418bea5b6e608f6730e42f60c1c12b0b025
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21361
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2020-05-11 19:12:12 +00:00
Corentin Wallez bf009f50c5 Add a test for creating a 0-sized buffer.
This is valid in WebGPU but causes validation errors in backends.

Also make it an OOM error on Metal to request a buffer close to
UINT32_MAX size because it would truncate the size, and could lead to
OOBs.

Bug: chromium:1069076
Change-Id: Ib961cb236cb7cabc0ae21203bf1d72ba82a56272
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21060
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-05-11 18:55:52 +00:00
Bryan Bernhart 19b21c5b85 D3D12: Remove ComPtr from D3D12 objects when possible.
Returning COM for getters needlessly refcounts which wastes CPU cycles
in critial sections and floods PIX traces with [Add/Release]Ref.

BUG=dawn:212

Change-Id: Ifa853f2d5f78a450fdb7ffb9492f0d08dfbcdd37
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21364
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-05-11 16:47:21 +00:00
Austin Eng 562255a943 Load Swiftshader Vulkan separately from the system Vulkan
This enables both Swiftshader Vulkan and the system Vulkan drivers
to be discovered and used simultaneously.

Bug: dawn:396, dawn:283
Change-Id: I580ca26c12296fe13c0331c4faf6e7a4520664e4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21041
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-05-08 19:31:00 +00:00
Austin Eng 818c6b7082 Validate that ShaderModuleDescriptor has chained descriptor
Bug: chromium:1074575
Change-Id: Ibb124ca8c4771d9b8f2846d3a5f79dca6de8743d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21360
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-05-08 18:05:19 +00:00
Yunchao He 70ffa0c285 Add more tests for resource usage tracking
This change added more tests for texture usage tracking for compute.
It also added multiple write usages related tests for both buffer
and texture.

Bug: dawn:358, dawn:359

Change-Id: I8e3dbc92a06ceccfa5fce3ed319e4e641e72e41f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21100
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2020-05-07 23:49:15 +00:00
Natasha Lee 351c95a477 Refactor Serial tracking to be owned by Device frontend.
Move mCompletedSerial and mLastSubmittedSerial to Device frontend and
add getters and setters for the device backend to access such.
This is to aid the Device in taking more ownership of Serials and Ticking.

Bug: dawn:400
Change-Id: Ifa53ac294a871e484716842a3d212373b57847c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20480
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-07 21:52:54 +00:00
Ryan Harrison 4f3811c064 Add Tint to BUILD.gn
Tint is behind a build flag, since Tint is not yet available in
chromium's third_party.

BUG=dawn:403

Change-Id: If5fa36b36216ef6965341b886c3bd70d27daf23a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21300
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-05-07 21:15:55 +00:00
Austin Eng 4fe8ead090 Revert "Support depth32float sampling on D3D12"
This reverts commit 071fe56ffe.

Reason for revert: SamplerRender/D3D12 has flaky crashes

Original change's description:
> Support depth32float sampling on D3D12
> 
> Bug: dawn:367
> Change-Id: I026e718130cbd92427c6292045fd041c878d4f77
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20840
> Commit-Queue: Austin Eng <enga@chromium.org>
> Reviewed-by: Stephen White <senorblanco@chromium.org>

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

Change-Id: I35df2ac35986d4a32437a52b70b025a370302651
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:367
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21320
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-05-07 20:38:37 +00:00
Austin Eng d785988172 Add missing include in DawnWireServerAndFrontendFuzzer.cpp
This file was missing an include of libfuzzer_exports.h which was
causing LLVMFuzzerInitialize to be stripped from the binary.

Tbr=cwallez@chromium.org
Bug: chromium:1075605
Change-Id: I251e3dd7ad1b3ebb95339dec946b80ce2e5d4a05
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21301
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-05-07 20:23:55 +00:00
Yunchao He 17e1e197e8 Add tests for texture usage tracking - 3
This change added tests for invisible and unsed bindings for
texture usage tracking. It also removed one buffer test, which
is not useful.

Bug: dawn:365

Change-Id: I01232836fb150ecea011a5fcbc250fa1eb7207cf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21120
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2020-05-07 16:49:05 +00:00
Austin Eng 071fe56ffe Support depth32float sampling on D3D12
Bug: dawn:367
Change-Id: I026e718130cbd92427c6292045fd041c878d4f77
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20840
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-05-07 16:47:55 +00:00
Jiawei Shao e8bf706d16 Add basic supports of storage textures on D3D12
This patch adds the basic supports of read-only and write-only storage
textures on D3D12.

The subresource tracking and barriers on the subresources used as
read-only and write-only storage textures are not included in this
patch.

BUG=dawn:267
TEST=dawn_end2end_tests

Change-Id: Ie29a3a9962cd1a79217bc87815ed0bd27623e3a8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21140
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-05-07 00:06:44 +00:00
Austin Eng 458ab1bf7f Expand depth sampling tests
This renames ComparisonSamplerTests to DepthSamplingTests
and adds tests which do normal sampling of depth32float textures
as well as sampling and comparison sampling in compute shaders.

Comparison samplers in compute shaders appear to be broken at least
on Metal Intel Haswell Iris 5100

Bug: dawn:367, dawn:401
Change-Id: I4a8208265675892d42b591126ffed2aadd420ab1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20782
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-05-07 00:06:34 +00:00
Austin Eng 531253357e Split ComparisonSampler tests with/without normalized depth textures
Depth textures outside the 0-1 range are clamped on OpenGL unless we
reinterpret contents as R32

Bug: dawn:367
Change-Id: Ifb539689c55bb5a4a16427025c9f0d97c4156c6b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20823
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-05-06 23:19:54 +00:00
Austin Eng b7dbb48351 Fix OpenGL format table for GL_DEPTH_COMPONENT textures
GL_DEPTH is for calls like glEnable(GL_DEPTH) and
glClearBuffer(GL_DEPTH, ...). GL_DEPTH_COMPONENT is the
enum for the texture internal format.

Bug: dawn:367
Change-Id: I8f237e26148e3fd5a624a8bb4ed69e65fdd1acd7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20822
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-05-06 21:17:04 +00:00
Corentin Wallez 5ffca2eb90 NativeSwapChainImplVk: Remove unnecessary transition on Configure
Configure was transitioning the swapchain images from undefined to
present layout but this was already happening because TextureVk starts
with a mLastUsage of None that will force a transition from undefined
when used.

Also introduce an internal texture usage bit kPresentTextureUsage to
prepare for the eventual remove of wgpu::TextureUsage::Present when
old swapchains are removed.

Bug: dawn:269
Change-Id: I57d26f18e34cacd5d91419a45787b2ece9558846
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20881
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-05-06 07:12:48 +00:00
Yunchao He 0abddd21c9 Add dispatch call in usage tracking tests
Resource usage tracking for compute is per dispatch. So we should
call pipeline and dispatch to trigger resource tracking in compute.
This change added dispatch calls for compute pass related tests.

This change also changed inappropriate comments, and moved a test
to a proper location in the file.

Bug: dawn:358

Change-Id: I6d31169164c434c2f446cd5746170433dd1eb4b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21000
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-05 17:18:47 +00:00
Corentin Wallez ecf93472d4 Move validation of the copy commands in the entrypoint.
This will allow follow-up CLs to no-op empty copies without making the
nooped copy skip the validation.

Bug: chromium:1069076
Change-Id: Id2460c531bc68e4a8a27705520aeaec7e944d7a7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20880
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-05-05 08:33:55 +00:00
Corentin Wallez 3874434bf1 TextureVk: Make a Create function for swapchain textures.
This aligns this constructor to be used via Create like the other
vulkan::Texture constructors.

Bug: dawn:269
Change-Id: Ib85874bf24bfe49b644b4faa63c9248c540811c8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20882
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-05-05 08:33:35 +00:00
Yunchao He 07328ba0bb Add validation tests for texture resource tracking - 2
This patch adds tests to verify that texture usage tracking is per
each pass for render, and it is per each dispatch for compute.

Bug: dawn:358
Change-Id: I7ed0f470a6457e4cc53b02cd03c3da7d68cbca9a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20162
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-04 17:19:19 +00:00
Yunchao He 23428ea82f Add validation code for texture subresource usage tracking
This patch also add validation tests for texture subresource tracking
for render pass. Resource usage tracking for compute is per each
dispatch() call, I will add it in next patch.

BUG=dawn:157

Change-Id: I6c4b932e317d66521fa428311e727876d0adf4ea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17661
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-05-04 17:10:49 +00:00
Yunchao He a6d7f56cf8 Add resource usage tests in a single draw/dispatch
It is invalid to read and write on the same buffer/texture in
a single draw or dispatch. This change adds tests to cover this
situation.

Note that we have already added resource usage tests between passes
in the same command buffer, and tests between draw or dispatch calls
in the same pass. And this patch adds tests inside a draw or dispatch
call.

Bug: dawn:358

Change-Id: Ic52b2e559e9c996e5b76ea960183d80d67c24178
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20821
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2020-05-04 16:23:09 +00:00
Corentin Wallez a8337c378e DescriptorSetAllocation.h: Add missing include
Bug:
Change-Id: Iff2c62a83f479a85407c3cce8dba2b3376d6ab57
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20861
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-04 16:05:39 +00:00
Corentin Wallez dbec2fa2f6 Use unordered_set<std::string> for deprecation warnings
This fixes the roll in Google3, otherwise it complains that
unordered_set<const char*> hashes the pointer, which is most likely not
what you want to do.

Bug: dawn:394
Change-Id: I1ef06c923bb45e55b39c23e5e7734f1577c47255
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20860
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-05-04 16:04:40 +00:00
Yunchao He 798cefb78d Fix incorrect validation error in CommandBufferStateTracker
If we are missing pipeline in render or compute pass, it always reports
that we are missing vertex buffers or bind groups for render and compute
pass respectively.

Bug: dawn:359

Change-Id: I5550e55fcc9f29c0f2fb71462def836061038add
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20784
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-05-04 06:05:47 +00:00
Yunchao He ccc40f6ffa Fix a bug in ResourceUsageTrackingTests
When we test resource per draw/dispatch, we need to set pipeline, etc.,
in addition to set bind groups.

Bug: dawn:358

Change-Id: Ic51986d0608baf786521158c887a0c1ced7ccacf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20800
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-05-04 05:37:32 +00:00
Bryan Bernhart 303a3daf0d D3D12: Decouple descriptor heap allocations.
Allows bindgroups to be populated by heap type. Previously, failing to
populate one type of GPU descriptor heap required both GPU heaps
to be switched out. This resulted in extra copies and heap allocations
should only one heap type overflow.

This change also simplifies GPU descriptor heap management:
- Allocator no longer needs to operate on both heaps.
- Sub-allocation tracking can be moved into handles.

A follow-up change will remove duplicated sampler heap allocations.

BUG=dawn:155

Change-Id: I1960cf3a8bc3d86d3e8b2775da3d0c92125bcf82
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19887
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-04-30 23:19:16 +00:00
Yunchao He 2ba90d6654 Add tests for resource tracking in compute - 1
This patch adds resource usage tracking tests for overwritten
situations within a draw/dispatch when we call multiple
SetBindGroup. We should track the overwritten resources
even though they are not used in render/compute pass.

Bug: dawn:357

Change-Id: I7467db1c0b43fed8513ddb7604adbbd1be55866f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20160
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-04-30 22:08:18 +00:00
Austin Eng 129dc00c69 Suppress MSVC warnings about invalid switch values
Dawn extends texture and buffer usage enums with additional internal
usages.

Bug: dawn:397
Change-Id: Idb3918e1455f596b1e21f109016dd622d8b66732
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20781
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-30 22:05:38 +00:00
Corentin Wallez a121e7fff0 Enable -Wno-language-extension-token except on Windows
It is required on Windows to be able to use __uuidof().

Bug: dawn:394
Change-Id: I02c1a4d36688c5985d5eb7f65737f6b821655ddc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20703
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-30 16:10:48 +00:00
Corentin Wallez 75f55bfaa3 Fix and enable -Wgnu-anonymous-struct
Bug: dawn:394
Change-Id: I7753b7daff2beaeb67fe6cbb54b002ddbe077f6f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20701
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-30 16:01:08 +00:00
Corentin Wallez e642b1d959 Fix and enable -Wnested-anon-types
Bug: dawn:394
Change-Id: I51b533c07f21bcacd22a058cf4a080b9b2b853f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20700
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-30 15:58:28 +00:00
Jiawei Shao 754c161fd3 Add basic supports of storage textures on Vulkan
This patch adds the basic supports of read-only and write-only storage
textures on Vulkan.

The subresource tracking and barriers on the subresources used as
read-only and write-only storage textures are not included in this
patch.

BUG=dawn:267
TEST=dawn_end2end_tests

Change-Id: I6831b96202a97182763ecd28bc41ab03df904a7c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20560
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-30 02:43:08 +00:00
Corentin Wallez c85ef7927f Fix and enable -Wfour-char-constants
Bug: dawn:394
Change-Id: Ic11924bf81820f6d3a67bf5d70cce7104e70954f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20581
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-29 21:07:21 +00:00
Corentin Wallez b2d1d7b2ce Fix and enable -Wvla-extension
Bug: dawn:394
Change-Id: If5ced5f910da7fd598521113aba89e6a9051f4a9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20582
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-29 16:00:41 +00:00
Corentin Wallez 85cc603394 Enable -Wc++20-designator
Bug: dawn:394
Change-Id: I03f0c779e4fb3f0a32d171e986de885c857fe782
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20580
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-29 15:56:41 +00:00
Corentin Wallez 2d79ef264e Do not use Dawn's warnings for compiling Chromium's gtest main.
When building in Chromium, Dawn's gtest targets use sources files
in Chromium so it can use Chromium's GTest harness. These source
files were compiled with the "dawn_internal" config included.
This made them include Dawn-specific warnings that trigger on parts
of Chromium's //base.

Instead compile these "main" files as separate source_sets without
dawn_internal and link them in the dawn test executables.

Bug: chromium:1075817

Change-Id: I573390ca3e6a7dfd1e8a949dc10ed268f0d0f63e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20520
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-28 17:12:05 +00:00
Bryan Bernhart c94f4a7a19 D3D12: Fix invalid allocation size check.
GetResourceAllocationInfo() returns UINT_MAX64 when
the requested size is too large. This corrects the
validation to OOM when D3D considers the size
invalid.

Only validating for zero-size would cause a device
loss as certain D3D drivers may not always consider
zero-sized invalid and NextPowerOfTwo(UINT_MAX64)
would overflow the allocator.

BUG=dawn:393

Change-Id: Idaad10c139f6428d4f48bca24027a6691257aca9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20400
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-04-28 15:58:45 +00:00
Jiawei Shao 88f2ec853f Add basic supports of readonly and writeonly storage textures on Metal
This patch adds the basic supports of both read-only and write-only
storage textures on Metal with several simple end2end tests that use
read-only or write-only storage textures in every shader stage.

Here are the follow-ups after this patch:
1. test all the texture formats that can be used as both read-only and
write-only storage textures.
2. support using a texture with multiple different binding types in one
rendering or compute encoders.
3. test image2DArray, imageCube and imageCubeArray.

BUG=dawn:267
TEST=dawn_end2end_tests

Change-Id: Id0de623f7c48389b3b1e90b34a34fd16b14e1477
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19420
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-04-28 01:02:21 +00:00
Felix Maier f70db58dce Fix MSVC compilation.
Add missing includes:
- Add missing vector include WGPUHelper.h
- Add missing algorithm include as there is a std::transform used in DawnPerfTestPlatform.cpp

Remove c++20 designated initializers from tests.
Removing these as we target c++14 and they trigger warnings in MSVC.

Bug: dawn:394
Change-Id: Id7aea9ef953cc9baa5b7633a036dd09a96aca130
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20460
Commit-Queue: Felix Maier <xilefmai@gmail.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-27 20:29:01 +00:00
Corentin Wallez c05a0e1aac Enable -pedantic and disable currently triggered warnings
This will help avoid the introduction of additional non-standard
code and the warnings can be reintroduced one by one.

Bug: dawn:394

Change-Id: Ib3cd63058f47d17ae5ef67b047887a3b263a7e64
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20382
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-27 18:09:40 +00:00
Corentin Wallez 006020b04d Fix ValidateRowsPerImage error text.
Bug: None
Change-Id: I4fa934c5cfd5df0b0d18286350640bd1ff9df510
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20440
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-27 16:42:40 +00:00
Corentin Wallez 00b90ea832 Enable more warning needed for Skia to build with Dawn on Linux
The new warnings are:

 - -Wdeprecated-copy
 - -Winvalid-offsetof
 - -Wpessimizing-move

And the list of warnings was sorted alphabetically.

Bug: chromium:1072449
Change-Id: I9f3eecae645455c481ecc2e0be4df350e1453907
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20381
Reviewed-by: Zhenyao Mo <zmo@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-24 17:02:53 +00:00
Corentin Wallez cdf2d8de77 Deprecate BufferCopyView.rowPitch/imageHeight -> bytesPerRow/rowsPerImage
Bug: dawn:22

Change-Id: Ib4d93a73a6c40326d180f569fd51216c2d87df1e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20201
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-24 10:02:43 +00:00
Corentin Wallez c244f53921 Add a size argument to Set[Vertex|Index]Buffer
Bug: dawn:22
Change-Id: I06a4fc2b651e5a4692893f710ca11785976c1fa4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20200
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-24 09:42:03 +00:00
Brandon Jones 635239faf8 Non-Local Residency 2: Implement Non-Local Management Logic
Implements logic for managing the NON_LOCAL memory segment for UPLOAD
and READBACK heaps on Non-UMA devices.

Bug: dawn:193
Change-Id: I2426bf6b5f7a7ccd4420f830f344379af9faf73c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19901
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2020-04-23 21:50:32 +00:00
Corentin Wallez 409cf67207 Special-case GetDefaultQueue in the wire
Reland with a fix where commands only start being serialized by the
device after the first GetDevice() is called, not in the constructor.

This makes it so calling GetDefaultQueue always returns the same
object. It required updating various WireTests to account for the
additional wire calls.

Bug: dawn:22
Change-Id: Ibe43d84b25100f58a9ec5029a9341e400aec97f6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19982
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-23 21:21:52 +00:00
Bryan Bernhart b46d002057 D3D12: Fix UBO and sampler heap encoding test.
The test failed to switch out because the same
bindgroups were being de-duped. This change encodes
as many bindgroups required to switch.

BUG=dawn:155

Change-Id: I238cd0cebf2f8372046fe0cf83a18570aca41761
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20241
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-04-23 20:36:22 +00:00
Austin Eng 642009261e Reland "Slab-allocate VkDescriptorSets"
This is a reland of 96c4019214

It includes a fix to add a dummy descriptor count if the
VkDescriptorPool would be empty, and adds a test that a bind group
with an empty bind group layout may be created and used.

Original change's description:
> Slab-allocate VkDescriptorSets
>
> This introduces a slab allocator for VkDescriptorSets which creates
> a VkDescriptorPool pre-allocated with multiple VkDescriptorSets per
> BindGroupLayout. In the future, we can deduplicate pools that have
> the same, or roughly the same, descriptor counts.
>
> This CL also removes the old DescriptorSetService and moves most of
> the functionality onto the DescriptorSetAllocator itself to keep
> the tracking logic in one place.
>
> Bug: dawn:340
> Change-Id: I785b17f4353fb3d40c9ccc33746600d6794efe7c
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19320
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

Bug: dawn:340
Change-Id: Iabb744f110d0cab442bb857b31c87ba46bf0ad7a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20321
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-04-23 19:56:32 +00:00
Rafael Cintron 0e9320b5b5 Use Ref<TextureBase> instead of TextureBase* in more places
To avoid accidental memory leaks on account of using raw pointers,
use Ref<TextureBase> as method return type except at Dawn interface
boundaries.

Change-Id: I6459062ee28984de2cb1d5a2059bc70cf82b2faf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19580
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
2020-04-23 19:47:12 +00:00
Corentin Wallez 7e972be121 Revert "Slab-allocate VkDescriptorSets"
This reverts commit 96c4019214.

Reason for revert: Breaks the roll, WebGPU CTS hits the
ASSERT(totalDescriptorCount > 0)

Original change's description:
> Slab-allocate VkDescriptorSets
> 
> This introduces a slab allocator for VkDescriptorSets which creates
> a VkDescriptorPool pre-allocated with multiple VkDescriptorSets per
> BindGroupLayout. In the future, we can deduplicate pools that have
> the same, or roughly the same, descriptor counts.
> 
> This CL also removes the old DescriptorSetService and moves most of
> the functionality onto the DescriptorSetAllocator itself to keep
> the tracking logic in one place.
> 
> Bug: dawn:340
> Change-Id: I785b17f4353fb3d40c9ccc33746600d6794efe7c
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19320
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

TBR=cwallez@chromium.org,kainino@chromium.org,enga@chromium.org,bryan.bernhart@intel.com

Change-Id: Icb58485f1080eab79b24fbcd834a89fc6206b80e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:340
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20280
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-23 12:41:03 +00:00
Yunchao He 21d753a053 Read and write usage in compute pass is valid
Resource usage tracking in compute pass is per dispatch. So readable
and writeable usages in pass granularity may be valid.

This patch also removes ComputePassValidationTests.cpp because it
is duplicated with ResourceUsageTrackingTests.cpp. The former actually
contains resource usage tracking tests only, and the latter is also
for the same purpose and it is much more comprehensive.

Bug: dawn:358

Change-Id: I53f8906660b348eeff4f2a061e3b829d1c2ceab8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20122
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2020-04-23 00:15:50 +00:00
Bryan Bernhart 7434b2c67d D3D12: Enable sub-allocation for RTV/DSV heaps.
Uses the staging descriptor allocator to enable
sub-allocation for RTV/DSVs.

This change also simplifies CPU descriptor heap
 management for render-passes:
- Allocating slot-by-slot removes extra attachment
 pass.
- No need for the slower direct allocation allocator.
- Move RP creation of view handles into RP builder.

BUG=dawn:155

Change-Id: I508492a2e56a897bf8c85f9a45cd13f62fa0a2ef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20042
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-22 23:57:30 +00:00
Austin Eng 96c4019214 Slab-allocate VkDescriptorSets
This introduces a slab allocator for VkDescriptorSets which creates
a VkDescriptorPool pre-allocated with multiple VkDescriptorSets per
BindGroupLayout. In the future, we can deduplicate pools that have
the same, or roughly the same, descriptor counts.

This CL also removes the old DescriptorSetService and moves most of
the functionality onto the DescriptorSetAllocator itself to keep
the tracking logic in one place.

Bug: dawn:340
Change-Id: I785b17f4353fb3d40c9ccc33746600d6794efe7c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19320
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-04-22 23:22:40 +00:00
Brandon Jones f56f19059b Non-Local Residency 1: Get Non-Local Memory Info
Adds functionality to query VideoMemoryInfo for the NON_LOCAL memory
segment.

Bug: dawn:193
Change-Id: I63c2f5a649c37617e7b39a60faa2d3b5b5077156
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19900
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-22 21:57:00 +00:00
Rafael Cintron b4eccc8227 Allow Ref<Derived> -> Ref<Base> assignment, and move operations
Previous to this change, you were unable to assign or move Ref<Derived>
to a Ref<Base>.

This change addresses the problem by introducing <typename U> versions
of assignment, copy and move methods. nullptr_t specific ones were
also added to disambiguate things for the compiler.

Bug:dawn:390
Change-Id: Ib5d44231e26db35de33d63c67b36b5bf411a3540
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20121
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-04-22 20:34:00 +00:00
Austin Eng d4302437c9 Add depth texture sampling and tests for only depth32float
This is currently the only depth format that can be sampled.

Bug: dawn:367
Change-Id: Ie35c3f7eeee03661838e301453f387ae99e671d9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19702
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-22 19:54:00 +00:00
Jiawei Shao 64fcf3909a Allow one texture as write-only storage and sampled in one compute pass
This patch enables one texture to be used as both write-only storage
texture and sampled texture in one compute pass.

Note that while we don't need to check the usage scope of a texture in
the whole compute pass scope, we still need to verify one texture cannot
be bound to multiple bindings that are used in one dispatch at the same
time. This check will be added in the following patches.

This patch also adds tests to ensure a texture can be used as the
following binding types in one compute pass:
- read-only storage + sampled
- write-only storage + sampled
- read-only storage + write-only storage

BUG=dawn:267
TEST=dawn_unittests

Change-Id: Ibff2b005a5269a0bfa254e0417de4920758add39
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20120
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-22 00:55:43 +00:00
Bryan Bernhart c133cab158 D3D12: Remove increment during bindgroup population.
Simplifies descriptor heap allocations by removing increment which is
no longer required by Populate().

BUG=dawn:155

Change-Id: I1d9cd2c607691dc1bcffddd82aa46a10c2bf6fd3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20048
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-04-21 22:07:59 +00:00
Rafael Cintron f204cf2c4f Add Ref<T> specialization for Result
Ref<T> specialization will allow us to, in a future change, return
Result<Ref<T>> instances from Create methods while still keeping the
tagged pointer optimization.

Change-Id: I20c764358af22ba1dc53458d59b0b2b4770a0c6a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19801
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
2020-04-21 17:27:00 +00:00
Corentin Wallez fee2783cb0 Deprecate ShaderModuleDescriptor.code in favor of chained descriptor
This also adds the definition of the WGSL sub descriptor but forbids
using it for now.

Bug: dawn:22
Change-Id: I0514eec95bbcda28911547d6bda4d5257b62432b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19865
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-21 08:04:48 +00:00
Corentin Wallez 21744d0fb8 Make all backend::ShaderModule get SPIRV from the frontend
This will make it easier to support SPIRV as a chained sub-descriptor of
ShaderModuleDescriptor in follow-up CLs.

Also fix a couple style and formatting issues.

Bug: dawn:22
Change-Id: Iddaf1f87edee65687e17670b70024835918a0382
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19864
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-21 07:57:30 +00:00
Corentin Wallez 3966eb1175 Deprecate BG[L]Desc::binding[s|Count] in favor of entr[ies|yCount]
Bug: dawn:22

Change-Id: I02188d70103a1bee25b9b2024a2ea9f785656236
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19862
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-21 07:36:30 +00:00
Jiawei Shao e89b48768b Validate texture usage scope with storage textures in one render pass
This patch adds the validation rules on the texture usage scope with
storage textures in one render pass.
1. Write-only storage cannot be used in combination with anything else
in the same render pass.
2. Sampled and read-only storage are allowed to be used in the same
render pass.

This patch also adds dawn_unittests to test the storage texture usage
scope in one render pass:
1. read-only or write-only storage only
2. read-only or write-only storage + sampled
3. read-only or write-only storage + output attachment
4. read-only + write-only

This patch also removes kWritableBufferUsages as it is not used in Dawn
at all.

BUG=dawn:267
TEST=dawn_unittests

Change-Id: Ib2a0f06ec8d183c5f812f87459c6b1b8f79937e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19820
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-04-21 00:48:10 +00:00
Jiawei Shao d543d58760 Allow using write-only storage textures in fragment shader stage
This patch enables the use of write-only storage textures in fragment
shader stage after the new decision in WebGPU CG.

BUG=dawn:267
TEST=dawn_unittests

Change-Id: Ia1884e5d1a8e63cf992d3518df7375c2b3a72c41
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19784
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-04-21 00:43:30 +00:00
Austin Eng 7817a9aafe Reland "Add ComparisonSampler binding type and validation tests"
This is a reland of 6d9e4f8076
Now that the Chromium-side API change has landed, this CL can land.

Original change's description:
> Add ComparisonSampler binding type and validation tests
>
> Bug: dawn:367
> Change-Id: Iba1d3d03f6247a356b6f3fabfe7a7ba3c0753171
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18423
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

Bug: dawn:367
TBR=cwallez@chromium.org,kainino@chromium.org
Change-Id: I325d096e7ce092d17833429c3f54ef7c71189739
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20045
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-04-20 23:43:20 +00:00
Rafael Cintron 7e8385c183 Move and improve RefCounted
- Move RefCounted to common (from dawn_native) so that we can use
it from additional places.
- Use EXPECT_ macros instead of ASSERT_ in RefCounted tests for
improved logging on failures.
- Add a missing test for Ref::Detach.
- Plug memory leak in RaceOnReferenceRelease

Change-Id: Iaa7b11b5a6fa146e3c322143279a21a4ac027547
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19903
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
2020-04-20 17:36:22 +00:00
Corentin Wallez 8edb723dea Revert "Add ComparisonSampler binding type and validation tests"
This reverts commit 6d9e4f8076.

Reason for revert: Breaks the roll in Chromium, gpu_sampler.cc must first be
fixed to use the new undefined value, before this can be landed.

Original change's description:
> Add ComparisonSampler binding type and validation tests
> 
> Bug: dawn:367
> Change-Id: Iba1d3d03f6247a356b6f3fabfe7a7ba3c0753171
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18423
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

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

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

Bug: dawn:367
Change-Id: Ic071a601df2063bd2da5388b2e75c1a121924a69
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19983
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-20 17:21:52 +00:00
Corentin Wallez 5e088591ca Revert "Special-case GetDefaultQueue in the wire"
This reverts commit f93791ab62.

Reason for revert: breaks gl_tests on roll.

Original change's description:
> Special-case GetDefaultQueue in the wire
> 
> This makes it so calling GetDefaultQueue always returns the same
> object. It required updating various WireTests to account for the
> additional wire calls.
> 
> Bug: dawn:22
> 
> Change-Id: I8c74374b7c732b8bb7d0490bbc740dee0d2dface
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19726
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>

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

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

Bug: dawn:22
Change-Id: Id2f051b1d4be64a6e16ee8bbe998d72028660334
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19980
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-20 15:33:20 +00:00
Corentin Wallez 98334dfdf7 Deprecate BGLEntry::textureDimension in favor of viewDimension
Bug: dawn:22
Change-Id: Ibc58be789e3d3322fcd9cef92b1942c0e0b79090
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19861
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-20 08:10:10 +00:00
Yunchao He 99655bcf85 Add validation tests for resource usage tracking - 3
This patch adds validation tests for invisible and unused bindings.

The tests create bindings for compute, fragment and none stage. So,
only some bindings are visible for a particular render/compute pass.
In addition, some visible bindings in bind groups are not used by
pipeline. But resources of all bindings in bind groups (including
invisible/unused bindings) should be tracked, in order to identify
resource usage conflicts.

Bug: dawn:365

Change-Id: Ibb8d45a1a7b69891a17b4949147a16ada4ed6bd8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18120
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-18 05:41:58 +00:00
Austin Eng 6d9e4f8076 Add ComparisonSampler binding type and validation tests
Bug: dawn:367
Change-Id: Iba1d3d03f6247a356b6f3fabfe7a7ba3c0753171
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18423
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-04-17 20:14:17 +00:00
Austin Eng d6a5431304 Add default Undefined sampler compare function
Bug: dawn:367
Change-Id: I27ee54b0117c90dd554690e4fabc939d679c4005
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18422
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-04-17 19:32:07 +00:00
Corentin Wallez f93791ab62 Special-case GetDefaultQueue in the wire
This makes it so calling GetDefaultQueue always returns the same
object. It required updating various WireTests to account for the
additional wire calls.

Bug: dawn:22

Change-Id: I8c74374b7c732b8bb7d0490bbc740dee0d2dface
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19726
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-17 17:09:07 +00:00
Corentin Wallez 8a437947a8 Introduce Device::GetDefaultQueue and deprecate CreateQueue
This makes all backends register the default queue at device
initialization time, so that the same queue is returned by
each call to GetDefaultQueue.

All usages of CreateQueue are replaced by GetDefaultQueue
except a couple ones that could use the queue initialized by
DawnTest::SetUp.

A deprecation warning mechanism is added so that users of Dawn
can now that they should upgrade their usage of the API. It also
comes with a backdoor so we can test that they are emitted.

New DeprecatedAPITests are added that will contain tests for
deprecated APIs, and will also check that deprecation warnings
are produced.

The special casing of GetDefaultQueue in the wire will be done
in a follow-up CL to ease the review. It happens to work through
the regular wire mechanisms at the moment but returns a different
object on each GetDefaultQueue call.

Bug: dawn:22

Change-Id: I78dc1fa474769674278d30040e8d05c658b88360
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19724
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-17 16:45:17 +00:00
Corentin Wallez 9f5a1c5141 BUILD.gn: Remove leftover temporary test target.
This target was forgotten in the previous cleanup.

Bug: chromium:1064305
Change-Id: Ibf35df4393927ac8cc08d4965b8b8098c36e4bd3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19860
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-17 16:05:09 +00:00
Corentin Wallez 9c79dc050e Vulkan: Use VK_LAYER_KHRONOS_validation
This layer replaces VK_LAYER_LUNARG_standard_validation that is now
deprecated.

Bug: dawn:388
Change-Id: I488c175b997434a8e22deecfba3fc89495969cbc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19722
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-17 08:24:45 +00:00
Corentin Wallez 0925720ecb Add the Vulkan loader as an optional dependency and use it on Mac
On macOS we can't rely on having the Vulkan loader installed in the
system. So we add the Vulkan loader as an optional dependency of Dawn
and use it on macOS when building Dawn in standalone with Vulkan
support.

Usage of building our own loader might broaden if the loader gains
features that are useful on other OSes. For example the ability to pass
in the "root ICD" entrypoint to the loader so we can have both
Swiftshader and the system driver at the same time.

Bug: dawn:388

Change-Id: I7ade4961cce0463c66846ad17aebf95224f1afcc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19723
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-17 08:22:25 +00:00
Brandon Jones 53f694b34a Fix ASAN violation when a heap outlives the ResidencyManager
It's possible for a heap in the residency LRU to outlive the
ResidencyManager. When this happens, some heap in the LRU will be
referencing the LRU head node. On destruction, the outstanding heap
will attempt to access the LRU head node after the memory has been
freed. This commit removes the LinkedList head node from the list
within the LinkedList destructor to fix the bug.

Bug: dawn:387
Change-Id: I13617d1b4e464e1541f989f31caecd4305037019
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19581
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2020-04-16 23:59:03 +00:00
Brandon Jones 82ae680ccc Residency Bug: Always Attempt To Evict To Under Budget
In the case that a previous submit to the GPU required Dawn to exceed
the residency budget, Dawn must attempt to get back under budget the
next time EnsureCanMakeResident is called. This CL fixes a bug where we
only evicted the current size needed to be resident, which would
incorrectly raise the budget when a submit to the GPU required us to
exceed the budget.

Bug: dawn:193
Change-Id: I04649056e9eecce1fc6b5759c889b52a4f1b4594
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2020-04-16 23:52:23 +00:00
Austin Eng 3aa5be9749 Print the failing statement in ASSERT_DEVICE_ERROR
Makes it easier to track where and why a test failed.

Bug: none
Change-Id: Icdccde97db68c32c35af6c044a3eacd4d4978b61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19701
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-04-16 21:36:33 +00:00
Bryan Bernhart 319672791e D3D12: Remove ComPtr from d3d12::Device::GetD3D12Device()
Accessing the d3d device using COM needlessly
refcounts. This is a particular issue in areas
that frequently access the d3d device like
Populate().

BUG=dawn:155

Change-Id: I24e83093623afd02fa592d8ec0c404b4571c374b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19703
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-04-16 18:59:53 +00:00
Corentin Wallez f941205370 Use new gmock MOCK_FUNCTION macro.
Bug: None
Change-Id: If436fbf5c2392051caeadfc4a7482544d565b597
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19720
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-16 16:39:06 +00:00
Corentin Wallez d3bbcc3334 Correctly support setSubData of 0 bytes.
DynamicUploader/RingBuffer were incorrectly assuming that they could not
get empty allocation requests. Fix this and add a test.

The test also surfaced a bug in the Metal backend where the command
recording context could be left with a blit encoder open that was not
properly handled on device shutdown.

Bug: chromium:1069076
Change-Id: I9793b37142bd509254ce2894fa9f6208e9a68048
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19291
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-16 09:51:26 +00:00
Corentin Wallez 15b9531cca Rolling 4 dependencies
Also fixes an uninitialized variable in tests.

Roll build/ f3d0ca5f4..896323eed (1627 commits; 2 trivial rolls)

f3d0ca5f46..896323eeda

$ git log f3d0ca5f4..896323eed --date=short --no-merges --format='%ad %ae %s'
2020-04-14 chromium-autoroll Roll Fuchsia SDK from 0.20200414.2.1 to 0.20200414.3.1
2020-04-14 sergey.kipet gtkui: Fix standalone Ozone/Wayland configuration
2020-04-14 gbiv Reland "compiler: remove `!is_android` from CrOS thinlto checks"
2020-04-14 wez [fuchsia] Add //fuchsia/SECURITY_OWNERS and per-file OWNERS using it.
2020-04-14 hypan android: Add emulator avd specific OWNERS files
2020-04-14 chromium-autoroll Roll Fuchsia SDK from 0.20200413.3.1 to 0.20200414.2.1
2020-04-14 hypan emulator: Add option "--debug-tags" for avd start
2020-04-14 chromium-autoroll Roll Fuchsia SDK from 0.20200413.2.1 to 0.20200413.3.1
2020-04-13 steveroe Reland "[fuchsia] Collect Fuchsia system logs from Chrome-Fuchsia tests."
2020-04-13 chromium-autoroll Roll Fuchsia SDK from 0.20200413.1.1 to 0.20200413.2.1
2020-04-13 chromium-autoroll Roll Fuchsia SDK from 0.20200412.2.1 to 0.20200413.1.1
2020-04-13 wez Revert "[cipd] Refactor CIPD template"
2020-04-13 hirokisato Revert "Manually roll chromite to pick up localhost vs VM fixes."
2020-04-13 chromium-autoroll Roll Fuchsia SDK from 0.20200412.1.1 to 0.20200412.2.1
2020-04-12 atyfto [cipd] Refactor CIPD template
2020-04-12 chromium-autoroll Roll Fuchsia SDK from 0.20200412.0.1 to 0.20200412.1.1
2020-04-12 chromium-autoroll Roll Fuchsia SDK from 0.20200410.3.1 to 0.20200412.0.1
2020-04-11 dmazzoni Re-enable some Android content_browsertests
2020-04-11 chromium-autoroll Roll Fuchsia SDK from 0.20200410.2.2 to 0.20200410.3.1
2020-04-10 cduvall Revert "Use .r8dex.jar and .mergeddex.jar rather than .dex.zip"
2020-04-10 bpastene Manually roll chromite to pick up localhost vs VM fixes.
2020-04-10 chromium-autoroll Roll Fuchsia SDK from 0.20200409.3.1 to 0.20200410.2.2
2020-04-10 leuisken fix vs%s_install environment variable
2020-04-10 huangs [Build] print_python_deps.py: Use importlib.util for Python 3.
2020-04-10 chromium-autoroll Roll Fuchsia SDK from 0.20200409.2.1 to 0.20200409.3.1
2020-04-10 nhiroki Revert "Android: Use lint from cmdline-tools"
2020-04-10 wnwen Android: Use lint from cmdline-tools
2020-04-09 chromium-autoroll Roll Fuchsia SDK from 0.20200409.1.1 to 0.20200409.2.1
2020-04-09 bsheedy Optimize Android Skia Gold code
2020-04-09 agrieve Use .r8dex.jar and .mergeddex.jar rather than .dex.zip
2020-04-09 chromium-autoroll Roll Fuchsia SDK from 0.20200409.0.1 to 0.20200409.1.1
2020-04-09 ddorwin [Fuchsia] Add ddorwin to OWNERS
2020-04-09 huangs [Build] extract_unwind_tables.py: Remove temp file usage.
2020-04-09 chromium-autoroll Roll Fuchsia SDK from 0.20200407.1.1 to 0.20200409.0.1
2020-04-08 jeffyoon [ios] moving test runner xcode version to //testing/buildbot
2020-04-08 agrieve Android: Always run Desugar.jar as well as d8 desugaring
2020-04-08 akiss Add use_external_fuzzing_engine build argument
2020-04-08 wnwen Android: Use dots to distinguish java build steps
2020-04-08 agrieve apk_operations.py: Don't look for .mapping file for release builds
2020-04-08 hypan emulator: add "--dry-run" option for avd create
2020-04-08 wez [fuchsia] Migrate cr_package_fuchsia() to use SDK-provided rules.
2020-04-08 vasilyt Reland "Build: remove resource_dirs support"
2020-04-08 spang Revert "[fuchsia] Migrate cr_package_fuchsia() to use SDK-provided rules."
2020-04-07 agrieve Add more logging to compile_resources.py
2020-04-07 agrieve Add a \n to the end of AndroidManifest.expected
2020-04-07 chromium-autoroll Roll Fuchsia SDK from 0.20200407.0.1 to 0.20200407.1.1
2020-04-07 chromium-autoroll Roll Fuchsia SDK from 0.20200406.3.1 to 0.20200407.0.1
2020-04-07 brucedawson Better asserts on missing files during gn gen
2020-04-07 chromium-autoroll Roll Fuchsia SDK from 0.20200406.2.3 to 0.20200406.3.1
2020-04-06 xhwang media: Remove enable_mojo_media gn arg
(...)
2019-08-14 pcc Only link against libandroid_support on 32-bit platforms.
2019-08-14 thakis win: Remove msvc_use_absolute_paths gn arg.
2019-08-14 agrieve Android: Remove use_r8 flag and respect proguard_jar_path when set.
2019-08-14 robliao Start A List of Areas to Consider when Updating the Windows SDK
2019-08-14 hans Roll clang 365097:368742.
2019-08-14 aluo Make chrome smoke test self-testing and fix launch intent flags.
2019-08-14 chromium-autoroll Roll Fuchsia SDK from 890518145943 to 890514841981
2019-08-14 chromium-autoroll Roll Fuchsia SDK from 890520283089 to 890518145943
2019-08-14 svillar Fix build with BLINK_ANIMATION_USE_TIME_DELTA enabled
2019-08-14 ntfschr apk_operations: allow downgrade for bundle installs
2019-08-14 wez [Fuchsia] Remove legacy constant names from FIDL/JS.
2019-08-14 chromium-autoroll Roll Fuchsia SDK from 890523177803 to 890520283089
2019-08-13 wez [Fuchsia] Update FIDL/JS generator for 64-bit method ordinals.
2019-08-13 chromium-autoroll Roll Fuchsia SDK from 890525926525 to 890523177803
2019-08-13 chromium-autoroll Roll Fuchsia SDK from 890528724273 to 890525926525
2019-08-13 chromium-autoroll Roll Fuchsia SDK from 890530860946 to 890528724273
2019-08-13 wez Revert "Reland "[Fuchsia] Make hardware boot image downloading opt-in by .gclient.""
2019-08-13 kmarshall Reland "[Fuchsia] Make hardware boot image downloading opt-in by .gclient."
2019-08-12 chromium-autoroll Roll Fuchsia SDK from 890533504707 to 890530860946
2019-08-12 agrieve Android: Delete last references to "resource_rewriter" .build_config type
2019-08-12 justincohen Reland "[ios] Goma use is forbidden for official iOS builds."
2019-08-12 justincohen Revert "[ios] Goma use is forbidden for official iOS builds."
2019-08-12 thakis clang docs: mention llvm_force_head_revision
2019-08-12 chromium-autoroll Roll Fuchsia SDK from 890536058498 to 890533504707
2019-08-12 chromium-autoroll Roll Fuchsia SDK from 890539920088 to 890536058498
2019-08-12 huangs [DevUI DFM] Add BUILDFLAG(DFMIFY_DEV_UI).
2019-08-12 sidereal Revert "Reland "Roll clang 365097:368354.""
2019-08-11 chromium-autoroll Roll Fuchsia SDK from 890541741734 to 890539920088
2019-08-11 chromium-autoroll Roll Fuchsia SDK from 890544660006 to 890541741734
2019-08-11 chromium-autoroll Roll Fuchsia SDK from 890547849076 to 890544660006
2019-08-11 chromium-autoroll Roll Fuchsia SDK from 890550071829 to 890547849076
2019-08-10 thakis Revert "clang tot bots: Disable Wdangling-field"
2019-08-10 chromium-autoroll Roll Fuchsia SDK from 890552937159 to 890550071829
2019-08-10 chromium-autoroll Roll Fuchsia SDK from 890555439656 to 890552937159
2019-08-10 chromium-autoroll Roll Fuchsia SDK from 890557346683 to 890555439656
2019-08-10 kmarshall Revert "[Fuchsia] Make hardware boot image downloading opt-in by .gclient."
2019-08-10 thakis clang tot bots: Disable Wdangling-field
2019-08-10 kmarshall [Fuchsia] Make hardware boot image downloading opt-in by .gclient.
2019-08-09 rnk Reland "Roll clang 365097:368354."
2019-08-09 thakis mac: Create all parent directories of build/mac_files/xcode_binaries
2019-08-09 chromium-autoroll Roll Fuchsia SDK from 890560294264 to 890557346683
2019-08-09 sclittle Revert "Roll clang 365097:368354."
2019-08-09 rnk Roll clang 365097:368354.
2019-08-09 thomasanderson Switch Linux/Ozone to build with GTK
2019-08-09 justincohen [ios] Goma use is forbidden for official iOS builds.
2019-08-09 thakis mac: Stop downloading full hermetic Xcode.
2019-08-09 cliffsmo Add delayloads for full browser test libraries
2019-08-09 thakis clang tot bots: Disable Wreturn-stack-address
2019-08-09 chromium-autoroll Roll Fuchsia SDK from 890562890212 to 890560294264
2019-08-09 chromium-autoroll Roll Fuchsia SDK from 890565823233 to 890562890212

Roll buildtools/ 74cfb5700..2c41dfb19 (26 commits; 1 trivial rolls)

74cfb57006..2c41dfb19a

$ git log 74cfb5700..2c41dfb19 --date=short --no-merges --format='%ad %ae %s'
2020-03-30 tvanderlippe Update clang-format version to eb85e90350e
2020-03-23 brettw Roll GN from 9499562d..5ed3c9cc
2020-03-12 agrieve Roll GN from fd3d768b..9499562d
2020-03-10 thakis roll gn 4166e9fbc1f..fd3d768bcfd4
2020-02-29 xiaohuic Clean up buildtools repo migration code
2020-02-24 thakis Revert "Roll libunwind 43bb9f8722..d999d54f4b"
2020-02-21 thakis Roll libunwind 43bb9f8722..d999d54f4b
2020-02-21 seblalancette Roll GN from 97cc440d..4166e9fb
2020-02-21 bpastene Reland: Pull libunwind, libcxx, libcxxabi from a different mirror.
2020-02-19 bpastene Revert "Pull libunwind, libcxx, libcxxabi from a different mirror."
2020-02-19 thakis Pull libunwind, libcxx, libcxxabi from a different mirror.
2020-01-28 thakis Roll GN 83dad00a:97cc440d
2020-01-28 thakis Reformat remaining gn files.
2020-01-21 sdefresne Roll GN 0c5557d173..83dad00afb
2020-01-16 thakis Reformat all gn files in /buildtools/third_party/libc++.
2020-01-16 felipesalazar Include cxa_thread_atexit on linux targets.
2020-01-13 thakis Roll GN a5bcbd726a..0c5557d17
2020-01-08 bpastene Update //buildtools/README.txt after it was merged into chromium.
2019-12-31 agable Roll GN from 6feb5599..a5bcbd72
2019-12-13 chouinard Roll GN from ad9e442d..6feb5599
2019-11-18 xiaohuic Reland: Roll src/buildtools/third_party/libc++/trunk/ 5938e0582..78d6a7767 (333 commits)
2019-10-28 xiaohuic Revert "Roll src/buildtools/third_party/libc++/trunk/ 5938e0582..78d6a7767 (333 commits)"
2019-09-13 hnakashima Add exception for libassistant to import checker.
2019-09-10 dpranke Add a COMPONENT entry (Build) for //buildtools.
2019-09-10 dpranke Roll GN from 152c5144..ad9e442d

Roll third_party/binutils/ 01aa7745b..f9ce77769 (2 commits)

01aa7745b0..f9ce777698

$ git log 01aa7745b..f9ce77769 --date=short --no-merges --format='%ad %ae %s'
2020-04-03 adetaylor Adding CPEPrefixes for more dependencies.
2019-10-07 efoo Add "# COMPONENT" to OWNERS files

Roll tools/clang/ 3605577b6..698732d5d (129 commits)

3605577b67..698732d5db

$ git log 3605577b6..698732d5d --date=short --no-merges --format='%ad %ae %s'
2020-04-10 aeubanks Point TODOs at newer bug
2020-04-09 inglorion goma_link: Add more unit tests, split from integration tests
2020-04-09 johannkoenig remove GarbageCollectedFinalized plugin flag
2020-04-09 jabolopes Fix garbled diff output in clang test tool.
2020-04-08 inglorion goma_link_tests: Require Python 3
2020-04-03 aeubanks Revert "Use urllib instead of curl"
2020-04-03 aeubanks Use urllib instead of curl
2020-04-03 hans Clang package: build with -DLIBCXX_ENABLE_{SHARED,STATIC}=OFF
2020-04-02 akhuang Reland "clang build.py: change LLVM_ENABLE_ZLIB from ON to FORCE_ON"
2020-04-01 bikineev blink_gc_plugin: Add check for WeakPtrs to GCed objects
2020-03-31 bikineev blink_gc_plugin: Change RefPtr to scoped_refptr
2020-03-31 hans Roll clang n345938-a1762f9c-1 : n346557-4e0d9925-1.
2020-03-29 jdoerrie [clang tools] Don't print edit lines when no replacements exist
2020-03-26 rnk Update clang blink gc plugin test expectations
2020-03-25 agable Revert "clang build.py: change LLVM_ENABLE_ZLIB from ON to FORCE_ON"
2020-03-25 akhuang clang build.py: change LLVM_ENABLE_ZLIB from ON to FORCE_ON
2020-03-24 thakis Roll clang n345635-5d881dd8-1 : n345938-a1762f9c-1.
2020-03-20 inglorion goma_link_tests: Add test for -gsplit-dwarf
2020-03-19 hans Roll clang n344329-9284abd0-6 : n345635-5d881dd8-1.
2020-03-18 inglorion Update goma_link_tests to look for '<func>' instead of 'func'
2020-03-15 thakis Revert "Change to download and build zlib every time, in case a bot happens to die during a build"
2020-03-14 inglorion Pass -g* flags to code generation in distributed ThinLTO
2020-03-14 akhuang Change to download and build zlib every time, in case a bot happens to die during a build
2020-03-13 aeubanks Create new branch at origin/master, don't specify -r in git cl try
2020-03-13 akhuang Clang build.py: add zlib to linker search path so that cmake can find it
2020-03-12 hans Clang packaging script: don't do separate threads-enabled and disabled builds
2020-03-11 thakis clang build: enable in-process cc1 at clang build time instead of with a compiler flag.
2020-03-10 thakis Make run_tool.py less spammy after /showIncludes:user change.
2020-03-09 hans Clang packaging script: don't build lld with thinlto
2020-03-06 hans Revert "IWYU for bind/callback_helpers.h and ptr_util.h"
2020-03-06 thakis Roll clang n343707-61f538d3-1 : n344329-9284abd0-1.
2020-03-06 gab IWYU for bind/callback_helpers.h and ptr_util.h
2020-03-05 rnk Blink GC plugin: Fix tests after addition of const qual
2020-03-04 omerkatz heap: Make all TraceAfterDispatch methods const
2020-02-27 ehsankia Remove infrastructure for multiple extractor backend.
2020-02-26 hans Roll clang n341867-c2900381-1 : n343707-61f538d3-1.
2020-02-18 omerkatz heap: Add omerkatz@ as GC and GC plugin owner
2020-02-10 inglorion Fix fallback logic in goma_ld.py
2020-02-09 thakis Roll clang n340759-eaabaf7e-2 : n341867-c2900381-1.
2020-02-05 inglorion Correct fallback and mtime in distributed ThinLTO scripts
2020-02-04 akhuang Use zlib to build LLVM on Windows.
2020-02-04 inglorion Add scripts for distributed ThinLTO
2020-02-03 keishi blink_gc_plugin: Handle TraceIfNeeded for resolved T
2020-01-31 thakis clang upload script: Use Cq-Include-Trybots: for internal bots too.
2020-01-30 thakis clang upload script: Move list of bots from docs to Cq-Include-Trybots:.
2020-01-29 thakis Fix some more compile errors after upstream 777180a32b6107 in blink clang plugin
2020-01-29 thakis Fix some compile errors after upstream 777180a32b6107 in blink clang plugin
2020-01-29 thakis Fix some clang tool compile errors after upstream 777180a32b6107
2020-01-29 hans Roll clang n332890-c2443155-2 : n340759-eaabaf7e-1.
2020-01-28 enga Revert "Roll clang n332890-c2443155-2 : n340584-68051c12-1."
(...)
2019-11-15 hans Remove tools/clang/scripts/download_lld_mac.py
2019-11-15 hans Remove tools/clang/scripts/download_objdump.py
2019-11-11 hans Add UBSan runtime to the Mac Clang package
2019-11-05 thakis win: upload pdb for clang_rt.asan_dynamic-x86_64.dll to symbol server.
2019-11-05 hans Clang update.py: Add --package option
2019-10-30 johnchen Revert "Roll clang 373424-64a362e7-1 : n330255-55c223a7-1."
2019-10-29 hans Roll clang 373424-64a362e7-1 : n330255-55c223a7-1.
2019-10-24 hans Make upload_revision.py do a git checkout so it can get the commit count
2019-10-24 Taylor.Woll Add libclang package to sit alongside prebuilt LLVM binaries
2019-10-22 hans Clang build.py: LLVM no longer has SVN revision numbers
2019-10-15 hans Clang package.py: Don't run 'git diff' before building
2019-10-15 hans Clang build.py: Nuke the source dir if there is a local diff
2019-10-15 mlippautz heap: Add bikineev@ as GC and GC plugin owner
2019-10-03 thakis clang upload script: include full svn-git-sub triple in generated cl text.
2019-10-02 thakis Roll clang 372314:373424.
2019-09-25 rnk Fix crbug number in comment for 962988
2019-09-24 nicolaso Reland: "[Traffic Annotation] Remove function_context from extractor output"
2019-09-24 raul tools/: Convert uses of has_key
2019-09-24 hans Fix process-graph.py after #698787, take 2
2019-09-24 hans Fix process-graph.py after #698787
2019-09-23 hans Build Clang using profile-guided optimization on Windows
2019-09-22 raul tools: Use Python 3 style print statements [2/9]
2019-09-20 hans Roll clang 371856:372314.
2019-09-20 bikineev blink_gc_plugin: Remove GCFinalized and related diagnostics
2019-09-16 thakis Roll clang 371202:371856.
2019-09-13 mlippautz gc-plugin: Add mlippautz as owner
2019-09-12 tandrii Specify -B <bucket> where to trigger optional tryjobs.
2019-09-12 bikineev blink_gc_plugin: Check for correct use of CRTP
2019-09-12 bikineev Change clang subrevision to reflect changes in blink-gc-plugin
2019-09-11 bikineev blink_gc_plugin: Add no-gc-finalized options
2019-09-06 thakis Roll clang 370156:371202.
2019-09-05 thakis Roll clang 369647:370156.
2019-09-02 mlippautz [Stack Map Artefact] Add compiler plugins needed for safepoints
2019-09-01 thakis Fix Wfinal-dtor-non-final-class in plugin tests.
2019-08-29 contact Update BaseBindRewriters to convert base::BindRepeating to base::BindOnce
2019-08-28 hans Build clang with gcc 5.3.0 on Linux
2019-08-28 jakehughes [Stack Map Artefact] Introduce moving heap and root relocation
2019-08-28 jakehughes Layout initial experimental stack map gc design
2019-08-23 medinaandres Added revision to build_clang_tools_extra.py
2019-08-22 hans Roll clang 365097:369647.
2019-08-20 thakis clang upload script: Skip presubmits on upload.
2019-08-17 thakis clang: Attempt to fix plugin compilation after llvm r369130.
2019-08-16 hans Clang build script: Remove NDK r16 workaround
2019-08-15 jmadill Revert "Roll clang 365097:368742."
2019-08-14 hans Roll clang 365097:368742.
2019-08-12 sidereal Revert "Reland "Roll clang 365097:368354.""
2019-08-09 rnk Reland "Roll clang 365097:368354."
2019-08-09 sclittle Revert "Roll clang 365097:368354."
2019-08-09 rnk Roll clang 365097:368354.
2019-08-09 thakis clang mac tot bots: Stop setting DEVELOPER_DIR.

Created with:
  roll-dep build buildtools third_party/binutils tools/clang

Bug: None

Change-Id: Ice39068a904341972861759771f4793ea2aa694b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19601
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-15 19:58:17 +00:00
Austin Eng ba72944d3d dawn_wire: Validate all objects are from the same device in the client
This is a temporary fix until dawn_wire can support multiple devices.
When using objects from different devices, the wire will inject an
error into the receiver object's device. Methods that return objects
will return a dummy object. Using the dummy object will cause a fatal
error on the server.

Without this fix, the server would blindly lookup an ObjectId which
could point to some other object. This would bypass same-device
validation and have incorrect results.

Bug: dawn:383
Change-Id: I898f07d4b26f2a97ef952b82af488e7f807c36f0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19261
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-15 17:58:25 +00:00
Corentin Wallez 0ff7ed41ec Remove CreateBufferMappedAsync
The upstream WebGPU spec decided to not pursue CreateBufferMappedAsync,
and it adds some complexity to Dawn, so we remove it.

Bug: dawn:22
Change-Id: I4182a90c4a1aa0bfbaecd7d8f67d7049cf5df5d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17321
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-15 13:53:15 +00:00
Corentin Wallez e3f44e3cd6 ShutDownBase, only tick frontend facilities if they have been created
Bug: chromium:1068886
Bug: chromium:1068887
Change-Id: Ifbec86d806a9e03a7cf029824349a6f94b9fe63c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19290
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-15 10:07:25 +00:00
Corentin Wallez cd586a92e8 Null: Properly fake commands being completed on WaitForIdle
Bug: chromium:1068465
Change-Id: I7c01b1c4fed2424a53d30b7e53dabf4d74ed4a73
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19288
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-15 09:56:55 +00:00
Austin Eng 93bea5cb50 Add WireClient::Disconnect to stop serializing commands
This prevents the client from continuing to send commands
when the wire connection has dropped. In Chromium this may
be because the connection to the GPU process is lost and the
transfer buffer may be destroyed.

This CL also adds a new helper to make testing callbacks
with mocks easier.

Bug: chromium:1070392
Change-Id: I6a69c32cc506069554ead18ee83a156ca70e2ce2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19160
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-15 02:00:14 +00:00
Corentin Wallez 4bfc1539c3 Make a static const variable constexpr in BitSetIterator
This was found during some changes in Google3.

Also renames BitsPerWord to kBitsPerWord.

Bug:
Change-Id: I80cfe3a391963c2da376a7d8eadfc2797df01894
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19286
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-14 18:15:14 +00:00
Corentin Wallez 797fa62b91 Remove temporary GN proxy groups.
It also changes remaining deps for internal targets
from libdawn_proc to dawn_proc.

Bug: chromium:1064305
Change-Id: I36df2b5d7793be9d6c878b6a1f2ec238603a8205
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19289
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-14 17:36:44 +00:00
Yunchao He 81091b7434 Add more resource binding related validation tests
This change adds more resource binding related tests to clarify some
validation rules.

Bug: dawn:359

Change-Id: I16eca96c22c0d5f3f16dce5151bcabfd04d28349
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18940
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2020-04-14 17:15:24 +00:00
Zhenyao Mo 37193aa3b3 Roll glm 06f084063..bf71a8349 and turn on -Wextra-semi-stmt.
06f084063...bf71a8349

Bug: chromium:1064305
Change-Id: Id656cbc07b8a59a3485ebf08e806635514069109
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19480
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-04-14 16:20:14 +00:00
Corentin Wallez 8c8d16a1c5 BUILD.gn: Move dawn_end2end_tests to its final location
Bug: chromium:1064305
Change-Id: Ie51377301117a8ffbc6c21dc4c58349871bcf232
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19285
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-13 21:23:46 +00:00
Yunchao He 582e5284d0 Support none visibility binding in bind group
None visibility of shader stage bindings should be supported in
bind group. But Dawn can't support it. The patch fixed this issue.

Bug: dawn:385

Change-Id: I5b747abead24050b56b0fd0a9de561c87df4e36e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19340
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2020-04-13 20:01:22 +00:00
Corentin Wallez 871651d999 Fix another -Wc++11-narrowing on ChromeOS
Bug: chromium:1064305
Change-Id: Id2650dd3dd4f6ec0baf97ab1d061eb908739940e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19284
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-13 18:04:11 +00:00
Austin Eng 518c8e77ab Cleanup: Rename dawn_wire Object "serial" to "generation"
This is a more accurate name and conflicts less with the callback
request serials.

Bug: none
Change-Id: I0f9660c24468064dadffb3ab9b3392d403f93c41
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19260
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-04-13 17:50:51 +00:00
Austin Eng 077a427499 Tombstone exhausted ObjectIds in the wire
It's possible though unlikely to overflow the generation for a given
ObjectId. If this happens, an object like a Buffer or Fence could begin
receiving callbacks for previously destructed objects. This CL makes it
so the client doesn't reuse ObjectIds once they've hit the max generation
number so overflow isn't possible.

Bug: dawn:381
Change-Id: I443c1c87d96614a95d1973e2bf18cd702c34b3f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19240
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-13 17:11:22 +00:00
Corentin Wallez 3c31efc796 Metal: Fix MSAA workaround texture being leaked.
Bug: chromium:1070195
Change-Id: Ifb319d567f820bb4d3e9354d24b404bdb9617661
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19281
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-13 17:10:51 +00:00
Corentin Wallez 0543f78881 Fix -Wc++11-narrowing on ChromeOS
Bug: chromium:1064305

Change-Id: Ie34022633a708eb685138a3df004a65138139caf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19283
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-13 17:10:33 +00:00
Corentin Wallez b3f54318e7 Make dawn_native link against user32.lib on Windows
This is required for the call to the IsWindow function that's in
Surface.cpp.

Bug: chromium:1064305
Change-Id: I0c4a6ed17ba4aada994262d393de142de3f26144
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19282
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-13 17:09:52 +00:00