Commit Graph

1766 Commits

Author SHA1 Message Date
Corentin Wallez b31015b836 Split examples, test and utils in their own BUILD.gn
The basic change was to copy-paste targets in the new BUILD.gn files and
fixup paths / add includes. There's a couple more changes that had to be
done at the same time:

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

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

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

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

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

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

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

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

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

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

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

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

f175adffa9..8026364968

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

Created with:
  roll-dep third_party/shaderc

BUG=dawn:367

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

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

Bug: chromium:1064305

Change-Id: I13dc776af84151131584a95caeee2cd21ae80fea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18964
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-08 16:04:32 +00:00
Corentin Wallez c08a0d40fc Roll third_party/swiftshader/ 51b2800bb..63ed0e445 (131 commits)
https://swiftshader.googlesource.com/SwiftShader/+log/51b2800bb317..63ed0e445fa5

$ git log 51b2800bb..63ed0e445 --date=short --no-merges --format='%ad %ae %s'
2020-04-07 bclayton Remove src/Device/Config.cpp
2020-04-07 bclayton Kokoro: Check that build files don't reference non-existent files
2020-04-07 bclayton Regres: Fix uncovered calculations after optimizations
2020-04-07 bclayton Regres: Optimize coverage processing
2020-04-07 bclayton Regres: Re-populate treeFile.allSpans on parse.
2020-04-07 bclayton Update third_party/marl/BUILD.gn with new files
2020-04-07 bclayton Squashed 'third_party/marl/' changes from 16e1dc37c..539094011
2020-04-06 bclayton Coverage: Improve uncovered visualizations
2020-04-06 sugoi Don't blend integer formats
2020-04-03 amaiorano Clamp GLES sine/cosine to [-1,1]
2020-04-03 sugoi Delete Plane.cpp and Plane.hpp
2020-04-04 bclayton CMake / Kokoro: Build and run system-unittests.
2020-04-04 bclayton Vulkan: Destruct the list of vk::Query in QueryPool
2020-04-03 amaiorano Really fix Android build
2020-04-03 amaiorano Fix Chromium and Android build
2020-04-03 bclayton Debug: Add missing include.
2020-04-03 bclayton Vulkan/Debug: Create a PhysicalFile if DebugSource has no content
2020-04-03 bclayton Vulkan/Debug: Always provide the dap::Source::path
2020-04-03 bclayton CMake: Don't always regenerate OpenCLDebugInfo100.h
2020-03-31 amaiorano CMake: use gtest and gmock targets
2020-03-30 amaiorano CMake: split out atsc-encoder into its own CMakeLists
2020-03-30 amaiorano CMake: clean up cppdap usage
2020-03-30 amaiorano CMake: split out Reactor into its own CMakeLists
2020-03-30 amaiorano CMake: split out boost into its own CMakeLists
2020-03-30 amaiorano CMake: split out libbacktrace into its own CMakeLists
2020-03-27 amaiorano CMake: split out subzero and llvm-subzero into their own CMakeLists
2020-04-03 bclayton Kokoro: Add the ppa:ubuntu-toolchain-r/test apt-repository
2020-03-30 capn Remove the D3D9 and D3D8 source code
2020-03-30 capn Remove the custom Visual Studio solution and projects
2020-04-02 capn Fix GN build
2020-04-01 bclayton Reactor: Fix remove_if brokenness
2020-04-02 capn Remove the sw::Color<> class
2020-04-02 bclayton Change for loops to use const refs, per performance-for-range-copy clang-tidy.
2020-04-01 sugoi Fix ImageView size computation
2020-03-27 cwallez MetalSurface: set layer.device to a ref of the system default device.
2020-03-31 bclayton Regres: Add invertCommon optimization.
2020-03-31 bclayton Regres: Move optimization logic to separate file
2020-03-31 bclayton Regres: Keep coverage span groups stable.
2020-03-31 bclayton Regres: Split coverage.go into multiple files
2020-03-30 bclayton Regres: Further optimizations for coverage
2020-03-30 bclayton Regres: Add cov.ReadJSON()
2020-03-30 capn Fix implicit narrowing cast
2020-03-30 capn Eliminate the legacy PowerVR SDK
2020-03-30 capn Integrate PowerVR OpenGL ES samples
2020-03-30 capn Fix completeness test of OpenGL ES immutable textures
2020-03-30 cwallez Revert "MetalSurface: set layer.device to a ref of the system default device."
2020-03-27 cwallez MetalSurface: set layer.device to a ref of the system default device.
2020-03-28 capn Don't expose the sampling routine cache's mutex
2020-03-17 capn Create PowerVR targets if submodule already exists
2020-03-28 bclayton Regres: Generate coverage data on nightly runs
(...)
2020-03-24 bclayton CMake: Move LLVM rules out to third_party/llvm-7.0
2020-03-24 bclayton Add missing copyright header to CMakeLists.txt
2020-03-25 bclayton Initial drop of LLVM 10 to third_party/llvm-10.0
2020-03-23 bclayton Regres: Add new run_testlist flags
2020-03-19 capn Remove unused sampler parameter
2020-03-17 capn Specialize sampling routine for immutable sampler data
2020-03-24 bclayton Squashed 'third_party/marl/' changes from ca8408f68..16e1dc37c
2020-03-23 amaiorano CMake: make SWIFTSHADER_DCHECK_ALWAYS_ON work on Windows
2020-03-23 chrisforbes Refactor vertex fetch to use VkFormat more aggressively
2020-03-20 amaiorano Subzero: fix CoroutineBegin generation
2020-03-19 sugoi Fix float to r11g11b10 conversion
2020-03-19 amaiorano marl: manually apply partial patch to fix x86 crashes
2020-03-17 amaiorano Subzero: fix external function calls on x86-32
2020-03-17 amaiorano Subzero: fix partially initialized ManagedStatic assert
2019-12-04 digit [vulkan]: Support multiple external semaphore implementations.
2020-03-16 bclayton Squashed 'third_party/marl/' changes from 64d123947..ca8408f68
2020-03-16 swiftshader.regress Regres: Update test lists @ 3a50a43d
2020-03-13 bclayton SpirvShaderDebugger: Implement scope nesting
2020-03-10 sugoi Compile Vulkan library with Subzero in Chromium
2020-03-13 bclayton SpirvShader: Silence warnings of unexpected opcodes
2020-02-28 amaiorano Subzero: hide dependency on Marl
2020-03-13 amaiorano BUILD.gn: add missing dependency onto marl for SubzeroReactor
2020-03-12 capn Consistently use TRUE/FALSE in CMakeLists.txt
2020-03-13 capn Exclude all static libraries from "all" build target
2020-02-28 amaiorano Subzero: replace Win32 fibers with Marl for couroutines
2020-03-12 bclayton SpirvShaderDebugger: Add flag for printing opcodes as they're executed
2020-03-12 bclayton SpirvShaderDebugger: Make Function extend Scope
2020-03-12 bclayton SpirvShaderDebugger: Add string helper for debug kinds
2020-03-12 bclayton SpirvShader: Implement OpenCLDebugInfo100DebugInfoNone
2020-03-12 bclayton SpirvShaderDebugger: Stub UNIMPLEMENTED() opcodes
2020-03-11 bclayton SpirvShader: Implement OpenCLDebugInfo100DebugInlinedAt
2020-03-11 sugoi Allow 3D filtering in the Blitter
2020-03-12 capn Fix building with latest LLVM
2020-03-12 capn Document single-level YCbCr image assumption
2020-03-09 capn Clarify the PointCoord calculation
2020-03-09 capn Remove unnecessary point setup calculations
2020-03-12 capn Don't needlessly build LLVM
2020-03-12 bclayton Squashed 'third_party/marl/' changes from 94a361cf0..64d123947
2020-03-11 bclayton VkImage: Implement BC7 texture format
2020-03-11 bclayton Squashed 'third_party/marl/' changes from a047dd0bb..94a361cf0
2020-03-06 capn Support running PowerVR samples using SwiftShader on Linux
2020-02-18 bclayton Regres: Roll dEQP to 1.2.1
2020-03-10 capn Regres: support testlist creation from specified hash
2020-03-06 capn Suppress warnings in Subzero dependencies
2020-03-10 bclayton Regres: Simplify running of local tests
2020-03-11 bclayton Kokoro: Update clang-8 URL
2020-03-10 amaiorano Subzero: fix Call on bool-returning functions
2020-03-09 swiftshader.regress Regres: Update test lists @ b44162fd
2020-03-05 madesroches Support for the largePoints feature in Vulkan
2020-03-06 capn Explicitly compile with warnings-as-errors

