Commit Graph

1989 Commits

Author SHA1 Message Date
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
Zhenyao Mo 4fbd14badb Fix more compilation warnings.
Add -Wconditional-uninitialized -Wc++11-narrowing.

Bug: chromium:1064305
Change-Id: I1c1503cafaa2e58e990fc18998200af1f2c00d06
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19341
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-04-13 12:34:20 +00:00
Zhenyao Mo 5b7292c8f8 Fix more compilation warnings.
Bug: chromium:1064305
Change-Id: I3aac24f8179d2c9e5206dd4542ea2506f26755e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19301
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@google.com>
2020-04-11 03:22:33 +00:00
Zhenyao Mo 8619cbe237 Fix two warnings.
1) size_t >= 0 is always true, and trigger a warning. This is fixed
in the code because I feel such warning is useful to catch bugs.

2) extra statements from TRACE. Also fixed.

Bug: chromium:1064305
Change-Id: I487ff38f6947554fd175a19148c6f2aaaf56ed37
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19300
Commit-Queue: Zhenyao Mo <zmo@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-10 19:04:42 +00:00
Bryan Bernhart 4f86505544 D3D12: Bucket CPU descriptor allocators on the device.
Move the CPU descriptor allocators to the device and bucket them to
ensure only kMaxBindingsPerGroup exist rather than create them per BGL.

Also, renames NonShaderVisible => Staging.

BUG=dawn:155

Change-Id: If6dae368e7e2a2b349343bdf898041a049159038
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19001
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-04-10 18:43:22 +00:00
Corentin Wallez 42450c6d1c Fix the CMake build because of CMP0077
Prior to CMake 3.12 option() is a cache variable operation which meant
that the overriding of third_party project variables in
third_party/CMakeLists.txt needs to write to the cache.

Also remove a couple extra commas that were causing warnings.

Bug: None
Change-Id: I35efce70cf3e0cb923ebdbad654b2b9883b8f734
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19280
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-10 17:04:31 +00:00
Corentin Wallez d11cc3961a Split third_party/BUILD.gn in per-project files.
Bug: chromium:1064305

Change-Id: I6fc2da97e20865b62ff34a9d1c3f42120ac90348
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19202
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-10 08:24:00 +00:00
Corentin Wallez b31015b836 Split examples, test and utils in their own BUILD.gn
The basic change was to copy-paste targets in the new BUILD.gn files and
fixup paths / add includes. There's a couple more changes that had to be
done at the same time:

 - Multiple files need to know if GLFW is supported so the variable was
moved to dawn_features.gni.
 - The gtest_and_gmock target used to abstract between Dawn's copy of
GTest/GMock is only needed by tests and was moved in src/tests/BUILD.gn.
 - A leftover dawn_end2end_tests target is left in the main BUILD.gn
file that is an exact copy of the on in src/tests/BUILD.gn. This is
because the GN path is hardcoded in Chromium's isolate_map.pyl that also
can't support GN groups. The only way to move a target I could figure
out was to duplicate it temporarily.

Bug: chromium:1064305
Change-Id: I96820e9d6510b8c9b9112c3e6cd8df2413f04287
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19201
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-10 08:20:10 +00:00
Brandon Jones ab2c84ffd2 Residency 6: Enable D3D12 Residency and Add Tests
Toggles on D3D12 residency management by default. Adds basic residency
tests.

Bug: dawn:193
Change-Id: Idafa4a6d0f8f4052fb3428ac3d5f6be018db68cf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16385
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-09 23:31:02 +00:00
Brandon Jones 7be1d84975 Residency Bug: Make Setting Heap's Last Submission Serial Optional
When attempting to allocate more than Dawn's budget within a single
serial, all heaps in the LRU will be un-evictable because the last
submission serial is the same as the current serial. We can work
around this by instead using the LockHeap and UnlockHeap functions
instead of EnsureCanMakeResident when calling CreatePlacedResource.
Also added in some additional comments regarding the last submission serial.

Bug: dawn:193
Change-Id: Ie4ec7ed5350b0858ea817431fbf77df6ca8acd96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18622
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
2020-04-09 23:28:22 +00:00
Austin Eng 26b7d8f6d7 Fix use-after-free if BindGroup is the last owner of its BindGroupLayout
Destruction of the BindGroup needs to ensure that the BindGroupLayout is
destroyed after the BindGroup. This is done by using a custom deleter which
first creates an extra reference to the BGL before deleting the BindGroup.

Bug: dawn:355
Change-Id: I819bbce13473ee4738eaa304f6dac90e0501302a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19060
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-09 21:22:12 +00:00
Corentin Wallez 6574f92747 Fix the @rpath of dawn_components
When the libdawn_native target was renamed to dawn_native, the output
library name stayed the same (GN inserts a lib prefix if it isn't
present) but the @rpath annotation changed to be just dawn_native.dylib.

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

Bug: dawn:380
Change-Id: Id8610a6318af3468dcc486ee8d3c035f0273fe0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19200
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-04-09 17:31:40 +00:00
Corentin Wallez 0074b6e710 Remove temporary GN groups after Chromium fix
Bug: chromium:1064305
Change-Id: I8e169de411500c4b618c0a91bb0d8fd0ffb490d5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19180
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-09 17:27:40 +00:00
Corentin Wallez 757d153d54 Fix UBO/SSBO OOB in ComputeStorageBufferBarrierTests
The test was failing on Swiftshader, likely because the allocations for
the SSBO and the UBO where neighbors. The UBO test uses uvec4 instead of
uint so it needs 4 times less invocations to perform the test.

Bug: dawn:283
Change-Id: Id1952505763a0a3eb34718e000cb386e1faa4ade
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19082
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-04-09 17:18:40 +00:00
Corentin Wallez d9c2e89ef1 Fix wgpu::WholeSize not being set correctly inside BindGroup
The only test where this can matter at the moment is the OpArrayLength
test, so one of the buffers tested is repurposed to test wgpu::WholeSize
with an offset.

Bug: dawn:377
Change-Id: I43f22f614dff55e399246c46892a865ec77f13c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19080
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-09 12:17:00 +00:00
Corentin Wallez 989f139ceb Skip ViewportTest failing on Swiftshader.
The viewport tests assume sub-pixels precision when the Vulkan
specification explicitly allows for no subpixel precision.

Swiftshader seem to have only 4 bits of subpixel precision and fails
only this test surprisingly.

Bug: dawn:283
Change-Id: I77f6a6169a8fdff13448a612abdd4ab1dc42532e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19084
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-09 08:16:50 +00:00
Corentin Wallez d56b69f115 Skip Float16 TextureFormatTests on Swiftshader
Rendering +-INIFNITY with these formats results in a NaN when using
Swiftshader. Temporarily disable these tests while the Swiftshader issue
if being resolved.

Bug: dawn:283
Bug: swiftshader:147
Change-Id: I6e7c91ff72d0b4b6423175f5ab8586fdea42bb53
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19083
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-09 08:16:30 +00:00
Ryan Harrison 61e170b3c5 Propagate comparison sampler support from spvc
Roll third_party/shaderc/ f175adffa..802636496 (5 commits)

f175adffa9..8026364968

