Commit Graph

273 Commits

Author SHA1 Message Date
Kai Ninomiya 05863e62f3 Niceify formatting in webgpu_cpp
Since now there's a copy (slightly hand-modified) saved into
Emscripten: https://github.com/emscripten-core/emscripten/pull/11737

Bug: None
Change-Id: I2677400f9e69a7fcd71f89bdaa04c642be357151
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26005
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-07-30 19:02:43 +00:00
Kai Ninomiya 01aeca22a9 Add .clang-format files and format more files
The .clang-format files tell clang-format to ignore certain directories
(replacing code in lint_clang_format.sh which will be removed).

$ git ls-tree -r master --name-only | grep '\.\(c\|h\|cpp\|gn\|gni\|mm\|m\|py\)$' | xargs ./append-space-to-files
$ git checkout -- generator/templates third_party/khronos/{KHR,vulkan}
$ git cl format --full --python

Followed by manual reformatting of a few things in Python for
readability.

Bug: none
Change-Id: I4c9e472cc9a5cd80c07286e808f4e597cfef5428
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24785
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-07-15 19:51:17 +00:00
Kai Ninomiya 9da11c990f Fixes for Emscripten generators
Bug: none
Change-Id: I9b4f7843e2b401776a868d33335a9df027c13511
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24881
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-07-15 08:57:49 +00:00
Corentin Wallez 0d52f800a1 Implement Buffer::MapAsync
MapAsync in dawn_native is fully implemented and only missing
a couple cleanups that can be done once MapRead/WriteAsync are
removed.

MapAsync in dawn_wire is left as a pure shim on top of
MapRead/WriteAsync and will be transitioned to its own commands
in follow-ups.

All MapRead/WriteAsync end2end and validation tests are duplicated
for MapAsync.

Bug: dawn:445

Change-Id: Ib1430b9257149917be19a84f13e0ddd2a8eccc32
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24260
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-07-14 12:30:14 +00:00
Corentin Wallez 00d6215be9 dawn_wire/client: Add ToAPI and FromAPI helpers.
In the client code, we often need to translate between WGPUObject (the
API type) to Object* (the internal client type). This added a bunch of
reinterpret_casts that make the code less readable and more fragile.

This CL adds FromAPI and ToAPI helpers in the autogenerated
ApiObjects_autogen.h header, that convert between API and internal types
in a type-safe way.

Bug: dawn:445

Change-Id: Ia1bf624f0315ced496b95cb660adf88abd916d71
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24063
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-06-30 18:39:50 +00:00
Corentin Wallez 2f616dd108 dawn_wire: Remove client/ApiProcs_autogen.h
This header was only used to call DeviceCreateErrorBuffer and
DeviceInjectError that are used in some handwritten client commands.
We remove the need for the header by making these two commands
handwritten.

This also improves readability, previously injecting errors read:

  ClientDeviceInjectError(reinterpret_cast<WGPUDevice>(device),
                           WGPUErrorType_Validation,
                           "Some validation message");

And now reads:

  device->InjectError(WGPUErrorType_Validation, "Some validation message");

Bug: dawn:445

Change-Id: Ie11570aacf3036e13abd174d91670ecb84661226
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24080
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-06-30 18:26:30 +00:00
Corentin Wallez d411726003 dawn_wire: Make ApiProcs call into objects directly.
This CL modifies code generation so that the generated client procs call
the handwritten methods on client objects directly.

Previously the flow was:
  - wgpuBarDoStuff
  - ClientBarDoStuff
  - ClientHandwrittenBarDoStuff
  - client::Bar::DoStuff

With this CL the flow is:
  - wgpuBarDoStuff
  - ClientBarDoStuff
  - client::Bar::DoStuff

This required adding Buffer creation methods on client::Device instead
of calling client::Buffer static methods directly.

Bug: dawn:445

Change-Id: I1b332b71ac7a03685afcf8fd0617d3d27da468cf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24062
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-06-30 18:01:50 +00:00
Corentin Wallez 90abd47a28 dawn_wire: Factor the common command serialization pattern.
Bug: dawn:445

