Commit Graph

869 Commits

Author SHA1 Message Date
Bryan Bernhart 96e1911b0b Memory manager: buffer uploads (Vulkan) - Part 2
Manages a single persistently mapped GPU heap which is sub-allocated
inside of ring-buffer for uploads. To handle larger buffers without additional
unused heaps, ring buffers are created on-demand.

BUG=dawn:28
TEST=dawn_unittests

Change-Id: Ic2a5df3142fc24fa772b9a85b38248eea8c7e003
Reviewed-on: https://dawn-review.googlesource.com/c/4260
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-02-06 18:10:12 +00:00
Raul Tambre 7771f58c7f Fix missing include for std::unique_ptr in VulkanBinding.cpp
Bug: dawn:100
Change-Id: Ied470aca31dba15e704ec6c737b01e3ff344b240
Reviewed-on: https://dawn-review.googlesource.com/c/4380
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-02-06 17:35:41 +00:00
Corentin Wallez 978fa65a2c Metal: Implement the backend connection and adapter.
BUG=dawn:29

Change-Id: Idaca7d2f8ac52d5f46d8030571b5e2da3a573a97
Reviewed-on: https://dawn-review.googlesource.com/c/3940
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-02-05 13:02:30 +00:00
Corentin Wallez a27bdb4a5e Vulkan: Fix finding of the largest candidate heap.
BUG=dawn:98

Change-Id: Ibcae3a760b9feb2cbba47d40c3eeea9e63481682
Reviewed-on: https://dawn-review.googlesource.com/c/4340
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-02-05 12:52:50 +00:00
Corentin Wallez 8c88e1ddce Remove redundant BackendType enums
BUG=dawn:29

Change-Id: Iaef26ca12a7a8721de17edb76e8fd4ff66cac0bd
Reviewed-on: https://dawn-review.googlesource.com/c/4342
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-02-05 12:17:20 +00:00
Corentin Wallez 00976d0db1 Make setBlendColor take in a Color instead of 4 floats
BUG=

Change-Id: Ic70d5b664c0ea64c038129cdb83f4ba05fb61830
Reviewed-on: https://dawn-review.googlesource.com/c/4341
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-02-05 12:13:10 +00:00
Corentin Wallez d1be0e7077 Vulkan: Implement the backend connection and adapter.
This also changes VulkanInfo to gather info on backends / adapters
instead of the device, because all the info gathering can happen before
the device is created.

BUG=dawn:29

Change-Id: I9dc4412f494428f1ae589544d3adf76fe8b9a3a3
Reviewed-on: https://dawn-review.googlesource.com/c/3941
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-02-04 09:31:09 +00:00
Raul Tambre c26f6dae33 Fix missing include for std::unique_ptr in D3D12Binding.cpp
Bug: dawn:99
Change-Id: Ifeaa69b3061fe962a39f0b13bdee028dbeb2677d
Reviewed-on: https://dawn-review.googlesource.com/c/4320
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-02-04 09:04:19 +00:00
Yunchao He baa3741c9f Rename variables in DepthStencilStateDescriptor, in order to match web idl
Bug:dawn:31
Change-Id: Ie3326e13f62446bf020ae60f47c8dfa6687d7b9a
Reviewed-on: https://dawn-review.googlesource.com/c/4240
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-01-30 21:11:43 +00:00
Austin Eng 8749506bae dawn_wire: Move manual class members from ServerBase to Server
Bug: dawn:88
Change-Id: Ic216006aa52cace7aa7451b957e72119783e6d7a
Reviewed-on: https://dawn-review.googlesource.com/c/4100
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-30 17:37:28 +00:00
Raul Tambre 2427666df1 Fix missing include for std::unique_ptr in RingBuffer.h
Bug: dawn:96
Change-Id: If815bb1811eff5467039df6fdf939ef068abdb15
Reviewed-on: https://dawn-review.googlesource.com/c/4300
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-30 16:27:28 +00:00
Frank Henigman 4531bd2477 Convert spirv-cross fuzzers to use shaderc.
BUG=dawn:95

