Commit Graph

1626 Commits

Author SHA1 Message Date
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 5dc07d1b1b Rolling 2 dependencies
Roll third_party/SPIRV-Tools/ 18b3b9456..f8d7df760 (2 commits)

18b3b94567..f8d7df760c

$ git log 18b3b9456..f8d7df760 --date=short --no-merges --format='%ad %ae %s'
2020-01-14 jaebaek Fix OpLine bug of merge-blocks pass (#3130)
2020-01-13 afdx spirv-fuzz: add dead blocks (#3135)

Roll third_party/shaderc/ dc2172c08..df0e683b5 (4 commits)

dc2172c083..df0e683b58

$ git log dc2172c08..df0e683b5 --date=short --no-merges --format='%ad %ae %s'
2020-01-15 rharrison Fix incorrect casing on flags in docs (#957)
2020-01-14 rharrison Convert get_shader_resources to return ptr instead of ref (#955)
2020-01-14 rharrison Convert spvc messages internal struct to be a vector (#952)
2020-01-13 rharrison Rolling 5 dependencies (#953)

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

Change-Id: Ib97af2147dd6c17f9e71ff1c3cf8200e4b353fdc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15160
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-01-15 16:18:32 +00:00
Corentin Wallez 1bf3167ce6 Add a proper license to webgpu.h's template.
This avoids linter checks to trigger when importing updates of Dawn into
Google3.

Bug:
Change-Id: Ib038d8937cc6c294823b56d52b6f2c5e5e24ffac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15140
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-01-15 15:39:12 +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
Ryan Harrison e5cb8f2eff Rolling 3 dependencies
Roll third_party/SPIRV-Tools/ fb2e81981..18b3b9456 (1 commit)

fb2e819819..18b3b94567

$ git log fb2e81981..18b3b9456 --date=short --no-merges --format='%ad %ae %s'
2020-01-10 33791085+aqnuep Remove names and decorations of imported symbols (#3081)

Roll third_party/glslang/ 518136706..d203754bc (1 commit)

5181367062..d203754bc1

$ git log 518136706..d203754bc --date=short --no-merges --format='%ad %ae %s'
2020-01-03 lryer Fix glslang can't link multiple AST in a single stage

Roll third_party/shaderc/ 0b9a2992c..dc2172c08 (3 commits)

0b9a2992c7..dc2172c083

$ git log 0b9a2992c..dc2172c08 --date=short --no-merges --format='%ad %ae %s'
2020-01-10 rharrison Implement Reflection API needed by Dawn (#950)
2020-01-10 rharrison Add reference to Go bindings in README.md (#949)
2020-01-10 dneto Fix spelling of -finvert-y in doc (#947)

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

Change-Id: Idca26abcb9612ddda847250333418a408477e7b3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15041
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-01-13 17:16:51 +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
Ryan Harrison 1dbb528629 Rolling 4 dependencies
Roll third_party/SPIRV-Tools/ 96354f504..fb2e81981 (17 commits)

96354f5047..fb2e819819

$ git log 96354f504..fb2e81981 --date=short --no-merges --format='%ad %ae %s'
2020-01-08 dneto Fix GN build for OpenCL.DebugInfo.100 update (#3134)
2020-01-08 bclayton Fix bad parameter names in error message (#3129)
2020-01-07 alanbaker Revert PR #3093 (#3131)
2020-01-07 alanbaker Disallow forward references in arrays (#3093)
2020-01-07 afdx spirv-fuzz: Add fuzzer pass to perform module donation (#3117)
2020-01-06 dneto GetOperandConstants operand can be const (#3126)
2019-12-27 dneto Avoid pessimizing std::move (#3124)
2019-12-27 kburjack Fix typo in validation message (#3122)
2019-12-27 greg Change default version for CreatInstBindlessCheckPass to 2 (#3119)
2019-12-20 greg Fix convert-relax-to-half invalid code (#3099) (#3106)
2019-12-19 dneto Support OpenCL.DebugInfo.100 extended instruction set (#3080)
2019-12-19 afdx spirv-fuzz: Always add new globals to entry point interfaces (#3113)
2019-12-19 afdx spirv-fuzz: Transformation to add a new function to a module (#3114)
2019-12-19 afdx spirv-fuzz: Avoid passing access chains as parameters (#3112)
2019-12-18 dneto Add support for SPV_KHR_non_semantic_info (#3110)
2019-12-16 afdx spirv-fuzz: Transformations to add types, constants and variables (#3101)
2019-12-16 greg Make Instrumentation format version 2 the default (Step 1) (#3096)

Roll third_party/glslang/ ebf634bca..518136706 (13 commits)

ebf634bcaa..5181367062

$ git log ebf634bca..518136706 --date=short --no-merges --format='%ad %ae %s'
2020-01-07 cepheus Fix #1829: Add "--" command-line options for macro def/undef.
2020-01-08 laddoc Move symbol builtin check to grammar stage
2020-01-06 lryer Add missing extension defination
2020-01-06 cepheus Bump revision
2020-01-06 laddoc Add builtin constants
2019-11-26 laddoc Add support for ARB_gpu_shader_fp64
2019-12-26 cepheus HLSL: Fix #2037: Integer dot used incorrect input for adds.
2019-12-25 laddoc atomic counter offset should align to 4
2019-12-25 laddoc Modify atomic_uint binding check
2019-11-26 laddoc Add support for ARB_uniform_buffer_object
2019-11-26 laddoc Add support for ARB_texture_multisample
2019-11-26 laddoc Add support for ARB_sample_shading
2019-12-20 cepheus Command-line: Give better error messages. From #1829.

Roll third_party/shaderc/ 6d3e0ee67..0b9a2992c (3 commits)

6d3e0ee67f..0b9a2992c7

$ git log 6d3e0ee67..0b9a2992c --date=short --no-merges --format='%ad %ae %s'
2020-01-07 rharrison Rolling 5 dependencies and updating expectations (#946)
2019-12-18 rharrison Adding in missing APIs for MSL support in Dawn (#943)
2019-12-16 rharrison Rolling 4 dependencies (#942)

Roll third_party/spirv-cross/ f912c3289..172e39f03 (20 commits)

f912c32898..172e39f039

$ git log f912c3289..172e39f03 --date=short --no-merges --format='%ad %ae %s'
2020-01-09 post HLSL: Add a resource remapping API similar to MSL.
2020-01-09 post MSL: Deal with sign on wave min/max.
2020-01-09 post HLSL: Deal with casting for WaveActiveMin/Max.
2020-01-09 post GLSL: Deal with sign in subgroup Min/Max operations.
2020-01-08 post Run format_all.sh.
2020-01-08 post HLSL: Fix bug when reading and writing structs from SSBO.
2020-01-08 post HLSL: Implement stores for complex composites in ByteAddressBuffers.
2020-01-08 post HLSL: Support loading complex composites from ByteAddressBuffer.
2020-01-08 post Run format_all.sh.
2020-01-07 post MSL: Deal with padded fragment output + Component decoration.
2020-01-07 post MSL: Explicitly don't support component packing for tessellation.
2020-01-07 post MSL: Don't set OrigID when emitting component packed vectors.
2020-01-07 post MSL: Deal with packing vectors for vertex input/fragment output.
2020-01-07 post MSL: Add trivial tests for Component decoration.
2020-01-06 post Fix Clang warnings.
2020-01-06 post Roll custom versions of isalpha/isalnum.
2020-01-06 post Add test shader for OpCopyLogical with packing/unpacking.
2020-01-06 post Go through access chain path for OpCopyLogical.
2020-01-06 post Basic implementation of OpCopyLogical.
2019-12-21 dm86.jang Add debug prefix on Windows

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

BUG=1037829

Change-Id: I0dc87160c607e615be6e6f2f6dd4a892b010de51
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14943
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-01-09 16:09:37 +00:00
Austin Eng c3609d224a Reland "Use Swiftshader by default when fuzzing"
This is a reland of d08a14b709

It gates dawn_use_swiftshader on dawn_enable_vulkan because the
Vulkan backend isn't supported on Mac. We may support Swiftshader
Vulkan on Mac in the future, but that will first require changes
to how we initialize the Vulkan backend.

Original change's description:
> Use Swiftshader by default when fuzzing
>
> Note: This still requires Chromium to have set dawn_swiftshader_dir
> to take effect.
>
> Bug: dawn:295
> Change-Id: I0c953196630dd2694f68d290e6f3f1e427c20a2f
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14821
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

Bug: dawn:295
Change-Id: Ia125005b35951021702104a99a78712bcd47dd1e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14941
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-01-08 22:59:47 +00:00
Austin Eng 9b2712456f Revert "Use Swiftshader by default when fuzzing"
This reverts commit d08a14b709.

Reason for revert: This breaks the Mac fuzzer builds because it tries
to build with Swiftshader without Vulkan enabled. Reverting this now
to unblock the roll while I work on a fix.

Original change's description:
> Use Swiftshader by default when fuzzing
> 
> Note: This still requires Chromium to have set dawn_swiftshader_dir
> to take effect.
> 
> Bug: dawn:295
> Change-Id: I0c953196630dd2694f68d290e6f3f1e427c20a2f
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14821
> 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:295
Change-Id: I7b73d5edc844e090d5d2c8efe9efacc60040463e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14940
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-01-08 18:16:47 +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
Austin Eng d08a14b709 Use Swiftshader by default when fuzzing
Note: This still requires Chromium to have set dawn_swiftshader_dir
to take effect.

Bug: dawn:295
Change-Id: I0c953196630dd2694f68d290e6f3f1e427c20a2f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14821
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-01-06 19:42:47 +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
Austin Eng 5e98e38744 fuzzing: Remove download of existing testcases in seed corpus script
ClusterFuzz already has facilities to minimize testcases daily. It is
not necessary to do so in our update script.

Bug: dawn:295
Change-Id: I9869d25f657b40f1af1aac90c27200a59f46b9c1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14621
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:06 +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
Ryan Harrison 1bbbe8f52d Rolling 3 dependencies
Roll third_party/SPIRV-Tools/ 0a2b38d08..96354f504 (5 commits)

0a2b38d082..96354f5047

$ git log 0a2b38d08..96354f504 --date=short --no-merges --format='%ad %ae %s'
2019-12-12 afdx spirv-fuzz: Fuzzer pass to merge blocks (#3097)
2019-12-11 stevenperron Start SPIRV-Tools v2020.1
2019-12-11 stevenperron Finalize SPIRV-Tools v2019.5
2019-12-11 stevenperron Update CHANGES
2019-12-10 stevenperron Don't crash when folding construct of empty struct (#3092)

Roll third_party/glslang/ 6c479796f..ebf634bca (1 commit)

6c479796f6..ebf634bcaa

$ git log 6c479796f..ebf634bca --date=short --no-merges --format='%ad %ae %s'
2019-12-12 greg Update spriv-tools known good

Roll third_party/shaderc/ eec373d9e..6d3e0ee67 (6 commits)

eec373d9e7..6d3e0ee67f

$ git log eec373d9e..6d3e0ee67 --date=short --no-merges --format='%ad %ae %s'
2019-12-16 rharrison Replace callback interface with data one for combined image samplers (#938)
2019-12-16 rharrison Convert enum from BLOCK_STYLE to snake_style (#940)
2019-12-12 rharrison Implement a C++ only version for ForEachCombinedImageSamplers (#936)
2019-12-11 9856269+sarahM0 Add missing APIs for GLSL in Dawn (#934)
2019-12-11 dneto Don't assume locations of spirv-tools, effcee, and RE2 are located (#931)
2019-12-10 rharrison Rolling 5 dependencies (#933)

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

Change-Id: I2451c6fd80acbfde66cceaeda20d26c2a4c20804
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14600
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-12-16 20:04:07 +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