Change-Id: I15a99a126c0494fd06dd727ff5c9008cde675d76
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23560
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-06-19 16:49:43 +00:00
Corentin Wallez 84ae2bfe3b Remove deprecated "Binding" types and members
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>
2020-05-13 17:05:55 +00:00
Corentin Wallez 00b90ea832 Enable more warning needed for Skia to build with Dawn on Linux
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>
2020-04-24 17:02:53 +00:00
Corentin Wallez 59382b7d3f Use python3 for all of Dawn's python scripts
Bug: dawn:389
Change-Id: I5034ab2791f0cca0b7690eae5f4d7f4e6efc4bd9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19863
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-17 20:43:07 +00:00
Corentin Wallez 3741f7373c Factor compilation of ~MockProcTable in mock_webgpu.cpp
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>
2020-04-16 18:08:23 +00:00
Corentin Wallez f941205370 Use new gmock MOCK_FUNCTION macro.
Bug: None
Change-Id: If436fbf5c2392051caeadfc4a7482544d565b597
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19720
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-16 16:39:06 +00:00
Austin Eng ba72944d3d dawn_wire: Validate all objects are from the same device in the client
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>
2020-04-15 17:58:25 +00:00
Corentin Wallez 0ff7ed41ec Remove CreateBufferMappedAsync
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>
2020-04-15 13:53:15 +00:00
Austin Eng 518c8e77ab Cleanup: Rename dawn_wire Object "serial" to "generation"
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>
2020-04-13 17:50:51 +00:00
Zhenyao Mo 5b7292c8f8 Fix more compilation warnings.
Bug: chromium:1064305
Change-Id: I3aac24f8179d2c9e5206dd4542ea2506f26755e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19301
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@google.com>
2020-04-11 03:22:33 +00:00
Corentin Wallez ce100347eb Fix a -Wstrict-prototypes
Bug: chromium:1064305
Change-Id: I06c5feb2f43e00d4991a8a244175d79b8ad987d9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18962
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-07 16:09:27 +00:00
Corentin Wallez c3c6694d8f Rename BG[L]Binding to BG[L]Entry
This is to match the WebGPU API change.

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

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

Bug: dawn:22
Change-Id: I1377eef9ea9816578441c91d167909dedc7f8e96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18863
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-04-07 07:11:12 +00:00
Austin Eng 76a8d0b92f Support chained extension structs on the wire
This CL also adds a couple of dummy extensions in dawn.json so that
the serialization/deserialization in the wire can be tested.

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

Bug: dawn:269

Change-Id: Ie13b33a4f9ac2e1f5f98b3723d83cf1c6205c988
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17965
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-01 12:07:43 +00:00
Corentin Wallez e51f8dd09a Fix compilation with stdlibc++ (instead of libc++)
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>
2020-02-18 02:44:05 +00:00
Corentin Wallez 713d9cbf93 webgpu.h: Fix WGPU_WHOLE_SIZE causing linking errors.
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>
2020-02-10 20:25:36 +00:00
Corentin Wallez 7fe6efba4a Add initial CMakeLists.txt files
Adds CMake support for:
 - Generating the Dawn headers and C++ wrappers
 - libdawn_wire
 - libdawn_native with the Metal backend for now
 - All the examples.

Bug: dawn:333

Change-Id: I6ffbe090b0bd21d6a805c03a507ad51fda0275ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15720
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2020-02-05 17:16:05 +00:00
Reid Kleckner 48e7da791f Use dict.items() instead of dict.iteritems() for py3 compat
iteritems() went away in Python 3.

R=kainino@chromium.org

Bug: 941669
Change-Id: I0c107aaa35bb1df7c126485c33c3d15cb77f03fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15560
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-01-30 01:25:08 +00:00
Kai Ninomiya 7b6246a2ad Generators for Emscripten
api_struct_info.json:
//* This generator is used to produce part of Emscripten's struct_info.json,
//* which is a list of struct fields that it uses to generate field offset
//* information for its own code generators.
//* https://github.com/emscripten-core/emscripten/blob/master/src/struct_info.json

