Commit Graph

2038 Commits

Author SHA1 Message Date
Austin Eng b75075ac7b Protect against huge buffer allocations on macOS 10.12, 10.13
|MTLDevice maxBufferLength| is not available until 10.14, so on
lower versions of macOS, try using |recommendedMaxWorkingSetSize|

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

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

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

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

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

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

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

Bug: dawn:442
Change-Id: I5a0271bb187682616eb5ef3a13bb7f6271203453
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-18 09:00:48 +00:00
Ryan Harrison a84ab48150 Add support for different default branches in roll-shader-deps
tint has moved to using origin/main, and shaderc is soon to migrate

Change-Id: I578e4df91330351e10513874b2ca2728e4227803
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23320
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-06-17 23:52:19 +00:00
Austin Eng 7a4685f448 Add TypedInteger
This CL adds a TypedInteger helper which provides additional type
safety in Dawn. It is a compile-time restriction that prevents integers
of different types from being used interchangably in Debug builds.

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

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

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

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

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

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

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

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

Created with:
  roll-dep third_party/tint

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

Rename AssertAndIgnoreDeviceLossError to IgnoreErrors

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

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

Bug: dawn:444

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

BUG=dawn:453
TEST=dawn_end2end_tests

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Bug: dawn:22

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

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

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

Bug: dawn:450, dawn:398, chromium:1014740
Change-Id: Ieb34c04c3d01c429b7e3b7810729d5e91ecb6270
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22626
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-15 23:42:13 +00:00
Ryan Harrison c3c2c9b6b0 Rolling 3 dependencies
Roll third_party/SPIRV-Tools/ 30bf46dbe..52a5f074e (1 commit)

30bf46dbe0..52a5f074e9

$ git log 30bf46dbe..52a5f074e --date=short --no-merges --format='%ad %ae %s'
2020-06-15 dj2 Update access control lists. (#3433)

Roll third_party/glslang/ ebf55a071..00965b9fa (3 commits)

ebf55a0711..00965b9fa9

$ git log ebf55a071..00965b9fa --date=short --no-merges --format='%ad %ae %s'
2020-06-15 dj2 Remove unused variable. (#2273)
2020-06-15 rharrison Remove unused function, BaseTypeName (#2272)
2020-06-15 cepheus HLSL: Remove support for having GLSL versions of HLSL intrinsics.

Roll third_party/tint/ 0647d2360..be45ff508 (52 commits)

https://dawn.googlesource.com/tint/+log/0647d2360701..be45ff508124

$ git log 0647d2360..be45ff508 --date=short --no-merges --format='%ad %ae %s'
2020-06-11 rharrison Create tint.h for external users
2020-06-11 dneto [spirv-reader] Simplify if-selection bookkeeping
2020-06-11 dneto [spirv-reader] remove exclusive_false_head_for
2020-06-10 rharrison Fix BUILD.gn based builds
2020-06-09 dneto [spirv-reader] Avoid emitting empty elses
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
2020-06-01 dsinclair Fix merge conflict
2020-06-01 dsinclair [spirv-writer] Add fallthrough support
2020-06-01 dsinclair [spirv-writer] Add switch support
2020-06-01 dneto [spirv-reader] use stack of statement lists
2020-06-01 dneto [spirv-reader] Add problematic CFG case as disabled test
2020-06-01 dsinclair Add case_selectors update
2020-06-01 dsinclair [spirv-writer] Generate kill statements.
2020-06-01 dsinclair Updating to match WGSL spec.
2020-06-01 dsinclair Update intrinsics in the grammar.
2020-06-01 dsinclair Update WGSL grammar builtins to match spec.

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

Change-Id: Ib0bced03a45c9204aa644bc721bb54e7d427421f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23222
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-06-15 19:00:52 +00:00
Idan Raiter 4f8a6d688a Rolling 5 dependencies
Roll third_party/SPIRV-Tools/ 7c213720b..30bf46dbe (5 commits)

7c213720bb..30bf46dbe0

$ git log 7c213720b..30bf46dbe --date=short --no-merges --format='%ad %ae %s'
2020-06-13 vasniktel Fix operand access (#3427)
2020-06-12 jaebaek Debug info preservation in ccp pass (#3420)
2020-06-10 dneto Fix round trip tests that weren't instantiated (#3417)
2020-06-10 vasniktel spirv-fuzz: Add a test (#3238)
2020-06-10 vasniktel spirv-fuzz: Add support for OpSpecConstant* (#3373)

Roll third_party/glslang/ 08328fea5..ebf55a071 (5 commits)

08328fea5a..ebf55a0711

$ git log 08328fea5..ebf55a071 --date=short --no-merges --format='%ad %ae %s'
2020-06-15 rdb HLSL: Fix incorrect case in name of DX9-style cube sampler type (#2265)
2020-06-11 bclayton Fix signed / unsigned mismatch warning (#2266)
2020-06-10 cepheus Bump code gen version, due to removal of OpEntryPoint operands.
2020-06-10 cepheus Fix #2264: OpEntryPoint incorrectly including function parameters.
2020-06-09 rharrison Use correct type for var storing returned value (#2263)

Roll third_party/shaderc/ d8eca133b..c2ac70797 (6 commits)

d8eca133b4..c2ac70797a

$ git log d8eca133b..c2ac70797 --date=short --no-merges --format='%ad %ae %s'
2020-06-15 31453424+iraiter2 Add minimum buffer size for dawn reflection (#1084)
2020-06-10 dneto Update for Glslang generator version number 9 (#1083)
2020-06-10 rharrison Rolling 5 dependencies and update expectations (#1081)
2020-06-10 rharrison Remove infrastructure for and references to VS2013 (#1082)
2020-06-09 rharrison Start shaderc v2020.2
2020-06-09 rharrison Finalize shaderc v2020.1

Roll third_party/spirv-cross/ 92fcd7d2b..9e3df69d4 (1 commit)

92fcd7d2b0..9e3df69d4e

$ git log 92fcd7d2b..9e3df69d4 --date=short --no-merges --format='%ad %ae %s'
2020-06-12 git GLSL: Require GL_ARB_draw_instanced for gl_InstanceID in GLSL < 1.40

Roll third_party/tint/ 3f3483be1..0647d2360 (0 commit)

https://dawn.googlesource.com/tint/+log/3f3483be14b1..0647d2360701

$ git log 3f3483be1..0647d2360 --date=short --no-merges --format='%ad %ae %s'

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: I8e689c57e5f0adc403d536c4da7308b6793414fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23240
Commit-Queue: Idan Raiter <idanr@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-06-15 18:41:22 +00:00
Yunchao He e5be22e949 D3D12: use one barrier to transit states for all subresources
If a texture's old states of all subresources are the same, and its
new states are the same too, then we can use one barrier to transit
states for all subresources. We don't need to use one barrier per
each subresource.

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

Bug: dawn:441

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

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

Bug: dawn:157

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

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

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

Bug: dawn:22

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

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

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

Bug:dawn:22

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

BUG=dawn:414
TEST=dawn_end2end_tests

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

BUG=dawn:414
TEST=dawn_end2end_tests

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

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

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

Bug: dawn:441

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

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

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

Bug: dawn:457

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

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

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

Bug: dawn:157

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

BUG=dawn:27

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

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

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

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

Bug: dawn:444
Change-Id: I3e5ca325b19eb8b6cfe53e4d833c5acbbd293a26
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22880
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-06-11 17:12:35 +00:00
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