$ git log f175adffa..802636496 --date=short --no-merges --format='%ad %ae %s'
2020-04-07 rharrison Add concept of comparison sampler to API (#1036)
2020-04-06 rharrison Start shaderc v2020.1
2020-04-06 rharrison Finalize shaderc v2020.0
2020-04-06 rharrison Update CHANGES
2020-04-06 rharrison Rolling 5 dependencies and updating exceptions (#1035)

Created with:
  roll-dep third_party/shaderc

BUG=dawn:367

Change-Id: I10c80c2d5ac839eaa33765f845e8680ab759e3a8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19061
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-04-08 20:30:52 +00:00
Zhenyao Mo d9d9d1ec73 Make the Vulkan Validation Layers an optional dependency.
The build_overrides directory for the VVL will default to "" which
causes support for them to be skipped if the dependents don't set the
dawn_vulkan_validation_layers_dir variable.

Bug: chromium:1064305
Change-Id: I0a31f5d1d55982b5c953ce8ac6542d38829eedb5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19085
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@google.com>
2020-04-08 20:00:12 +00:00
Corentin Wallez 7119a0278d BUILD.gn: enable additional warnings.
Skia uses more warnings than Dawn, enable in Dawn directly so that
rolls of Dawn into Skia don't introduce warnings. These warnings
seem useful anyway.

Bug: chromium:1064305

Change-Id: I13dc776af84151131584a95caeee2cd21ae80fea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18964
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-08 16:04:32 +00:00
Corentin Wallez ff77ffee1a Fix wgpu::WholeSize to count until the end of the buffer.
Bug: dawn:377
Change-Id: Ia829ec05e5dd6a218b7f1c1bb7bdaf39088bdf70
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18960
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-08 12:09:25 +00:00
Corentin Wallez 36cd17488a dawn_wire: Correctly handle buffer state changes on Destroy()
The server didn't take intercept the destroy() call which meant the
buffer could be unmapped by dawn_native without the status updated in
ServerBuffer. This caused crash when a subsequent UpdateMappedData
command was handled and tried to write into the mapped buffer.

The client needs to also track destroy() otherwise it could sent an
UpdateMappedData to a destroyed buffer which is a fatal error.

Tests are added that cover the client-server interaction for this, but
the pattern that the following is unfortunately not tested directly
against the wire server:

 - CreateBufferMapped
 - Destroy
 - UpdateMappedData

Bug: chromium:1068466
Change-Id: If5185d4a8a81cd5f6bb41c9888a18c44c14b2de4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18961
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-08 10:23:35 +00:00
Ryan Harrison 9d2de1d6d4 Add default to conversion utility to avoid build breakage
I am about to add a new entry to the enum being used in this switch on
the spvc side. Temporarily adding in a default here, so that can roll
correctly, then this function can be updated to use the new entry.

BUG=dawn:367

Change-Id: I9345f651e2e23604599a1b25fcd2993127062695
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19040
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-07 21:53:37 +00:00
Corentin Wallez 30ec4fc626 Fixes to be able to build Dawn inside Skia
Add a dawn_has_build override similarly to angle_has_build that makes
Dawn not depend on Chromium //build if it can avoid it. (this was
previously used for mac_sdk.gni).

Only load the Vulkan Validation Layers' gni if it is enable via
dawn_enable_vulkan_validation_layers.

Fix a GN build warning where the source of dawn_components would be
built twice: for example libdawn_native.MetalBackend.o would be built
once for libdawn_native static and once for libdawn_native shared. Fix
this by making libdawn_native as a static library libdawn_native_static.

Change-Id: Ib8fb72282435eb475d7a11dae0d5a9977572fd57
Bug: chromium:1064305
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18963
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-07 19:35:47 +00:00
Corentin Wallez 73ea1f1106 Simplify the device lifecycle.
What was previously the Device's loss status is now a state that also
contains the "being created" state. Its transitions are entirely
handled in the frontend which enforces somewhat uniform lifecycles
between backends.

The backend devices' ShutDownImpl() function is now guaranteed to be
called only during the destructor, which leads to further simplification.
Previously Destroy() could also be called when the device was first
lost. This require complications because, for example, a WGPUBuffer
could still exist, and would want to call some resource allocator
service after the call to Destroy(). Now destruction of the device's
backing API objects is deferred to the destructor. (that's ok as long
as the application can't submit any more work).

WaitForCompletion is now guaranteed to be called before ShutDownImpl() iff
the call to DeviceBase::Initialize was succesful and the backing device
not lost. The idea is that after DeviceBase::Initialize, the GPU can
have some work enqueued and we need to wait for it to complete before
deleting backing API objects. In the future we might also have backend
be reentrant, using WebGPU itself to implement parts of the backend.
Reentrant calls would only be allowed after DeviceBase::Initialize.

Also the DynamicUploader that was special-cased in all backends is
now handled entirely by the frontend.

Bug: dawn:373

Change-Id: I985417d67727ea3bc11849c999c5ef0e02403223
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18801
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-07 16:19:47 +00:00
Corentin Wallez 7dbfc91d30 Fix Dawn's proxy groups to use public_deps instead of deps
To do perfect forwarding of GN targets, the proper method is to make a
group with public_deps. For example in the following:

 - Config C
 - Target T with a public_deps including C
 - Group G that proxies B
 - Target T2 that depends on G

If G uses deps = [ T ] then T2 won't see C, whereas if G uses
public_deps = [ T ] then T2 will dep on T, which will make it dep on C.

Bug: chromium:1064305
Change-Id: Iae236150c119b1a4003b957dcacf42e7759a936c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18965
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-07 16:16:37 +00:00
Corentin Wallez 09ee5eb499 Add a DeviceBase::Initialize that must be called by backends.
Bug: dawn:373
Change-Id: I5213496f4676bedc8e2a88912e89b6e0aacbac37
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18800
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-07 15:10:17 +00:00
Corentin Wallez 2d10e954ce BUILD.gn: rename libdawn_native/wire to dawn_native/wire
This helps take advantage of the GN feature where when a directory is
used as a target name, like //foo/bar/baz, the //foo/bar/baz:baz target
is used automatically.

Bug: chromium:1064305
Change-Id: I2e2d9f308fda1b811482026962ab0770ac45e988
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18862
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-07 07:44:00 +00:00
Corentin Wallez 5c2d2e7ff8 Split dawn_(native|wire|platform) to their own BUILD.gn files
This will help external projects that want to use Dawn, like Skia, refer
to GN targets without GN discovering Dawn's main BUILD.gn file that
causes all the tests and third_party dependencies to be discovered.

This CL just splits off chunks of BUILD.gn into separate file, adds
necessary includes and fixes up GN paths. It also introduces temporary
groups for targets that are used in Chromium so that the paths can be
fixed in a 3-way patch.

Bug: chromium:1064305

Change-Id: Ib4b73bd8d3121ef67d4ecee2e54ec158875f2117
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18861
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-07 07:29:45 +00:00
Corentin Wallez c3c6694d8f Rename BG[L]Binding to BG[L]Entry
This is to match the WebGPU API change.

The only manual changes are in dawn.json and templates. The rest was
created with the following commands:

  git grep -l BindGroupLayoutBinding | xargs sed -i "" -e "s/BindGroupLayoutBinding/BindGroupLayoutEntry/g"
  git grep -l BindGroupBinding | xargs sed -i "" -e "s/BindGroupBinding/BindGroupEntry/g"
  git cl format

Bug: dawn:22
Change-Id: I1377eef9ea9816578441c91d167909dedc7f8e96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18863
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-07 07:11:12 +00:00
Bryan Bernhart cb859a2037 Reland "D3D12: Stage BindGroups on CPU descriptor heaps."
This reverts commit c7f454c241
and relands commit 2479860e4b.

> D3D12: Stage BindGroups on CPU descriptor heaps.
>
> Instead of directly populating GPU heaps, pre-encoded
> BindGroups are staged on CPU heaps then copied over
> to the GPU. Non-shader visible allocators are stored
> on the BGL, which hands out fixed-size chunks to
> simplify memory managment. To enable memory re-use,
> CPU allocations are tied to the lifetime of BindGroup
> objects.

Reason for revert: We can reland this CL now that the CTS suppression merged.

Note: Adds validation to ensure binding size > 0.

Bug: dawn:155
Bug: dawn:375
Change-Id: I75b9773bbb7c70bcea803a7ad8b6480d21ea90f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18904
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-04-06 22:07:42 +00:00
Rafael Cintron c64242d4c2 Make RefCounted derived objects have private destructors
RefCounted (and derived) destructors should be protected on the class
to ensure the objects can ONLY be destructed by calling Release. This
avoids errors cause by destroying objects out from under code which
has an active reference count.

Unfortunately, many of the 'base' classes must continue having public
destructors because they are used as "blueprint" objects created on
the stack.

Added final on most-derived classes.

Ideas for future improvement:
- Change "base" objects to have protected destructors but create new
blueprint objects that privately derive from base objects. This
limits the blueprint object's usefulness to only be a blueprint.
- Modify createX methods to return Ref<Object> instead of Object*

Change-Id: I6f3b3b178118d135c4342cb912e982a3873d71af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18780
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-04-06 18:20:02 +00:00
Corentin Wallez 022d074c06 Make Toggles overriden automatically and device creation
Bug: dawn:373
Change-Id: I9aac64d1b800caad123161f4b48e70d39c1e0085
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18761
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-06 16:55:22 +00:00
Li, Hao be73a51136 Force uninitialized variables to be zero for shader compiler on D3D12
The shader with uninitialized variables will fail to compile on D3D12
backend. SPIRV-Cross has added an option for supporting forcefully
zero-initialized variables in latest version.

Bug: dawn:347
Change-Id: Id02fa486317c583ee11cfe3bc382816dc34121fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18680
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-04-06 15:19:22 +00:00
Corentin Wallez cb84c798dd Change the TogglesSet API to look like a set<>
Bug: dawn:373
Change-Id: Id1c7e4f03364a0975ea4965eaaf7d71c34db6b4c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18760
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-06 08:32:01 +00:00
Corentin Wallez c7f454c241 Revert "D3D12: Stage BindGroups on CPU descriptor heaps."
This reverts commit 2479860e4b.

Reason for revert: Causes WebGPU CTS failures

Original change's description:
> D3D12: Stage BindGroups on CPU descriptor heaps.
> 
> Instead of directly populating GPU heaps, pre-encoded
> BindGroups are staged on CPU heaps then copied over
> to the GPU. Non-shader visible allocators are stored
> on the BGL, which hands out fixed-size chunks to
> simplify memory managment. To enable memory re-use,
> CPU allocations are tied to the lifetime of BindGroup
> objects.
> 
> BUG=dawn:155
> 
> Change-Id: I402e6686c96f7450a077c627c8499600979e426c
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18100
> Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>

TBR=cwallez@chromium.org,enga@chromium.org,rafael.cintron@microsoft.com,bryan.bernhart@intel.com

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

Bug: dawn:155
Change-Id: I3dfae3e15e2bc21de692513725c9cf3ca38110b5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18860
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-06 08:16:31 +00:00
Austin Eng 76a8d0b92f Support chained extension structs on the wire
This CL also adds a couple of dummy extensions in dawn.json so that
the serialization/deserialization in the wire can be tested.

Bug: dawn:369
Change-Id: I5ec3853c286f45d9b04e8bf9d04ebd9176dc917b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18520
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-04-03 17:37:48 +00:00
Bryan Bernhart 2479860e4b D3D12: Stage BindGroups on CPU descriptor heaps.
Instead of directly populating GPU heaps, pre-encoded
BindGroups are staged on CPU heaps then copied over
to the GPU. Non-shader visible allocators are stored
on the BGL, which hands out fixed-size chunks to
simplify memory managment. To enable memory re-use,
CPU allocations are tied to the lifetime of BindGroup
objects.

BUG=dawn:155

Change-Id: I402e6686c96f7450a077c627c8499600979e426c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18100
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-04-03 16:52:28 +00:00
Li, Hao c00163ba09 Return error instead of crash if compile shader failed on D3D12
Bug: dawn:347
Change-Id: Id5cc8c9c7c3acf5daa6f17fd3235b584dd52d522
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18720
Commit-Queue: Hao Li <hao.x.li@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-03 08:34:38 +00:00
Corentin Wallez 9322cc3908 Fix -Wunreachable-code-break
Bug: None

Change-Id: I2bb05b6c4f9c2ec58ffdaa9eff14fd9bf71fccf7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18661
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-02 18:09:57 +00:00
Corentin Wallez e8316538e3 Normalize case X : {} break; to case X : { break;}
Dawn was using a very uncommon way to do breaks from case statements
when a block was introduced for that case statement. Fix it by running
the following commands:

  git grep -l "} break;" | xargs sed -i "" -e "s/} break;/break;}/"
  git cl format

Some -Wunreachable-code-break become very apparent in this CL but and are
fixed in a follow-up to keep mechanical and manual changes separate.

Bug: None
Change-Id: I558eda92bb1c9d938cc7cf07b091b733b57d3aca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18660
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-02 16:45:17 +00:00
Natasha Lee 5b29904d76 D3D12 Add check for DXGI_ERROR_DEVICE_REMOVED real device removed
Bug: dawn:269
Change-Id: I9a078efde0f0def29c9abfcc06d9f3ef2323cb55
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18560
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2020-04-01 20:09:16 +00:00
Corentin Wallez 373a3ff26e Rename GetBindGroupLayout's argument group->groupIndex
This is to follow upstream webgpu.h changes.

Bug: dawn:22
Change-Id: I976d1394a31a47870a73ed834137ce99047675bd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18540
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-01 18:22:36 +00:00
Corentin Wallez a0afd31585 Separate device lost from internal errors.
The effect to the user is the same, the Dawn device gets lost. However
we need to make the difference internally because when the backend
device is lost we can clean up immediately. On the contrary on internal
errors, the backend device is still alive and processing commands so we
need to gracefully shut it down.

Bug: dawn:269

Change-Id: Ie13b33a4f9ac2e1f5f98b3723d83cf1c6205c988
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17965
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-01 12:07:43 +00:00
Corentin Wallez 3da19b843f Use the default values for Dispatch in examples and tests
Bug: dawn:22
Change-Id: I4f83b966ee73ed92dc6648e3c59fac1be89031e1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18381
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-31 16:23:35 +00:00
Corentin Wallez 67b1ad7a97 Add the defaults for Draw and DrawIndexed
And updates all places in tests and examples where they could have been
used.

Bug: dawn:22
Change-Id: Ic36e3f1810037b5addeb9e971b1da28fdd1da183
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18380
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-31 16:21:35 +00:00
Brandon Jones 7982cc0527 Residency 5: Implement and Integrate Residency Management
Adds all D3D12 residency management logic.

Bug: dawn:193
Change-Id: Ibc160289c29cc85817dcfaaef1b92d04599aa802
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16384
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2020-03-31 15:31:56 +00:00
Yunchao He 276b065265 Add validation tests for resource usage tracking - 4
This patch adds tests to verify that resource usage tracking is per
each pass (neither per each draw/dispatch, nor per each command
encoder or command buffer).

Bug: dawn:358

Change-Id: I7bd05de3539ff2d11bb58cd34a370015907e4666
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18180
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-03-30 23:34:55 +00:00
Corentin Wallez d25b8e14f4 Fix compilation on iOS where setDisplaySyncEnabled isn't available.
Bug: dawn:269
Change-Id: I607983aaf437c39082156151b79887e72d529247
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18260
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-30 20:45:05 +00:00
Ben Wagner a0d8362e00 Add std:: to nullptr_t
Fixes compiler error on Linux about bare nullptr_t not existing.

Bug:

Change-Id: I1eb97d40e9ff564775d4ec7bbc54430481475f34
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18320
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Wagner <bungeman@chromium.org>
2020-03-30 20:40:05 +00:00
Rafael Cintron c602c86907 Call ID3D12SharingContract::Present on WebGPU swap buffer destroy
In PIX's D3D12-only mode, there is no way to determine frame boundaries
for WebGPU since Dawn does not manage DXGI swap chains. Without
assistance, PIX will wait forever for a present that never happens.

If we know we're dealing with a swapbuffer texture, inform PIX we've
"presented" the texture so it can determine frame boundaries and use the
texture's contents for the UI.

Bug: dawn:364
Change-Id: I7eb628c460e1e7c446ad91b29b03dd7b54545afb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18060
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
2020-03-30 20:31:45 +00:00
Natasha Lee 29d712f9de D3D12 Immediately release pending commands
We want to release pending commands in Device::WaitForIdleForDestruction()
so that when we call TickImpl(), we can reset the command allocators.

Bug: dawn:269
Change-Id: Ibd8fdd685a4e9ed7cce8176ba097bc67687bcd97
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18101
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-30 11:37:44 +00:00
Yunchao He 81431f5034 Add validation tests for resource usage tracking - 2
This patch adds resource usage tracking tests for overwritten
situations within a draw/dispatch:
1) multiple SetIndexBuffer
2) multiple SetVertexBuffer on the same index
3) multiple SetBindGroup on the same index

