Commit Graph

1989 Commits

Author SHA1 Message Date
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
Corentin Wallez fb01a6024e Add missed file for the CMake build.
Bug: dawn:333
Change-Id: Ie966ec61f05c788bdb89a732bafe7f12c16e52cd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15860
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-02-07 23:46:30 +00:00
Ryan Harrison 6f3e8d8f0f Add flag to use spvc parser in tests
This also changes the name to be consistent with the option being set
in the spvc API.

BUG=dawn:335

Change-Id: I6f7431095493874e1fef0856e563f7f1225cfc21
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15780
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-02-07 16:30:27 +00:00
Ryan Harrison 28e054e8cb Turn off spvc being used by default
There appears to be issues with the CTS + spvc that are preventing
chromium to roll, so I am reverting spvc by default, until the CTS
issues are resolved.

BUG=dawn:337

Change-Id: I171ee5325b9afbf5d240a469009433105caf6ddb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15840
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-02-07 16:00:27 +00:00
Ryan Harrison 7f380d3d40 Turn on using spvc by default
BUG=dawn:291

Change-Id: I9ebf34388abc6f5ff443a430f5bd79507c095520
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15463
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-02-06 17:26:46 +00:00
Natasha Lee c30635174e Handle Device Lost for Fence and Queue::Signal
Bug: dawn:68
Change-Id: I5391d55f85fba7dce28b1df5bb06c2d9217dc72a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15420
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-02-06 00:56:35 +00:00
Corentin Wallez 7fe6efba4a Add initial CMakeLists.txt files
Adds CMake support for:
 - Generating the Dawn headers and C++ wrappers
 - libdawn_wire
 - libdawn_native with the Metal backend for now
 - All the examples.

Bug: dawn:333

Change-Id: I6ffbe090b0bd21d6a805c03a507ad51fda0275ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15720
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2020-02-05 17:16:05 +00:00
Bryan Bernhart 525ef86c2e Vulkan: attempt sub-allocation before direct allocation.
Falling-back to direct allocation ensures allocation failure returns OOM.
If no OOM, the resource could be left then used while in an invalid state.

BUG=chromium:1045811,chromium:1047220,chromium:1047048

Change-Id: I927962b1dc6a7422a7d6eac114d82f28a42794a2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15600
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-02-03 19:17:34 +00:00
Natasha Lee 2dd9ed0776 Handle Device Lost for Command Encoder Finish
Bug: dawn:68
Change-Id: I3449cdd9e69f3ae44a30f113fd88bd2fce2c94d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15602
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-01-31 19:26:49 +00:00
Kai Ninomiya f44a809f9a Remove VK_DEFINE_NON_DISPATCHABLE_HANDLE magic, use explicit VkHandle wrapper
Overriding VK_DEFINE_NON_DISPATCHABLE_HANDLE changes the function
signatures of Vulkan functions, changing their ABI and making us
incompatible with real drivers. This removes that magic, and replaces it
with an explicit wrapper, VkHandle, which has much of the same
functionality as the original VkNonDispatchableHandle.

It adds definitions for dawn_native::vulkan::VkBuffer et al, which
shadow the native ::VkBuffer et al. This retains type safety throughout
the Vulkan backend without changing every single usage.

Notably, the following things had to change:
- An explicit conversion from VkBuffer* to ::VkBuffer* is needed for
  arrays. This is implemented as a reinterpret_cast, which is still
  safe as the new VkHandle still has the same memory layout properties
  as VkNonDispatchableHandle did.
- When pointing to a VkHandle as an output pointer, it's now necessary
  to explicitly get the native ::VkBuffer (via operator*) and point to
  it.

Previously reviewed on:
https://dawn-review.googlesource.com/c/dawn/+/15580

Bug: chromium:1046362
Change-Id: I7d34ec38a805025f92165ea9a7ee07ae5c182076
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15641
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-01-31 04:04:16 +00:00
Kai Ninomiya f28d0ae614 Revert "Remove VK_DEFINE_NON_DISPATCHABLE_HANDLE magic, use explicit VkHandle wrapper"
This reverts commit 4e17d5c248.

Reason for revert: broken on chromeos

Original change's description:
> Remove VK_DEFINE_NON_DISPATCHABLE_HANDLE magic, use explicit VkHandle wrapper
> 
> Overriding VK_DEFINE_NON_DISPATCHABLE_HANDLE changes the function
> signatures of Vulkan functions, changing their ABI and making us
> incompatible with real drivers. This removes that magic, and replaces it
> with an explicit wrapper, VkHandle, which has much of the same
> functionality as the original VkNonDispatchableHandle.
> 
> It adds definitions for dawn_native::vulkan::VkBuffer et al, which
> shadow the native ::VkBuffer et al. This retains type safety throughout
> the Vulkan backend without changing every single usage.
> 
> Notably, the following things had to change:
> - An explicit conversion from VkBuffer* to ::VkBuffer* is needed for
>   arrays. This is implemented as a reinterpret_cast, which is still
>   safe as the new VkHandle still has the same memory layout properties
>   as VkNonDispatchableHandle did.
> - When pointing to a VkHandle as an output pointer, it's now necessary
>   to explicitly get the native ::VkBuffer (via operator*) and point to it.
> 
> Bug: chromium:1046362
> Change-Id: I9c5691b6e295aca1b46d4e3d0203956e4d570285
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15580
> Reviewed-by: Austin Eng <enga@chromium.org>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Commit-Queue: Kai Ninomiya <kainino@chromium.org>

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

Change-Id: I500df2e34fd0f245ad04c517ff028ddd7bb5a2bf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1046362
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15620
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-01-31 02:09:06 +00:00
Kai Ninomiya 4e17d5c248 Remove VK_DEFINE_NON_DISPATCHABLE_HANDLE magic, use explicit VkHandle wrapper
Overriding VK_DEFINE_NON_DISPATCHABLE_HANDLE changes the function
signatures of Vulkan functions, changing their ABI and making us
incompatible with real drivers. This removes that magic, and replaces it
with an explicit wrapper, VkHandle, which has much of the same
functionality as the original VkNonDispatchableHandle.

It adds definitions for dawn_native::vulkan::VkBuffer et al, which
shadow the native ::VkBuffer et al. This retains type safety throughout
the Vulkan backend without changing every single usage.

Notably, the following things had to change:
- An explicit conversion from VkBuffer* to ::VkBuffer* is needed for
  arrays. This is implemented as a reinterpret_cast, which is still
  safe as the new VkHandle still has the same memory layout properties
  as VkNonDispatchableHandle did.
- When pointing to a VkHandle as an output pointer, it's now necessary
  to explicitly get the native ::VkBuffer (via operator*) and point to it.

Bug: chromium:1046362
Change-Id: I9c5691b6e295aca1b46d4e3d0203956e4d570285
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15580
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-01-31 01:30:56 +00:00
Ryan Harrison 1edaa1d1e1 Use the spvc translated version of the Vulkan shader
BUG=dawn:325

Change-Id: I66bed7fec65cadecc956878bf11fc204b66ad195
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15500
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-01-30 18:50:49 +00:00
Mark Henderson 7d56022a64 Make Vulkan's surface config available before the swap chain is actually created/
Change-Id: I9da1c9f513d26aa95b40f97908bfc3a54c843053
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15541
Commit-Queue: Mark Henderson <mehe@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-01-29 23:11:17 +00:00
Kai Ninomiya 7b6246a2ad Generators for Emscripten
api_struct_info.json:
//* This generator is used to produce part of Emscripten's struct_info.json,
//* which is a list of struct fields that it uses to generate field offset
//* information for its own code generators.
//* https://github.com/emscripten-core/emscripten/blob/master/src/struct_info.json

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

Change-Id: I4704509737cde4685a093eb484dd977e5a106d19
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15240
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-01-28 23:54:38 +00:00
Natasha Lee 74f5054ec9 Handle Device Lost for Buffer
Bug: dawn:68, chromium:1042998, chromium:1043468
Change-Id: I4faa46b0d2e8f814b9d353a75489d3c8ca0b2e89
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15340
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2020-01-28 22:18:58 +00:00
Corentin Wallez d26ee85fba Implement the webgpu.h swapchains in the frontend and Null backend.
The state-tracking of the webgpu.h swapchain is a bit complicated
because contrary to implementation-based swapchains, they have more
guarantees and a "replacing mechanism". For example instead of hoping
the implementation-based swapchain resize automatically, the
surface-based swapchain needs to be replaced by a new swapchain and
invalidated.

This mechanism of invalidation also needs to be triggered when the last
reference to the surface is lost because we don't want to risk the
application destroying the window from under us.

Adds tests for all the cases of invalidation I could think of apart from
device loss.

Bug: dawn:269

Change-Id: Id515dbb640e13c6e30bb1f1e93b8e54f1e2bba4b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15400
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-01-25 10:05:40 +00:00
Austin Eng 0df4753ba6 Vulkan: Fix crashes on Device destruction if Device::Initialize fails
If Device creation fails, several things are just partially initialized
and the destroy sequence crashes dereferencing null data.

This commit marks the Vulkan device as lost until after it is created.
This avoids parts of the destroy sequence which are unecessary since
the Device was never successfully created and no commands are in flight.

Bug: chromium:1043095
Change-Id: I8e121709fa19b215e118a615b639380d1db1f3f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15460
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-01-25 09:35:50 +00:00
Austin Eng eb1ca45df7 Fix Vulkan fuzzer on mac_libfuzzer_chrome_asan
This commit fixes two problems:
1) It includes testing/libfuzzer/libfuzzer_exports.h which exports
   the LLVMFuzzerInitialize symbol. On Mac, not doing so causes it
   to be removed by the linker.
2) It makes it so that dawn_use_swiftshader is enabled by default
   when fuzzing, and enabling swiftshader also enables the Vulkan
   backend.

Bug: chromium:1042426
Change-Id: Ic0ae0d59c91476b0079148f33a4b1ebd1cc6743c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15462
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-01-25 02:14:39 +00:00
Ryan Harrison 1d036f7766 Removing deprecated spvc API usages
Roll third_party/shaderc/ c6a2ef12d..a4f9acedf (5 commits)

c6a2ef12df..a4f9acedf3