Change-Id: I0fedb7b068de39c41b1b1d8aa2b42a96fdb584fb
Reviewed-on: https://dawn-review.googlesource.com/c/4140
Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2019-01-30 16:12:28 +00:00
Corentin Wallez d77fd5f889 D3D12: Implement the backend connection and adapter.
BUG=dawn:29

Change-Id: Id4497b4a91ba58b79d1cd976a52df5a0fa5d60a8
Reviewed-on: https://dawn-review.googlesource.com/c/3844
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-01-30 16:07:48 +00:00
Li Hao 45da8c0115 Fix non-zero validation in Draw and DrawIndexed
Metal validation layer does not allow indexCount or instanceCount to be 0 in
drawIndexedPrimitives and drawPrimitives, otherwise we should draw nothing
with these operations.

BUG=dawn:76
TEST=dawn_end2end_tests

Change-Id: Ic22be73ac992289d4bc8d7b3d4d30d20c4488776
Reviewed-on: https://dawn-review.googlesource.com/c/3900
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-01-30 09:01:08 +00:00
Austin Eng 1139d1c12c Factor wire client handlers into proper command handlers and doers
Bug: dawn:88
Change-Id: I3ab28efad7edc7d06f11aa5abae07a1bb3d7e59e
Reviewed-on: https://dawn-review.googlesource.com/c/4003
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-30 03:00:17 +00:00
Austin Eng cd4fd8e7cd Make the wire Client own ObjectAllocators and CommandSerializer
This moves ownership of ObjectAllocators and CommandSerializers
from the Device to the Client. There may be also be multiple
Devices, so New() now takes the Device the object belongs to.
Device allocation specializes New() to take the owning Client so
that we can get a pointer to the Client from any Dawn API object.

Bug: dawn:88
Change-Id: Ie4274d46313884c44a857159e95d236dc1141c0c
Reviewed-on: https://dawn-review.googlesource.com/c/4001
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-01-30 02:31:37 +00:00
Austin Eng fd4688e8d0 Separate WireServer.cpp into multiple files.
This patch copies methods and classes from WireServer.cpp and
distributes them over multiple files. Headers and forward declarations
are added as necessary, but no functional changes are made.

Bug: dawn:88
Change-Id: I471b8c27804916257eff266a51d087ba1ddbfeb6
Reviewed-on: https://dawn-review.googlesource.com/c/4000
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-01-30 02:20:58 +00:00
Bryan Bernhart 74e95fff4a Memory manager: buffer uploads (D3D) - Part 1
Manages a single persistently mapped GPU heap which is sub-allocated
inside of ring-buffer for uploads. To handle larger buffers without additional
unused heaps, ring buffers are created on-demand.

BUG=dawn:28
TEST=dawn_unittests

Change-Id: Ifc5a1b06baf8633f1e133245ac1ee76275431cc5
Reviewed-on: https://dawn-review.googlesource.com/c/3160
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-01-29 00:10:07 +00:00
Frank Henigman 79ff8bead9 DEPS: Roll SPIRV-Headers and SPIRV-Tools.
Roll SPIRV-Headers and SPIRV-Tools so we can roll shaderc so we can use
libshaderc_spvc in the SPIRV-Cross fuzzers.

BUG=dawn:95

Change-Id: I02f8dd4788e3094b1b59a99a27fdeba94d3aa47f
Reviewed-on: https://dawn-review.googlesource.com/c/4220
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
2019-01-28 19:47:07 +00:00
Corentin Wallez 1c0b0474c1 [commit-queue.cfg] Remove old cq.cfg
Bug=chromium:916292