We should track the overwritten resources even though they
are not used in render/compute pass.

Bug: dawn:357

Change-Id: I1e804c9aebfc62acb82513db51b6ae94a85579fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18000
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-27 21:40:47 +00:00
Austin Eng 06508118eb Merge BindGroupLayout and ShaderModule BindingInfos
This moves BindGroupLayoutBase::BindingInfo into the dawn_native
namespace and changes ShaderModule::BindingInfo to extend it with
SPIR-V ids.

Bug: dawn:354
Change-Id: I6a2187e94c0200bee729cf8290f74e4f8c648334
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17920
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-27 18:54:03 +00:00
Corentin Wallez ba53617f6f Vulkan: Load functions for surface extensions we support.
Previously the surface extensions were only enabled so we could import
VkSurfaceKHR's created from GLFW. To implement the webgpu.h
surface-based swapchains, we are going to use the extension entrypoints
too.

This changes vulkan_platform.h to set defines that make vulkan.h expose
the entrypoints and datatypes for all the Vulkan extensions we might
care about for a given compilation configuration.

Bug: dawn:269
Change-Id: If4202ff5e31c816eccb5f5381bd36b660a3b6c5b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17964
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-03-27 16:50:59 +00:00
Corentin Wallez 12944c84c9 Metal: Don't crash on invalid shaders
MetalFunctionData::function was uninitialized when an error happened
its destructor would run, calling release on a garbage pointer.