library_webgpu_enum_tables.js:
//* This generator is used to produce the number-to-string mappings for
//* Emscripten's library_webgpu.js.
//* https://github.com/emscripten-core/emscripten/blob/master/src/library_webgpu.js

Change-Id: I4704509737cde4685a093eb484dd977e5a106d19
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15240
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-01-28 23:54:38 +00:00
Corentin Wallez 13e2e139a5 Update WGPUChainedStruct usage to match webgpu.h
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>
2020-01-25 09:30:40 +00:00
Corentin Wallez 1bf3167ce6 Add a proper license to webgpu.h's template.
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>
2020-01-15 15:39:12 +00:00
Corentin Wallez 3a1746e71c Introduce wgpu::Surface and implement it for HWND, X11 and Metal
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>
2020-01-15 13:14:12 +00:00
Corentin Wallez 2b24c3d92d webgpu.h introduce a base struct for extension structures.
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>
2020-01-15 09:54:42 +00:00
Corentin Wallez 5fc2c82c11 Add Instance and CreateInstance to webgpu.h
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>
2020-01-10 13:06:48 +00:00
Natasha Lee 9bba4a936e Add DeviceLostCallback to dawn.json and dawn_wire
Bug: dawn:68
Change-Id: I6d8dd071be4ec612c67245bfde218e31e7a998b8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14660
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-12-18 18:59:20 +00:00
Corentin Wallez 84d836295e Remove generation of proxy dawn.h and dawncpp.h
BUG=dawn:22

Change-Id: Iee8b93fddf2f4aced72bb12062ffae6dddc336ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14260
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-12-06 08:34:49 +00:00
Corentin Wallez 20c014cee7 Fix typo in the name of wgpuGetProcAddress
BUG=dawn:22

Change-Id: Id8213f1d06313d0ab1ee5845e892f88ff803fbc2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14060
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-11-26 17:28:11 +00:00
Austin Eng f6eb890f4c Implement getBindGroupLayout
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>
2019-11-22 17:02:22 +00:00
Corentin Wallez aca8c4a528 Remove the concept of "native_methods" in the generators
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>
2019-11-22 14:02:52 +00:00
Corentin Wallez 540ababb6b Introduce a "callback" type in dawn.json
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>
2019-11-22 13:18:22 +00:00
Corentin Wallez 321c12255e Remove the "Base" from pure-frontend dawn_native types
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>
2019-11-13 17:00:37 +00:00
Corentin Wallez 45b51f5df7 Make unittests and fuzzers use webgpu.h
BUG=dawn:22

Change-Id: Iff5465ad7a9456f9c6b2ee380af748b3afc129b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12741
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-28 22:15:47 +00:00
Corentin Wallez 9f90c8d3ca Make dawn_native public headers and dawn_wsi use webgpu.h
BUG=dawn:22

Change-Id: I112d71323c9305fa0997d251556fe0a41dafed29
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12701
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-10-24 23:55:37 +00:00
Corentin Wallez 1fdcb16b69 Make dawn_wire use the webgpu.h header
BUG=dawn:22

Change-Id: I4963aa27322086e74947a1a6265c921e2c7d3d85
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12700
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-24 22:27:27 +00:00
Corentin Wallez 1f6c8c4d54 Make dawn_native use the webgpu.h header
BUG=dawn:22

Change-Id: I66e2d998f5e09030e40ec88813cd65c492018fd0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12541
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-10-23 11:57:41 +00:00
Corentin Wallez 2c8b5c6370 Introduce the webgpu[_cpp].h headers.
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>
2019-10-21 20:04:10 +00:00
Jiawei Shao 5c2f5f3961 Implement serialization/deserialization of DawnDeviceProperties
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>
2019-10-20 03:01:56 +00:00
Corentin Wallez 919812ed1c Use webgpu.h's bitmask type definitions.
BUG=dawn:22