Created with:
  roll-dep third_party/swiftshader

Bug: None

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

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

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

 - CreateBufferMapped
 - Destroy
 - UpdateMappedData

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

BUG=dawn:367

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

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

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

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

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

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

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

Bug: dawn:373

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

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

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

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

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

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

Bug: chromium:1064305

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

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

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

Bug: dawn:22
Change-Id: I1377eef9ea9816578441c91d167909dedc7f8e96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18863
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-07 07:11:12 +00:00
Kai Ninomiya f526d777e0 Fix is_asan build (at least on Mac)
The changes in this CL are copied from Chromium.

Bug: dawn:355
Change-Id: I3772b5849b096dd11541b94331309293f1a64fb5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18903
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-04-06 22:27:02 +00:00
Bryan Bernhart cb859a2037 Reland "D3D12: Stage BindGroups on CPU descriptor heaps."
This reverts commit c7f454c241
and relands commit 2479860e4b.

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

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

Note: Adds validation to ensure binding size > 0.

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

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

Added final on most-derived classes.

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

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

Bug: dawn:347
Change-Id: Id02fa486317c583ee11cfe3bc382816dc34121fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18680
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2020-04-06 15:19:22 +00:00
Ryan Harrison 27dcffcc02 Rolling 3 dependencies
Roll third_party/SPIRV-Tools/ fd773eb50..e95fbfb1f (9 commits)

