This is a temporary fix until dawn_wire can support multiple devices.
When using objects from different devices, the wire will inject an
error into the receiver object's device. Methods that return objects
will return a dummy object. Using the dummy object will cause a fatal
error on the server.
Without this fix, the server would blindly lookup an ObjectId which
could point to some other object. This would bypass same-device
validation and have incorrect results.
Bug: dawn:383
Change-Id: I898f07d4b26f2a97ef952b82af488e7f807c36f0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19261
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
The upstream WebGPU spec decided to not pursue CreateBufferMappedAsync,
and it adds some complexity to Dawn, so we remove it.
Bug: dawn:22
Change-Id: I4182a90c4a1aa0bfbaecd7d8f67d7049cf5df5d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17321
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This prevents the client from continuing to send commands
when the wire connection has dropped. In Chromium this may
be because the connection to the GPU process is lost and the
transfer buffer may be destroyed.
This CL also adds a new helper to make testing callbacks
with mocks easier.
Bug: chromium:1070392
Change-Id: I6a69c32cc506069554ead18ee83a156ca70e2ce2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19160
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Roll third_party/SPIRV-Tools/ e95fbfb1f..7d65bce0b (12 commits)
e95fbfb1f5..7d65bce0bb
$ git log e95fbfb1f..7d65bce0b --date=short --no-merges --format='%ad %ae %s'
2020-04-14 stevenperron Sampled images as read-only storage (#3295)
2020-04-14 alanbaker Remove implicit fallthrough (#3298)
2020-04-14 stevenperron Add tests for recently added command line option (#3297)
2020-04-14 dneto If SPIRV-Headers is in our tree, include it as subproject (#3299)
2020-04-13 stevenperron Struct CFG analysus and single block loop (#3293)
2020-04-13 jaebaek Preserve debug info in eliminate-dead-functions (#3251)
2020-04-13 stevenperron Update acorn version (#3294)
2020-04-09 stevenperron Handle more cases in dead member elim (#3289)
2020-04-09 h.baensch.92 Fix pch macro to ignore clang-cl (#3283)
2020-04-07 afdx spirv-fuzz: Improve the handling of equation facts (#3281)
2020-04-07 afdx spirv-fuzz: Handle more general SPIR-V in donation (#3280)
2020-04-06 afdx spirv-fuzz: Improve support for compute shaders in donation (#3277)
Roll third_party/glslang/ b5757b950..4d2298bfd (5 commits)
b5757b9500..4d2298bfd7
$ git log b5757b950..4d2298bfd --date=short --no-merges --format='%ad %ae %s'
2020-04-13 cnorthrop Support multiple swizzled out operands (#2175)
2020-04-12 cepheus Fix#2178: Allow specialization constants for texel offsets.
2020-04-10 h.baensch.92 Get rid of all warnings with MSVC and clang-cl (#2177)
2020-04-08 40001162+alelenv Add support for EXT_ray_flags_primitive_culling. (#2173)
2020-04-07 cepheus Error message: Finish addressing #2097, better texture error message.
Roll third_party/shaderc/ 802636496..1926de063 (1 commit)
8026364968..1926de0638
$ git log 802636496..1926de063 --date=short --no-merges --format='%ad %ae %s'
2020-04-09 rharrison Remove ambiguity in comment of pointer vs Klein star for * (#1037)
Roll third_party/spirv-cross/ 6637610b1..54658d625 (3 commits)
6637610b16..54658d6255
$ git log 6637610b1..54658d625 --date=short --no-merges --format='%ad %ae %s'
2020-04-10 cdavis MSL: Add options to control emission of fragment outputs.
2020-04-09 h.baensch.92 Improve compatibility with clang-cl
2020-04-07 post MSL: Do not use base expression with PhysicalTypeID OpCompositeExtract.
Roll third_party/spirv-headers/ f8bf11a02..2ad0492fb (1 commit)
f8bf11a025..2ad0492fb0
$ git log f8bf11a02..2ad0492fb --date=short --no-merges --format='%ad %ae %s'
2020-04-13 cepheus Discuss generator magic number reservations.
Created with:
roll-dep third_party/SPIRV-Tools third_party/glslang third_party/shaderc third_party/spirv-cross third_party/spirv-headers
Change-Id: I807bb9493fbe33cb3944fbc58eebb9975da01ec7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19520
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This was found during some changes in Google3.
Also renames BitsPerWord to kBitsPerWord.
Bug:
Change-Id: I80cfe3a391963c2da376a7d8eadfc2797df01894
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19286
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
It also changes remaining deps for internal targets
from libdawn_proc to dawn_proc.
Bug: chromium:1064305
Change-Id: I36df2b5d7793be9d6c878b6a1f2ec238603a8205
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19289
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This change adds more resource binding related tests to clarify some
validation rules.
Bug: dawn:359
Change-Id: I16eca96c22c0d5f3f16dce5151bcabfd04d28349
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18940
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
None visibility of shader stage bindings should be supported in
bind group. But Dawn can't support it. The patch fixed this issue.
Bug: dawn:385
Change-Id: I5b747abead24050b56b0fd0a9de561c87df4e36e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19340
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
This is a more accurate name and conflicts less with the callback
request serials.
Bug: none
Change-Id: I0f9660c24468064dadffb3ab9b3392d403f93c41
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19260
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
It's possible though unlikely to overflow the generation for a given
ObjectId. If this happens, an object like a Buffer or Fence could begin
receiving callbacks for previously destructed objects. This CL makes it
so the client doesn't reuse ObjectIds once they've hit the max generation
number so overflow isn't possible.
Bug: dawn:381
Change-Id: I443c1c87d96614a95d1973e2bf18cd702c34b3f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19240
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This is required for the call to the IsWindow function that's in
Surface.cpp.
Bug: chromium:1064305
Change-Id: I0c4a6ed17ba4aada994262d393de142de3f26144
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19282
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
1) size_t >= 0 is always true, and trigger a warning. This is fixed
in the code because I feel such warning is useful to catch bugs.
2) extra statements from TRACE. Also fixed.
Bug: chromium:1064305
Change-Id: I487ff38f6947554fd175a19148c6f2aaaf56ed37
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19300
Commit-Queue: Zhenyao Mo <zmo@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Move the CPU descriptor allocators to the device and bucket them to
ensure only kMaxBindingsPerGroup exist rather than create them per BGL.
Also, renames NonShaderVisible => Staging.
BUG=dawn:155
Change-Id: If6dae368e7e2a2b349343bdf898041a049159038
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19001
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Prior to CMake 3.12 option() is a cache variable operation which meant
that the overriding of third_party project variables in
third_party/CMakeLists.txt needs to write to the cache.
Also remove a couple extra commas that were causing warnings.
Bug: None
Change-Id: I35efce70cf3e0cb923ebdbad654b2b9883b8f734
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19280
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>