Commit Graph

2164 Commits

Author SHA1 Message Date
Yunchao He ee7debf44d Refactor subresource related variables to a struct - backend
This patch put subresource related variables like baseMipLevel,
levelCount, baseArrayLayer, layerCount into a single struct at
backends.

Bug: dawn:157

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

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

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

Bug: dawn:22

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

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

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

Bug:dawn:22

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

BUG=dawn:414
TEST=dawn_end2end_tests

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

BUG=dawn:414
TEST=dawn_end2end_tests

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

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

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

Bug: dawn:441

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

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

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

Bug: dawn:457

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

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

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

Bug: dawn:157

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

BUG=dawn:27

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

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

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

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

Bug: dawn:444
Change-Id: I3e5ca325b19eb8b6cfe53e4d833c5acbbd293a26
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22880
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-11 17:12:35 +00:00
Ryan Harrison 4cef4b89ff Roll third_party/tint/ af5df70c7..3f3483be1 (2 commits)
https://dawn.googlesource.com/tint/+log/af5df70c7bd0..3f3483be14b1

$ git log af5df70c7..3f3483be1 --date=short --no-merges --format='%ad %ae %s'
2020-06-10 rharrison Fix BUILD.gn based builds
2020-06-09 dneto [spirv-reader] Avoid emitting empty elses

Created with:
  roll-dep third_party/tint

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

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

Bug: dawn:457

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

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

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

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

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

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

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

BUG=dawn:414
TEST=dawn_end2end_tests

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

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

BUG=dawn:453
TEST=dawn_end2end_tests

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

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

BUG=dawn:426
TEST=dawn_end2end_tests

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

BUG=dawn:414
TEST=dawn_end2end_tests

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

BUG=dawn:456

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

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

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

Bug: dawn:157

Change-Id: I783a76cb88fcdffb60c307ddfb89d50f1583201a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22101
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2020-06-09 16:18:04 +00:00
Ryan Harrison c8000bb02b Rolling 5 dependencies
Roll third_party/SPIRV-Tools/ f050cca7e..7c213720b (6 commits)

f050cca7ec..7c213720bb