Change-Id: Ib7cf75a1411a6ed86cc5abb1218beb924dbb9001
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12260
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-17 08:46:07 +00:00
Stephen White f104ec23bc Fix missing #include.
BUG=

Change-Id: I2e659e9f86ef4757915aeb07ec96a83ea904cb1c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12340
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-10-16 15:36:12 +00:00
Corentin Wallez e180b591d1 Fix compilation with shared_library components on Windows
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>
2019-10-16 15:31:31 +00:00
Austin Eng cc071e45bb Split generation of dawncpp headers from libdawncpp
libdawn_native also requires the dawncpp headers. When we separated
libdawn_cpp from the dawn_headers, libdawn_native lost the cpp headers
and caused a compile failure. This patch separates the dawncpp headers
as a separate target so both libdawncpp and libdawn_native can depend
on them.

Bug: dawn:22
Change-Id: I4172f1654377afac8c4314123ee8b5b81dc7c928
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12300
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-10-16 10:26:01 +00:00
Corentin Wallez c57b180208 Add dawnGetProcAddress.
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>
2019-10-15 12:08:48 +00:00
Corentin Wallez 96496828a0 Split the libdawn target in components with a single purpose.
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>
2019-10-15 11:44:38 +00:00
Austin Eng b0cdf95213 Fix compilation with MSVC of volatile assignment operator
Bug: dawn:230
Change-Id: Ie6e4ddf52132a6980d86c9d80524385b51d9d0d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12200
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-10-15 07:30:35 +00:00
Corentin Wallez 97231682d0 Make dawn.h closer to webgpu.h
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>
2019-10-08 07:38:01 +00:00
Austin Eng 8eb8385e2e dawn_wire: Tag deserialize commands with volatile pointer
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>
2019-10-07 20:38:47 +00:00
Austin Eng 4379e8f34f dawn_wire: Only generate has_member for optional members
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>
2019-10-02 06:35:08 +00:00
François Beaufort f622a44750 Fix support for optional const char*
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>
2019-09-27 21:25:43 +00:00
Corentin Wallez a9a84dfe1e BUILD.gn: Delete stale generated files in Dawn's gen dir.
This normalizes even more the directory structure of generated files in
Dawn and removes stale autogenerated files that could be included
wrongly using a GN action.

See comment on top of dawn_generator.gni in this commit for more
context.

BUG=dawn:22

Change-Id: I8ec038f949c048431b2b643af4462f98c4ae610b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11361
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-19 23:30:42 +00:00
Corentin Wallez 05623df97f BUILD.gn: Add a check generated files are in allowed dirs.
This is important so that we know that the list of allowed directories
is in sync with other parts of the build in follow-up commits.

BUG=dawn:22

Change-Id: I202bec55b510989e43acf497956e2937c9a2f60a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11360
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-18 23:19:31 +00:00
Corentin Wallez 897ebc7a71 Normalize generated file paths to match main tree.
Previously dawn_native files were in src/dawn_native/ while generated
files were in dawn_native/. This makes some things complicated when
integrating in other source trees so normalize all generated files to be
in paths that match the main tree.

BUG=dawn:225

Change-Id: I5b3e04d37a16251143578dfb7a31445b229fe4ac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11300
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-18 04:33:12 +00:00
Corentin Wallez 45f9185de5 generator_lib.py: correctly handle lack of --jinja2-path.
Python's list.index() method raises an exception when the item isn't
present in the list. Fix this check that was instead expecting a
negative index.

BUG=dawn:225

