Dawn used to return "nullptr" when an error happened while creating an
object. To match WebGPU we want to return valid pointers but to "error"
objects.
This commit implements WebGPU error handling for all "descriptorized"
objects and changes the nullptr error checks into "ValidateObject"
checks. This method is used both to check that the object isn't an
error, but also that all objects in a function call are from the same
device.
New validation is added to objects with methods (apart from Device) so
they check they aren't error objects.
A large number of ASSERTs were added to check that frontend objects
aren't accessed when they are errors, so that missing validation would
hit the asserts instead of crashing randomly.
The bind group validation tests were modified to test the behavior with
both nullptrs and error objects.
Future commits will change the CommandBufferBuilder to not be a builder
anymore but an "Encoder" instead with special-cased error handling. Then
once all objects are descriptorized, the notion of builders will be
removed from the code.
BUG=dawn:8
Change-Id: I8647712d5de3deb0e99e3bc58f34496f67710edd
Reviewed-on: https://dawn-review.googlesource.com/c/4360
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This will allow implementing the following part of the WebGPU IDL using
a nullable pointer instead of an extra hasDepthStencilState boolean:
partial interface GPURenderPipelineDescriptor {
GPUDepthStencilStateDescriptor? depthStencilState;
};
BUG=dawn:102
Change-Id: Iae709831ad857fcef073f18753ab39567a8797da
Reviewed-on: https://dawn-review.googlesource.com/c/4500
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Yunchao He <yunchao.he@intel.com>
It doesn't need to care about device creation anymore, except for the
GLFW window hints and creating a GL context to discover the adapter.
Also remove the non-adapter GetPCIInfo.
BUG=dawn:29
Change-Id: I9bc8232536a55d2f973463ae0f2e0548dfc35456
Reviewed-on: https://dawn-review.googlesource.com/c/4381
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Undefined BGLs are stored as nullptr in the pipeline layout, so to be
defensive we assert clients of PipelineLayout can't request undefined
BGLs (which forces iteration on the BGLMask).
Also fix two cases where the BGLs were iterated on incorrectly.
BUG=dawn:8
Change-Id: I3c084125b93d6684b4c79a56745632874079ebec
Reviewed-on: https://dawn-review.googlesource.com/c/4480
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
The flushing of command buffers was in an ASSERT which made them skipped
on release builds.
BUG=
Change-Id: I07bf558d1689f4bea0047a80ab3c8b04938f04a0
Reviewed-on: https://dawn-review.googlesource.com/c/4501
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This creates proper Client and Server interfaces which will be necessary
for adding additional features to the Wire for chrome integration
Bug: dawn:103
Change-Id: I181e95079b0bac85c2c6152ad8066a94b80c8d28
Reviewed-on: https://dawn-review.googlesource.com/c/4002
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>