Bug:

Change-Id: Ib72038da2a07b4e0f27ec929ec08f303c54dcc62
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17760
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-27 16:50:11 +00:00
Corentin Wallez ffd94da5f1 Vulkan: Free recording context semaphores on destroy.
Previously the code ASSERTed that the semaphores didn't exist on
destroy, but that's not necessarily the case. Handle destruction more
correctly.

Bug: dawn:269

Change-Id: If123e0e20b4ee157c70a1b8cc2f3b20a9473f55e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17963
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-27 16:48:39 +00:00
Corentin Wallez e784d8d0dc Vulkan: Use EXT_metal_surface instead of MVK_macos_surface
All Vulkan implementations on macOS have EXT_metal_surface available
(MoltenVk, Swiftshader and gfx-rs), and it matches webgpu.h's surface
creation from a CAMetalLayer more closely.

Bug: dawn:269

Change-Id: I313cd366b3509fb8930552406d150f08fc8e3666
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17962
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-27 16:37:17 +00:00
Corentin Wallez a44221d05b Vulkan: Make GatherSurfaceInfo use ResultOrError
Bug: dawn:269

Change-Id: I80ac5ce170b2e7630d8524cd34375bf0f1c67a60
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17961
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-27 16:35:17 +00:00
Corentin Wallez 97ec825cde Vulkan: Don't use vulkan.h's prototypes.
VulkanFunctions handles the storing of Vulkan function pointers so Dawn
doesn't need the declarations for Vulkan entrypoints.

Bug: dawn:269

Change-Id: I25f05d4a82fd31a60b22257261e940ce276f5eac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17960
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-27 16:32:24 +00:00
Yunchao He 3665d28e6e Add validation tests for resource usage tracking
This change mainly does a code refactoring. It moves resource tracking
tests from CommandBufferValidationTests.cpp to a separate test file.

It also adds a few tests, like copy dst/src doesn't impact resources
used in render/compute pass.

More tests about resource usage tracking will be added into this
separate test file.

Bug: dawn:359

Change-Id: I29d9b87b8de9a07b39ee1087e9f6a53ad10fe8fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17720
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2020-03-27 15:52:50 +00:00
Austin Eng 0847cb4637 Convert LayoutBindingInfo to an array of BindingInfos
This makes accessing per-index data simpler, and now that dynamic
buffer bindings are packed at the front, the old IterateBitset on
the dynamic buffer binding mask can be replaced with a simple loop
over the beginning bindings.

Bug: dawn:354
Change-Id: I1adf371c3228690758f90ab1f0de88ad8d0f950d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17681
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-03-26 17:22:14 +00:00
Jiawei Shao d5db214564 Collect if a storage texture is declared as multisampled in shader
This patch records if a storage texture is declared as multisampled or
not in shaders after a fix in shaderc.

BUG=dawn:267
TEST=dawn_unittests

Change-Id: I3914ccd3bfa4d0b6ab9c7cfb650352b70ba067a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17600
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-26 00:46:38 +00:00
Bryan Bernhart 046389926f D3D12: Add end2end tests for small shader-visible heaps.
Adds a toggle to force the use of small shader-visible heaps and
whitebox tests to verify bindgroup encoding correctness.

BUG=dawn:155

Change-Id: I4118b850d9f2cb445ae805aa68ebf4fab671261b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16960
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-25 18:31:08 +00:00
Jiawei Shao 0eff2a2b46 Add validations on the creation of bind groups with storage textures
This patch adds all the validations on the creation of bind groups with
read-only and write-only storage textures.

1. Only the textures with STORAGE usage can be used as read-only or
   write-only storage textures.
2. The format of the texture view used as read-only or write-only
   storage texture must match the corresponding declarations in the
   bind group layout.
3. The texture view dimension of the texture view used as read-only or
   write-only storage texture must match the corresponding declaration
   in the bind group layout.

Note that we don't test the match of the sample count because currently
we don't support sample count > 1 when creating a texture with STORAGE
usage and creating a bind group layout with read-only or write-only
storage textrue binding type.

This patch also adds a unit test to verify that it is invalid to create
a bind group layout with either read-only or write-only storage texture
binding type and dynamic offsets.

This patch also implements the bind group with storage textures on
Vulkan to make the Vulkan fuzzer happy with this patch.

BUG=dawn:267
TEST=dawn_unittests

Change-Id: Iee1b3c49671aae8a5424882b035624248d5fc281
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17583
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-25 07:53:37 +00:00
Austin Eng b867e14cac Add DAWN_NO_DISCARD to ErrorData
ErrorData should not be discarded. The error must be handled.

Bug: chromium:1063810
Change-Id: I55e782e499f307b91790db10a42878afdc7540dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17501
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-24 18:24:24 +00:00
Corentin Wallez 4c6c40d47d Validate there are at most kMaxBindingsPerGroup entries per layout.
This is a regression that was caught by the WebGPU CTS after
https://dawn-review.googlesource.com/c/dawn/+/17240 where the
BindGroupLayout validation was changed to use a set, and the check for
KMaxBindingsPerGroup removed.

This CL also adds a regression test.

Bug: dawn:354

Change-Id: I0cda545b9df7220ca53216878cf24ac8ce880648
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17620
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-24 17:29:54 +00:00
Jiawei Shao 4a858a0cbd Reland "Check bind group layout with storage texture in pipeline descriptors"
This reverts commit 7c24b6b2ff.