Change-Id: I8e67d71ff7384f49533a95d5cbe04da1cf7bb0bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11301
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-09-18 00:59:40 +00:00
Corentin Wallez c6c7a42e6e Remove indirection for vertexStage
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>
2019-09-05 09:35:07 +00:00
Austin Eng 45238d775a Add empty implementations of Push/PopErrorScope
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>
2019-09-04 22:54:03 +00:00
Austin Eng 45ea7e66bf Rename SetErrorCallback to SetUncapturedErrorCallback
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>
2019-08-27 21:43:56 +00:00
Austin Eng cb0cb658d4 Rename DeviceErrorCallback to ErrorCallback and add ErrorType arg
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>
2019-08-27 21:41:56 +00:00
Austin Eng 5603dc9044 Rename ContextLost to DeviceLost
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>
2019-08-27 18:10:03 +00:00
Corentin Wallez 9e9e29f7a6 Remove Bit from TextureUsageBit and BufferUsageBit
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>
2019-08-27 08:21:39 +00:00
Kai Ninomiya 93196db8ef Implement new defaults for Texture::CreateView
https://github.com/gpuweb/gpuweb/pull/389 except for removing createDefaultView
https://github.com/gpuweb/gpuweb/pull/407

This will need to slightly change again when
https://github.com/gpuweb/gpuweb/pull/424 lands.

Bug: dawn:214
Change-Id: Id904b55cea6d77fcf7d971bd743468c7d82a9aa8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10440
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-08-26 22:51:19 +00:00
Jiawei Shao 9d9d76c590 OpenGL: Support B2T and T2T copies with BC formats
This patch implements the creation, buffer-to-texture copies and
texture-to-texture copies with BC formats on OpenGL backend. Note that
OpenGL SPEC also has the same issue about texture-to-texture copies
with compressed textures as Vulkan SPEC, so we have to skip the related
case.

The texture-to-buffer copies with BC formats and related end2end tests
will be supported in the following patches.

BUG=dawn:42
TEST=dawn_end2end_tests

Change-Id: I76b16862259cb2df77f202ed7ed433d41aa3cd47
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10220
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-08-22 08:19:13 +00:00
Corentin Wallez ba84fb2977 OpenGL: Add support for backend validation
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>
2019-07-22 10:02:49 +00:00
Austin Eng 6a5418a760 Add MemoryTransfer interfaces to the wire
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>
2019-07-19 16:01:48 +00:00
François Beaufort 0326b8012b Use whole size of buffer if binding buffer size is UINT64_MAX
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>
2019-07-17 08:54:19 +00:00
François Beaufort 4af9808400 Make rasterization state descriptor optional
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>
2019-07-16 17:01:59 +00:00
Corentin Wallez 8f93871dff Add default values to dawn.json for dawncpp.h
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>
2019-07-08 19:20:22 +00:00
Corentin Wallez 7ac0815347 dawn_json_generator: Assert that enum values are unique.
This will be useful when we add all texture formats because there are
more than 50 of them and we want to make sure no two enum values
collide.

BUG=dawn:128

Change-Id: I928d3311ee3f6422ea503a3fa90c5e377fe5e03d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8360
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-26 19:54:43 +00:00
David 'Digit' Turner 5dee3e826b [generator_lib]: Make generator_lib.py easier to reuse.
This CL tries to make generator_lib.py easier to reuse in
other projects (e.g. non Dawn-related), by doing the following:

- Removing dawn-specific variables from the script and
  replacing them by path-relative defaults, or through
  additional command-line parameters (e.g. --root-dir can
  now be used to pass the root source directory for Python
  dependency computations).

- Move project-agnostic processing from dawn_generator
  GN template into a new generator_lib:generator_lib_action
  template. The new generator_lib.gni file does not
  contain Dawn-specific settings and can be reused more
  easily outside of Dawn.

+ Replace --extra-python-path with --jinja2-path to be
  more explicit.

+ Add a few documentation comments in the Python scripts.

R=cwallez@chromium.org

Bug: NONE
Change-Id: I3e89f4bc32bdb6a019d251473222c6ce5cdc5f9f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8280
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-06-24 14:31:06 +00:00
Corentin Wallez 8f4046b0b6 Remove glad and replace it with our own GL header
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>
2019-06-17 09:17:29 +00:00
Austin Eng 21eba761b5 Implement CreateBufferMappedAsync in dawn_wire and dawn_native
Bug: dawn:7
Change-Id: I1a4e5eece53d83a4c5395ba6b41df2e20668c5bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8120
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-06-14 17:35:56 +00:00
Corentin Wallez df69f24824 OpenGL: Don't use glad to load OpenGL entrypoints
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>
2019-06-13 10:22:32 +00:00
Corentin Wallez 031fbbbaa1 Generators: main.py is now dawn_json_generator.py
This merges all the files for main.py together again except
generator_lib.py because there doesn't seeem to be a good way to
separate the pure dawn.json generators and the dawn wire generator.