$ git log c6a2ef12d..a4f9acedf --date=short --no-merges --format='%ad %ae %s'
2020-01-23 rharrison Big cleanup to normalize API behaviour (#967)
2020-01-22 rharrison Start v2020.0 (#970)
2020-01-22 rharrison Fix the version string (#971)
2020-01-22 rharrison Finalize v2019.1 (#969)
2020-01-20 rharrison Rolling 3 dependencies and updating expectations (#966)

Created with:
  roll-dep third_party/shaderc

BUG=dawn:324

Change-Id: I3c3900dcccc317054f035e21a6863f068ce417c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15421
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-01-24 16:16:59 +00:00
Corentin Wallez fa06dd0b62 Fix Vulkan Swiftshader build on macOS
There was a typo in macro name used to do platform detection.

Bug:

Change-Id: I81958419b4283d1d0498f5edc48efc385a648e09
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15440
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-01-24 15:36:59 +00:00
Corentin Wallez d87e676845 Add the webgpu.h swapchain creation path
This commit changes wgpu::Device::CreateSwapChain to take an additional
wgpu::Surface argument. Passing nullptr is enough to stay on the
previous swapchain implementation, until the new one is ready.

In order to support both the "old" implementation-based swapchains and
the "new" surface-based swapchains. SwapChainBase is now split into
three abstract classes:

 - SwapChainBase that has a virtual method for each of the
wgpu::SwapChain methods.
 - OldSwapChainBase that corresponds to the implementation-based
swapchains.
 - NewSwapChainBase that will contain the surface-based swapchain
implementation and will eventually just be renamed to SwapChainBase.

The interaction of the surface-based swapchains with the Surface objects
aren't implemented yet, neither are the swapchain methods. Only creation
works.

Validation tests for surface-based swapchain creation are added in the
end2end test target because they need to create OS windows.

Bug: dawn:269

Change-Id: I7e07d6c666479867b9a16d7b1b8c181d5dbd69a0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15281
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-01-23 17:20:38 +00:00
Corentin Wallez c2e16963a9 Add SurfaceDescriptorFromHTMLCanvasID
Bug:dawn:269

Change-Id: I91802b44d0280224b93eb4fb637e91597bc03c81
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15322
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-01-22 21:37:26 +00:00
Corentin Wallez 8ffd3f2333 Move EXPECT_LAZY_CLEAR to TextureZeroInitTests.cpp
This macro is used only for testing texture zero initialization so it
didn't need to be in DawnTest.h

Bug:
Change-Id: Ifb7ed06d93ae1bc275c9fd4650858c9b27117b5e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15360
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-01-22 15:55:46 +00:00
Corentin Wallez 6b66b67f69 Fix compilation of Log2(uint64_t) on MSVC
The _BitScanReverse64 intrinsic only exists when compiling for 64bit.
Replace it by two calls to _BitScanReverse (the 32bit one) when on
32bit.

Bug:
Change-Id: Ie294327ec914b0ca4a73732e4b78c1f2a08f100f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15321
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-01-22 13:05:16 +00:00
Natasha Lee 80880ee998 Device Loss handle GetBindGroupLayout and test
This includes moving the destruction of vkDevice from Destroy to the
Device Destructor since we need vkDevice to destroy child objects.

Bug: dawn:68
Change-Id: Id477206b2e3f80138b3708eedcee073303f1b696
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15220
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2020-01-21 18:48:45 +00:00
Corentin Wallez 3003aa622b Fix compilation on MSVC
- Fix a warning on 32bit for converting uint64_t to size_t for the
 buffer mapped range.
 - Fix a macro redifinition caused by including glfw3.h before windows.h

 Bug:

Change-Id: I3897af55679d943b1dfc34b93bba7bd25d8fb7d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15320
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-01-21 15:25:25 +00:00
Natasha Lee d8f8c29bb2 Add QueueBase::MakeError
Bug: dawn:68, chromium:1042598
Change-Id: I1cf97e29ecadb520e2641ea01ac6dcf7e908bbd3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15221
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-01-17 21:32:08 +00:00
Ryan Harrison 352a589fe0 Add code path to use spvc in Metal backend
BUG=dawn:291

Change-Id: Idf20496bac733b14db3b7df7eb86ff0a23a9d826
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15161
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-01-17 20:28:58 +00:00
Austin Eng 631f4258a1 Suppress Depth32TextureCreationDepthClears on D3D12 NVIDIA
This test often crashes on first run, but succeeds on retry.

Bug: dawn:145
Change-Id: I44303a01eaceded10ba277a837c5b5e7649df033
Tbr: cwallez@chromium.org
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15180
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-01-16 02:36:10 +00:00
Austin Eng 9652add688 OpenGL: Simplify lazy clear of render pass attachments
Bug: dawn:145
Change-Id: Ia175ebc5a74f7cc15584b9132e00f9089d5dc5b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14983
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-01-16 01:30:30 +00:00
Austin Eng 3d97384e16 D3D12: Simplify lazy clear of render pass attachments
Bug: dawn:145
Change-Id: If4c83cdf4065acc9f68aa5d9a7e581e9f2e801a9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14982
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-01-16 01:29:40 +00:00
Austin Eng 5a2dd74450 Vulkan: Simplify lazy clear of render pass attachments
Bug: dawn:145
Change-Id: I3d74e9ce865d7273a4b737ac11c98380785a415c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14981
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-01-16 01:21:10 +00:00
Austin Eng 636e6cee4f Directly load Swiftshader if no Vulkan driver is available
This may be a short term solution before linking our own version
of the Vulkan Loader.

Bug: dawn:283
Change-Id: Ifeddeaa5170bccc912c61059071a83c2b5fd9524
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15121
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-01-16 00:34:30 +00:00
Austin Eng 0d6619848d Metal: Implement lazy texture clears
Bug: dawn:145
Change-Id: I73d161002cb09498e41838a10e9ac1db996c955d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14781
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-01-16 00:12:10 +00:00
Natasha Lee 0ecc48ecb7 Handle DeviceLost error
Handle DeviceLostCallback once DeviceLost error occurs.
Disallow any other commands or actions on device to happen after device
has been lost.

Bug: dawn:68
Change-Id: Icbbbadf278cae5e6213050d00439118789c863dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12801
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-01-15 19:02:13 +00:00
Austin Eng 0c66bcd13a Reland "Metal: Add CommandRecordingContext"
This is a reland of 2b3975f808

The previous CL failed to retain autoreleased ObjC objects which
should live longer than the autoreleasepool block. This reland fixes
the issue and adds tests for it.

Original change's description:
> Metal: Add CommandRecordingContext
>
> Introduces the idea of a CommandRecordingContext to the Metal backend,
> similar to other backends. This is a class to track which Metal encoder
> is open on the device-global pending MTLCommandBuffer.
> It will be needed to open/close encoders for lazy clearing.
>
> Bug: dawn:145
> Change-Id: Ief6b71a079d73943677d2b61382d1c36b88a4f87
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14780
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

Bug: dawn:145
Change-Id: I67494b35225ce8f6443a3fa9787d054522e5d422
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15042
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-01-15 18:22:53 +00:00
Ryan Harrison 855a24b150 Switch over to using CheckSpvcSuccess where possible
BUG=dawn:274

Change-Id: Ia7bfc96a2a85bff5b30065e7b985e0d84c8dcd4b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15120
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-01-15 16:58:23 +00:00
Ryan Harrison 9af58bbe14 Return errors in ExtractSpirvInfo instead of sending to the device
BUG=dawn:274

Change-Id: Ieeaffdd356a6f2174a39a8098b306c36d10ef9e7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15100
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-01-15 14:56:22 +00:00
Corentin Wallez 3a1746e71c Introduce wgpu::Surface and implement it for HWND, X11 and Metal
This is another step to implement webgpu.h swapchains, Surface is
essentially a union type of all the types of windows that can be used to
create swapchains.

Changes to allow implementing wgpu::Surface and test its creation are:

 - Add GLFWUtils.cpp/.h/_metal.mm  that contains helpers used to use
WebGPU with GLFW. This deprecates BackendBinding.h that will be removed
when the NXT swapchain is removed.
 - Add a `dawn_use_x11` GN variable to factor all the places in BUILD.gn
where we checked whether we should use X11.
 - Add a `supports_glfw_for_windowing` GN variable in the main BUILD.gn
file to control which configuration tests and samples using GLFW can be
built.
 - Add a ObjCUtils.h to contain some ObjC functionality that we'd need
in files that otherwise would be C++ (so that they can be compiled on
all platforms).

Bug: dawn:269

Change-Id: I25548142a1d1d1f05b0f4d71aa3bdc4698d19622
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15081
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-01-15 13:14:12 +00:00
Corentin Wallez 2b24c3d92d webgpu.h introduce a base struct for extension structures.
struct WGPUChainedStruct {
     WGPUChainedStruct const * nextInChain;
     WGPUSType sType;
 };

And changes all the nextInChain to point to such structures. This adds
more type safety to extension structs and requires less casting to check
sTypes and friends.

Bug: dawn:269

Change-Id: I443f363cdb55dbec7c7f6e897245d4a7ea0ebe70
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15080
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-01-15 09:54:42 +00:00
Jiawei Shao 7f078e7ebe Add checks to TextureUsage::Storage
This patch adds validations to the texture usage "Storage" when
creating a texture.
1. "Storage" usage cannot be used when SampleCount > 1
2. "Storage" usage can only be used with some texture formats. The
list of the formats can be found through the following link:
https://github.com/gpuweb/gpuweb/issues/513

BUG=dawn:267
TEST=dawn_unittests

Change-Id: Ifc7296d966ac0c600433948a63c3dd6a436c8d8b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15040
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-01-15 00:09:42 +00:00
Ryan Harrison cd170a5c72 Implement using spvc in ExtractSpirvInfo
BUG=dawn:291

Change-Id: I6c12c1874afb9b2c60e326f5c80230fba5fa748c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15000
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-01-14 16:29:41 +00:00
Corentin Wallez 15c442e941 Revert "Metal: Add CommandRecordingContext"
This reverts commit 2b3975f808.

Reason for revert: causes the failure in crbug.com/1041358

Original change's description:
> Metal: Add CommandRecordingContext
>
> Introduces the idea of a CommandRecordingContext to the Metal backend,
> similar to other backends. This is a class to track which Metal encoder
> is open on the device-global pending MTLCommandBuffer.
> It will be needed to open/close encoders for lazy clearing.
>
> Bug: dawn:145
> Change-Id: Ief6b71a079d73943677d2b61382d1c36b88a4f87
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14780
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Kai Ninomiya <kainino@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:145
Bug: chromium:1041358
Change-Id: I05c76cd96f723230d05cff65127dc8513d5e03c5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15060
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-01-13 13:47:01 +00:00
Jiawei Shao df2ae16e59 Enable ComputeCopyStorageBufferTests.SizedArrayOfStruct on D3D12
Now ComputeCopyStorageBufferTests.SizedArrayOfStruct can pass on all
backends with the fix in the latest SPIRV-Cross.

BUG=chromium:1037829
TEST=dawn_end2end_tests

Change-Id: I20103c3b0848da394e82912f59548a71a3273ac1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15020
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-01-13 08:48:53 +00:00
Rafael Cintron 69c68d01b2 Improve Memory Management of Result class
The way in which the Result class is used in Dawn can be fragile
with respect to memory management because the caller of AcquireError
must know they need to delete the returned pointer or a memory leak
will occur. We've had a couple of instances where developers have
accidentally left out the delete call and managed to get past code
review.

This CL changes the Result class so that it assumes the error is
allocated on the heap and forces the caller to use unique_ptr when
calling AcquireError.

Bug:dawn:320
Change-Id: I13ec953b0c37eaafbd6ce93c2f719b4743676acb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14960
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
2020-01-10 17:58:28 +00:00
Li, Hao 4950095ac9 Remove suppression for BindGroupTests.MultipleBindLayouts on Metal
The padded matrix issue in MSL has been fixed in SPIRV-Cross, and
it's updated in https://dawn-review.googlesource.com/c/dawn/+/13421,
so we can add BindGroupTests.MultipleBindLayouts back.

Bug: dawn:33
Change-Id: I8847ab536ebfd779219a1c6d0e1a9a128adf7e85
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13560
Commit-Queue: Hao Li <hao.x.li@intel.com>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-01-10 14:55:18 +00:00
Corentin Wallez f12c9dba6d Add WGPUAdapterProperties and expose it in DawnNative
The dawn_native::Adapter::GetPCIInfo/GetBackendType/GetDeviceType
methods are now deprecated in favor of a method returning a webgpu.h
AdapterProperties structure. Deprecated function are still available to
avoid breaking Chromium or Skia compilation.

This reduces the difference between dawn.json and webgpu.h

BUG=dawn:160

Change-Id: Ib68fe1c4d1d87676c01c212c91f80fdd26056c56
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14541
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-01-10 13:28:18 +00:00
Corentin Wallez 5fc2c82c11 Add Instance and CreateInstance to webgpu.h
This is the first step in making the API before WGPUDevice creation
match webgpu.h and is necessary to implement WGPUSwapChain.

BUG=dawn:269

Change-Id: If92ced42d7683d79e67c02738949ff8b483d22c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14061
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-01-10 13:06:48 +00:00
Jiawei Shao e6441b604f dawn_wire: Make GetProcs() a static member function of WireClient
This patch makes GetProcs() a static member function of WireClient so
that we can call it without creating a WireClient object.

BUG=chromium:996713

Change-Id: I499be0cd2c5a5f29c796d3be88ce33c1b70711d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14942
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2020-01-10 00:02:38 +00:00
Austin Eng 2b3975f808 Metal: Add CommandRecordingContext
Introduces the idea of a CommandRecordingContext to the Metal backend,
similar to other backends. This is a class to track which Metal encoder
is open on the device-global pending MTLCommandBuffer.
It will be needed to open/close encoders for lazy clearing.

Bug: dawn:145
Change-Id: Ief6b71a079d73943677d2b61382d1c36b88a4f87
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14780
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-01-08 17:01:07 +00:00
Brandon Jones d1cba106c8 Temporarily Disable Use of D3D12 Render Pass API
Due to significant performance regressions on Intel Gen11 Graphics,
temporarily disable use of the D3D12 Render Pass API until a workaround
infrastructure can be implemented.

Bug: dawn:310
Change-Id: I994a2c2a0f6a3b61c48b083c73d6e0d3f8910dfa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14663
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2020-01-07 17:49:15 +00:00
Yunchao He 5ccecaade2 Fix a comment in BindGroupValidationTests.cpp
BUG=

Change-Id: Ice06ef17f40951493215a84ddcfef33521bf2656
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14860
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2020-01-06 22:18:45 +00:00
Austin Eng 3890934033 fuzzing: Create Instance and discover Adapters only once
This patch moves Instance initialization and adapter discovery so that
it is done once globally, and not for every fuzz input. This is to work
around a bug where destructing the instance at the end of a run breaks
when fuzzing with Swiftshader.

Bug: dawn:295, chromium:1038952
Change-Id: Iabfe178f40b9df85d47a6353f16cd2ef26f39966
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14822
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2020-01-06 20:40:27 +00:00
Austin Eng 470921fe46 Reland "fuzzing: Add supportsErrorInjection option to DawnWireServerFuzzer"
This is a reland of f58f69f66b

The whitebox dawn_end2end_tests are updated to link statically against
libdawn_native. This is required because the test link against and use
libdawn_native as sources. It is an error with MSVC to both import and
export symbols from libdawn_native.

Original change's description:
> fuzzing: Add supportsErrorInjection option to DawnWireServerFuzzer
>
> This option will be used by backends that support error injection so
> that errors can be injected into a "clean" corpus to generate a seed
> corpus with good examples of injected error conditions.
>
> Bug: dawn:295
> Change-Id: I837acdde6dd4274adb56edf8e4307427f8d6333b
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14681
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

Bug: dawn:295
Change-Id: Ifa092d28aa7ac57cfb197aa4daeb8408f8036d4a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14820
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-01-06 19:56:17 +00:00
Corentin Wallez 96f79f6db5 Validate SetVertexBuffers' slot is less than kMaxVertexBuffers
Bug: chromium:1034808
Change-Id: Ibad70a7cd7b4e30b5b885e9373cc40db16768c72
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14840
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-01-06 19:36:07 +00:00
Austin Eng 87d3138158 Revert "fuzzing: Add supportsErrorInjection option to DawnWireServerFuzzer"
This reverts commit f58f69f66b.

Reason for revert: This breaks the MSVC build because the whitebox end2end tests try to both import and export the error injector symbols from libdawn_native

Original change's description:
> fuzzing: Add supportsErrorInjection option to DawnWireServerFuzzer
> 
> This option will be used by backends that support error injection so
> that errors can be injected into a "clean" corpus to generate a seed
> corpus with good examples of injected error conditions.
> 
> Bug: dawn:295
> Change-Id: I837acdde6dd4274adb56edf8e4307427f8d6333b
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14681
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

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

Change-Id: I14a15fcd094d431cbb8a29d5642a4a7fe6a11f4c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:295
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14741
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-12-20 23:07:40 +00:00
Austin Eng 2cb76ab598 perf_tests: Manually serialize JSON and remove dependency on jsoncpp
jsoncpp causes some flaky failures because of inconsistencies in nested
DEPS. We barely use it for JSON serialization so the simplest solution
is to just manually write the serialization for perf test tracing data.

Bug: dawn:208
Change-Id: Ie5e4b5436e2c9e32e6817d64c6e95c774cb8751f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14720
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-12-20 19:39:10 +00:00
Austin Eng e9b15ab829 perf_tests: Fixup perf test result printing format
Results should be printed METRIC: STORY, not the other way around.
Also, story names shouldn't have slashes as it will parse as separate
chart segments and won't be allowed when we switch to using histograms.

Bug: dawn:208, dawn:311
Change-Id: Ifc893e5aa94eddcb3a08c0d4aff66b7a0f41620b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14740
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-12-20 19:10:50 +00:00
Bryan Bernhart cd1152fb9b Support for small resource placement for MSAA textures.
Enables use of 64KB texture alignments where permitted.
This saves heap memory (64KB vs 4MB per allocation) and
improves re-use.

BUG=dawn:27

Change-Id: Ief4c531446788284e69ec1646cfe2ea7a25c7bb2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14683
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-12-20 17:42:30 +00:00
Austin Eng f58f69f66b fuzzing: Add supportsErrorInjection option to DawnWireServerFuzzer
This option will be used by backends that support error injection so
that errors can be injected into a "clean" corpus to generate a seed
corpus with good examples of injected error conditions.

Bug: dawn:295
Change-Id: I837acdde6dd4274adb56edf8e4307427f8d6333b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14681
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-12-20 15:52:20 +00:00
Yunchao He d28b578b6b Disallow storage buffer binding in vertex shader
Writable storage buffer in vertex shader is an optional feature.
It is not supported in many devices/OSes. WebGPU doesn't support
writable storage buffer in vertex shader. This change generates an
error for storage buffer binding for vertex shader stage, in order
to disallow writable storage buffer in vertex shader.

This change also adds a validation test and revises existing
end2end tests and validation tests accordingly.

BUG=dawn:180

Change-Id: I9def918d19f65aab45a31acb985c1a0a09c97ca8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14521
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-12-19 18:50:18 +00:00
Austin Eng bfb2a5740f fuzzing: Add Vulkan backend fuzzer
Bug: dawn:295
Change-Id: If134a076e53eb6c1b03712b7b14436464bf5f73a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14680
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-19 17:01:38 +00:00
Austin Eng 5217ad51c5 fuzzing: When fuzzing, always ASSERT, and abort() instead of SIGTRAP
Currently, when we hit an assertion failure, the fuzzer stops
immediately without producing a crash. This patch makes it so that we do
a hard abort instead which will be caught.

Bug: dawn:295, dawn:293
Fixes: dawn:293
Change-Id: Ie00074e84b51c9aa364aba96c11a35659bbba740
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14682
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-19 16:07:58 +00:00
Austin Eng cf788596f4 fuzzing: Factor WireServer set up code out of frontend fuzzer
This will make it easier to bring up other Dawn backend fuzzers
that don't use the Null backend.

Bug: dawn:295
Change-Id: I176b937722a63509cab620ac2a90098d87a6049c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14623
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-12-19 03:46:37 +00:00
Natasha Lee 9bba4a936e Add DeviceLostCallback to dawn.json and dawn_wire
Bug: dawn:68
Change-Id: I6d8dd071be4ec612c67245bfde218e31e7a998b8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14660
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-18 18:59:20 +00:00
Austin Eng 3d2d62813f Fix VkResult typo in MemoryServiceDmaBuf
Bug: dawn:295
Change-Id: I24b0204fecb8503c98c30ba3741440253200fcc5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14662
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-12-18 00:39:26 +00:00
Austin Eng fc6b1e3912 fuzzing: WireServer -> CommandHandler in WireServerTraceLayer
This is a cleanup patch which changes the WireServer interface to
a CommandHandler interface in the DawnTest tracing layer. It also fixes
the opening mode flags on the output stream which was missing an output
usage.

Bug: dawn:295
Change-Id: I5b154e5201f8215b4dafc6389ebf1ec977a09c05
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14620
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-12-18 00:35:36 +00:00
Danusch Merrikh-Yazdi 7433023fff Fix Apple SDK availablity check
Change-Id: I02332c8cbddaa30fb74603849fe00c52d9b43b88
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14661
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-12-18 00:08:16 +00:00
Ryan Harrison 2fdc7ab692 Use spvc API instead of directly accessing compiler on GLSL path
BUG=dawn:291

Change-Id: I3e76749bcff8d7635d9dc02de0a9a66b686cd9d8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14622
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-12-17 19:14:21 +00:00
Danusch Merrikh-Yazdi bee45bb79c dawn: Fix GetExecutablePath for iOS.
Change-Id: Ibde0793471606b9db783991aeb46e284225d5783
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14624
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Danusch Merrikh-Yazdi <danusch@google.com>
2019-12-17 18:01:02 +00:00
Corentin Wallez c073adaa76 Fix compilation of VkResult changes on MSVC and ChromeOS
Bug: dawn:295
Change-Id: I8156af4789fca155163e8beed57805eefe6ec686
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14640
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-12-17 17:39:31 +00:00
Corentin Wallez 1586b4d73e Vulkan: prevent degenerate buffer sizes from reaching the driver
Allocating buffers with sizes close to UINT64_MAX caused issues in all
Vulkan drivers. See https://gitlab.khronos.org/vulkan/vulkan/issues/1904
for more context. Do early validation to prevent such cases from
reaching the driver.

Bug: dawn:241
Fixed: dawn:241

Change-Id: I7edbb25999b4c11767047518b69edc1fa624cd3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14641
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-12-17 17:34:21 +00:00
Austin Eng 6ea362cae0 fuzzing: Add error injection macros to the Vulkan backend
This will enable fuzzing the Vulkan backend with randomly injected
errors to help ensure the backend properly handles all errors. It also
redefines VkResult in the dawn_native::vulkan namespace such that a
VkResult cannot be used unless it is explicitly wrapped.

Bug: dawn:295
Change-Id: I3ab2f98702a67a61afe06315658a9ab76ed4ccc3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14520
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-12-17 00:47:40 +00:00
Natasha Lee 2c8a17ecc7 Refactor Device destructors to WaitForIdleForDestruction + Destroy
To help with Device Loss, this splits Device backend destructors
to WaitForIdleForDestruction and Destroy.

WaitForIdleForDestruction waits for GPU to finish, checks errors and gets
ready for destruction.

Destroy is used to clean up and release resources used by device,
does not wait for GPU or check errors.

Bug: dawn:68
Change-Id: I054fd735e8d5b289365604209f38e616c723a4e7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14560
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
2019-12-16 23:36:16 +00:00
Corentin Wallez 77fd4750ae Remove unnecessary getters from dawn_native::Instance.
As part of moving to webgpu.h's version of the Instance, the setters
will be replaced with a descriptor, and getters don't usually exists for
things set with descriptors (except getBindGroupLayout).

BUG=dawn:22

Change-Id: I05be8ebf241b33d019d521e40bfef8e49cdab07d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14540
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-12-13 15:32:42 +00:00
Ryan Harrison 5c413afdc7 Propagating errors out of GetFunction in MTL backend
BUG=dawn:303

Change-Id: Iff1903aecae4c043b222208b3eab5efdf9774b52
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14501
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-12-12 17:51:39 +00:00
Corentin Wallez 69cdaf94df RenderPipeline: validate depth bias params are not NaN
Also changes the sampler validation to allow INFINITY and only check for
NaN.

BUG=dawn:296

Change-Id: I2a61df807d37dcaf280b12a1ffe56dc670d0f455
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14480
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-12-12 11:41:02 +00:00
Corentin Wallez ab4485f86c RefCounted: use more precise barriers
This improves the DrawCallPerfRun/Vulkan_NoReuseBindGroups benchmark by
2% on an Intel processor but should be a bigger improvement on ARM.

The change was inspired by the Boost documentation at
https://www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html
Chromium's base::AtomicRefCount implementation and Rust's core::Arc
implementation.

BUG=dawn:304

Change-Id: I7ca71f34af20fd267cf2efc63871ff330b1dcc7c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14482
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: David Turner <digit@google.com>
2019-12-12 10:40:22 +00:00
Yunchao He 73c5573f1f Use GetBindGroupLayout in BindGroupTests
BUG=dawn:276

Change-Id: I1f00c2ed0d67cae78754223fb4e452c5fe4219ad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14401
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-12-12 02:39:31 +00:00
Jiawei Shao 51c347a231 Add two missing checks on render pass descriptor
This patch adds two missing checks on the render pass descriptor:
1. NaN is not allowed to be a value of clearColor and clearDepth.
2. Ensure only valid values can be used as loadOp and storeOp.

This patch also adds the unit tests to ensure INFINITY is a valid
value for both clearColor and clearDepth.

BUG=dawn:299

Change-Id: Ia5500701ccd99abf488a80c87adb809521d7873f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14460
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-12-12 01:29:01 +00:00
Sarah Mashayekhi af094e6a88 Adding SPVC fuzzers
Change-Id: I9dc598f7d929595d674b5a5916e5b00e46e85559
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14502
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2019-12-11 19:03:01 +00:00
Bryan Bernhart 6ce8f32fee D3D12: Fix 64-bit overflow for large buffers and return OOM.
Use `resourceDesc.alignment` + GetResourceAllocationInfo
 to determine the buffer size and OOM should it return an
empty sized buffer instead of overflowing + INVALID_ARGS.

BUG=dawn:238

Change-Id: I0a2cc7dac629d55624dafa4a3c4a45f16e90049c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14420
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-11 17:13:21 +00:00
Corentin Wallez 280b96ea8d Re-enable -Wunguarded-availability in Dawn standalone builds
By bumping the min macOS SDK version for standalone Dawn builds we are
able to re-introduce -Wunguarded-availability, which will help prevent
usage of Metal APIs without correctly checking for their availability.

BUG=

Change-Id: Iebf2f64e9f68e2a7a90fc6f3f208967f952f3487
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11400
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-12-11 16:54:51 +00:00
Corentin Wallez e8e9d5daf5 Use InfoLog to report perftest results.
On Android printing to stdout doesn't show in logcat. Use InfoLog
instead of fprintf(stdout) so that the message get routed to
android_log.

BUG=dawn:286

Change-Id: I067a12d8a790e42d75617c760a2693a3d94ebda6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14481
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-12-11 11:10:01 +00:00
Austin Eng cbc206e84f Add intermediate dawn_wire command handler to dump command traces
This adds an argument to Dawn tests to use an intermediate
command handler which dumps command traces. In the near term, this will
be useful to generate a seed corpus for fuzzing. In the future, we may
be able to use the layer to produce reproducible traces of real
applications.

Bug: dawn:295
Change-Id: Ie36d10f4b46f4b16a3ad3ea34961fd38ba8041aa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14241
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-12-10 23:32:48 +00:00
Austin Eng d1db0e94b0 docs: Add section about dawn_perf_tests
Bug: dawn:23
Change-Id: Ic0f8e8775d85b43db3ad1665d805a201770ca8d1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14440
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-12-10 19:49:08 +00:00
Ryan Harrison 652fd5a416 Use correct Initialize call to spvc for Metal backend
BUG=dawn:292

Change-Id: I91d315d2f071cb8a25acb0d5379944ac8049deea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14340
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-12-10 18:38:28 +00:00
Austin Eng ff8b3f4397 Inline CommandAllocator/Iterator
Inlining these hot functions decreases CPU time in perf tests for
DrawCallPerf.Run/Vulkan by roughly 12% (55 to 47ns) and increases
binary size by about 0.16% (~4kB).

Bug: dawn:304
Change-Id: I84e5d011defe88d6f1492dcb54e421c3d1bf099f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14000
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-10 01:10:27 +00:00
Yunchao He 56b12422da Implement readonly storage buffer on OpenGL backend
Note that storage buffer and readonly storage buffer may not be
supported in vertex shader on OpenGL backend. In OpenGL Spec 4.6,
the minimum value of MAX_VERTEX_SHADER_STORAGE_BLOCKS is 0.

BUG=dawn:180, dawn:284

Change-Id: Ib637a61e4eee0a0996c0da33f492e075fd94e1e7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14380
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-12-09 23:59:28 +00:00
Yunchao He ef8dee90a7 Implement readonly storage buffer on Metal backend
BUG=dawn:180, dawn:284

Change-Id: I07358e5817faa85a0695a7c44db7b6472307d101
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14360
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-12-09 21:35:38 +00:00
Yunchao He 5554283717 Implement readonly storage buffer on D3D12 backend
This change implements D3D12 backend for readonly storage buffer.
It uses SRV in root signature at API side and ByteAddressBuffer at
shader side (has already been done in spirv-cross) for readonly
storage buffer.

BUG=dawn:180, dawn:284

Change-Id: Iafcd24835a75349ce719e9735752de50210a846f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14300
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-12-09 21:01:28 +00:00
Yunchao He 4326a8a6f2 Use GetBindGroupLayout in GpuMemorySynchronizationTests
BUG=dawn:276

Change-Id: I46bf19047c1f32cb547a04006a077481038a3910
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14400
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-12-09 19:17:22 +00:00
Natasha Lee 792ff476ce Validate texture max size
Bug: dawn:294
Change-Id: I966dd87bfc0584fdcfa734193d083fcaa6b50898
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14283
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-09 19:11:12 +00:00
Corentin Wallez dc3317da6c Namespace Log.h/cpp in dawn::
The LogMessage::LogMessage constructor was redefining a symbol that
exists in re2 inside of Chromium. So we namespace Log inside dawn:: to
avoid the conflict.

BUG=dawn:302

Change-Id: Ida349208e2c6fe9ac032e1bd8cd442dff0b3f6bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14320
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-12-06 18:21:39 +00:00
Ryan Harrison dd4584340d Refactor D3D12 pipeline creation to better propagate errors
BUG=dawn:301

Change-Id: Ia7982cfe40abb28ab786c8941e269bded11468ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14282
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-12-06 14:41:49 +00:00
Ryan Harrison 32c1eae35f Use spvc API for calls in ShaderModuleD3D12
BUG=dawn:291

Change-Id: I0c467d1d7b213872ec0bc1e3924ab89f7786aeba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14281
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-12-06 14:01:29 +00:00
Corentin Wallez 84d836295e Remove generation of proxy dawn.h and dawncpp.h
BUG=dawn:22

Change-Id: Iee8b93fddf2f4aced72bb12062ffae6dddc336ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14260
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-12-06 08:34:49 +00:00
Yunchao He ce8bf128ec Readonly storage buffer - Vulkan backend
This change implements Vulkan backend for readonly storage buffer. It
also adds a few end2end tests to verify the implementation.

BUG=dawn:180
Change-Id: I0d680654fa490192c357eccdcdce8e56a8037bce
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14200
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-05 21:18:12 +00:00
Corentin Wallez 84a57756db Vulkan: Choose D32S8 or D24S8 depending on availability
The Vulkan spec mandates support for only one or the other, which is
why we have the concept of a depth24plus format. This also adds a Toggle
to test both formats in DepthStencilStateTests.

Finally this renames ForceWorkarounds to ForceToggles because toggles
can be more than just workarounds.

BUG=dawn:286

Change-Id: I5b5dc582ffd4ee61c51e3e75563aec815c580511
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14103
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: David Turner <digit@google.com>
2019-12-05 14:02:11 +00:00
Corentin Wallez ec0020c208 Add links to, and format Toggles.cpp
Missing links and bad formatting was found while adding a Toggle for
choosing which format to use for Depth24PlusStencil8 in the Vulkan
backend.

BUG=dawn:286

Change-Id: I7d9c964ed90988ac63563707afb86a27005ff1b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14180
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-12-05 12:46:41 +00:00
Corentin Wallez 95586ff184 Add Log.h to replace all uses of iostream
On Android iostream doesn't appear in logcat, the system log that's
often used for printf debugging. Introduce Chromium/ANGLE like logging
that looks like the following:

  InfoLog() << stuff << stuff;

This makes sure the message is put in logcat on Android and removes
static initializers from <iostream>

BUG=dawn:286

Change-Id: Ie0d018f49bcac1a7b740739a6e59d45ae6728638
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14102
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-12-05 11:13:01 +00:00
Ryan Harrison 7ecb9268df Merge two calls to InitializeHLSL into one
BUG=dawn:290

Change-Id: I6dca2120278be998ef342a24ac027c1aa60d3a78
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14221
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-12-04 21:54:00 +00:00
Ryan Harrison 42b3b9c413 Plumb UseSpvc toggle for tests
BUG=dawn:273

Change-Id: I4660f0f984b6fb0103eafca9d674dcb4ed02cee4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14220
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-12-04 20:05:36 +00:00
Austin Eng 53782d60dc Use GetBindGroupLayout in TextureViewTests
Bug: dawn:276
Change-Id: If502f933d3fbefb03bc04a7aceacb89874187d3e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14032
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:40:05 +00:00
Austin Eng cd62568bc8 Use GetBindGroupLayout in TextureFormatTests
Bug: dawn:276
Change-Id: I34c36b4835485858cd0fd8bd84f0961a7c00a17b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14031
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:35:35 +00:00
Austin Eng 1fe9979ad8 Use GetBindGroupLayout in SamplerTests
Bug: dawn:276
Change-Id: I294a3e94e1134212cc8f9bccd743435a6cd67538
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14030
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:32:55 +00:00
Austin Eng da82324098 Use GetBindGroupLayout in RenderBundleTests
Bug: dawn:276
Change-Id: I07683751d4361230754e75096dd695752a9a05d1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14029
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:30:55 +00:00
Austin Eng 016f3060a3 Use GetBindGroupLayout in ComputeCopyStorageBufferTests
Bug: dawn:276
Change-Id: I66291eec6b36e6d3318d6bd01fd891f354bb2be3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14022
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:25:45 +00:00
Austin Eng ca5f61f9ed Use GetBindGroupLayout in DepthStencilStateTests
Bug: dawn:276
Change-Id: Ibd3fcf7131c3c1aa4e8723f7235aa7a1dc55ff46
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14026
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:24:05 +00:00
Austin Eng 159d5c6a90 Use GetBindGroupLayout in IOSurfaceWrappingTests
Bug: dawn:276
Change-Id: Ie9bc27e8cc0ec5892b6e63429124249232e69725
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14027
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:21:55 +00:00
Austin Eng 476a14a7cc Use GetBindGroupLayout in MultisampledRenderingTests
Bug: dawn:276
Change-Id: I31e879a9e4ed7cc7ccbb882502942302dfd19bb4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14028
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-12-03 21:18:05 +00:00
Austin Eng ac89f2d619 Use GetBindGroupLayout in ComputeStorageBufferBarrierTests
Bug: dawn:276
Change-Id: I204226ab4535b69ea6a59be857c3a7bf4e71b47e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14025
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:14:55 +00:00
Austin Eng e40c87c986 Use GetBindGroupLayout in ComputeSharedMemoryTests
Bug: dawn:276
Change-Id: I024ec718b3f8423f6c271404d4beb125987290dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14024
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:08:45 +00:00
Austin Eng f9033b89e5 Use GetBindGroupLayout in ComputeIndirectTests
Bug: dawn:276
Change-Id: Ic54ce6d47d9ecf7291b824c829d76831258ab6e6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14023
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 21:05:55 +00:00
Austin Eng cd642f9fdd Use GetBindGroupLayout in TextureZeroInitTests
Bug: dawn:276
Change-Id: I6ca2e4fd511ea86afdb7036258845d74080bc0f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14033
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-03 20:59:25 +00:00
Austin Eng 48befdf311 Use GetBindGroupLayout in CompressedTextureFormatTests
Bug: dawn:276
Change-Id: I364279b5d727816f1c7e0da3c55cf2cee2551eaf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14021
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-12-03 20:56:55 +00:00
Austin Eng 3d38301020 Use GetBindGroupLayout in ColorStateTests
Bug: dawn:276
Change-Id: If5824bc4870f8842481f7b4012c47ad709395e57
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14020
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-12-03 20:39:53 +00:00
Ryan Harrison be5c135672 Refactor code to have rudimentary support for using SPVC
This is the first step for having a fully operational SPVC usage
path. This version of SPVC integration uses SPVC for setting up the
options to the compiler, but a lot of the actual interaction with
spirv-cross is done in Dawn, just via SPVC's compiler object.

Future CLs will migrate more of the spirv-cross interaction to using
the SPVC API, eventually removing the need for Dawn to know about
spirv-cross.

BUG=dawn:288

Change-Id: I68e0773f910d7fe967235b6987b3debe1d13883f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14143
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-12-03 20:25:13 +00:00
Yunchao He 969df2b3a2 Fix a typo in viewport test
BUG=dawn:53

Change-Id: Ibc768cc4695072533d6715f62f46fd4c72d40a3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14142
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-11-30 09:04:18 +00:00
Ryan Harrison fd12e1b746 Add runtime toggle to select IR generation path in SPVC
BUG=dawn:281

Change-Id: I3102fece31289d1b511a13536aaf29254501d7c1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14140
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-11-29 15:28:26 +00:00
Yunchao He 40b10e4d65 Add memory synchronization tests - multiple write then multiple read
The change adds multiple write then multiple read tests for gpu memory
synchronization test. It covers all common usages: write into storage
buffers, then read the data as vertices, indices, and uniforms.

The different usages are done via separate buffers, and one mixed buffer
via two tests.

I added two uniform buffers/usages in these two tests. I will replace one
uniform buffer by readonly storage buffer later. Then all readonly usages
will be covered. So it is also useful to verify the upcoming implementation
on backend for readonly storage buffer.

BUG=dawn:275

Change-Id: Ifbe086f55064e7b26cfc42ebc9c56edaf7e9d5a7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13940
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-28 18:55:45 +00:00
Ryan Harrison 0625ae2167 Add runtime toggle for using SPVC
This will be used in the future to choose between Dawn directly
accessing spirv-cross, and using spvc to mediate that interation.

This also adds in the spvc library as a dependency. This is what cause
the rollback last time, but that issue should be resolved.

BUG=dawn:281

Change-Id: Ic0b02d136ca05e2fa71844ebc85586b8866d5712
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14122
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-28 18:12:35 +00:00
Corentin Wallez 0ee91fc0a1 Vulkan: Choose correct libvulkan on Android
Contrary to Linux, libvulkan.so on Android doesn't have the additional
.1 at the end (libvulkan.so.1 on Linux)

BUG=dawn:286

Change-Id: I22f06121b81e0fe08faae7d105a7c2094e788184
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14104
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-28 09:48:44 +00:00
Corentin Wallez 1e2c2f2af3 Vulkan: Don't require TRANSFER for universal queues
The Vulkan specification requires that GRAPHICS and COMPUTE queue
support transfer operations, but it doesn't require them to expose the
TRANSFER flag. Make Dawn not require that flag so it can find a
universal queue on Adreno drivers.

BUG=dawn:286

Change-Id: Id4811e2077b27aa7db5ce554a4fd919c3cdcdb96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14101
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-28 09:42:24 +00:00
Corentin Wallez 673146475f Allow compilation of Dawn on Android
BUG=dawn:286

Change-Id: Ia65b57fde12a1260d29913f61f9b24eded7dbc30
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13822
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-28 09:40:54 +00:00
Ryan Harrison 00b1e38f3b Re-enable spirv-cross fuzzers
Roll third_party/shaderc/ 24536bdd3..1d6155d86 (1 commit)

24536bdd3c..1d6155d867

$ git log 24536bdd3..1d6155d86 --date=short --no-merges --format='%ad %ae %s'
2019-11-27 rharrison Moving spirv-cross dep from Dawn into shaderc (#911)

Created with:
  roll-dep third_party/shaderc

BUG=dawn:285

Change-Id: I47d202166f9e34c88e7aad75d6a3c8aa9a7d6499
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14120
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-11-27 20:56:14 +00:00
Corentin Wallez 74cebd6879 Allow using swiftshader with the Vulkan backend
This adds swiftshader as a dependency of Dawn, and when it is present
dawn_use_swiftshader=true will force usage of it. (due to a Vulkan
loader limitation we can't have both regular drivers and swiftshader in
the same VkInstance).

BUG=dawn:283

Change-Id: Ib94f4dcca652eb380e994f007cdcfb145b1a5102
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13440
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-26 18:21:51 +00:00
Ryan Harrison 80d71ecd12 Remove build rules for spvc support & spirv-cross fuzzers
Disabling this while refactoring how dependencies are set up to avoid
breaking various builds and rolls.

BUG=dawn:285

Change-Id: Iaca2614fb73277a1ea850f90a487693cd4c54fcb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14040
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-11-26 17:42:51 +00:00
Corentin Wallez 8e9c3f663c Fix compilation on MSVC
BUG=

Change-Id: I9f33a4c26cc2ca1e6d6cdbc245d929175867b1e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13961
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2019-11-23 03:40:53 +00:00
Yunchao He 733842c59d Add memory synchronization tests - render to compute and vice versa
This change adds GPU memory synchronization tests for buffer. The tests cover
data flow from render pass to compute pass via storage buffer, and vice versa.

It is the last one for the series of memory sync tests for buffer.

BUG=dawn:275

Change-Id: Ic866161cadc0fa9df4c441f3970783077f3a9bd0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13921
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-11-23 00:20:53 +00:00
Brian Ho e568fe138e Remove WrapVulkanImageOpaqueFD
This CL removes the deprecated WrapVulkanImageOpaqueFD now that it
no longer being called in Chromium [1].

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

BUG=chromium:996470

Change-Id: I19a7ff36e39b5ed07c68f422cd053f480a7c177e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13980
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brian Ho <hob@chromium.org>
2019-11-22 21:00:43 +00:00
Austin Eng f6eb890f4c Implement getBindGroupLayout
This patch makes the |layout| member of the Render|ComputePipelineDescriptor
optional. If it is not provided, a default layout is created from the
ShaderModules provided and used to replace the layout in the descriptor.

Then, pipeline.GetBindGroupLayout may be called to get the existing, or
the computed bind group layout. If no bind group layout exists at the
provided index, an empty bind group layout is returned.

Bug: dawn:276
Change-Id: I276ed0296a2f1f2d8131fa906a4aefe85d75b3a7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13741
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2019-11-22 17:02:22 +00:00
Austin Eng d0993ba83a Test TextureComponentType and TextureViewDimension compatibility
The TextureComponentType and TextureViewDimension of resources in
the shader must match those in the bind group layout.

This patch also extracts the texture view dimension from the SPIRV.

Bug: dawn:202
Change-Id: Ie155f17109f4f1b5d9b386d757062ae5ffe5da67
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13861
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-11-22 16:40:22 +00:00
Austin Eng 4b0b7a532a Skip validation during command recording when skip_validation is on
This patch factors resource usage tracking so it is separate from
command validation, allowing the bulk of command validation to be
completely skipped.

In DrawCallPerfRun/Vulkan_DynamicPipeline_DynamicBindGroup, disabling
validation cuts roughly 74 nanoseconds (20%) of CPU time, per draw.

In DrawCallPerfRun/Vulkan_DynamicBindGroup, disabling validation
cuts roughly 35 nanoseconds (17%) of CPU time, per draw.

In DrawCallPerfRun/Vulkan_MultipleBindGroups, disabling validation
cuts roughly 45 nanoseconds (14%) of CPU time, per draw.

Bug: dawn:271
Change-Id: I517b85840ba18c6a554b83f34a1d0aef1a8c56a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13520
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-21 22:09:41 +00:00
Ryan Harrison 48bf745b96 Revert "Convert spvc build flag to a runtime toggle"
This reverts commit 1954436fe2.

Reason for revert:
The shaderc side of this multi-patch brings in a dependency on glslang, which uses a static initializer, which chromium doesn't like.

Original change's description:
> Convert spvc build flag to a runtime toggle
> 
> Also moves some of the spirv_cross code into the main library that was
> feature guarded, since spvc requires it.
> 
> BUG=dawn:281
> 
> Change-Id: I482d1d5a5c851956d3815bad90665c52a1ea15bb
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13860
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>

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

Change-Id: Ia9a025fb4440c96874d1b45776a9f97023ca591d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:281
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13941
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-11-21 20:31:05 +00:00
Corentin Wallez 3f195e7d42 Fix link in standalone on Linux
There were some missing DAWN_NATIVE_EXPORT arributes for new structures
in VulkanBackend.h which resulted in linking errors.

BUG=chromium:996470

Change-Id: I45deb56faf5fd77ecfa96ebda99d31d0109d98ec
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13900
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-11-21 18:54:42 +00:00
Bryan Bernhart 12e780d709 Fix D3D12 render-pass failure when GPU does not support sampling positions.
It is invalid to specify a resolve source region on GPUs that do not
support sample positions. Instead, the entire region rect should be
set to all zeros or "empty" to always resolve the entire region.

Bug: dawn:36
Change-Id: I23575b2186bffbcb2e236988558b78f97375a126
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13501
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-11-21 18:16:02 +00:00
Ryan Harrison 1954436fe2 Convert spvc build flag to a runtime toggle
Also moves some of the spirv_cross code into the main library that was
feature guarded, since spvc requires it.

BUG=dawn:281

Change-Id: I482d1d5a5c851956d3815bad90665c52a1ea15bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13860
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-21 18:08:15 +00:00
Bryan Bernhart 127cd1f258 Skip small texture alignment test on NV GPUs.
Windows bots may fail should GPU/drivers not support 4KB alignments,
specifically NV GTX 1160.

Bug: dawn:282
Change-Id: I0f66792c198774ef7265bdab691488945ee7dc35
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13920
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-21 18:05:52 +00:00
Brian Ho 899c17090f Implement a dma-buf MemoryService
This CL implements the MemoryService for importing memory and
creating VkImages from a dma-buf handle. Under the hood, it uses the
VK_EXT_external_memory_dma_buf and
VK_EXT_image_drm_format_modifier extensions to find a memory type
that supports dma-buf import. In addition, the extensions are also
used to properly specify the stride and tiling of the dma-buf to
vkAllocateMemory and vkCreateImage.

BUG=chromium:996470

Change-Id: Ie72d73117a4cbafcb40468aab0952b783351d499
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13785
Commit-Queue: Brian Ho <hob@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-21 16:02:10 +00:00
Corentin Wallez 0d4a7b0ba5 Correctly reset mappedData in MapTwice buffer test
The test would previously fail because the mappedData pointer stayed
non-null which meant the spin-loop waiting for the map read callback
would exit immediately.

BUG=dawn:278
BUG=dawn:280

Change-Id: I53e5974571d7684b09903c599bb65c0d8efe4d8a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13821
Reviewed-by: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-21 12:49:30 +00:00
Austin Eng 4d15609d26 Add a toggle to disable Dawn validation
Trusted users of Dawn should be able to use it without the
overhead of command validation. This patch adds the toggle and
skips validation for object creation.

Bug: dawn:271
Change-Id: Ica9a1988177685d73e2c36e05c4d525ad1ab0fdb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13802
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2019-11-21 00:48:39 +00:00
Brian Ho 98ba76af00 Define an interface to import dma-bufs
This CL adds an API to import a dma-buf into Dawn as a WGPUTexture.

We also add a descriptor type enum to the base
ExternalImageDescriptor struct. This is because all memory import
code (e.g. MemoryService, Texture::CreateFromExternal) takes the
a base ExternalImageDescriptor as a parameter. The dma-buf external
memory and image services, however, will need to downcast to
ExternalImageDescriptorDmaBuf to access import parameters like
stride. Explicitly adding a type enum will let us more safely verify
the type before downcasting.

BUG=chromium:996470

Change-Id: I2d9883a15e9059a91f2c7bdb7a96d74373e18c56
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13782
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brian Ho <hob@chromium.org>
2019-11-20 23:57:03 +00:00
Brian Ho ae687f5b83 Add CreateImage support to MemoryService
This CL introduces SupportsCreateImage and CreateImage to the
external memory service API to provide different implementations for
creating VkImages for different types of external image handles.

While opaque FD and Zircon seem to share the same vkCreateImage
implementation, dma-buf import will require the use of the
VkImageDrmFormatModifierExplicitCreateInfoEXT [1] struct (among
other differences) with vkCreateImage.

[1] https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkImageDrmFormatModifierExplicitCreateInfoEXT.html

BUG=chromium:996470

Change-Id: I3eb11f8877d4465f5fcdd4089d5fdd8acbc1da10
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13781
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brian Ho <hob@chromium.org>
2019-11-20 23:53:43 +00:00
Brian Ho d3123137b1 Request dma-buf Vulkan extensions
This CL adds a few Vulkan extensions to be used for importing
dma-bufs as VkImages.

In particular, we need:
  - VK_EXT_external_memory_dma_buf
  - VK_EXT_image_drm_format_modifier

BUG=chromium:996470

Change-Id: I7a3dfd0184177c756b07613fbfe140506f54584c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13783
Commit-Queue: Brian Ho <hob@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-11-20 18:06:33 +00:00
Jiajie Hu 9e5b9edb43 Enable Vulkan validation layers on Linux
When vkDestroyDebugReportCallbackEXT() is called in Backend::~Backend()
and Vulkan validation layers are in use, the variable unique_id_mapping
is referenced internally[1]. However, the variable is global[2] and it's
destructed before Backend::~Backend(), which causes a use-after-free
issue. The issue was unnoticed on Windows, but we observed the crash at
exit on Linux.

[1] 9fba37afae/layers/generated/layer_chassis_dispatch.cpp (4961)
[2] 9fba37afae/layers/generated/chassis.cpp (40)

Bug: dawn:150
Change-Id: I505373a88ef9795243dd18da9785fb49d253e498
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13787
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-20 09:45:41 +00:00
Brian Ho 756a9d7e49 Create VkImage before importing external memory
This CL is part of a chain of CLs that imports dma-bufs as VkImages
to support WebGPU on Chrome OS.

There are currently two steps for importing external memory into
Vulkan:

  1. DeviceVk::ImportExternalImage: calls into
     MemoryServiceOpaqueFD::ImportMemory which in turn calls into
     vkAllocateMemory and outputs a VkDeviceMemory handle to the
     imported memory.
  2. TextureVk::CreateFromExternal: creates the actual TextureVk
     object, creates the VkImage, and binds the VkDeviceMemory from
     ImportExternalImage to the VkImage.

For dma-buf support, however, we need to re-order these two steps
because importing dma-buf memory requires a handle to the VkImage
that will alias it [1].

This CL splits these two steps into three steps to ensure we create
the VkImage first so we can use it in vkAllocateMemory:

  1. TextureVk::CreateFromExternal: creates the TextureVk and
     VkImage (no longer concerns itself with vkBindImageMemory).
  2. DeviceVk::ImportExternalImage: now takes the VkImage as input
     but is otherwise unchanged.
  3. TextureVk::BindExternalMemory: calls vkBindImageMemory with
     handles to VkDeviceMemory and VkImage.

[1] https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkMemoryDedicatedAllocateInfo.html

BUG=chromium:996470

Change-Id: Id2d5951e9b573af79c44ce8c63be5210a279f946
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13780
Commit-Queue: Brian Ho <hob@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-11-20 01:50:50 +00:00
Yunchao He 02dd733454 Add memory synchronization tests - data deps chain among passes
This CL adds end2end tests for memory synchronization tests for buffer.
It adds a few tests that iterate data read-add-write operations a few
times in buffer for compute and render respectively, and verifies
that data dependency among interations is well synchronized.

BUG=dawn:275

Change-Id: Idfe627e90de795d664ee64787d5c5d2bfcee676b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13700
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-11-20 00:05:20 +00:00
Yunchao He 452225d6be Add tests for map buffer twice
This patch add end2end tests for map buffer twice for map read, map
write, and SetSubData.

BUG=dawn:278

Change-Id: Ibe57d7923310d2513e314fa9bf185677a706d6da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13801
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-11-19 18:47:30 +00:00
Yunchao He 0c02f54edf code refactoring: prefix const color values with RGBA8
BUG=
Change-Id: I820180adc19b1d1c226ca92084c64e441173c27b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13760
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-11-19 17:57:30 +00:00
Corentin Wallez 083a1ce2bf Inline a 1 bit payload in RefCounted
This changes RefCounted to increment and decrement the refcount by steps
of 2, so that a 1 bit payload can be inlined in the refcount. This
avoids using a whole boolean + padding (4 or 8 bytes in general) to know
if objects are errors.

Fixes a longstanding optimization TODO.

BUG=dawn:105

Change-Id: I5e8f66465d23772fb6082ea3e0d5d4aba2132648
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13680
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-11-19 14:35:10 +00:00
Bryan Bernhart 9c81f8738a Allow SetBindGroup command to be skipped with dynamic offsets.
Fixes a bug where SetBindGroup command would fail to be skipped.

BUG=dawn:256

Change-Id: I9815c9d31aa88f6881274a1873cabe17379cc2e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13800
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-11-18 23:09:38 +00:00
Jiajie Hu d0c07f112e Vulkan: Fix release of semaphores in the recording context
This seems to be a regression introduced by CL:12022, where the
previously recorded semaphores are leaked while resetting the recording
context. The Vulkan validation layers will complain about this when
running the Linux-only image wrapping tests. Also, the semaphores are
queued for deletion with the right serial now.

Bug: dawn:19, dawn:150
Change-Id: I50fd46ca9de9199b29be2f85d5e9bd7394a10f1a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13420
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Jiajie Hu <jiajie.hu@intel.com>
2019-11-18 08:15:18 +00:00
Yunchao He 612a63abe1 Add memory synchronization tests - storage to uniform sync
This CL adds end2end tests for memory synchronization tests for buffer.
It adds a few tests that write into storage buffer in compute pass,
then read via uniform binding from the same buffer in render pass.

BUG=dawn:275

Change-Id: Ic98a10aab4cdcddecd60662438d4b8bdd34fafbc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13580
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-18 04:28:24 +00:00
Yunchao He e0eeef4b34 code refactoring: const color values
BUG=
Change-Id: I6f394fd8ae45d30e1e3846b9a7a03f51efb8a475
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13660
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-11-18 03:27:44 +00:00
Austin Eng a930e599e1 Add cpu_time metric to dawn_perf_tests
The cpu_time metric measures the amount of CPU time spent on a step.
It excludes time spent waiting for the GPU or time between frames.

Bug: dawn:208
Change-Id: I5624d45557716c02bb7da632d2347eca0b81ad41
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13640
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-11-15 15:43:26 +00:00
Yan b639e68495 Add large buffer to handle super large data block commands
TerribleCommandBuffer has space for 10,000,000 bytes worth of commands. If
commands contain super large data block (e.g. setsubdata), it will
return nullptr and crash dawn wire layer.

This patch adds a large buffer to handle super large data block.

BUG=dawn:251

Change-Id: Ib007e92b5282afbb93aef63cfffe5a3965f6d5c1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13040
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-15 09:32:56 +00:00
Ryan Harrison 58dbfcae38 Refactor ShaderModule creation to use a Builder pattern
BUG=dawn:270

Change-Id: Iedae1a5500b1eb65abb84ff59f68d829c5c22c2b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13500
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-14 16:10:45 +00:00
Corentin Wallez 321c12255e Remove the "Base" from pure-frontend dawn_native types
This was unnecessary verbosity. Fix this by having the ProcTable
generator using type aliases so all types appear like they have
"Base".

BUG=

Change-Id: I8c472fb924f6ce739e4e41038452381b4f727a2b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13442
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-11-13 17:00:37 +00:00
Ryan Harrison 9e7107eb96 Migrate Dawn fuzzers to using new SPVC split API
Roll third_party/shaderc/ c9d5be6b0..0865050e5 (3 commits)

c9d5be6b01..0865050e54

$ git log c9d5be6b0..0865050e5 --date=short --no-merges --format='%ad %ae %s'
2019-11-12 rharrison Split spvc shader generation into initialize and compile phases (#882)
2019-11-12 9856269+sarahM0 opName - opStruct (#880)
2019-11-12 rharrison Rolling 5 dependencies and updating expectations (#879)

Created with:
  roll-dep third_party/shaderc

Change-Id: Iea431b36973ac1fbfe68f1353e538ca4ca5ca910
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13423
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-11-13 15:37:47 +00:00
Jiawei Shao cfdbaaa376 Implement querying WGPUDeviceProperties from dawn_native::Adapter
This patch adds an interface GetAdapterProperties() on Adapter which can
directly return a WGPUDeviceProperties object that includes the
information of the adapter.

BUG=chromium:996713

Change-Id: I9a7b1512d259761e198dfac3eafa718171d47241
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13340
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-11-13 01:53:25 +00:00
Corentin Wallez 604072bc2e Make the SwapChain interface match webgpu.h
This changes the methods of Dawn's SwapChain to match webgpu.h, namely
Present() now doesn't take arguments, and GetNextTexture() is replaced
with GetCurrentTextureView().

BUG=dawn:269

Change-Id: Ia0debefb170caf799c3310b1dad5535c4c5f59ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13441
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-11-12 18:30:11 +00:00
Brandon Jones 700cfe7664 Implement D3D12 Native Render Passes
Uses D3D12 native render pass API when possible. On pre-RS5 builds of
Windows, Dawn will fall back to a software emulated render pass. A
toggle was added to provide test coverage to the emulated render pass
implementation and used in tests that test render pass functionality in
particular.

Bug: dawn:36
Change-Id: I297a3ec7655b68d28204db2d3ab78cb82bb4e7a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13082
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2019-11-12 18:14:21 +00:00
Austin Eng cfc9c6e322 Make perf test tracing thread-safe
The Metal driver calls command buffer completion callbacks on a
separate thread so enqueueing these trace events needs to be made
thread-safe. In the future, Dawn will probably have other threads
that also require thread-safe tracing.

In this CL, each thread records trace events into its own buffer,
and all buffers concatenated when trace events are acquired.

Bug: dawn:254, dawn:208
Change-Id: I0f1abd404568d838091066a8f27a3bf98fa764b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13080
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-11-11 23:15:56 +00:00
Yunchao He c51616d790 Implement readonly storage buffer - validation at shader side
This patch adds validation code for shader side for readonly storage
buffer. It also adds unit tests for validation.

BUG=dawn:180

Change-Id: Ib5789381d41d77867dd6e6aa1f1ccbc8fa43a382
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12941
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-11-11 20:05:28 +00:00
Yunchao He 5aa7458db6 Tiny fixes for BindGroup/BindGroupLayout tests
This patch sets proper value in a few end2end tests for BindGroup/BindGroupLayout.
It also removes unused variables in unittest test for BindGroup/BindGroupLayout.

Bug=dawn:180
Change-Id: Ie5c8b2fd8265fe90b7b54c48af48106c356564b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13300
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-11-11 19:11:08 +00:00
Ryan Harrison 59b2987b20 Another spvc API migration
Subtle change to how results are handled requiring another change.

Rolling DEPS ahead to pick up change.

Roll third_party/shaderc/ 76ee91e12..f4cf10c66 (4 commits)

76ee91e126..f4cf10c66f

$ git log 76ee91e12..f4cf10c66 --date=short --no-merges --format='%ad %ae %s'
2019-11-11 rharrison Correct Unicode issue with add_copyright.py (#876)
2019-11-08 rharrison Another major API rework (#871)
2019-11-07 rharrison Remove deprecated API elements (#870)
2019-11-07 9856269+sarahM0 Add support and unit test for OpTypeInt, OpTypePointer and OpConstant (#872)

Created with:
  roll-dep third_party/shaderc

Change-Id: Ic461c3ec135d2c73ebadede62fb34c90e7961eda
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13380
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-11 18:39:08 +00:00
Jiajie Hu 3c086a0c2e Remove VulkanImageWrappingTests suppression on Intel
The Intel bot upgrade (crbug.com/966500) is finished.

Bug: chromium:976495
Change-Id: I2d48f07d2e6951f77f76c870e3d23b5a62db1dd1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13360
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-11 08:59:07 +00:00
Rafael Cintron 600a26d50a Fix ResourceHeapAllocation Memory Leak
ResourceAllocatorManager::DeallocateMemory was correctly invalidating the
passed in allocation object. However, since the subclass
ResourceHeapAllocation class was not overriding the Invalidate method and
clearing out the D3D12Resource pointer, the resource ended up being tied
to the lifetime of the Texture object instead of being released on Destroy.

In Chromium, this bug was particularly egregious as it meant swap chain
texture cleanup was at the whims of the Javascript garbage collector.

Bug: dawn:242
Change-Id: Ia5856c61c8d3b92a2247a9aaa5f91c5de0a99dcb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13200
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-11-08 21:47:00 +00:00
Kai Ninomiya ae1f25fee8 Update naming for vertex state
- VertexInputDescriptor -> VertexStateDescriptor
- VertexBufferDescriptor -> VertexBufferLayoutDescriptor
- VertexBufferDescriptor.stride -> .arrayStride
- VertexAttributeDescriptor.offset no longer optional

gpuweb PR: https://github.com/gpuweb/gpuweb/pull/469

Bug: dawn:22
Change-Id: I5431df4ba22cfbdb1bc81e6709e562cd736892a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13100
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-07 22:23:29 +00:00
Ryan Harrison c3284fa40e Migrate away from using recently deprecated APIs
Due to a renaming/refactoring of the spvc API Dawn is currently using
a deprecated class name. Fixing this, so the deprecated APIs can be
removed.

Also including the roll to pick up the API changes.

Roll third_party/shaderc/ 0a260d789..76ee91e12 (7 commits)

0a260d789f..76ee91e126

$ git log 0a260d789..76ee91e12 --date=short --no-merges --format='%ad %ae %s'
2019-11-06 9856269+sarahM0 Fix spvc test machanism and adds unit tests for OpSource (#868)
2019-11-06 rharrison Move spirv_cross state out of result and rename opaque state handle (#865)
2019-11-05 9856269+sarahM0 Add unit test for spvcir parser (#866)
2019-11-04 rharrison Rolling 5 dependencies (#862)
2019-11-04 9856269+sarahM0  Add --emit-line-drective option (#861)
2019-11-01 9856269+sarahM0 Add spvcir unit test - OpCapability (#857)
2019-11-01 rharrison Add flag for updating invalid expecations and rewrite end logic (#856)

Created with:
  roll-dep third_party/shaderc

Change-Id: I81649618da6753657ef5a7533785559c2a13c416
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13180
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-07 17:02:57 +00:00
Yunchao He 252d1eb47f Suppress viewport test
BUG=dawn:205, dawn:257

Change-Id: I319211832818e3aa865cbfc4b342328cad832230
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13120
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-07 12:15:17 +00:00
Li, Hao 0e1bef3251 Add Vulkan validation layers on Windows
Deploy self-built Vulkan validation layers instead of system installed
one. And it will reuse third_party/angle's Vulkan validation layers if
building with chromium.

Bug: dawn:150
Change-Id: I94e26f7a152fb2a1c39bcb102d60024f4d65eee6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11120
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-07 12:13:27 +00:00
Yunchao He 64cfaeac4c Reland "Implement readonly storage buffer - validation at API side"
This is a reland of 34ac535f02

Original change's description:
> Implement readonly storage buffer - validation at API side
> 
> This patch adds validation code for API side for readonly storage
> buffer. It also adds unit tests for API validation.
> 
> BUG=dawn:180
> 
> Change-Id: I9a97c5f3aa23e720619d138ca55d7b17f08d64c9
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12620
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Yunchao He <yunchao.he@intel.com>

Bug: dawn:180
Change-Id: I1e107ff6168279940496317b973f2d8c7c3c6114
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13083
Reviewed-by: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-11-07 07:09:07 +00:00
Bryan Bernhart 2cdf132c0f Support for small resource placement.
Enables use of 4KB resource alignments where permitted.
This saves heap memory (4KB vs 64KB per allocation) and improves re-use.

BUG=dawn:27

Change-Id: I7a0a30252f480db2d0fa7f5d949207a56e3aa2e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12900
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-11-05 19:34:45 +00:00
Corentin Wallez c277c38d90 Suppress failing VertexFormat tests on Mac Intel
BUG=dawn:259

Change-Id: I6865c4acb2a717f11d74eaf26ec4df88100f1573
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13060
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-05 16:07:05 +00:00
Kai Ninomiya e3b510e462 Enable EmulateStoreAndMSAAResolve correctly by platform
Fixes the accidental disabling of the workaround on 10.11, where it is
required, and implements detection for iOS.

Bug: dawn:253, dawn:56
Change-Id: I0278f29892d3a49144b5e9620e4377e42a4a5155
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12960
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-05 15:56:05 +00:00
Corentin Wallez 0558f99119 Vulkan: Reuse descriptor pools
This changes puts descriptor pools in the BindGroupLayout so that they
can be reused between descriptors with the same layout.

This makes the DrawCallPerf.Run/Vulkan_NoReuseBindGroups benchmark go
from 1400ns to 800ns per run.

BUG=dawn::256

Change-Id: Ia9baf7f998d9ff4d552e255c80069b67c6a9ac40
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12920
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-11-05 15:44:05 +00:00
Bryan Bernhart 6df81ebf1d Support for resource heap tier 2.
Enables mixing of texture and buffers in the same heap.
This allows better heap re-use and reduces internal fragmentation.
A toggle has been added and enabled by default.

BUG=dawn:27

Change-Id: I466dc96240fe1e8de6e3dc56ed5547d7b61ee045
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12821
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-11-01 18:19:01 +00:00
Austin Eng 314fd3513d Update SetBindGroup dynamic offsets to uint32_t
In WebGPU these are uint32_t because Vulkan accepts at most a 32-bit
unsigned integer.

Bug: dawn:22
Change-Id: Ia61cd710f80c19135ac215a9a93ef9a8f683bac2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12942
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-11-01 15:51:01 +00:00
Austin Eng c5e06a5d9f Fix result units in perf tests
Timing results extracted from trace events are reported in seconds,
not milliseconds.

Bug: dawn:208
Change-Id: I004d1ee5bbd0aaba8cf5b201f95903e76af0c530
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13000
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-11-01 15:07:01 +00:00
Austin Eng fb03935bed Add a GetInstanceProcAddr helper for the native Vulkan backend.
This is a helper to allow a Dawn embedder to look up the Vulkan device
functions.  Possibly remove when we design a cleaner way to share function
pointers.

Change-Id: I3ed92568e543c1aad9e0e64d72ad0990824640cb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12980
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-11-01 01:10:09 +00:00
Austin Eng ec9010eabc Revert "Implement readonly storage buffer - validation at API side"
This reverts commit 34ac535f02.

Reason for revert: Failing Dawn into Chromium roll due to failed ASSERT
https://ci.chromium.org/p/chromium/builders/try/dawn-linux-x64-deps-rel/3514

Original change's description:
> Implement readonly storage buffer - validation at API side
> 
> This patch adds validation code for API side for readonly storage
> buffer. It also adds unit tests for API validation.
> 
> BUG=dawn:180
> 
> Change-Id: I9a97c5f3aa23e720619d138ca55d7b17f08d64c9
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12620
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Yunchao He <yunchao.he@intel.com>

TBR=cwallez@chromium.org,kainino@chromium.org,yunchao.he@intel.com,enga@chromium.org

Change-Id: I64e5dfd40e7aab982d97fb48544180bc9b8ea558
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:180
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12981
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-11-01 01:09:51 +00:00
Yunchao He 34ac535f02 Implement readonly storage buffer - validation at API side
This patch adds validation code for API side for readonly storage
buffer. It also adds unit tests for API validation.

BUG=dawn:180

Change-Id: I9a97c5f3aa23e720619d138ca55d7b17f08d64c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12620
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-10-31 17:56:42 +00:00
Jiajie Hu 9ec47a0bca Validate texture component type in BGL against its shader module declaration
We have already been validating the component type of a texture matches
the bind group layout. Here is another constraint introduced by
https://github.com/gpuweb/gpuweb/pull/384. For better code reuse,
conversion from wgpu::TextureComponentType to dawn_native::Format::Type
is factored out as a helper function.

Bug: dawn:202
Change-Id: I394497722b4043dc109eca60116224b7a617e02e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12860
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-31 09:51:11 +00:00
Austin Eng 64a3bb93dc Add DrawCallPerf tests
These tests draw a simple triangle with many ways of encoding commands,
binding, and uploading data to the GPU. This tests the performance of Dawn's
validation, command recording, and submission by switching buffer
bindings, bind groups, and pipelines. Some test instantiations upload
per-draw data to test efficiency of resource transitions or pre-record
commands in a render bundle.

Change-Id: I9994cd96ef5988cca410462418792f28161c0526
Bug: dawn:208
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12460
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-31 03:20:31 +00:00
Austin Eng 672707f76e perf_tests: Compute metrics for command validation and recording
This CL reads trace events from the tests and computes the total
time of validation and command recording.

Bug: dawn:208
Change-Id: I551d1e30e60b7d1a839b4fb834ad3608c6cedf63
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12782
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-10-30 01:02:03 +00:00
Austin Eng 84bcf44fae Only mark objects as cached right before inserting into the cache
This fixes bugs where we try to uncache objects that fail creation.

Bug: dawn:249
Change-Id: Ic60b3ce702dfdda18baa6d263911885a43d3cda7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12820
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-10-30 00:20:03 +00:00
Stephen White fe221ac089 Add another missing #include.
Change-Id: I5a34f78e0387d249185a9f3e24c7fd77a40c5a9b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12841
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-10-30 00:19:43 +00:00
Bryan Bernhart 3debb26a9e Limit heap growth when uploading with SetSubData.
Removes unbounded heap growth by capping the heap
size to 4MB and falling back to direct allocation for larger
requests.

BUG=dawn:239

Change-Id: I9ae660809e3c0c539fbcfbee4afcf6fb1f466355
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12720
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-10-29 22:49:43 +00:00
Stephen White 6eb7d0ec3e Add some missing #includes.
Change-Id: I6d029dcddcfb77bbf30daa331ab066b6c254ee89
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12840
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2019-10-29 18:40:12 +00:00
Austin Eng 73d5bb57e6 Use enums for trace event categories
Explicit enums are simpler to use in Dawn and allow only specific
categories which the perf tests understand.

Also adds trace events around command recording and validation on
all backends.

Bug: dawn:208
Change-Id: I7859ffd6668b20893780c6081bf2c9019a7115e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12781
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-28 23:15:40 +00:00
Austin Eng 7a7d547381 perf_tests: Always capture trace events and flush incrementally
Previously, the trace event buffer was cleared after *all* tests
completed. In order to avoid allocating a ton of space to hold
traces, this patch factors the trace event recording so that the
buffer is processed and reset at the end of each test trial.

This patch also prepares for the future where trace events will be
processed at the end of each trial to compute additional metrics.

Bug: dawn:208
Change-Id: If2ed193ee47794c666df9f0b369ec1ce660b177f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12780
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-10-28 23:08:17 +00:00
Corentin Wallez 45b51f5df7 Make unittests and fuzzers use webgpu.h
BUG=dawn:22

Change-Id: Iff5465ad7a9456f9c6b2ee380af748b3afc129b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12741
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-28 22:15:47 +00:00
Corentin Wallez cab352c2f6 Make end2end and perf tests use webgpu.h
BUG=dawn:22

Change-Id: Ief855d294779b97283a79532e9d503aab6fda751
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12740
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-28 13:27:36 +00:00
Bryan Bernhart 9cf62efda9 D3D12: Use CheckHRESULT for allocator errors.
BUG=dawn:27

Change-Id: If28d1cbafcbdac29bafac0fb0e846208634ece33
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12521
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-28 12:59:36 +00:00
Austin Eng f6281a5530 perf_tests: Add missing trace event "id"
This missing identifier is used to match async trace events. Its
absence broke async trace events since their Begin/End could not
be matched correctly.

Bug: dawn:208
Change-Id: I0671af8c3cbb8ff6220adcb8ed5621b831e383c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12760
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-28 11:35:20 +00:00
Corentin Wallez 04863c42be Make examples and utils use webgpu.h
BUG=dawn:22

Change-Id: I602d6a3422b493d199f3fded61ff1666bc2d9d7d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12702
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-25 11:36:47 +00:00
Corentin Wallez 9f90c8d3ca Make dawn_native public headers and dawn_wsi use webgpu.h
BUG=dawn:22

Change-Id: I112d71323c9305fa0997d251556fe0a41dafed29
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12701
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-10-24 23:55:37 +00:00
Corentin Wallez 1fdcb16b69 Make dawn_wire use the webgpu.h header
BUG=dawn:22

Change-Id: I4963aa27322086e74947a1a6265c921e2c7d3d85
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12700
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-24 22:27:27 +00:00
Corentin Wallez 15e751e418 Vulkan: Implement initial version of the suballocation
This makes the Vulkan backend use the BuddyMemoryAllocator to
sub-allocate small resources inside a larger VkDeviceMemory object.
Right now the heuristic to decide to do suballocation is naive and
should be improved.

BUG=dawn:27

Change-Id: Idcc7b6686c086633c85328a7afb91ee84abf7b8c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12662
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-24 21:32:27 +00:00
Corentin Wallez ca35435716 Preliminary changes to Vulkan memory suballocation
This mostly makes the MemoryAllocator not owned by the
BuddyResourceAllocator so that we don't need an extra class for the
dependency injection in the Vulkan backend. (the container for the
BuddyMemoryAllocator can be it's MemoryAllocator at the same time).

Also renames methods of MemoryAllocator to be more explicit.

Also renames the constructor parameter of BuddyMemoryAllocator to be
(subjectively) closer to what the represent.

BUG=dawn:27

Change-Id: I37355ad5b3cded143956f0adc4742fa1b717e9bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12661
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-24 21:28:16 +00:00
Corentin Wallez 60a04dd18c Vulkan: Use the ResourceMemoryAllocator for all resources
This removes the duplication of the memory allocators in preparation for
using sub-allocation in the Vulkan backend too.

Also renames ResourceMemory to ResourceHeap and MemoryResourceAllocator
to ResourceMemoryAllocator, and fixes a number of unused includes.

BUG=dawn:27

Change-Id: I1a9e7d41e5efafa5192bda1d89dc06455fa2af40
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12660
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-24 21:24:27 +00:00
Yunchao He 6da1770507 Fix ambiguous errors for bind group
BUG=

Change-Id: I384e8125674dd5a83ef742fde9f3546f938909df
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12680
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-10-24 17:27:06 +00:00
Yan 402fbcca93 Enable UpdateDynamicOffsetsMultipleTimesComputePipeline case
Austin added barriers for storage buffer in compute pipeline in
this patch (https://dawn-review.googlesource.com/c/dawn/+/12301).

This case now can work fine.

Bug: dawn:236
Change-Id: Id449ae5053f1f018ea95c271bff7e4ab2180a937
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12640
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-10-23 16:34:42 +00:00
Corentin Wallez 1f6c8c4d54 Make dawn_native use the webgpu.h header
BUG=dawn:22

Change-Id: I66e2d998f5e09030e40ec88813cd65c492018fd0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12541
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-23 11:57:41 +00:00
Bryan Bernhart c833c0c592 D3D12: Enable sub-allocation for MSAA and non-MSAA textures.
Updates TextureD3D to use the allocation handle and
defaults to using MSAA heaps.

BUG=dawn:27

Change-Id: I2318bb8d068df86364cb2ebc433f4737e9e121aa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12580
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-10-22 21:01:11 +00:00
Austin Eng 7b3cc35cb6 D3D12/Vulkan: Insert storage buffer barriers between compute pass dipatches
This patch extends the BindGroupTracker in the D3D12 and Vulkan backends to
track bound storage buffers. We insert barriers between dispatches to properly
synchronize writes to storage buffers.

Bug: dawn:236
Change-Id: Iab3f964c345b64755557ab206e05a2ff7b0a3a1f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12301
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-10-22 17:28:20 +00:00
Corentin Wallez 2c8b5c6370 Introduce the webgpu[_cpp].h headers.
webgpu.h is the "official" header for WebGPU in native and is being
developed in https://github.com/webgpu-native/webgpu-headers

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

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

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

BUG=dawn:22

Change-Id: I12ee22d0b02ccb5b8a52ceccabb3e63ce74da007
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12480
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-21 20:04:10 +00:00
Rafael Cintron f0c036a3d2 Plug D3D 11on12 memory leak
11on12 has a bug where D3D12 resources used only for keyed
shared mutexes are not released until work is submitted to
the device context and flushed.

The most minimal work we can get away with is issuing a
TiledResourceBarrier.

ID3D11DeviceContext2 is available in Win8.1 and above.
This suffices for a D3D12 backend since both D3D12 and 11on12
first appeared in Windows 10.

Bug:dawn:217
Change-Id: I422eedf0de9c41777ab704f63520e2f2584f2afb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12520
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
2019-10-21 15:13:29 +00:00
Bryan Bernhart 8d00f5db8f Prevent kMaxHeapSize overflow on 32-bit debug builds.
Uses uint64_t instead of size_t in isPowerOfTwo checks.

BUG=dawn:27

Change-Id: If8bcdcd855d10fd2dc1f42fa18e3defab13a76b0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12500
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-21 09:23:09 +00:00
Jiawei Shao 5c2f5f3961 Implement serialization/deserialization of DawnDeviceProperties
This patch implements the serialization and deserialization of
DawnDeviceProperties in dawn_wire for the use of serializing this type
of object in Chromium.

BUG=chromium:996713
TEST=dawn_unittests

Change-Id: I1678627a017079540689d8529a1a7e1c975aae61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12240
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-10-20 03:01:56 +00:00
Bryan Bernhart f603903da7 Replace size_t with uint64_t in ringbuffer.
Adds overflow check in RingBufferAllocator + unit-test.
Also, update clients to use uint64_t to avoid casts or narrowing.

BUG=dawn:233

Change-Id: I652e3142407006d082491add600371f95d44741a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12380
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-10-18 16:19:00 +00:00
Yizhou Jiang 4794168ef8 Use toggle to turn off vsync on D3D12
Parameter syncInterval of function Preset specifies how to synchronize
presentation of a frame. To turn off vsync in D3D12 backend,
set syncInterval to 0 which represents the presentation occurs
immediately.

BUG=dawn:237

Change-Id: Ic17f00bae5af9fd6bca4130d6e2282f3c34de4e6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12303
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yizhou Jiang <yizhou.jiang@intel.com>
2019-10-18 01:45:28 +00:00
Rafael Cintron b2b2ef57a5 Add D3D12 keyed shared mutexes to Dawn
Dawn creates a keyed shared mutex for all wrapped resources and acquires
the mutex before the texture is used in an ExecuteCommandList call.

To coordinate with external clients, backend API has been extended
to allow clients to get and set the acquire key.

Pending and queue command lists have now been merged into one.

A future change will adjust GetPendingCommandContext to return a raw
command context without the need for error handling.

Bug:dawn:217
Change-Id: Ia96c449c305586407153f05ce75a40794b96027e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12220
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
2019-10-18 00:37:42 +00:00
Austin Eng 92a011a253 Record and dump trace events in the perf tests
Trace data can be used to build additional metrics which measure
validation costs, GPU time, etc. It will also be helpful to store in
the test output for later analysis.

This CL also adds jsoncpp as a DEP so we can dump trace file json
output.

Bug: dawn:208
Change-Id: Ia6c05ca90aecae308ee6a4fd11e5f43bb03b1dc9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12080
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-10-17 19:00:32 +00:00
Bryan Bernhart 154badfe2f Resource Management 8: placed resource sub-allocation.
- Adds d3d allocators (placed resource + heap).
- Support for heap tier 1 but only buffers.
- Suballocation optimization is enabled for allocations under 4MB.

BUG=dawn:27

Change-Id: I79177830670d1f322bbadf45f797415a3e9208d9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5680
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-10-17 17:25:28 +00:00
Austin Eng 31bde95857 perf_tests: Replace WaitForGPU with maxStepsInFlight argument
The current BufferUpload perf test calls WaitForGPU at the end of
every step to time how long the batch of uploads took. Future tests
will want to have multiple Steps or Frames in flight to mimic real
applications that use double or triple buffering. This patch removes
WaitForGPU and adds a |maxStepsInFlight| argument which a test can
set to configure how many steps can be running on the GPU.
For the BufferUpload tests, this is still 1.

Bug: dawn:208
Change-Id: I95ae12b2358e0283088205bd2ffd20532ea62871
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12302
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-17 00:15:07 +00:00
Austin Eng 7f426898ef Skip BufferUploadPerf 16MB SetSubData on all backends.
This test is flaky on all backends.

Bug: dawn:239, chromium:1014946
TBR=cwallez@chromium.org

Change-Id: I77dd261420c78d4b7f21a9e54b835ee3466df97d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12360
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-10-16 18:59:04 +00:00
Corentin Wallez e180b591d1 Fix compilation with shared_library components on Windows
An exported function of libdawn_native wasn't in libdawn_native_sources
instead of libdawn_native which made it not exported on Windows.

BUG=dawn:22

Change-Id: I824f1d4af18f8308b88e1650837cbe62374ace72
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12320
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-16 15:31:31 +00:00
Corentin Wallez fb7508435f Add missing header for MSVC
BUG=dawn:22

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

Bug: dawn:22
Change-Id: I4172f1654377afac8c4314123ee8b5b81dc7c928
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12300
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-16 10:26:01 +00:00
Natasha Lee f3d50baf85 D3D12 replace ASSERT_SUCCESS with better error handling
Added D3D12Error to check HRESULTS and return error messages
with the correct error names.

Remove ASSERT_SUCCESS from D3D12 backend and use
MaybeError and ResultError instead to handle errors.


Bug: dawn:19
Change-Id: Idf2f1987725e7e658bd29a9b13653125ab43c564
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12000
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-16 09:26:54 +00:00
Li, Hao c7d535bd72 Prioritize discrete GPU in end2end tests
- Prefer discrete GPU on multi-GPU systems, otherwise get
integrated GPU.
- Add a test to check adapter filter.

BUG=dawn:184

Change-Id: Ib1c3e81e20a15aeaf18746892324ce5144b7fda1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9320
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-10-16 09:24:55 +00:00
Stephen White fd90d767ba clang-win compile files for skia-dawn.
Do explicit uint8_t -> float conversions (as was previously done for TextureVk).
Add a missing #include.

Change-Id: If7616ec00e2ea2cf55b9b0cc966b0436a5a21d9d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12280
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2019-10-15 19:29:58 +00:00
Corentin Wallez c57b180208 Add dawnGetProcAddress.
This will become wgpuGetProcAddress that is part of the webgpu.h and the
last gap in functionality for dawn.h to match webgpu.h.

BUG=dawn:22

Change-Id: I0dcb3b5e6bd99cb10db273fc101d3ec0161b7da0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12120
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-15 12:08:48 +00:00
Corentin Wallez 96496828a0 Split the libdawn target in components with a single purpose.
The functionality of the dawn_headers and libdawn targets are split into
the following targets:

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

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

BUG=dawn:22

Change-Id: I5d941f0d98e5a4b633e14d67eb5269f7924f0647
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12160
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-10-15 11:44:38 +00:00
Yizhou Jiang 1093c4de2c Add a toggle to turn off vsync in Dawn
This commit add a toggle to turn off vsync in Dawn.
When turn off vsync, choose vulkan present mode VK_PRESENT_MODE_IMMEDIATE_KHR
if the mode is available on the system, but if the mode isn't supported,
choose default mode VK_PRESENT_MODE_FIFO_KHR.

BUG=dawn:237

Change-Id: If400262b67cc8051422745e3bed737431183c0b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12100
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yizhou Jiang <yizhou.jiang@intel.com>
2019-10-15 07:43:05 +00:00
Corentin Wallez 2e666bd5de Vulkan: Remove two ASSERT(false) with more detailed reading of Vk spec.
QueueWaitIdle can fail but if it fails, the error codes show that we
can't do anything about it so we just ignore the result.

BufferGetMemoryRequirements should always return memory types bits that
allow Dawn to select a good memory type of a resource.

BUG=dawn:19

Change-Id: I52beebf9f2be2bfb997ca9c1bf306618a73c9c4b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12183
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-15 07:29:55 +00:00
Li, Hao d59fec5d70 Skip LargeBufferFails test with NVIDIA for enabling Vulkan validation layers on Windows
Fails on NVIDIA cards when Vulkan validation layers are enabled becuase the maximum size of a single allocation cannot be larger than or equal to 4G on some platforms.

BUG=dawn:241

Change-Id: I863a2219287d3d363b3013027ba8fc9df846b42d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12141
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2019-10-15 01:42:45 +00:00
Jiawei Shao 91fbfc34e8 ASSERT object is not nullptr in DeviceBase::ValidateObject
This patch adds an ASSERT expression on the object parameter of
DeviceBase::ValidateObject() so that Dawn won't crash in the debug
build when a nullptr object is being used unexpectedly.

BUG=dawn:209

Change-Id: I52ad57b58eb59edf04afc9963e260436d93e673e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12140
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-10-15 00:17:35 +00:00
Corentin Wallez ba9e1ff86f Fix compilation in MSVC that was missing a <utility> include
BUG=

Change-Id: I3090fec89bb9dd39d28997cb58943643e8c7ed6f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12182
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-14 14:24:50 +00:00
Corentin Wallez b6acae6d35 Suppress BufferUploadPerf for setSubData of 16MB on Vulkan
TBR=enga@chromium.org
BUG=dawn:239

Change-Id: Ie6dda6df45326d57d7ea8f04670904afee25b51d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12161
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-14 12:38:10 +00:00
Corentin Wallez c44b2d4881 Vulkan: Properly handle errors for fences and commands
This commit makes the following changes:
 - Unused fences are reset when they will next be used so there is a
   single place where error handling is needed, either for resetting
   an existing fence, or for creating a new fence.
 - All accesses to VkCommandBuffer are moved to using the
   CommandRecordingContext and GetPendingCommandBuffer is removed.
 - Instead of tracking both a current (VkCommandBuffer + Pool) and
   a command recording context that contains the same VkCommandBuffer,
   the RecordingContext now holds the pool too, as well as a tag to
   know if it was ever queried (meaning it contains commands).
 - mRecordingContext is now always valid, such that
   GetRecordingContext() doesn't need to return an error.

BUG=dawn:19

Change-Id: I853d4ecdc6905b66e842688f39d863e362f59b66
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12022
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-11 12:12:07 +00:00
Corentin Wallez 76e1e41cc7 Vulkan: Proper error handling for submission.
BUG=dawn:19

Change-Id: I457a7d3f95a9f486b6d7dbf5fe1885758362d504
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12021
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-11 11:29:46 +00:00
Corentin Wallez 18a5d42898 Vulkan: Handle errors when creating VkRenderPass
BUG=dawn:19

Change-Id: I6007fb594a7c073b835554ca6914453a67608947
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11863
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-11 11:17:22 +00:00
Bryan Bernhart 3b05a6e031 BufferUploadPerf: Measure various buffer sizes.
Upload perf depends on buffer size. Try small and large buffers
to ensure allocation tuning is more accurate.

BUG=dawn:208

Change-Id: I1ee23454e86a31cf0a316946bc87550dad51e5c2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11961
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-10-10 18:14:28 +00:00
Rafael Cintron 8bde031abe Add CommandRecordingContext to D3D12
This change refactors D3D12 backend to have CommandRecordingContext
CommandRecordingContext allows us to, in a future, add additional
data to the context such as textures that need to be acquired and
released before command lists are executed.

The Device's pending command list and the command list which resides
in the Queue object were converted to use CommandRecordingContext.

Bug=dawn:234

Change-Id: Ic13a229fc1f15895ef71117ce638c942de224743
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11940
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-10-10 18:06:58 +00:00
Corentin Wallez d285525d4a Make the offset of SetIndexBuffer default to 0
BUG=dawn:22

Change-Id: Icc4f03c3f49b610ef5f620b4c26a6ae24ed6c774
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12040
Reviewed-by: François Beaufort <beaufort.francois@gmail.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-10 17:21:48 +00:00
François Beaufort bed0fdf7ad Allow Bind Group Layout Binding visibility to be None
According to https://github.com/gpuweb/gpuweb/issues/405, None is a
valid value for GPUBindGroupLayoutBinding visibility to be passed in.

Bug: dawn:22
Change-Id: I7b30b7ab8ed6824718573fa25fad5d509846db55
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11980
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
2019-10-10 09:08:29 +00:00
François Beaufort 91b2142ee4 Change setVertexBuffers to setVertexBuffer
Following WebGPU spec change at
https://github.com/gpuweb/gpuweb/pull/468, this CL changes all
occurrences of setVertexBuffers to setVertexBuffer.

Bug: dawn:22
Change-Id: I48b551a89dc0934dfa61e661e9546a2b7eafd2fc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12020
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-10-10 07:29:58 +00:00
Bryan Bernhart e16a901fb8 D3D12: Move resource into allocation handle.
Allows buffer/texture direct access to underlying resource rather than indirectly with a opaque memory type.

BUG=dawn:27

Change-Id: I2eb69f4e30c96c431dbc96094d671be1e0a29869
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11800
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-10-09 16:50:42 +00:00
Austin Eng e79b06100f Skip tests if no adapter is available
Bug: dawn:208
Change-Id: I076fd497101dd017e8d83ae034edb7b1fa1f8581
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11941
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-10-09 16:23:22 +00:00
Corentin Wallez 70c8c10571 Make the dynamicOffsets optional in SetBindGroup.
BUG=dawn:22

Change-Id: I9d032d9be16a483046edc6055b86e61ae08118e4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12023
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-09 16:08:42 +00:00
Corentin Wallez e09869ed52 Vulkan: Handle errors when wrapping external images
This also introduces another combinator to ConsumeError for
ResultOrError.

BUG=dawn:19

Change-Id: Ic204313436f5e919473d604efd049fe3d3c27a66
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11862
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-09 10:11:00 +00:00
François Beaufort c932f33093 Attribute offset needs to be multiple of 4 bytes
Metal requires offset to be 4 bytes aligned. This CL makes sure a
validation error is fired when offset is not a multiple of 4.

See https://developer.apple.com/documentation/metal/mtlvertexattributedescriptor/1515785-offset

Bug: dawn:22
Change-Id: I8be26fc1851e3aea7cfdbd5c92dfb4169fdaed5e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11902
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-10-09 06:12:10 +00:00
Corentin Wallez e986cb9254 Vulkan: Add proper error handling for all regular object creation.
This makes all the regular WebGPU object creation handle errors properly
in the Vulkan backend instead of ASSERTing no Vulkan error is raised.

Static Create functions are added to all these types so that the details
of how the initialization is done is private, and it isn't possible to
construct an object but forget to initialize it.

BUG=dawn:19

Change-Id: I362b2d66b74dd7799ffbf69d732bc58caa97950b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11861
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-08 08:16:11 +00:00
Bryan Bernhart bc8e7ea286 Fix MSVC build error due to implicit descriptor heap offset cast.
BUG=dawn:233

Change-Id: Ia42d7e99df910f245b7c78be16b7916c0730e8a9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11960
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-08 07:46:51 +00:00
Corentin Wallez b629c50a20 Guard macOS or iOS specific code in #if guards
This is necessary because @available(macOS 10.N, *) is taken on all iOS
versions but there is no way to say the branch is just not taken on any
iOS version. The proper way to deal with this is to add additional #if
guards to just not compile the code on iOS / macOS.

BUG=dawn:225

Change-Id: I76ec01f933364e9b47b5dda1198359f2ab4d1188
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11900
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-08 07:44:21 +00:00
Corentin Wallez a83e0cdbcc Remove stray push constant code.
There was still some logic associated with push constants in Dawn. This
removes it to remove some code and reclaim one buffer in Metal. Related
code was found via `git grep "push constant"`.

BUG=

Change-Id: I17de9d47872483875b6fa292f8259ef1fc4ecaf3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11904
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-08 07:37:02 +00:00
Corentin Wallez bd481fc199 Allow ResultOrError to downcast from backend to frontend types
More concretely this makes Result<T*, E*> able to be move-constructed
from Result<ChildClassOfT*, E*> for free.

BUG=dawn:19

Change-Id: Iea2b8997079ac3bfcf270d6b73a79cf5cac2c06f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11860
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-08 07:36:03 +00:00
Mathieu-Andre Chiasson 720988d878 Fixed compilation issue on clang 6.x
Bug:dawn:235
Change-Id: If96dbb9f70ee95a93fc1f14a9741903c3fd32b66
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11942
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-10-08 01:55:57 +00:00
Austin Eng 8eb8385e2e dawn_wire: Tag deserialize commands with volatile pointer
This prevents bugs where the compiler assumes a piece of memory
will be the same if read from twice.

Bug: dawn:230
Change-Id: Ib3358e56b6cf8f1fbf449c5d564ef85c969d695b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11840
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-10-07 20:38:47 +00:00
Rafael Cintron 86d921e048 Add MaybeError to d3d12::Device::ExecuteCommandList
Closing a command list can fail. We need to handle the error
gracefully instead of ignoring it.

As a fallout from adding MaybeError to ExecuteCommandList, need to
also add MaybeError to TickImpl, and OnBeforePresent.

Bug:dawn:19
Change-Id: I13685f3dd731f4ab49cbff4ce4edfa960d630464
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11841
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
2019-10-07 15:32:10 +00:00
Jinho Bang 0b82671047 Rename PipelineStageDescriptor to ProgrammableStageDescriptor
This is to match the WebGPU's WebIDL[1].

[1] https://github.com/gpuweb/gpuweb/pull/359

Bug: dawn:22
Change-Id: Id0cf0a7a6605ea7ec474d0f0885685ed21875dce
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11883
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-10-07 12:23:09 +00:00
Corentin Wallez 90a5595bbe dawn_wsi: Pass the Metal queue to the SwapChainImpl
If the swapchain creates its own queue, there can be races to determine
whether the submit of the present happens first. The didn't show up
in our samples but was an issue in real apps. Passing the queue to the
swapchain makes it simple to keep operations well ordered.

BUG=dawn:225

Change-Id: I9cc8e6e8140ad4a816373cffc9bda74ee826a41b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11640
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-07 08:18:09 +00:00
Bryan Bernhart 21dfc91954 Resource Management 7: Device memory sub-allocation using buddy allocator.
Uses a large buddy system to allocate binary sized heaps on-demand.

BUG=dawn:27

Change-Id: I72e425c23e601da6ee53827423bef7ff13be049c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10880
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-10-03 18:17:31 +00:00
François Beaufort 277d2e15d5 Add missing optional label member to descriptors
This CL adds missing optional label members to all descriptors. It is
not used yet but needed from the WebGPU side.

Bug: dawn:22
Change-Id: I103870f9207eed8168bc2245294888af4e1edd9f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11720
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-03 14:56:49 +00:00
Austin Eng 3fd022ef60 Validate injected errors are not NoError
HandleError assumes that the error is not NoError. InjectError is
an untrusted wire command and needs to validate that NoError is not
passed.

Bug: chromium:1010703, chromium:1004368
Change-Id: Id48a877ded327a6e3a54fedb2be2c54eeca5cd3c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11780
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-10-03 14:40:09 +00:00
Bryan Bernhart 0da52f2d92 D3D12: Move resource allocators from device into manager.
Encapsulates resource allocation using a manager class.

BUG=dawn:27

Change-Id: I7a496261dcede647d32e44d96ed27237bf418fb2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11742
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-10-02 21:45:09 +00:00
Austin Eng 867f72058a Add missing "strlen" parameter for Device InjectError command.
This CL adds a StringMessageMatcher to the wire unittests harness
to validate that messages are not degenerate.

Bug: chromium:1004368
Change-Id: I121a259e67938b06ccc5e9829abfa3e25fffc003
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11740
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-10-02 06:35:38 +00:00
Austin Eng dc9f1e6806 Add validation tests for WebGPU bind group "persistence"
A draw should be valid if the currently set bind groups match the
current pipeline layout, irrespective of changes in pipeline layout.
This is different from the descriptor set inheritance in Vulkan which
Dawn used to follow.

Bug: dawn:201
Change-Id: I1181ba80614ae40d665094f4ea742804565f6ed3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11641
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-10-02 06:27:58 +00:00
Jiawei Shao deb28ea45d D3D12: Implement ASSERT_SUCCESS as macro instead of function
This patch implements ASSERT_SUCCESS(hr) as a macro instead of a
function so that when hr fails Dawn can print out the line number of the
expression that causes the failure.

For example, previously we will always get the following error message
because ASSERT_SUCCESS is a function:
Assertion failure at ../../src/dawn_native/d3d12/DeviceD3D12.cpp:43
(ASSERT_SUCCESS): (((HRESULT)(hr)) >= 0)

Now we can get more details about where the failure occurs because now
ASSERT_SUCCESS is a macro:
Assertion failure at ../../src/dawn_native/d3d12/DeviceD3D12.cpp:59
(Initialize): (((HRESULT)(mD3d12Device->CreateCommandQueue(&queueDesc,
__uuidof(**(&mFence)), IID_PPV_ARGS_Helper(&mFence)))) >= 0)

BUG=dawn:178

Change-Id: I435ee2f418658bca276f439fcabfabbfecbff998
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11700
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-01 02:30:32 +00:00
Bryan Bernhart e6b93e8706 D3D12: Use ringbuffer allocator for descriptor heaps.
Enable descriptor heap re-use by using ringbuffer.

BUG=dawn:155

Change-Id: I72e3fb98a64dc1af671e185e2114868a577a0554
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9460
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-10-01 02:19:02 +00:00
Austin Eng e06f01be71 dawn_wire: Forward client-generated errors to the server
This fixes a problem where client-generated errors weren't properly
captured in error scopes.

Bug: chromium:1004368
Change-Id: Ic0f6e5bc5e281c676ea7154dd217cfc8dd51be5c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11642
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-09-30 22:50:59 +00:00
Jiawei Shao 55a00c7a1f Set writemask to 0 when no fs output matches color state on Metal and Vulkan
This patch fixes an undefined behaviour on Metal and Vulkan when there
is a color state whose corresponding fragment output is not declared in
the fragment shader.

According to Vulkan SPEC (Chapter 14.3), the input values to blending or
color attachment writes are undefined for components which do not
correspond to a fragment shader output. Vulkan validation layer follows
the SPEC that it only allows the shader to not produce a matching output
if the writemask is 0, or it will report a warning when the application
is against this rule.

When no fragment output matches the color state in a render pipeline,
the output differs on different Metal devices. On some Metal devices the
fragment output will be (0, 0, 0, 0) even if it is not declared in the
shader, while on others there will be no fragment outputs and the content
in the color attachments is not changed.

This patch fixes this issue by setting the color write mask to 0 to
prevent the undefined values being written into the color attachments.

With this patch, the following end2end tests will not report warnings
any more when we enable the Vulkan validation layer:
ObjectCachingTest.RenderPipelineDeduplicationOnLayout/Vulkan
ObjectCachingTest.RenderPipelineDeduplicationOnVertexModule/Vulkan
ObjectCachingTest.RenderPipelineDeduplicationOnFragmentModule/Vulkan

BUG=dawn:209
TEST=dawn_end2end_tests

Change-Id: I5613daa1b9a45349ea1459fbdfe4a12d6149f0f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11581
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-09-30 07:27:57 +00:00
Bryan Bernhart 52bd6b7da6 Move kInvalidOffset to RingBufferAllocator namespace.
BUG=dawn:27

Change-Id: I1c580d8e41c4f9bb10b638297b4c3a3fa61a0d93
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11680
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-27 21:26:13 +00:00
Bryan Bernhart 86ac0b93c9 Rename INVALID_OFFSET to kInvalidOffset.
BUG=dawn:27

Change-Id: Ida590a2b3cf3da17bbedf6ef61d72eaaa443bc4b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11561
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-09-27 15:11:52 +00:00
Jiawei Shao 64f4dd7127 Add check between color state format and fragment shader output
This patch adds the validation on the compatibility between the format
of the color states and the fragment shader output when we create a
render pipeline state object as is required in Vulkan (Vulkan SPEC
Chapter 14.3 "Fragment Output Interface"):
"if the type of the values written by the fragment shader do not match
the format of the corresponding color attachment, the resulting values
are undefined for those components".

BUG=dawn:202
TEST=dawn_unittests

Change-Id: I3a72baa11999bd07c69050c42b094720ef4708b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11461
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-09-26 00:12:41 +00:00
Mathieu-Andre Chiasson 09cc2b92c7 Fixed compilation issues when using libstdc++
Bug:dawn:229
Change-Id: I18ce6330bc4597db4f2c4548698b38ab2c826203
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11620
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-25 19:32:01 +00:00
Natasha Lee cf0e9d93f1 Add StoreOp::Clear
When storeOp is clear, texture subresource is set as not initialized

Bug: dawn:145
Change-Id: I364d7239a7ebdb9d5a28a4af559f3212be7ef15a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11560
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-25 13:08:28 +00:00
Jiawei Shao 05be0ff348 Validate fragment output location doesn't exceed kMaxColorAttachments
This patch adds the validation on the fragment shader output location to
ensure it will never exceed kMaxColorAttachments.

BUG=dawn:202
TEST=dawn_unittests

Change-Id: I4ac4463fd3dfb3c2e9ffecb370f9d9d59393c26d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11580
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-25 01:21:28 +00:00
François Beaufort c3b613296d Rename GPUBindGroupLayoutBinding dynamic to hasDynamicOffset
Following WebGPU change at  https://github.com/gpuweb/gpuweb/pull/427,
this CL renames GPUBindGroupLayoutBinding dynamic to hasDynamicOffset.

Bug: dawn:22
Change-Id: Ie1c2bf4b1f6764c83be7cfe04f4f1a1d2205f685
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11500
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-09-24 11:08:17 +00:00
Bryan Bernhart 41f8aa550b Return Dawn result upon submit.
Missing OOM error should submit fail to create a descriptor heap.

BUG=dawn:177

Change-Id: I6ccc10f3e0b8de0bd21caa9aca35f4f269ce51e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11540
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-09-23 21:21:10 +00:00
Corentin Wallez c81a717379 Remove indirection for colorStates
This is to match the work in progress webgpu.h header.

BUG=dawn:22

Change-Id: Ia1077fef95e6bda541cddbd2f6ce40b79138e960
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9383
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-09-20 23:22:27 +00:00
Corentin Wallez b8dbada76d Make ComboRenderPipelineDescriptor non copyable.
This causes subtle bugs in tests when pointers in combo render pipeline
descriptors point at other combo render pipeline descriptors.

BUG=dawn:22

Change-Id: I5234df26895986fd1d7a9b4e835598177581803a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11340
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-09-20 23:15:47 +00:00
Yunchao He 394553b02e Set y-axis up in normalized coordinate system.
BUG=dawn:224

Change-Id: I6bb4946e87b593f1d62a13b3b8ab38f21d3e9ffb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10201
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-09-20 23:04:47 +00:00
Corentin Wallez a838c7d497 Remove indirection for colorAttachments
This is to match the work in progress webgpu.h header.

BUG=dawn:22

Change-Id: I1371cda1b7666de8eb8283fa7e5da935d17e1d52
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9381
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-20 22:59:47 +00:00
Brian Sheedy 0c4d75931a Disable BufferSetSubData.ManySetSubData on Metal
Disables ManySetSubData on Intel/Metal configurations, as it has started
failing on Mac 10.14.6.

Bug: dawn:228
Change-Id: Ia7d27a698deb9abc08cc04660903e5c6c93bbf50
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11460
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-09-20 22:16:03 +00:00
Corentin Wallez 38b295de38 Fix availability check for MTLCopyAllDevices
This caused failure on macOS 10.11 because Dawn decided Metal is
supported but would go ahead and reach an UNREACHABLE() block.

BUG=chromium:1006181

Change-Id: I20739a058adaa60a71ec489e07b36ebf48ef871a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11420
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-20 17:40:53 +00:00
Corentin Wallez a9a84dfe1e BUILD.gn: Delete stale generated files in Dawn's gen dir.
This normalizes even more the directory structure of generated files in
Dawn and removes stale autogenerated files that could be included
wrongly using a GN action.

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

BUG=dawn:22

Change-Id: I8ec038f949c048431b2b643af4462f98c4ae610b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11361
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-19 23:30:42 +00:00
Bryan Bernhart bdd88a7dc1 Check if allocation is valid before deallocating.
Ensure deallocate does not assert should allocation fail but still be used.

BUG=dawn:227

Change-Id: I5edd4c160bced7934970c5d59e541a3a8f7a8afb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11380
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-09-19 20:40:12 +00:00
Ryan Harrison ae4dbeb178 Roll ahead shaderc API and update API usage as needed
Roll third_party/shaderc/ 4baa46a5d..68b6857ac (2 commits)

4baa46a5d1..68b6857ac0

$ git log 4baa46a5d..68b6857ac --date=short --no-merges --format='%ad %ae %s'
2019-09-18 rharrison Code hygiene work for spvc (#808)
2019-09-10 stevenperron Have update_build_version.py new parameter (#805)

Change-Id: I06e0f62a1443741e8ac09a84ff63ddd100f6a656
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11341
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-09-19 14:20:46 +00:00
Bryan Bernhart 450e212cf5 Remove device dependencies from ringbuffer.
Allows ringbuffer sub-allocator to be used for non-staging memory.

BUG=dawn:155

Change-Id: Id0021907f520909aaebaf79e992124a47797d38d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9760
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2019-09-18 22:06:41 +00:00
Austin Eng b11bd2dfe5 Fix leak of ErrorData after Device::ConsumedError
The code to delete this ErrorData* was lost in the error scope
refactor.

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

BUG=dawn:225

Change-Id: I5b3e04d37a16251143578dfb7a31445b229fe4ac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11300
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-18 04:33:12 +00:00
Corentin Wallez b495e48405 Support compilation of Dawn on iOS.
BUG=dawn:225

Change-Id: I618552c55c8472adc25625733b59d972d7297f57
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11040
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-18 04:32:52 +00:00
Corentin Wallez 5e9082daa4 Add some missing headers in BUILD.gn files.
BUG=dawn:225

Change-Id: Ie1ebe62caea48353b6b3579c9405b5cc700fba66
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11302
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-17 21:36:15 +00:00
Corentin Wallez f7c263624b Add missing include in the Vulkan backend.
BUG=dawn:225

Change-Id: I8dc0c5c884d8130b98a849e0d675e29d80aa4de8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11303
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-17 21:28:45 +00:00
Austin Eng 519b16c4b0 Add README.md for the Dawn perf test harness
Bug: dawn:208
Change-Id: Ic9b4c83ab3c27851d149adb5986f3a5556d0548a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11283
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-09-17 21:02:38 +00:00
Austin Eng 7f3f331ce6 Support setting bind groups before pipeline for all backends
This is to match WebGPU semantics.

Bug: dawn:201
Change-Id: I2aab671fc389edf1d2765395814a9c831afc653e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11080
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-09-17 19:25:27 +00:00
Natasha Lee 617e356580 OpenGL: clear nonrenderable texture formats
Clears nonrenderable color formats and merges zero vs nonzero clears
to use the same code path.

Bug: dawn:145
Change-Id: I8f2f36134b56787e07231d82e37c36897ba1d4ba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10820
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-09-17 18:54:47 +00:00
Austin Eng be990077f4 Support ErrorScopes for asynchronous GPU execution
This changes updates ErrorScopes so that scopes enclosing a
Queue::Submit or Queue::Signal resolve their callbacks asynchronously
after GPU execution is complete.

Bug: dawn:153
Change-Id: I0e0b8a9f19f3f29d1b6a3683938154b87f190a07
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10701
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-09-17 18:24:07 +00:00
Yunchao He bb3c895619 Fix a typo in viewport validation test
BUG=dawn:53

Change-Id: I793373fa6e1fb167d5a8fe0a064c57ddf2ceedba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11281
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-09-17 18:01:09 +00:00
Hao Li 2383fd4fbf Revert "Skip some end2end tests for Vulkan validation layers enable on Windows"
This reverts commit 4cc1891039.

Reason for revert: dawn:210 has been fixed, we can add these tests back.

Original change's description:
> Skip some end2end tests for Vulkan validation layers enable on Windows
> 
> Temporarily skip some tests to make Vulkan validation layers could be
> enabled on Windows, these tests are failing on Vulkan with validation
> layers enabled.
> 
> BUG=dawn:210
> 
> Change-Id: I03a6ab6aca94f7c7044cc27cc1ff5d79ad1f88d2
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11141
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>

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

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

Bug: dawn:210
Change-Id: I4f86369aa0dbfe366b0597cc844af4e74d687eea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11280
Reviewed-by: Hao Li <hao.x.li@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2019-09-17 02:36:22 +00:00
Natasha Lee 01600dfb3d Use clear loadop to lazy clear depth stencil attachments
Bug: dawn:210, dawn:145
Change-Id: I1eb990266ccd7b51b4a336b0d4d37e0195c6fe69
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11020
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-09-11 22:04:42 +00:00
Li, Hao 2a2392073b Set point size value for vertex shader in OptionalVertexInputTest
When pipeline topology is set to Point_List, PointSize must be written
in vertex shader for Vulkan backend.

BUG=dawn:146

Change-Id: I0ea6aa937866d1985287d353f82d344100b41acd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11140
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2019-09-11 15:59:16 +00:00
Li, Hao 4cc1891039 Skip some end2end tests for Vulkan validation layers enable on Windows
Temporarily skip some tests to make Vulkan validation layers could be
enabled on Windows, these tests are failing on Vulkan with validation
layers enabled.

BUG=dawn:210

Change-Id: I03a6ab6aca94f7c7044cc27cc1ff5d79ad1f88d2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11141
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-09-11 15:08:16 +00:00
Rafael Cintron 03e31edd98 Cleanup d3d12::Device::ExecuteCommandLists
- All callers were passing either 0 or 1 commandlist to this
function. Removing the initializer list means we can save an
std::vector heap allocation.
- Checking the number of lists before calling ExecuteCommandLists
eliminates superfluous entries in PIX logs.

Bug:dawn:222
Change-Id: Ic50b9293c3f31bf8f52e7de10161fd284ef2e0f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11060
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
2019-09-11 00:09:40 +00:00
Austin Eng f35dcfe60a Implement ErrorScopes for synchronous errors
This patch implements Push/PopErrorScope except for asynchronous
or GPU commands. These commands, such as Queue::Submit will need
to hold onto the ErrorScope until GPU execution is complete.

Bug: dawn:153
Change-Id: I2d340b8b391d117a59497f35690993a9cd7503e6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10700
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-09-10 23:19:11 +00:00