$ git log f050cca7e..7c213720b --date=short --no-merges --format='%ad %ae %s'
2020-06-05 vasniktel spirv-fuzz: Fix replayer bug (#3401)
2020-06-05 andreperezmaselco.developer Add value instruction condition (#3385)
2020-06-05 andreperezmaselco.developer Fix instruction function use (#3390)
2020-06-05 vasniktel spirv-fuzz: Fix regression (#3396)
2020-06-04 paulthomson Fix googletest inclusion (#3398)
2020-06-02 jaebaek Add tests for merge-return debug info preservation (#3389)

Roll third_party/glslang/ d39b8afc4..08328fea5 (10 commits)

d39b8afc47..08328fea5a

$ git log d39b8afc4..08328fea5 --date=short --no-merges --format='%ad %ae %s'
2020-06-09 lryer Fix xfb stride limit issue (#2088)
2020-06-04 laddoc Add Shared/Std140 SSBO process & top-level array elements related (#2231)
2020-06-04 apinheiro spirv: Support initializers on uniforms (#1588)
2020-06-03 47594367+rg3igalia Add SPIR-V capabilities needed for spec constants (#2199)
2020-06-02 rdb HLSL: Add better diagnostic when using in/out qualifiers in global scope (#2258)
2020-06-02 rdb HLSL: Recognize POSITION semantic et al in DX9 compatibility mode (#2255)
2020-06-02 rdb HLSL: fix handling of uniform qualifier in entry point parameters (#2254)
2020-06-01 40001162+alelenv Add default descriptorset decoration for acceleration structure (#2257)
2020-06-01 cepheus Update news for header location change and recommendation.
2020-06-02 dj2 Remove install to the SPIRV/ folder. (#2256)

Roll third_party/shaderc/ da87b8d8b..d8eca133b (1 commit)

da87b8d8b0..d8eca133b4

$ git log da87b8d8b..d8eca133b --date=short --no-merges --format='%ad %ae %s'
2020-06-01 rharrison Rolling 5 dependencies (#1078)

Roll third_party/spirv-cross/ d385bf096..92fcd7d2b (7 commits)

d385bf096f..92fcd7d2b0

$ git log d385bf096..92fcd7d2b --date=short --no-merges --format='%ad %ae %s'
2020-06-08 post GLSL: Handle the rest of GL_ARB_sparse_texture_clamp.
2020-06-08 post GLSL: Support uint code for sparse residency query.
2020-06-05 post Refactor texture fetch function generation.
2020-06-06 AlexanderMeissner Fix missing switch cases in Y'CbCr conversion
2020-06-04 post GLSL: Implement sparse feedback.
2020-06-04 post MSL: Remove obsolete MSLVertexAttr members.
2020-06-04 post HLSL: Add native support for 16-bit types.

Roll third_party/tint/ e2be48975..af5df70c7 (37 commits)

https://dawn.googlesource.com/tint/+log/e2be4897566d..af5df70c7bd0

$ git log e2be48975..af5df70c7 --date=short --no-merges --format='%ad %ae %s'
2020-06-08 dj2 Add GLSL FindILsb, FindUMsb, FindSMsb and InterpolateAtCentroid.
2020-06-08 dj2 Add support for GLSL cross.
2020-06-08 dj2 Add GLSL umin, umax, smin and smax support.
2020-06-08 dj2 Add ssign and sabs GLSL support.
2020-06-08 dj2 Refactor GLSL type determination code.
2020-06-08 dneto [spirv-reader] Emit non-header OpBranchConditional
2020-06-08 dneto [spirv-reader] Add cases for mergeless OpSwitch
2020-06-08 dneto [spirv-reader] Fix typo in test name
2020-06-08 dneto [spirv-reader] Check some merge block dominance
2020-06-08 dneto [spirv-reader] Add mergeless OpSwitch case
2020-06-08 dneto [spirv-reader] kIfBreak edge counts toward divergence
2020-06-04 dj2 [spirv-writer] Cleanup capabilities code.
2020-06-04 dj2 [spirv-writer] Add support for outer_product
2020-06-04 dj2 [spirv-writer] Add support for derivatives.
2020-06-04 dj2 [spirv-writer] Add support for dot call.
2020-06-04 dj2 [spirv-writer] Add support for is_inf
2020-06-04 dj2 [spirv-writer] Add is_nan support.
2020-06-04 dj2 [spirv-writer] Add support for all intrinsic.
2020-06-04 dj2 [spirv-writer] Generate any intrinsic
2020-06-04 dneto [spirv-reader] Refactor emission for OpBranch
2020-06-04 dneto [spirv-reader] Update test to show error caught
2020-06-04 dneto [spirv-reader] Update test to show error is caught
2020-06-03 rharrison Fix nit in PRESUBMIT.py
2020-06-03 dsinclair Remove right shift arithmetic operand.
2020-06-03 dsinclair Remove unless_stmt
2020-06-03 dsinclair Remove conditional break/continue.
2020-06-03 dneto [spirv-reader]: Support OpBranch
2020-06-03 rharrison Adding PRESUBMIT.py with a bunch of checks turned on
2020-06-02 dj2 Make case selectors an integer value
2020-06-02 dj2 Add IntLiteral parent for Sint and Uint literals.
2020-06-02 dj2 Rename the IntLiteral to SintLiteral.
2020-06-02 dneto [spirv-reader] Support unreachable, as a return
2020-06-02 dneto [spirv-reader] Support kill
2020-06-02 dj2 Rename case statement conditions to selectors.
2020-06-02 dneto [spirv-reader] Support return, return-value
2020-06-02 dneto [spirv-reader] Emit loop and continuing
2020-06-02 dneto [spirv-reader] Emit control flow: if/then/else

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

Change-Id: Ida82702401ba6fd4a53b98b3b51bee55ba9dd54b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22920
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-06-09 15:33:14 +00:00
Idan Raiter e5b40629ec Reset bind group aspect in SetBindGroup
Change-Id: Ic123578764266a913a3a9a814d5b6c01f47d4ff9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22860
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
2020-06-09 15:14:14 +00:00
Corentin Wallez 83faf15d21 infra: Migrate builders to Goma RBE
Bug: 950413
Change-Id: I95ff4bc6380eb2af210a8c264411d6064a9a8b32
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22900
Reviewed-by: Simon Que <sque@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-09 12:34:02 +00:00
Yunchao He 0a79bee135 Vulkan: Combine all pass barriers in a single call
This patch combines barriers in a render/compute pass into one
function call.

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

Bug: dawn:441

Change-Id: Ibe44967fefd2e1e6e64df4587146c4fb7fbe8e73
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22700
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-06-08 22:27:18 +00:00
Corentin Wallez f5657af110 Fix use of bytesPerRows=0 in CppHelloTriangle
The defaulting when bytesPerRow is 0 has been removed so there was a
validation error.

Bug: dawn:432
Bug: dawn:455
Change-Id: I8e38eb7aeb315d93cc8a9528beb77b9285b368d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22800
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-08 16:13:41 +00:00
Xinghua Cao db8f804bc3 Reland "Check FP16 support on vulkan backend"
This reverts commit 0357eed7de
and reland commit bdc05c3d5f.

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

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

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

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

BUG=dawn:453
TEST=dawn_unittests
TEST=dawn_end2end_tests

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

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

BUG=dawn:267
TEST=dawn_end2end_tests

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

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

BUG=dawn:267
TEST=dawn_end2end_tests

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

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

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

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

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

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

Tbr=cwallez@chromium.org
Bug: chromium:1064305
Change-Id: I7d894dba701ebe2fe0e1b78d5fb42032d88846aa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22522
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-02 18:54:20 +00:00