Also updates the GN templates to make it easier to define new generators
based on generator_lib, and move the Jinja2 template "stdlib" to
generator_lib.py

BUG=dawn:165

Change-Id: I1b5b2ef0a59cb142e214f3af9a58048a88ae949a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7880
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-11 18:03:05 +00:00
Corentin Wallez 0c38e92187 Split off the reusable part of the code generator
This is in preparation for using it to generate code for replacing glad
with our own OpenGL function pointer loading code.

BUG=dawn:165

Change-Id: Ic3e774ab207e85a1491f299ad06131c8095416ae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7781
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-06-07 08:59:17 +00:00
Corentin Wallez 67ab1ea8c7 dawn.json: Use void* instead of uint8_t* for data pointers
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>
2019-06-06 16:19:15 +00:00
Corentin Wallez 839053b90c Replace dawn::CallbackUserdata with void*
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>
2019-05-29 13:03:50 +00:00
Austin Eng 3a8aa31d88 Rename .inl to .inc
Bug: chromium:964411
Change-Id: Iff1ff8aadccd3e6ce6abefed983f23241dc19edf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7341
Commit-Queue: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-05-17 20:42:33 +00:00
Austin Eng 740995c0b1 Implement CreateBufferMapped in dawn_native for MAP_WRITE buffers only.
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>
2019-05-15 18:55:22 +00:00
Austin Eng cf52d711fb Change buffer-related sizes/offsets to be uint64_t
Bug: dawn:121
Change-Id: I9d88e2b2b8eff4eda98d25ae0922bc07199a69c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5720
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-04-05 20:51:29 +00:00
Corentin Wallez 4f5fc2d325 Nuke Builders part 4: headers, proctable and miscreferences
BUG=dawn:125

Change-Id: If1b2feb1b0880eb8ad168cfabb9d67ece4f02190
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6220
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-04-01 21:48:38 +00:00
Corentin Wallez cb2c64f7d9 Nuke Builders Part 2: remove all builder code from wire
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>
2019-04-01 21:04:17 +00:00
Corentin Wallez 0ae00a187d Nuke Builders Part 1: remove the testing BufferBuilder.
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>
2019-03-28 17:12:47 +00:00
Corentin Wallez d754fb2034 Make Wire tests more strict w.r.t. expectations
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>
2019-03-28 10:44:41 +00:00
Austin Eng 45f9730855 Capitalize C types dawn -> Dawn
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>
2019-03-11 16:52:42 +00:00
Corentin Wallez 579cf621f3 Split off common and libdawn / dawn_headers from BUILD.gn
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>
2019-03-07 01:46:39 +00:00
Corentin Wallez abc753c9c9 BUILD.gn: Split dawn_component/generator in their own files
This will allow follow up commits to use them from the different parts
of the split-off BUILD.gn file.

BUG=dawn:61

Change-Id: I767f6c97c06ee73290d3df482880d1a2df92e187
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5301
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-03-06 23:17:39 +00:00
Austin Eng 1541c8ba7a Remove |start| and |size| from buffer mapping
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>
2019-02-14 19:31:17 +00:00
Corentin Wallez f872e6924c Wire: Add support from optional struct/integer const*
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>
2019-02-13 10:15:38 +00:00
Austin Eng 62e83971ca Factor wire server handlers into proper command handlers and doers
Bug: dawn:88
Change-Id: If637e7ac694d68ad7a4a1e85fd241e8b48e62f6a
Reviewed-on: https://dawn-review.googlesource.com/c/4060
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-02-11 19:39:46 +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
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
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
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