Reason for revert: We can reland this CL now as the fix in shaderc has
been merged.

Note that the declaration whether a storage texture is multisampled or not
cannot be extracted correctly in SPVC. The fix in Dawn will be added after
it is fixed in shaderc.

Original change's description:
> Revert "Check bind group layout with storage texture in pipeline descriptors"
>
> This reverts commit 63f2666ee7.
>
> Reason for revert: causes failures in dawn_unittests after Dawn uses SPVC by default. We need a fix in both SPVC and this CL before re-landing.
>
> Original change's description:
> > Check bind group layout with storage texture in pipeline descriptors
> >
> > This patch adds all the validations on the use of bind group layout with
> > read-only storage texture and write-only storage texture in the creation
> > of pipeline objects.
> >
> > 1. GPUBindGroupLayout.bindingType must match the type of the storage
> >    texture variable (read-only or write-only) in shader.
> > 2. GPUBindGroupLayout.storageTextureFormat must be a valid texture
> >    format that supports STORAGE usage.
> > 3. GPUBindGroupLayout.storageTextureFormat must match the storage
> >    texture format declaration in shader.
> > 4. GPUBindGroupLayout.textureDimension must match the storage texture
> >    dimension declared in shader.
> >
> > BUG=dawn:267
> > TEST=dawn_unittests
> >
> > Change-Id: Ifa3c2194dc76de14f790a0a73868e69bbb31c814
> > Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17167
> > Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
> > Reviewed-by: Kai Ninomiya <kainino@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
>
> Change-Id: Idb4083b11f22fa7e4c5c8477bc4b65b58900746e
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: dawn:267
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17380
> Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>

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

Bug: dawn:267, chromium:1063570
Change-Id: If762cbb206e738f4e54e75c88d506fdf3a44f280
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17461
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-03-24 00:56:53 +00:00
Austin Eng 80a1868f33 Fix MSVC build
(Manual)?SwapChainTests had a narrowing conversions from double to float

Bug: dawn:269
Change-Id: I5b07f53556fa5461877631904fa2c1ab6c8e6596
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17540
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-03-23 20:10:53 +00:00
Corentin Wallez 26e42d31f3 Properly handle SPVC errors.
Also removes a MaybeError from a function that can't return errors.

Bug: chromium:1063810
Change-Id: I9125b2b164a2892006442e26d6070d226fec8665
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17481
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-23 15:08:41 +00:00
Corentin Wallez d920adc772 Stop using SPVC by default.
SPVC only allows SPIR-V 1.0 while WebGPU samples and other existing
content outputs SPIR-V 1.3. Turning SPVC on by default broke all of
them, so we disable SPVC until we decide what to do.

Bug: chromium:1063810
Change-Id: Iedcf31960eb25b0974e8c67030232902cd58a4a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17480
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-23 12:27:21 +00:00
Austin Eng a80993da44 Support and pack unbounded binding numbers in the BGL
Also fixes a bug where we weren't validating duplicating
bindings in the shader, and where dynamic offset validation
could be incorrectly fetching the wrong bindings.

Bug: dawn:354
Change-Id: I93178c34eb4d43119e8b9de5738ae4596e9277cd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17240
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-03-20 21:56:30 +00:00
Corentin Wallez 11652ff8f8 Implement the webgpu.h swapchains on Metal
The webgpu.h surface-based swapchains are implement on Metal which
required adding the present mode to NewSwapChainBase.

Additional automated tests are added which require getting the Instance
so a new getter is added to DawnTest. Additional some the state tracking
of swapchains is performed in the backend, so the
SwapChainValidationTests are turned into regular DawnTests so they can
check backends do the correct state tracking. To not lose coverage of
the Null backend, a NullBackend() DawnTestParam factory is added.

Finally swapchains cannot be entirely tested in an automated fashion, so
a new example is added called "ManualSwapChainTests" that allows
manually checking a number of properties. Documentation of the controls
and a manual test plan is in a comment at the top of the example's
source.

Bug: dawn:269

Change-Id: If62fffc29a6cefdbec62747d01c523e2a5475715
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17181
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-20 17:07:20 +00:00
Corentin Wallez 527045fe55 Change present modes to match webgpu.h
Bug: dawn:269
Change-Id: I879ce75addde068097ec54d95ec21697d6ac2dc4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17400
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-20 16:47:50 +00:00
Corentin Wallez e5753d2fb8 Enable (and fix) the DeviceLost tests on Metal
They were failing because services of the Metal backend like the
MapRequestTracker thought that work was still pending since the device
only waited for previous commands to complete, and not also pending
commands.

Bug: dawn:68
Change-Id: I917ecefe90707b0c89f7e9b4b7379a98ed3956d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17320
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-20 09:14:30 +00:00
Corentin Wallez 69c5dd70e7 Fix depth-only render pipeline creation on Metal.
Bug:

Change-Id: I6e07d2a0164386f7fe2fe1776cf8228066e23959
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16700
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-20 09:04:00 +00:00
Jiawei Shao 7c24b6b2ff Revert "Check bind group layout with storage texture in pipeline descriptors"
This reverts commit 63f2666ee7.

Reason for revert: causes failures in dawn_unittests after Dawn uses SPVC by default. We need a fix in both SPVC and this CL before re-landing.  

Original change's description:
> Check bind group layout with storage texture in pipeline descriptors
> 
> This patch adds all the validations on the use of bind group layout with
> read-only storage texture and write-only storage texture in the creation
> of pipeline objects.
> 
> 1. GPUBindGroupLayout.bindingType must match the type of the storage
>    texture variable (read-only or write-only) in shader.
> 2. GPUBindGroupLayout.storageTextureFormat must be a valid texture
>    format that supports STORAGE usage.
> 3. GPUBindGroupLayout.storageTextureFormat must match the storage
>    texture format declaration in shader.
> 4. GPUBindGroupLayout.textureDimension must match the storage texture
>    dimension declared in shader.
> 
> BUG=dawn:267
> TEST=dawn_unittests
> 
> Change-Id: Ifa3c2194dc76de14f790a0a73868e69bbb31c814
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17167
> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
> Reviewed-by: Kai Ninomiya <kainino@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

Change-Id: Idb4083b11f22fa7e4c5c8477bc4b65b58900746e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:267
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17380
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-03-20 01:44:29 +00:00
Jiawei Shao 63f2666ee7 Check bind group layout with storage texture in pipeline descriptors
This patch adds all the validations on the use of bind group layout with
read-only storage texture and write-only storage texture in the creation
of pipeline objects.

1. GPUBindGroupLayout.bindingType must match the type of the storage
   texture variable (read-only or write-only) in shader.
2. GPUBindGroupLayout.storageTextureFormat must be a valid texture
   format that supports STORAGE usage.
3. GPUBindGroupLayout.storageTextureFormat must match the storage
   texture format declaration in shader.
4. GPUBindGroupLayout.textureDimension must match the storage texture
   dimension declared in shader.

BUG=dawn:267
TEST=dawn_unittests

Change-Id: Ifa3c2194dc76de14f790a0a73868e69bbb31c814
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17167
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-20 00:01:19 +00:00
Ryan Harrison 27622ce1c5 Turn on usage of spvc by default
The CTS has been changed to use the version of SPIR-V that spvc is
expecting, so the issues that previously caused a rollback should no
longer occur.

BUG=dawn:337

Change-Id: Ied5c39059d417359a697930287728faf57289c62
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16900
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-19 14:45:31 +00:00
Ryan Harrison 81bcbbc20e Add storage texture format reflection to spvc path
Roll third_party/shaderc/ 95185d920..362becca1 (2 commits)

95185d920a..362becca1f

