This removes the following types and members as well as fixup code
and depraction tests for them:
- wgpu::BindGroupLayoutBinding
- wgpu::BindGroupLayoutDescriptor::bindingCount
- wgpu::BindGroupLayoutDescriptor::bindings
- wgpu::BindGroupBinding
- wgpu::BindGroupDescriptor::bindingCount
- wgpu::BindGroupDescriptor::bindings
Bug: dawn:22
Change-Id: Ifc0e25107f3dcfbb850624cb362909f38c90bec2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21680
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
The new warnings are:
- -Wdeprecated-copy
- -Winvalid-offsetof
- -Wpessimizing-move
And the list of warnings was sorted alphabetically.
Bug: chromium:1072449
Change-Id: I9f3eecae645455c481ecc2e0be4df350e1453907
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20381
Reviewed-by: Zhenyao Mo <zmo@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
GMock generates a lot of code in the destuctor of mock classes, so
factor that in mock_webgpu.cpp instead of compiling the code once for
each file including mock_webgpu.h.
Bug: None
Change-Id: I2b5984e911020eb33457bde9c6a45beaa93b3071
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19725
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
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 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>
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>
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>
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>
Also fixes some warnings when compiling with GCC
Bug: dawn:333
Change-Id: Ib597bb3b950476279a1e20e3556765ec9f1db697
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15960
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
The symbol was not marked as static and would cause linking errors
because it would be defined in multiple translation units. Replace it
with a more traditional C-style #define.
Bug:
Change-Id: I19151884b7e8e171f829ffa47b1d119aff12ff99
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15740
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
In the webgpu-headers PR it was decided that in the C header
WGPUChainedStruct would be included as a member instead of members being
inlined.
See https://github.com/webgpu-native/webgpu-headers/pull/30
Bug: dawn:160
Change-Id: I8caf91f3106578077c80778621a632411da44423
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15441
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This avoids linter checks to trigger when importing updates of Dawn into
Google3.
Bug:
Change-Id: Ib038d8937cc6c294823b56d52b6f2c5e5e24ffac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15140
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This is another step to implement webgpu.h swapchains, Surface is
essentially a union type of all the types of windows that can be used to
create swapchains.
Changes to allow implementing wgpu::Surface and test its creation are:
- Add GLFWUtils.cpp/.h/_metal.mm that contains helpers used to use
WebGPU with GLFW. This deprecates BackendBinding.h that will be removed
when the NXT swapchain is removed.
- Add a `dawn_use_x11` GN variable to factor all the places in BUILD.gn
where we checked whether we should use X11.
- Add a `supports_glfw_for_windowing` GN variable in the main BUILD.gn
file to control which configuration tests and samples using GLFW can be
built.
- Add a ObjCUtils.h to contain some ObjC functionality that we'd need
in files that otherwise would be C++ (so that they can be compiled on
all platforms).
Bug: dawn:269
Change-Id: I25548142a1d1d1f05b0f4d71aa3bdc4698d19622
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15081
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
struct WGPUChainedStruct {
WGPUChainedStruct const * nextInChain;
WGPUSType sType;
};
And changes all the nextInChain to point to such structures. This adds
more type safety to extension structs and requires less casting to check
sTypes and friends.
Bug: dawn:269
Change-Id: I443f363cdb55dbec7c7f6e897245d4a7ea0ebe70
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15080
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This is the first step in making the API before WGPUDevice creation
match webgpu.h and is necessary to implement WGPUSwapChain.
BUG=dawn:269
Change-Id: If92ced42d7683d79e67c02738949ff8b483d22c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14061
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This patch makes the |layout| member of the Render|ComputePipelineDescriptor
optional. If it is not provided, a default layout is created from the
ShaderModules provided and used to replace the layout in the descriptor.
Then, pipeline.GetBindGroupLayout may be called to get the existing, or
the computed bind group layout. If no bind group layout exists at the
provided index, an empty bind group layout is returned.
Bug: dawn:276
Change-Id: I276ed0296a2f1f2d8131fa906a4aefe85d75b3a7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13741
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
This was used to make the distinction between native-only methods that
were those manipulating "natively defined" types, and the rest. Now that
all "natively defined" objects are "callback" instead this name didn't
make sense.
The only relevant thing is that in C there are the Reference and Release
methods that don't appear in dawn.json and shouldn't be exposed on C++
objects. Hence most of the native_methods() calls in the templates are
updated to be c_methods() calls except for the webgpu_cpp templates that
use type.methods directly.
BUG=dawn:22
Change-Id: I65c160b8b8a829e4728862c65bc67268a46f445e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13902
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
This replaces all instances of "natively defined" with callbacks and
adds information about the callbacks arguments so that their typedefs
can be autogenerated in dawn.json.
Also adds all the methods using callbacks to the list of handwritten
client commands so that the wire templates don't try to generate code
for them.
BUG=dawn:22
Change-Id: I30ce01e3e688a16b31efa74d0c94ebafdca00985
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13901
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
This was unnecessary verbosity. Fix this by having the ProcTable
generator using type aliases so all types appear like they have
"Base".
BUG=
Change-Id: I8c472fb924f6ce739e4e41038452381b4f727a2b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13442
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
webgpu.h is the "official" header for WebGPU in native and is being
developed in https://github.com/webgpu-native/webgpu-headers
dawn.h and dawncpp.h are changed to become webgpu.h and webgpu_cpp.h
respectively and use the new naming convention. New dawn.h and dawncpp.h
headers are created that just proxy the types, constants and functions
to their WebGPU counterpart.
Almost no naming change is done in Dawn in this commit, which help check
that the proxying headers work correctly. A couple changes were
necessary, in particular for tests of the internal of dawncpp.h, and a
workaround for a standard library bug for std::underlying_type was
removed because it is no longer needed and got in the way.
Finally since some templates were renamed to match the name of the file
they create instead of using the generic "api" name.
BUG=dawn:22
Change-Id: I12ee22d0b02ccb5b8a52ceccabb3e63ce74da007
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12480
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This patch implements the serialization and deserialization of
DawnDeviceProperties in dawn_wire for the use of serializing this type
of object in Chromium.
BUG=chromium:996713
TEST=dawn_unittests
Change-Id: I1678627a017079540689d8529a1a7e1c975aae61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12240
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
An exported function of libdawn_native wasn't in libdawn_native_sources
instead of libdawn_native which made it not exported on Windows.
BUG=dawn:22
Change-Id: I824f1d4af18f8308b88e1650837cbe62374ace72
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12320
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This will become wgpuGetProcAddress that is part of the webgpu.h and the
last gap in functionality for dawn.h to match webgpu.h.
BUG=dawn:22
Change-Id: I0dcb3b5e6bd99cb10db273fc101d3ec0161b7da0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12120
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
The functionality of the dawn_headers and libdawn targets are split into
the following targets:
- dawn_headers: the new version only exposes the "dawn.h" C API and no
longer includes the C++ API.
- dawncpp: the header and implementation of the C++ API that wraps the
C API. This is unbundled from the rest so the C++ API can be used
with libdawn_proc or other libraries implementing the C API.
- libdawn_proc: A DawnProcTable-backend implementation of the C API.
This is needed because in follow-up commit there will be three libraries
implementing the C API: libdawn_proc that trampolines where we want, and
libdawn_native/wire that don't have trampolines for better perf.
BUG=dawn:22
Change-Id: I5d941f0d98e5a4b633e14d67eb5269f7924f0647
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12160
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This includes several changes to make dawn.h closer to webgpu.h (apart
from the renames and copyright changes):
- Make nextInChain follow the same type convention as the rest of the
header.
- Add defines that allow skipping the procs definition or the functions
declaration part of the header.
- Sort the methods by name for each object.
- Put the callback definition inside extern "C"
- Make the enums typedef have the name of the enum twice.
BUG=dawn:22
Change-Id: I36e4587d60ca43886636ebd19d54752004f4696d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11903
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This prevents bugs where the compiler assumes a piece of memory
will be the same if read from twice.
Bug: dawn:230
Change-Id: Ib3358e56b6cf8f1fbf449c5d564ef85c969d695b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11840
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
We were generating has_member for all pointer members which meant
it was possible to incorrectly pass nullptr for required arguments.
Bug: chromium:1009166
Change-Id: I5e32bab5ccae010468e55897ae9840ab8fda684f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11760
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Optional labels were added to command buffer descriptor and compute pass
descriptor in https://dawn-review.googlesource.com/c/dawn/+/11601.
Sadly, the wire was not updated. This CL fixes support for optional
const char*.
Bug: dawn:22
Change-Id: I23211456f5e3d5f3c0344d8b8cc604bab20015f6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11660
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This is to match the work in progress webgpu.h header.
Also contains a fix for the wire where it wouldn't GetExtraRequiredSize
for structures that are by-value members of other structures.
BUG=dawn:22
Change-Id: I3c706bf9cd7a550d40fd667877f032c860d0a032
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9382
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This adds Push/PopErrorScope to the API with empty implementations which
just call the error callback. Also adds unittests that the wire callbacks
return as expected.
Bug: dawn:153
Change-Id: I63826360e39fbac4c9855d3d55a05b5ca26db450
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10543
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This is to better match the naming of the uncapturederror event
in WebGPU.
Bug: dawn:153
Change-Id: Ic2bc1f46bf3d1f0d14cbd5cb8ea6e54d1679f987
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10542
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This same callback will be used for push/pop error scope.
Bug: dawn:153
Change-Id: I2771539e13f8a4e6a59f13c8082689d25ba44905
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10460
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
DeviceLost is a better name because we don't have a "context" as in
OpenGL.
Bug: dawn:153
Change-Id: Idf7fcb731a0e138f46a81fb31f0d11ff58b4fa96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10541
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This is to match the naming convention of WebGPU's WebIDL and webgpu.h
BUG=dawn:22
Change-Id: Ia91c5a018403e6a72eb0311b5f1a072d102282a2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10461
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This uses the OpenGL debug ouput functionality to make the driver call
us back when an error happens so we can ASSERT and fail.
BUG=dawn:190
Change-Id: I4b6d7a860384dfeccc1c37383fd4cbdc09d7dc05
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9204
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This patch adds MemoryTransfer client/server interfaces and
uses it to implement data transfers for buffer mapping.
This patch also provides a default "inline" implementation of
the MemoryTransfer which is used if the embedder does not
provide one on initialization.
Because implementations of MemoryTransfer perform their own
serialization, a skip_serialize option is added to WireCmd records.
Bug: dawn:156
Change-Id: I2fa035517628a3ad465b0bc18a6ffc477e2bd67f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8642
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Following WebGPU spec change at https://github.com/gpuweb/gpuweb/issues/331,
bind groups in Dawn now use the whole size of the buffer if binding buffer
size is UINT64_MAX.
Bug: dawn:22
Change-Id: If28d905e634432755dad5c67c69eadedcee53dfe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8863
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Following WebGPU spec change at https://github.com/gpuweb/gpuweb/issues/347,
the rasterizationState from GPURenderPipelineDescriptor should not be
required anymore.
BUG=dawn:22
Change-Id: Ic458396665a7e2fbd942aa7f50138cc96497ff33
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9000
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
This adds almost all default values in descriptors that are present in
WebGPU to the C++ interface for Dawn.
This also fixes the indentation of dawncpp.h both by reindenting the
template, and making the indentation counting in generator_lib.py more
precise.
BUG=dawn:22
Change-Id: I9a852d26f78a3349f3d6eee7237407d1cf8ca426
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8680
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
This completely removes the dependency on glad by generating the GL
headers from gl.xml directly.
This requires adding khrplatform.h so all Khronos dependencies are
gathered in third_party/khronos.
Also removes a stray CMakeLists.txt that was still hanging out.
BUG=dawn:165
Change-Id: Ia64bc51bc8b18c6b48613918e2f309f7405ecb3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8163
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This makes the OpenGL entry points loaded at Adapter creation from the
getProcAddress passed in the DiscoveryOptions and update all GL calls in
the backend to go through the new OpenGLFunctions object.
A code generator is added that generates the function loader and list of
GL procs from Khronos' gl.xml file but we can't get rid of glad yet
because it is used to have the PROC typedefs and enum values.
BUG=dawn:165
Change-Id: I2a583d79752f55877fa4190846f5be16cf91651a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7983
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This requires some changes in the wire because WireCmd doesn't know the
size of void. This also adds a handwritten implementation of the Wire
commands for SetSubData that internally converts to uint8_t so that
WireCmd can generate the de/serialization.
BUG=dawn:160
Change-Id: Icbf0fd7dd841639ee6f67333844e027b27a8afcc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7780
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This initial reasoning for having a u64 userdata was to be able to pack
two u32s in a single userdata but that was never used, and made a bunch
of code uglier than it should.
BUG=dawn:160
Change-Id: Ia0d20bc23f09f5d8f3748ca4edd1a331604f2ba8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7561
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This is the first command to return a struct. This patch also
updates the code generator to support structure return values.
Bug: dawn:7
Change-Id: Ie8acec895c0ec88429672138ffc900032fbbc447
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/4780
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This removes blocks of code that were obviously builder-specific but
also removes the ObjectStorage::valid member that was used to implement
the maybe monad on the wire server side. This is no longer needed since
dawn_native handles the maybe monad internally now.
BUG=dawn:125
Change-Id: I8c30daae9fc70853bc1996d85a860b4877c5976c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6161
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This requires deleting wire tests for builders that were using it, and
leads to small simplifications in the WireTest harness. Also allows
removing the BuilderBase class from dawn_native.
BUG=dawn:125
Change-Id: I3cbac609207aa652cdc9d37e0b700cce3ac6e093
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6120
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This changes Wire tests to produces errors on "uninteresting calls" and
flushes mock expectations on client/server flushes so that we control
100% of the order of calls.
BUG=941543
Change-Id: I6eabc79dde2abb564e54df90c5c0e615fd4496c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6040
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This is to match Chromium style.
Change-Id: Ic97cc03e2291c653ade9662ba3d5e629872b10ad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5482
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This adds an option to dawn_generator to generate files in a different
directory so the generated stay at the same place. Otherwise compilation
errors occur because of stale versions of the headers on the CQ
builders.
BUG=dawn:61
Change-Id: I71ceb3172b5a4e35911973a03be29d90fa684416
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5304
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This is part of making buffer mapping match WebGPU
Bug: dawn:7
Change-Id: Ia97c872e398112aef0f93c98618c8a7f3ff0c19a
Reviewed-on: https://dawn-review.googlesource.com/c/4580
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@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>
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>
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>
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 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>
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>
An old-style builder might become an error object when a
validation error occurs on one of its methods. It still has
to be freed, so the correct check for "destroy" is to check
that the handle is not null.
BUG=chromium:914819
BUG=chromium:914867
BUG=chromium:914964
BUG=chromium:915083
Change-Id: I349faffa48f369b72c603d47dd23ffae7d86891e
Reviewed-on: https://dawn-review.googlesource.com/c/3323
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
PostHandleQueueSignal assumed that fence was not null because QueueSignal
generates an error if it is. The errors are not surfaced immediately so
this additional check is needed before doing the post-handler.
Bug: chromium:914808
Change-Id: I2a99f5229712d49d3c9a2d1f3f2dd1009247a24c
Reviewed-on: https://dawn-review.googlesource.com/c/3280
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This reverts commit 672d29d14c.
Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=913171
Original change's description:
> Create new src/tests BUILD.gn file.
>
> Move all test-related build stuff into its own BUILD.gn file. This
> required moving the dawn_generator template into a common file, so it
> can be called by both BUILD.gn and src/tests/BUILD.gn.
>
> [This is a reland of https://dawn-review.googlesource.com/c/dawn/+/2940
> with a fix for mock_dawn.]
>
> Bug: dawn:61
> Change-Id: Id1e6d0c2b07caa2610cebe206511e972ac18fe8d
> Reviewed-on: https://dawn-review.googlesource.com/c/3020
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Stephen White <senorblanco@chromium.org>
TBR=cwallez@chromium.org,kainino@chromium.org,senorblanco@chromium.org
Change-Id: I54cdc558b128935dc8a8d22ec2b5e879271c35ae
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:61
Reviewed-on: https://dawn-review.googlesource.com/c/3080
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Move all test-related build stuff into its own BUILD.gn file. This
required moving the dawn_generator template into a common file, so it
can be called by both BUILD.gn and src/tests/BUILD.gn.
[This is a reland of https://dawn-review.googlesource.com/c/dawn/+/2940
with a fix for mock_dawn.]
Bug: dawn:61
Change-Id: Id1e6d0c2b07caa2610cebe206511e972ac18fe8d
Reviewed-on: https://dawn-review.googlesource.com/c/3020
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
The fuzzer is correctly detecting leaks when an object is created but
not freed through the wire. It isn't clear yet if we want leftover
objects to be freed by the wire of by the Device itself, but in the
meantime we make the wire free them to fix the fuzzer issues.
BUG=dawn:59
Change-Id: Id7bff93e60a52e1f833f31b1eb3bfd30f8fe4215
Reviewed-on: https://dawn-review.googlesource.com/c/2566
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Fence::GetCompletedValue introduced the first return value that's not an
object which reinterpret_cast to its own type. MSVC complains about it,
so instead we reinterpret_cast only if the value is an object.
BUG=
Change-Id: I35225cd1ff47a91868572a45a67ebe979e4b064f
Reviewed-on: https://dawn-review.googlesource.com/c/2942
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Without this the serialize step failed to increment the pointer to
the buffer to account for the recording of "main" in the render
pipeline descriptor:
descriptor->vertexStage->entryPoint = "main";
BUG=dawn:4
Change-Id: Ic3829787af2213577ac67ee93625679afdae1cc9
Reviewed-on: https://dawn-review.googlesource.com/c/2880
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
(It's not clear to me why only some projects/compilers are complaining
but other parts of the code are using the explicit namespace.)
Change-Id: I24b0c3b8104932b4ec82a25f5eb96c08abff87b5
Reviewed-on: https://dawn-review.googlesource.com/c/2901
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This change implements timeline fences in Dawn.
It includes methods and descriptor members to eventually
support multi-queue, but does not implement them.
Bug: dawn:26
Change-Id: I81d5fee6acef402fe099227a034d9669a89ab6c3
Reviewed-on: https://dawn-review.googlesource.com/c/2460
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
In preparation for the descriptorization of BindGroup, support was added
to treat wire ID 0 as nullptr for a bunch of objects. Now that we have a
fuzzer for the wire+frontend, we need to validate when we have a 0 id.
Either the wire needs to reject the ID or the frontend needs to validate
against nullptrs. Since only few entrypoints will have a use for
nullptrs (bind groups, render pass resolve textures), we require an
opt-in in the JSON file for a structure member or an argument to be
optional.
This disables the tests related to ID 0 = nullptr, because we don't yet
have optional argument/members in dawn.json.
BUG=chromium:905273
BUG=chromium:906418
BUG=chromium:908678
Change-Id: If9a3c4857db43ca26a90abff2437e1cebb0ab79b
Reviewed-on: https://dawn-review.googlesource.com/c/2704
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
When generating the proc tables for dawn_native and dawn_wire (for the
client), we were casting between function pointers with the C types and
function pointers with the internal types. This is UB and was caught by
UBSan.
Replace casts between function pointers by casts between types inside
the functions themselves.
BUG=chromium:906349
Change-Id: Icd8f6eedfa729e767ae3bacb2d6951f5ad5c4c82
Reviewed-on: https://dawn-review.googlesource.com/c/2400
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This removes the need for Clone() so it is removed and also adds tests
for the new constructors.
BUG=dawn:11
Change-Id: Ia45c765c2d30e40b0e036427793a62327b2008fc
Reviewed-on: https://dawn-review.googlesource.com/c/1901
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
At this point this change is a noop, however encoders introduced in
follow-up patches aren't builders and thus won't have the fluent syntax.
BUG=dawn:5
Change-Id: Idc5f327a1a7788c3ba16a50491aefb054700f257
Reviewed-on: https://dawn-review.googlesource.com/1540
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Instead make them have the same name as their typedef. This is because
anonymous structures is considered bad practice in C because it prevents
forward declaring them.
BUG=
Change-Id: I2d7a788a0d807a2689567d0bb220adaf5335e07a
Reviewed-on: https://dawn-review.googlesource.com/1521
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
BUG=dawn:13
Change-Id: I7a224503d0a33ef148e63b8327a6a53df1b3868a
Reviewed-on: https://dawn-review.googlesource.com/1520
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
The error type will help distinguish between validation errors, context
losts and others which should be handled differently.
Take advantage of advantage of this to change DAWN_RETURN_ERROR to
"return DAWN_FOO_ERROR" to have the return be more explicit. Also
removes usage of DAWN_TRY_ASSERT for more explicit checks.
Change-Id: Icbce16b0c8d8eb084b0af2fc132acee776909a36
We still keep a dummy BufferBuilder object around so that it can be used
for the builder error callback tests of the wire.
Change-Id: If0c502bb8b62ee3ed61815e34e9b6ee6c03a65ef
This required putting Queue::Submit on QueueBase which is something we
would want to do anyway, and removes the need for Queue::ValidateSubmit
being called in the ProcTable.
This removes the need for all the "GeneratedCodeIncludes" files and
leads to a bunch of simplifications in BindGroup as well as the
dawn_native CMakeLists.txt.
Finally this was done in order to simplify the writing of BUILD.gn
files.
Also moves the TerribleCommandBuffer to utils:: because it isn't part of
the implementation of the wire, renames dawn::wire to dawn_wire, moves
src/wire to src/dawn_wire and puts the interface of dawn_wire in
src/include/dawn_wire.
The dawn.h and dawncpp.h structure definitions references dawnFoo or
dawn::Foo respectively when it should reference dawn_native::FooBase* in
dawn_native. Autogenerate files to declare the dawn_native version of
the structs and change the ProcTable generation to use it instead.
This is important to make libdawn_native a shared library because
currently it was depending on dawncpp's definition of .Get().
When a MapReadRequestCallback arrived late and hit one of the early out
of the handler (for example if the buffer was already unmapped), the
handler wouldn't consume the data payload of the command. This would
cause the command buffer pointer to not be advanced enough and point to
random data instead of the next command.
Methods, when their arguments are stored in a structure, are very
similar to structures (duh?) Take advantage of this to factor the
[de]serialization code between them and not just memcpy structures
around. This will allow structures to contain objects, and pointers to
other structures / array of objects etc.
The flow of commands is a bit more involved than for MapReadAsync and
goes like this:
- C->S MapAsync isWrite = true
- S: Call MapWriteAsync
- S: MapWriteAsync callback fired
- S->C: MapWriteAsyncCallback (no data compared to the read case)
- C: Call the MapWriteAsync callback with a zeroed out buffer
- C: Application calls unmap.
- C->S: UpdateMappedData with the content of the mapped pointer
- S: Copy the data in the mapped pointer
- C->S: Regular unmap command
- S: Call unmap
Makes nxt_end2end_tests -w pass all tests.
Also duplicates the MapRead wire tests for the write cases
This will help with follow-up changes that add support for a more
complete grammer of types, including structures containing pointers
to objects or other structures.
Instead of having the wire::Client and wire::Server directly act on
buffer memory, a couple interfaces are introduced so that WireCmd can do
things like get the object<->id mapping and temporary allocations.
While the serialization and deserialization of most commands was moved
into WireCmd, the commands that don't directly correspond to NXT methods
have their logic moved inside Client and Server and will be made to
expose the new interface in a follow-up commit.
When calling unmap on a mapped buffer for which the callback hasn't
fired yet, the callback should be called with UNKNOWN. The code marked
the callback as called only after calling it, causing problems with
re-entrancy where the callback would be called twice.
This could also get triggered by destroying the buffer inside the
callback.
Fix this in backend::Buffer and the WireClient and add test for both.
The templates will live in the Chromium prototype. This also removes
the blink/ prefix from the Blink template filenames as this won't be
present in anymore.
* clang/gcc: enable -pedantic warnings
* suppress a GCC-specific warning in stb_image
* And some clang-specific warnings
* -Wconversion (clang) -Wold-style-cast (clang+gcc)
and fix a few warnings that show up with these (and a few more with
-Wconversion on gcc, even though that's not enabled by default)
* bunch more warnings
* fixes
* remove merge error
This macro has some advantages over the standard library one:
- It prints the place where the macro was triggered
- It "references" the condition even in Release to avoid warnings
- In release, if possible, it gives compiler hints
It is basically is stripped down version of the ASSERT macros I wrote
for the Daemon engine in src/common/Assert.h
This commit also removes the stray "backend" namespaces for common/
code.
This directory used to contain both the state tracking code for the
backends, and the common utilities that could be used both by the
backends and the rest of the code. Things are now:
- src/common is utility code for the whole repo
- src/backend contains libNXT's code
- src/utils is utility code that we don't want in libNXT
This commit also changes all includes to use global paths from src/
bacause it had to touch a bunch of #include statements anyway.
This adds support for "natively defined" API types like callbacks that
will have to be implemented manually for each target language. Also this
splits the concept of "native method" into a set of native methods per
language.
Removes the "Synchronous error" concept that was used to make builders
work in the maybe Monad, this will have to be reinroduced with builder
callbacks.