fd773eb50d..e95fbfb1f5

$ git log fd773eb50..e95fbfb1f --date=short --no-merges --format='%ad %ae %s'
2020-04-02 afdx spirv-fuzz: Transformation to add OpConstantNull (#3273)
2020-04-02 afdx spirv-fuzz: Handle isomorphic types property in composite construction (#3262)
2020-04-02 afdx spirv-fuzz: Limit adding of new variables to 'basic' types (#3257)
2020-04-02 afdx spirv-fuzz: Only replace regular ids with synonyms (#3255)
2020-04-02 afdx spirv-fuzz: Introduce TransformationContext (#3272)
2020-04-02 afdx spirv-fuzz: Add validator options (#3254)
2020-04-02 alanbaker Update dominates to check for null nodes (#3271)
2020-04-01 alanbaker Set wrapped kill basic block's parent (#3269)
2020-03-31 caio.oliveira Validate Buffer and BufferBlock apply only to struct types (#3259)

Roll third_party/glslang/ 08c02ced7..b5757b950 (5 commits)

08c02ced79..b5757b9500

$ git log 08c02ced7..b5757b950 --date=short --no-merges --format='%ad %ae %s'
2020-04-03 rharrison Remove extra semicolons (#2170)
2020-04-02 mbechard Shader interface matching rework to fix #2136 (#2156)
2020-04-01 cepheus Build warning: Fix #2167: Remove nested reuse of 'unreachable'.
2020-03-31 cepheus Bump revision.
2020-03-30 alele Error assigns to objects of rayQueryEXT type.

Roll third_party/spirv-cross/ 9b3c5e12b..6637610b1 (7 commits)

9b3c5e12be..6637610b16

$ git log 9b3c5e12b..6637610b1 --date=short --no-merges --format='%ad %ae %s'
2020-04-03 post Expose a query if samplers or images are comparison resources.
2020-04-03 post Do not add NonWritable/NonReadable decorations for regular images.
2020-04-03 post MSL: Deal with cases where builtin is implicitly needed, declared, but unused.
2020-04-03 post HLSL: Add support for treating NonWritable UAV texture as SRV instead.
2020-04-03 troughton MSL: mark BuiltInFragCoord as implicitly used for subpass reads
2020-03-31 post MSL: Fix access chain for deep struct hierarchy on array of buffers.
2020-03-30 dsinclair Roll GLSLang, SPIRV-Tools and SPIRV-Headers

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

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

Reason for revert: Causes WebGPU CTS failures

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

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

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

Bug: dawn:155
Change-Id: I3dfae3e15e2bc21de692513725c9cf3ca38110b5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18860
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-06 08:16:31 +00:00
Li, Hao d48b329b49 Roll third_party/shaderc/ f085b9745..f175adffa (4 commits)
f085b9745f..f175adffa9

$ git log f085b9745..f175adffa --date=short --no-merges --format='%ad %ae %s'
2020-04-02 rharrison Add flag to control if we build with -Werror (#1032)
2020-03-31 rharrison Add knob to control force_zero_initialized_variables (#1028)
2020-03-31 dgkoch update glslang to SDK-Candidate-2 tag (#1027)
2020-03-30 rharrison Rolling 5 dependencies and updated exceptions (#1026)

Created with:
  roll-dep third_party/shaderc

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

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

BUG=dawn:155

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

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

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

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

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

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

Bug: dawn:269

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

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

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

Bug: dawn:358

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

Bug:

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

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

Bug: dawn:364
Change-Id: I7eb628c460e1e7c446ad91b29b03dd7b54545afb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18060
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
2020-03-30 20:31:45 +00:00