$ git log 95185d920..362becca1 --date=short --no-merges --format='%ad %ae %s'
2020-03-18 rharrison Add support for storage texture format reflection (#1005)
2020-03-18 dgkoch Remove NV_EXTENSIONS conditionals (#1003)

Created with:
  roll-dep third_party/shaderc

BUG=dawn:337

Change-Id: I8b4dda98bcdac9eea170fe2a05bbeb75f48379e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17300
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-03-19 14:25:51 +00:00
Ryan Harrison 1f9b5960d8 Use new binding type reflection provided by spvc
This adds parity for reflection features in the spvc-only code path up
to 421684f. Additionally changes will be needed to bring support to
parity up to HEAD.

BUG=dawn:337

Change-Id: I2143587c54018da766934fa60d80aedd1ccd151b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17165
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-03-18 16:33:58 +00:00
Austin Eng 83e138ca96 D3D12: Fix usage of CopyResource
CopyResource may only be used for resources that have exactly the same
format, dimension, mips, layers. And it can only be used if the entire
texture region is copied.

Bug: dawn:353
Change-Id: Ia8f96cc10c88fe026e23bce2d0532624725b12e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16984
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-18 01:11:17 +00:00
Ryan Harrison b988e03982 Add in a default case to unblock shaderc rolls
The roll in Chromium is failing, because Dawn doesn't handle all of the new enum
values, but I cannot land the 'proper' fix in Dawn, because Chromium doesn't yet
know about the new enum values. Yay, cross dependencies.

So my solution is land the default case in Dawn, land the DEPS roll in Chromium,
then patch in the 'proper' cases in Dawn.

Roll third_party/shaderc/ a7657e4fa..95185d920 (2 commits)

a7657e4fa2..95185d920a

$ git log a7657e4fa..95185d920 --date=short --no-merges --format='%ad %ae %s'
2020-03-17 rharrison Rolling 4 dependencies (#1002)
2020-03-16 rharrison Add reflection support for storage textures (#1001)

Created with:
  roll-dep third_party/shaderc

Change-Id: Id73b38643d9a6d418be9c75e218fdad7a18839bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17164
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-03-17 18:12:57 +00:00
Natasha Lee 31eacb90f1 LoseForTesting can only be called once
Bug: chromium:1061878, dawn:68
Change-Id: Ieb35bdefc22299f828fe21e43d85fefabf500e27
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17140
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2020-03-17 15:03:18 +00:00
Brandon Jones 1f0596818d Residency 4: Add Facilities For Budgeting Device Memory
Use D3D12's QueryDeviceVideoMemoryInfo to get the OS-determined process
budget. Also introduces an export for reserving some amount of process
memory - which keeps Dawn from using the entire process's budget.

Bug: dawn:193
Change-Id: I6c17bd703d7cb24759bcee89c03add46944fec8c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16383
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-17 13:47:57 +00:00
Jiawei Shao 971a6233c2 Validate the declaration of storage texture format in shader
This patch adds the validation on the storage texture format declared in
shaders when we create a rendering or compute pipeline with read-only or
write-only storage textures.

This patch also fixes a typo in the TextureValidationTest.

BUG=dawn:267
TEST=dawn_unittests

Change-Id: Id302b4b7803d7e03b57c61de1290cc71ba940e2c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16940
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-17 10:28:07 +00:00
Austin Eng 2550e96724 Fix OpenGL over-eager lazy zero initialization for textures
Bug: dawn:145, dawn:348
Change-Id: I3b6e7b148a171bdcb50bcb825858cbf967c64c87
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16983
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-17 01:51:56 +00:00
Austin Eng 1cad258869 Fix Vulkan over-eager lazy zero initialization for textures
Bug: dawn:145, dawn:348
Change-Id: I10f7bcd324799b783d8dfdc8aaae52033236b695
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16981
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-17 01:14:36 +00:00
Austin Eng c7e16e351f Fix D3D12 over-eager lazy zero initialization for textures
Bug: dawn:145, dawn:348
Change-Id: Iafa1644424e67020b004765a0c9ccff2e077ead3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16980
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-03-16 17:48:26 +00:00
Nico Weber 022952303c Suppress two -Wunreachable-code warnings.
Bug: chromium:346399
Change-Id: Ieb76cf99022230dcfb0bc6b17f95ea544040a796
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17040
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-16 10:59:56 +00:00
Jiawei Shao 1a56ce54e0 Validate creating bind group layout with storage textures
This patch adds the validation on the creation of the bind group
layout with read-only storage texture, write-only storage texture
and read-write storage texture. Currently read-write storage textures
are not supported in any shader stages.

This patch also fixes chromium:1061156.

BUG=chromium:1061156, dawn:267
TEST=dawn_unittests, dawn_end2end_tests

Change-Id: Ib42678719df48565a46e39f21c34ec640960dcdc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16920
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-16 10:53:36 +00:00
Austin Eng 463c394905 Slab-allocate OpenGL bind groups
Now that all backends use slab-allocated bind groups, this patch also
moves the BindGroup implementation with owned-data into the Null backend.

Bug: dawn:340
Change-Id: I08a952075b382008fb82f1fbab3f779cc05bc2a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16747
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-13 23:51:50 +00:00
Austin Eng ae96f04c0a Slab-allocate frontend D3D12 bind groups
Bug: dawn:340
Change-Id: Ie613a1b8e445a385c10eb377983440ace9ad3f4a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16746
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-13 23:34:40 +00:00
Austin Eng 79230bf213 Slab-allocate frontend Vulkan bind groups
Bug: dawn:340
Change-Id: I3ef0b8a0585fac93ffb77d4642d13c14afbae177
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16745
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-03-13 23:10:00 +00:00
Austin Eng 459c2f930f Slab-allocate Metal bind groups
Bug: dawn:340
Change-Id: I6185e41d9c71c49953a4de91e5f3042968679fd6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15862
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-03-13 22:50:00 +00:00
Brandon Jones 0338b7ae19 Residency 3: Track Resource Heap Usages
Track what heaps are required to be resident upon command list
submission.

Bug: dawn:193
Change-Id: Icefe5aed047140f401d51018937c5364b3ed7c4f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16382
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-12 13:23:22 +00:00
Jiawei Shao 421684f943 Support Storage Textures as Valid Binding Types
This patch adds the basic validation of read-only storage texture,
write-only storage texture and read-write storage texture as new
binding types with no bind group layout provided in the creation of
pipeline state objects.

- Read-only storage textures can be used in vertex, fragment and
  compute shaders.
- Write-only storage textures can only be used in compute shaders
  due to the limitation on Metal.
- Read-write storage textures are not allowed now and they are
  reserved to be supported as an extension in the future.

BUG=dawn:267
TEST=dawn_unittests

Change-Id: Iffc432f29a855b85d59451cb3c50269e03b84627
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16661
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-11 01:28:48 +00:00
Bryan Bernhart 52d0627d56 D3D12: Pool-allocate shader-visible descriptor heaps.
Rather than destory GPU descriptor heaps upon being switched out,
heaps are stored in a list where they can be re-used once the GPU
is no longer using them.

BUG=dawn:155

Change-Id: I2074573e354f114c45afe9895e8515980d325852
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16282
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2020-03-09 22:56:59 +00:00
Brandon Jones f3bb4f4f32 Residency 2: Create a d3d12::Heap During Direct Allocations
When creating a directly allocated resource in D3D12, also create a
dawn_native::d3d12::Heap to represent that allocation alongside the
ResourceHeapAllocation. This matches D3D12's allocation model when using
CreateCommittedResource and makes residency management much easier.

Bug: dawn:193
Change-Id: I2280863dcfca57bad72962a2b097f8f2d4cc7dad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16381
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-03-09 15:53:19 +00:00
Jiawei Shao 532be50b76 Check bindingType with shader stage when creating default pipeline layout
This patch intends to fix a crash issue when creating a rendering
pipeline with storage buffer declared in vertex shader and pipeline
layout is not set.

Without this patch, in PipelineLayoutBase::CreateDefault() the
bindingSlot.visibility is always set to Fragment and Compute when it is
a storage buffer, therefore a crash happens at the failure of the
assertion modules->IsCompatibleWithPipelineLayout() when the storage
buffer is actually declared in the vertex shader.

BUG=dawn:276
TEST=dawn_unittests

Change-Id: I56876a97d53ead5ed226dc1b9bbed1a77156b2b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16564
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-03-09 00:45:18 +00:00
Natasha Lee 7d20b44501 Respect external clear status for Textures
Use ExternalImageDescriptor->isCleared to set the clear status of
subresources so it can be correctly lazy cleared when used.

Also remove old Wrap path that uses regular texture descriptors
since we have moved to use ExternalImageDescriptor.

Bug: chromium:1036080
Change-Id: Icb605dbf3cf3f0dc8a30287e8b9b8d9134805112
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16320
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-06 19:05:15 +00:00
Corentin Wallez e3f3e9a80d Revert "Vulkan: Report and enable subgroup size control device extension."
This reverts commit 4ae315b0d1.

Reason for revert: crbug.com/1059205

Bug: chromium:1059205

Original change's description:
> Vulkan: Report and enable subgroup size control device extension.
> 
> 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:
> 
> - The corresponding VkStructureType enum values and
>   struct types are not rolled to the third-party Vulkan
>   headers used by Dawn yet, so vulkan_platform.h has been
>   modified to define them if necessary. This can be
>   removed in the future when the Vulkan-Headers are
>   updated in a different patch.
> 
> - This modifies VulkanDeviceInfo::GatherDeviceInfo() to
>   use VkGetPhysicalDevice{Properties2,Features2} if the
>   VK_KHR_get_device_properties2 instance extension is
>   available. Otherwise, the Vulkan 1.0 APIs
>   VkGetPhysicalDevice{Properties,Features} are used instead
>   (and it is assumed that no subgroup size control is
>   possible).
> 
> - 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.
> 
> 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
> 
> Change-Id: I524af6ff3479f25b0a8bb139a062fe632c826893
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16020
> Reviewed-by: Austin Eng <enga@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>

TBR=cwallez@google.com,cwallez@chromium.org,enga@chromium.org,enga@google.com,david.turner.dev@gmail.com

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

Change-Id: I893d771d7effdf83685dda3edac8a08f98d2f6e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16522
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-06 13:27:10 +00:00
Corentin Wallez 36f0388f79 Revert "Vulkan: Enforce fixed subgroup size for compute shaders."
This reverts commit 56f1678437.

Reason for revert: crbug.com/1059205
Bug: chromium:1059205

Original change's description:
> Vulkan: Enforce fixed subgroup size for compute shaders.
>
> 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
>
> Change-Id: I332faa53b9f854a8abe43a7271f30d8c5deb2142
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16021
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>

TBR=cwallez@google.com,cwallez@chromium.org,enga@chromium.org,enga@google.com,david.turner.dev@gmail.com

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

Change-Id: I922eccc310505da4b4a9fc853335733ca4900fc8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16521
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-06 13:03:00 +00:00
Natasha Lee 1d54767364 Query if Texture subresource has been initialized
Bug: chromium:1036080
Change-Id: Ieb4c7012ae2d7d7b863c999756930b0ce45c06cb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16422
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2020-03-05 17:07:16 +00:00
David Turner 56f1678437 Vulkan: Enforce fixed subgroup size for compute shaders.
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

Change-Id: I332faa53b9f854a8abe43a7271f30d8c5deb2142
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16021
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-05 10:47:05 +00:00
David Turner 4ae315b0d1 Vulkan: Report and enable subgroup size control device extension.
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:

- The corresponding VkStructureType enum values and
  struct types are not rolled to the third-party Vulkan
  headers used by Dawn yet, so vulkan_platform.h has been
  modified to define them if necessary. This can be
  removed in the future when the Vulkan-Headers are
  updated in a different patch.

- This modifies VulkanDeviceInfo::GatherDeviceInfo() to
  use VkGetPhysicalDevice{Properties2,Features2} if the
  VK_KHR_get_device_properties2 instance extension is
  available. Otherwise, the Vulkan 1.0 APIs
  VkGetPhysicalDevice{Properties,Features} are used instead
  (and it is assumed that no subgroup size control is
  possible).

- 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.

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

Change-Id: I524af6ff3479f25b0a8bb139a062fe632c826893
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16020
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-03-05 10:34:25 +00:00
Brandon Jones 2de34c1791 Residency 1: Add Chromium's LinkedList to /common/
A Chromium's LinkedList class to Dawn. Implementation and header are
a direct copy/paste. This is to be used to implement an LRU Cache
for the ResidencyManager class.

Bug: dawn:193
Change-Id: I7cb02649590be4db0fe54c9d80557ac49efc34de
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16380
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-03-05 09:54:06 +00:00
Austin Eng e5534c4419 Add SlabAllocator and tests
Bug: dawn:340
Change-Id: I6fa1948261e8e6f91324464dade3e9954bd833e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15861
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-03-04 17:48:24 +00:00
Bryan Bernhart 9b5ecdf536 D3D12: Remove extra pre-pass used for RTV/DSV allocation.
Instead of tracking RTV/DSVs before the start of the pass to allocate
memory for CPU descriptors, allocate them at the start of the pass,
removing the need to loop through the entire command buffer each
Submit().

BUG=dawn:256

Change-Id: I72faff8951095c6a45207bfe5b12936715c58abf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16261
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-03-03 19:28:03 +00:00
Natasha Lee 6f92b9160b Also use ExternalImageDescriptor in D3D12 and Metal Backends
Bug: chromium:1036080
Change-Id: I358b0441c168ca075b09ab028c2f6d9df2a44d59
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16240
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2020-03-02 22:27:46 +00:00
Austin Eng 3ded65e807 Default initialize all descriptors
Some dawn_unittests crash on some configurations because the
uninitialized |label| member crashed string serialization.
Default initialize all descriptors to avoid this problem.

Bug: none
Change-Id: I6ea1851ebb6f54690a28ba396e0beaa85d8670cc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16260
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-02-28 22:29:15 +00:00
Austin Eng e299afa9ec Support CPU adapters in dawn_end2end_tests
This is so we can run the end2end_tests using Swiftshader. We still
prefer the discrete, then integrated GPUs so that normal testing uses
the real GPU.

Bug: dawn:283
Change-Id: I17a1ffd8aa88ddeaafa019feb67deeb25cdd2da0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16220
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Mark Henderson <mehe@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-02-27 17:47:19 +00:00
Bryan Bernhart 0363c3e46d D3D12: Allocate GPU bind groups at draw/dispatch.
Instead of counting descriptors to be allocated for the entire command
buffer in a pre-pass, the bindgroup state tracker is used to allocate
only dirty bindgroups upon recording draw/dispatch. If the heap has no
more room and must be changed, bindgroups will be re-created according
to the BGL.

A future change will address the CPU descriptors and removal of the
pre-pass.

BUG=dawn:256,dawn:307

Change-Id: I6603de17cfda713bd4512c46e1c93618ca01bb7b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13400
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-02-27 01:14:22 +00:00
Austin Eng a9d7d47842 Add Toggles to disable base vertex and base instance rendering
These are not supported on some older OpenGL, OpenGL ES, and iOS
devices.

Bug: dawn:343
Change-Id: I70def749ae57fcfe2895f8556674dd241941d3d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16163
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-02-26 08:24:20 +00:00
Austin Eng 2f0f850da8 Add Toggle to disable sampler compare function on Metal.
This Toggle is set if MTLFeatureSet_iOS_GPUFamily3_v1 is not supported.

Bug: dawn:342
Change-Id: Ia5f43e87fdd2c13eaffe9557cb0ce9a06dec3b29
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16180
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-02-26 08:06:00 +00:00
Ryan Harrison 227568451b Add in --no-use flags for spvc features
BUG=dawn:344

Change-Id: Ifa9e1e3167ecfe7d38c16f393cec0443ea1589f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16164
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-02-25 22:05:39 +00:00
Natasha Lee 17a8498982 ObjectStorage Allocate nullptr when id is 0
Bug: chromium:1052673
Change-Id: I16e39807a48f7a2c937b2a993f3a17cc8f58eac3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16161
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-02-25 19:20:15 +00:00
Austin Eng 6c1d646ee9 Change extern const DawnTestParam helpers to functions
If these extern variables are initialized after DAWN_INSTANTIATE_TEST,
they will be zero. Change them to be function calls instead.
Since they're function calls, fold in arguments from ForceToggles to
enable/disable toggles.

Bug: dawn:341
Change-Id: I1aeaa1e535a0a003977e8ce7ab3d5278c5d81281
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16162
Reviewed-by: Mark Henderson <mehe@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-02-25 16:23:17 +00:00
Corentin Wallez 1249ada986 Vulkan: Load promoted extensions or core entrypoint as needed
Previously we would always assume that if the driver supported a Vulkan
version it would also support extensions that were promoted in that
version. This is not a spec requirement, so instead try to load the core
entrypoints, and only if the version is not available, load the
extension entrypoints.

Also renames VulkanFunction members that are from promoted extension to
not have a vendor prefix.

Also tag the promoted extensions that are the same in a core version as
available when that core version is available. This simplifies checking
for features in the Vulkan backend.

Bug:
Change-Id: I0817c01b8838ba26070858abb0cbed030e3291df
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16040
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: David Turner <digit@google.com>
2020-02-24 15:08:18 +00:00
Corentin Wallez 33466973bc CMake: Add support for the D3D12 backend
Bug: dawn:333
Change-Id: I61defcd7d5a66fc728c92d1e702ed09b5c84968f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16000
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-02-24 13:27:28 +00:00
Brian Ho f949a10e51 Reland "Create VulkanImageWrappingTests for dma-buf images"
This relands commit 0bbfec1f7f which
was reverted in 21e5074dcd.

The original CL broke the Chromium roll because drm/drm_fourcc.h
could not be found. Still not sure why this is the case since it
seems to be present on all of my CrOS test machines, but at the end
of the day, I realized that I don't even need this header in the
first place.

This CL removes the header and relands the rest of the original CL.

Bug: chromium:996470
Change-Id: I77d6b1692094b7798f3c5d9c2b50219e674c8a8c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16060
Commit-Queue: Brian Ho <hob@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-02-20 19:19:13 +00:00
Corentin Wallez 21e5074dcd Revert "Create VulkanImageWrappingTests for dma-buf images"
This reverts commit 0bbfec1f7f.

Reason for revert: Makes the roll into Chromium fail with the following:

    [314/21578] CXX obj/third_party/dawn/dawn_white_box_tests_sources/VulkanImageWrappingTestsDmaBuf.o
    FAILED: obj/third_party/dawn/dawn_white_box_tests_sources/VulkanImageWrappingTestsDmaBuf.o
    ../../build/toolchain/clang_code_coverage_wrapper.py --target-os=chromeos --files-to-instrument=../....(too long)
    ../../third_party/dawn/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp:28:10: fatal error: 'drm/drm_fourcc.h' file not found
    #include <drm/drm_fourcc.h>
    ^~~~~~~~~~~~~~~~~~
    1 error generated.

Original change's description:
> Create VulkanImageWrappingTests for dma-buf images
> 
> This CL branches the existing VulkanImageWrappingTests to separate
> tests for OpaqueFD-backed amd DmaBuf-backed external images. On
> Chrome OS of Dawn, we no longer interop using opaque FDs, so these
> tests were failing in the end2end test suite.
> 
> The new VulkanImageWrappingTestsDmaBuf tests are essentially 1:1
> mappings of their counterparts in the Opaque FD version. The only
> difference is that we allocate memory directly on the device using
> GBM instead of creating a VkImage (which will likely call some GBM
> methods under the hood) and then extracting the FD using a Vulkan
> extension. We then communicate this to Dawn via the DmaBuf
> ExternalImageDescriptor.
> 
> Also, this fixes VulkanImageWrappingUsageTests::LargeImage on AMD
> devices (assuming the extension is implemented) as we can now
> specify DRM modifiers.
> 
> Bug: chromium:996470
> Change-Id: I2b3c57d7f5ff14131d415e99a09d32d2f16b3e54
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15800
> Commit-Queue: Brian Ho <hob@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>

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

Change-Id: Idb45586c608ce20432142834a4f14d42c76d3b3b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:996470
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16001
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-02-19 12:35:51 +00:00
Brian Ho 0bbfec1f7f Create VulkanImageWrappingTests for dma-buf images
This CL branches the existing VulkanImageWrappingTests to separate
tests for OpaqueFD-backed amd DmaBuf-backed external images. On
Chrome OS of Dawn, we no longer interop using opaque FDs, so these
tests were failing in the end2end test suite.

The new VulkanImageWrappingTestsDmaBuf tests are essentially 1:1
mappings of their counterparts in the Opaque FD version. The only
difference is that we allocate memory directly on the device using
GBM instead of creating a VkImage (which will likely call some GBM
methods under the hood) and then extracting the FD using a Vulkan
extension. We then communicate this to Dawn via the DmaBuf
ExternalImageDescriptor.

Also, this fixes VulkanImageWrappingUsageTests::LargeImage on AMD
devices (assuming the extension is implemented) as we can now
specify DRM modifiers.

Bug: chromium:996470
Change-Id: I2b3c57d7f5ff14131d415e99a09d32d2f16b3e54
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15800
Commit-Queue: Brian Ho <hob@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-02-18 20:57:36 +00:00
Austin Eng 0aa86a7ae8 Validate that sampler compare function requires iOS GPU family 3v1
Bug: b/149025333
Change-Id: I8683188c6189a9390ac6568e4ab5434a6c1a99f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15942
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-02-18 17:16:47 +00:00
Corentin Wallez e51f8dd09a Fix compilation with stdlibc++ (instead of libc++)
Also fixes some warnings when compiling with GCC

Bug: dawn:333
Change-Id: Ib597bb3b950476279a1e20e3556765ec9f1db697
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15960
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-02-18 02:44:05 +00:00
Corentin Wallez d353ca0881 CMake: Add support for the Vulkan backend
Bug: dawn:333
Change-Id: Id509e5f06862d6fee517ef47c40418077ccf4759
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15941
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-02-18 02:12:35 +00:00
Corentin Wallez 215b5370bc CMake: Add support for the OpenGL backend
Bug: dawn:333
Change-Id: Ic5386dc2fda3ba21f1437ee0b2c3f508ffb9dff7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15940
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-02-15 00:39:13 +00:00
Corentin Wallez 71b3dd56da Fix clean CMake builds
Headers only INTERFACE library with generated headers don't work in CMake
because the GENERATED property is local to a directory. Instead we make a
STATIC library with a Dummy cpp file.

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

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

Bug: dawn:333
Change-Id: Ib0d6dcc5f351a638d1c5360214c0ce14a28fee3e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15921
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-02-14 19:09:33 +00:00
Natasha Lee 2fd6181929 Handle Device Lost for SwapChain
Bug: dawn:68
Change-Id: I16e00bb2e203e71fd0840b71bc027e6fbea4e52c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15723
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2020-02-11 21:30:25 +00:00