Change-Id: I3b55d17aee849228d4db73c82bb3746df9eb6060
Reviewed-on: https://dawn-review.googlesource.com/c/4200
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-28 09:03:26 +00:00
Andrii Shyshkalov b92cee8987 [commit-queue.cfg] Create new project-scoped CQ config.
Autogenerated from ref-scoped cq.cfg located at:
  https://dawn.googlesource.com/dawn/+/refs/heads/master/infra/config/branch/cq.cfg
  (pinned https://dawn.googlesource.com/dawn/+/b59d04f79ee3bdc173beba9256c266e009321ffb/infra/config/branch/cq.cfg)

The new config is functionally equivalent to the old one. Upon landing, the new
config will take effect once LUCI config service picks it up. If you see
'commit-queue.cfg' in https://luci-config.appspot.com/#/projects/dawn ,
then it has been picked up.

New commit-queue.cfg takes precedence over old cq.cfg, and once picked up makes
it safe to remove old cq.cfg.

See also internal PSA go/psa-migrate-to-commit-queue-cfg.

Generated-by: https://crrev.com/i/815809
Bug: chromium:916292
Change-Id: I3d6a3dcf916fce35dca43ed3497d53eb6334d8f9
Reviewed-on: https://dawn-review.googlesource.com/c/4180
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-28 07:18:32 +00:00
Corentin Wallez da8ee83ee7 BUILD.gn: Change the static/shared library template to component
This changes the dawn_static_and_shared_library template to be a
dawn_component template that mimics the behavior of Chromium's
components.

This helps avoid issues where on non-component builds on Windows the CRT
would get linked statically in both the Dawn shared libraries and the
test executables, causing alloc/deallocs across library boundaries to
crash.

BUG=dawn:29

Change-Id: I69287a523cc0bf5f2e921982ea9c26dcfed82f11
Reviewed-on: https://dawn-review.googlesource.com/c/4040
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-25 03:20:20 +00:00
Corentin Wallez fe92685bfc Roll third_party/shaderc/ 909f0d3d3..ce7d92182 (28 commits)
909f0d3d31..ce7d92182b

$ git log 909f0d3d3..ce7d92182 --date=short --no-merges --format='%ad %ae %s'
2019-01-22 fjhenigman Use the full spirv-cross dependency. (#550)
2019-01-22 corentin BUILD.gn: fix build error on is_component_build=true (#549)
2019-01-21 corentin BUILD.gn: Make libraries Chromium-style "components" (#548)
2019-01-17 fjhenigman Disable spvc build by default.  (#542) (#547)
2019-01-16 fjhenigman Fix build with exceptions off. (#546)
2019-01-16 dneto Fix MinGW: Format %lu must be unsigned long. (#544)
2019-01-16 dneto Fix leaks in tests (#545)
2019-01-15 fjhenigman Fix ASAN build. (#543)
2019-01-15 fjhenigman Add libshaderc_spvc interface to SPIRV-Cross. (#524)
2019-01-15 fjhenigman Fix NDK build. (#540)
2019-01-11 dneto Android.mk: better fallback for SPIRV-Tools dir (#538)
2019-01-09 dj2 Roll RE2 Dep (#537)
2019-01-07 dj2 Fixup source matching test (#534)
2019-01-03 fjhenigman Fix Windows test script return value. (#533)
2019-01-02 dj2 Switch GLSLang to upstream (#515)
2018-12-28 alex Generate source text debug info if requested (#455) (#532)
2018-12-27 ehsann [kokoro] Stop running tests on VS 2013 builds. (#531)
2018-12-21 fjhenigman Update Android NDK. (#530)
2018-12-17 dneto Test shader uniforms need descriptor set and binding (#523)
2018-12-17 kknb1056 Add git clone of re2 and effcee to the Dockerfile (#527)
2018-11-28 dj2 Update to use Android.mk from glslang (#520)
2018-11-22 dneto Add unit tests for mesh and task shaders
2018-11-21 arseny.kapoulkine Add support for NV_EXTENSIONS in #pragma shader_stage()
2018-11-19 dj2 Build file updates. (#514)
2018-11-15 dj2 Fixup shadowed variables (#513)
2018-10-11 dneto Unpin googletest. It has been fixed upstream
2018-11-13 dj2 Add effcee and re2 when building spirv-tools tests (#510)
2018-10-24 dj2 Only include third_party directories if needed. (#507)

Created with:
  roll-dep third_party/shaderc

TBR=kainino@chromium.org
BUG=dawn:29

Change-Id: I30df4fe9423465d5db135874f6dec2687391e505
Reviewed-on: https://dawn-review.googlesource.com/c/4160
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-24 19:52:46 +00:00
Yunchao He c0f31e73e4 Use const*const* to annotate a sequence of descriptors
BUG=dawn:77

Change-Id: I2a523e54a06173c157730e043c25e9629887fd1f
Reviewed-on: https://dawn-review.googlesource.com/c/3820
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-21 08:29:01 +00:00
Jiawei Shao 850c0d9aec Fix a bug in computing bind group index in GroupsInheritUpTo()
This patch fixes a crash issue on D3D12 backends that are caused by
a bug in computing bind group index in function GroupsInheritUpTo().
The return value of this function should be kMaxBindGroups instead of
(kMaxBindGroups + 1) as the maximum number of bind group sets is
kMaxBindGroups.

This patch also adds a regression test on this bug.

BUG=dawn:78
TEST=dawn_end2end_tests

Change-Id: Ie060a52f987803ed6a325b337ff678e6b73e2897
Reviewed-on: https://dawn-review.googlesource.com/c/4080
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-01-18 04:41:20 +00:00
Brandon Jones 799cddcb83 Trigger GC Sweeps on Vulkan
Vulkan backend wasn't making a call to Tick(), meaning that
vkDestroy* operations were being enqueued, but never executed.

Change-Id: I597f59d6a17ea4247a1a042a2b5a7997d2e95612
Bug: dawn:94
Reviewed-on: https://dawn-review.googlesource.com/c/4020
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2019-01-17 00:15:14 +00:00
Yunchao He 63b59cfdf3 Remove annoying warnings in dawn_unittests
There are a lot of annoying warnings about uninteresting mock
function calls when running dawn_unittests because object release
function calls are not included into the gtest EXPECT_CALL.

BUG=dawn:93

Change-Id: I49f772bc1b9da9eaa86a51ca3a754886e8f0bcdc
Reviewed-on: https://dawn-review.googlesource.com/c/3960
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-16 23:56:16 +00:00
Austin Eng acd8b7d937 Separate WireClient.cpp into multiple files.
This patch copies methods and classes from WireClient.cpp and
distributes them over multiple files. Headers and forward declarations
are added as necessary, but no logical changes are made.

Bug: dawn:88
Change-Id: I9d0fcaeb67e789c3ad0597eaa3839adefc3ac5f9
Reviewed-on: https://dawn-review.googlesource.com/c/3980
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-01-16 02:18:06 +00:00
Austin Eng c7f416c0c9 Add wire_cmd.py and dawn_wire.json to autogenerate all wire commands.
Unify code generation for Client->Server and Server->Client commands.
Methods in dawn.json are converted into command records and additional
commands are specified in dawn_wire.json. This can then be used to
completely generate the command handlers and command struct definitions.

Bug: dawn:88
Change-Id: Ic796796ede0aafe02e14f1f96790324dad92f4c0
Reviewed-on: https://dawn-review.googlesource.com/c/3800
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-15 20:49:53 +00:00
Austin Eng a483fac90d d3d12: Lazily apply IASetVertexBuffers before draw
This fixes a bug where D3D12 SetVertexBuffers was using the input info
from the last set pipeline's InputState. IASetVertexBuffers needs to be
reapplied if the input state changes.

Bug: dawn:91
Change-Id: I7d0b308ea20cee6d595f6b29548f57d82c8e47a4
Reviewed-on: https://dawn-review.googlesource.com/c/3860
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-15 04:10:48 +00:00
Corentin Wallez 1a99f42c7d WireServer: Wrap userdata in unique_ptr in callbacks
This fixes a leak that was introduced in
https://dawn-review.googlesource.com/c/dawn/+/3622 where the early
return doesn't delete the userdata.

BUG=chromium:921360

Change-Id: I500dd2b4fa02121e5c0278c5f6f83a30861815e4
Reviewed-on: https://dawn-review.googlesource.com/c/3942
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-01-14 18:41:13 +00:00
Corentin Wallez 03f64292ad dawn_features.gni: add an option to complete static libraries
This is useful for people using Dawn's standalone build to compile
static libraries to use in other projects. Without this static libraries
will act as source sets as is GN's default.

BUG=dawn:85

Change-Id: I4d99cbbbe67c73f226717651cb12ed0a172409b2
Reviewed-on: https://dawn-review.googlesource.com/c/3840
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-12 17:26:49 +00:00
Raul Tambre 392b4a95c6 Fix missing include for std::unique_ptr in NullBinding.cpp
Bug: dawn:92
Change-Id: I9e179bfc7afb92c42d4111676a1c852d6eeae5cb
Reviewed-on: https://dawn-review.googlesource.com/c/3920
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-12 17:13:45 +00:00
Corentin Wallez ec18f9683c Gather PCI device info through the adapter when possible
This will help migrate PCI info collection from the device to the
adapter where it belongs.

BUG=dawn:29

Change-Id: Ifa7d167249c97f1934f7c10d420f864f59babd37
Reviewed-on: https://dawn-review.googlesource.com/c/3843
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-10 10:50:54 +00:00
Corentin Wallez 7aae840a22 Add missing ToBackend implementation for Adapter
BUG=dawn:29

Change-Id: I00926dd201c7a8f24d769078540c75c25f210515
Reviewed-on: https://dawn-review.googlesource.com/c/3842
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-10 10:12:24 +00:00
Corentin Wallez 0d03b09623 Remove non-adapter way to create null devices
BUG=dawn:29

Change-Id: I2153aa30afd096a3f27c8b8b2ba23a10c0ade50a
Reviewed-on: https://dawn-review.googlesource.com/c/3841
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-10 10:07:04 +00:00
Corentin Wallez bd48385d50 Add static library versions of libdawn*
Chromium will want to have both static and shared library versions of
Dawn to use in non-component and component builds respectively.

The *_export.h files are modified to noop when *_SHARED_LIBRARY is not
defined so that the static library doesn't export symbols that aren't
imported in dependents (this would break compilation on Windows).

A dawn_library_combo is introduced in BUILD.gn that factors out all the
logic needed to produce shared libraries and handle the _EXPORT macros.

Also contains a fix to dawncpp to export only the methods that aren't
defined in the header (otherwise they get defined multiple times)

BUG=dawn:85

Change-Id: Ib747deb9308e1165dd66002487147ba279d3eac0
Reviewed-on: https://dawn-review.googlesource.com/c/3761
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-09 09:05:18 +00:00
Corentin Wallez 97d2a71684 dawn_native: define exported functions in their own files.
This adds a new FooBackend.cpp file for each backend that defines
exactly the symbols that are exported by libdawn_native's headers. THis
will allow factoring most of the compilation of dawn_native between the
shared and static library variants.

BUG=dawn:85

Change-Id: I69c808dac2fe5e8bb08356117e3997677787b08a
Reviewed-on: https://dawn-review.googlesource.com/c/3760
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-09 08:35:16 +00:00
Austin Eng 5236eb2057 Specialize WireServer objects
This removes unnecessary builder and buffer info from server objects that
do not need them.

Bug: dawn:86
Change-Id: I97b11615da763725281495f05c70a4ee7a9c9e5a
Reviewed-on: https://dawn-review.googlesource.com/c/3780
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-08 17:58:38 +00:00
Kai Ninomiya 17be9deed6 Fix samples on null backend (add swapchain impl)
BUG=
Change-Id: I96e6c58b4ec46af58f7c0a97c88308075efe68dd
Reviewed-on: https://dawn-review.googlesource.com/c/3700
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-07 19:54:36 +00:00
Austin Eng 9dc1250d3e Use single DestroyObject command in the wire
Bug: dawn:83
Change-Id: Ic875d5111f59e7166d2decb3dc6a84973d9babdf
Reviewed-on: https://dawn-review.googlesource.com/c/3680
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-07 17:52:56 +00:00
Corentin Wallez 7c0f0fbf91 Vulkan: Always request all VkSurfaceKHR-related extensions
The backend had a "requiredInstanceExtensions" parameter to device
creation so that we could request the right instance extensions to
support swapchains. When we have dawn_native::Instance we don't want to
require this information before we can use the Vulkan backend. Instead
we make the backend always require all VkSurfaceKHR extensions. This
should be safe because these extensions basically enable copying a
struct into an opaque VkSurfaceKHR object and not much else.

BUG=dawn:29

Change-Id: I7fc5426f5770b65bb35f02793a1319eb0653782c
Reviewed-on: https://dawn-review.googlesource.com/c/3662
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-07 12:04:46 +00:00
Corentin Wallez 95fd2821c2 MetalBinding: query the MTLDevice instead of creating it.
With adapters the Metal backend will be in charge of creating the
MTLDevice so we remove this responsibility from the bindings.

BUG=dawn:29

Change-Id: Id7b9e5f6249963e2b87a91242a18119ba8d11c13
Reviewed-on: https://dawn-review.googlesource.com/c/3661
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-07 10:01:11 +00:00
Corentin Wallez 9506d53938 Remove unused SwapChainImplVulkan
BUG=dawn:29

Change-Id: Ic36bdd83b2351e3ef9d6825dee64469405e840a3
Reviewed-on: https://dawn-review.googlesource.com/c/3660
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-07 09:56:51 +00:00
Corentin Wallez 90e594ee8b OpenGL: Implement the backend connection and adapter.
The OpenGL backend can't gather discover default adapters because it
needs getProc to do anything so we add DiscoverAdapters method to
Instance that takes backend-specific options.

dawn_native::opengl::CreateDevice is removed in favor of the adapter
path so OpenGLBinding is modified to create an instance locally. This is
only temporary until all backends support adapters, at which point a lot
of *Binding code will be factored.

Also contains a small fix for Result<T, E> with movable types.

BUG=dawn:29

Change-Id: I4eb3d4a14a871af73e1872132aff72b45e5fe566
Reviewed-on: https://dawn-review.googlesource.com/c/3663
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-01-07 09:48:03 +00:00
Raul Tambre ab8eb2d6ed Fix missing include for unique_ptr in BackendConnection.h
Bug: dawn:84
Change-Id: I8a878c02fdee777e6a7aeb7fabde8ffbf8eafb0e
Reviewed-on: https://dawn-review.googlesource.com/c/3740
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-07 09:34:20 +00:00
Corentin Wallez 110bc7918f Validate EndPass isn't called more than once.
BUG=chromium:918254

Change-Id: I24db2f459bae7c0644a54472e56159ff8f5ab955
Reviewed-on: https://dawn-review.googlesource.com/c/3621
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-04 12:01:44 +00:00
Corentin Wallez ac67fec1c9 dawn_native: Add Instance and Adapters
New objects are introduced to control what happens before device
creation in dawn_native:
 - Instance: a connection from the application to dawn_native that is
used for dependency injection and to discover adapters.
 - Adapters: represents the possibility of device creation for a specific
(GPU, backend) pair.
 - BackendConnection: an internal object that standardizes the interface
between the frontend and backends.

The BackendConnection interface is implemented for the Null backend and
stubbed out in other backends. This allows this change to port the
ValidationTests to use the new Instance and Adapters concept and deal
with other backends later.

BUG=dawn:29

Change-Id: I19719a9342b4af091accc0c02fb6b9697eadde7b
Reviewed-on: https://dawn-review.googlesource.com/c/3500
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-04 10:30:40 +00:00
Corentin Wallez e9212dfe30 Vulkan: Print the VkResult value on device creation failure.
This adds a CheckVkSuccess utility function that adds the VkResult value
to the context lost error message.

Also adds a small fix to dawn_native/Error.h interoperability between
MaybeError and ResultOrError<NonPointer> with tests.

BUG=chromium:917555
BUG=dawn:79

Change-Id: Icc01122d62d83693fc0ea3f26b272f2372fd3087
Reviewed-on: https://dawn-review.googlesource.com/c/3623
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-01-04 10:18:40 +00:00
Corentin Wallez 1e37db5350 WireServer: check buffer exists before sending the map callback
The client might have asked for the buffer to be destroyed, but the
reference to the buffer is still alive because it is internally
referenced by Dawn.

BUG=chromium:918254

Change-Id: Id7d2de891eba98e3cf15e77730f66f64d9a3b9f9
Reviewed-on: https://dawn-review.googlesource.com/c/3622
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-04 09:54:40 +00:00