Commit Graph

242 Commits

Author SHA1 Message Date
Stephen White 03badec5d7 Refactor OpenGLVersion out of OpenGLFunctions.
We need the ability to parse the GL version irrespective of
GL extension handling, so pull it out into its own class.

BUG=dawn:580
Change-Id: I620267146159ba8e4fa8cba5f6ebff57e981add0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33540
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2020-11-23 18:50:42 +00:00
Ivan Murashov 75a1f5234e Remove storage class specifier for the explicit template specialization
According to the http://www.eel.is/c++draft/temp.expl.spec:
An explicit specialization shall not use a storage-class-specifier
other than thread_local.
Clang doesn't claims about it, but GCC does.
An error example for GCC 8.4.0:
gen/third_party/dawn/src/dawn_wire/client/ApiObjects_autogen.h:25:5:
error: explicit template specialization cannot have a storage class

Bug: dawn:384
Change-Id: Iaf86722a943d19c9796a7f112885666ac88f20ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33480
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-11-20 09:38:56 +00:00
Austin Eng b70a5b02e9 Reject all callbacks with DeviceLost on wire client disconnect
When the wire is disconnected, the client will not receive any
messages from the server. We need to manually reject all callbacks.

Bug: dawn:556
Change-Id: Ia03456b3209dbe0e1e54543d344180d11d4c6f1e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31162
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-11-11 21:01:18 +00:00
Austin Eng 3120d5ea0d Track and destroy all child objects on wire client destruction
This is needed so that:
 1. We can support multiple devices in the wire. The device will need
    to know how to destroy its child objects.
 2. The wire needs to be aware of all objects and their in-flight
    callbacks so that it can reject them if the wire is disconnnected.
    A future change will handle this.
 3. Fix leaks of objects on page teardown. When the page is torn down,
    the wire client is destroyed, and we skip calling release() for all
    objects since the object holding the proc table was also destroyed.

Bug: dawn:384, dawn:556

Change-Id: Ie23afe4e515b02e924fcfc2db92b749fd2257c9c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31160
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-11-11 19:46:18 +00:00
Corentin Wallez f2df66fce8 Remove deprecated names of texture formats.
Bug: dawn:22
Change-Id: I380380d3d965e603794123739392dae32b84ab9b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/32021
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-11-09 21:19:25 +00:00
Kai Ninomiya 16036cf206 Add WGPU_STRIDE_UNDEFINED and update bytesPerRow/rowsPerImage validation
This makes a nearly one-to-one mapping between the JS and C APIs, which
benefits projects like Blink and Emscripten.

- JavaScript's `undefined` is equivalent to C `WGPU_STRIDE_UNDEFINED`.
- JavaScript's `0` is equivalent to C `0`.
- To implement the API correctly, Blink must special-case an actual
  value coming in from JS that is equal to WGPU_STRIDE_UNDEFINED
  (0xFFFF'FFFF), and inject an error.

Keeps but deprecates a reasonable approximation of the old behavior.

Bug: dawn:520
Change-Id: Ie9c992ffab82830090d0dfc3120731e89cd9691c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31140
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-11-06 13:41:50 +00:00
Corentin Wallez 9d6265bc07 Fix examples when using the wire.
Previously the surface argument of CreateSwapChain was made un-optional
to prevent a compilation error. This broke examples because the
device-compatibility part of the wire would start dereferencing a null
pointer.

Instead of making the surface non-optional, make optional objects not
produce = nullptr for method calls in webgpu_cpp.h.

Bug: dawn:22
Change-Id: Icef357cc2b11ed452c78431dde514e4d497ae159
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31565
Reviewed-by: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-11-04 10:04:17 +00:00
Corentin Wallez b0789fde61 Fix RPDesc::occlusionQuerySet not defaulting to nullptr
The default value for optional object structure members wasn't set
correctly for C++ structures.

Bug: dawn:22
Change-Id: I09e7f3675f6e0b5990ddcf03601b3b91cd25f553
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31200
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-10-29 13:09:12 +00:00
Jiawei Shao 03e1400fce Add the entry point of CreateReadyRenderPipeline
BUG=dawn:529
TEST=dawn_end2end_tests

Change-Id: I42ac0edc77e5b6119eb374da72698fca14596f7b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30540
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-10-21 04:37:41 +00:00
dan sinclair e8022eaf59 Skip None paths when looking for modules
Change-Id: I49fb38b56f868a730b622e20cf8d5781f13fe5e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30580
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2020-10-20 14:46:10 +00:00
Corentin Wallez e557087870 CMakeLists: make DAWN_THIRD_PARTY_DIR an option.
Also output more context when failing to run the code generator.

Bug: None
Change-Id: I6685c062a074ad11a8fd67f19b8698ce9bcf6694
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30560
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2020-10-20 14:26:10 +00:00
Jiawei Shao ae5f950444 Add the entry point of CreateReadyComputePipeline
This patch adds the entry point of CreateReadyComputePipeline in both
dawn_native and dawn_wire.

TODOs:
1. Add more tests in dawn_unittests and dawn_end2end_tests.
2. Put the main logic of creating a pipeline into a separate thread.

BUG=dawn:529
TEST=dawn_end2end_tests

Change-Id: I7edd269a5422a8b85320a7f9173df925decba633
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30060
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-10-19 01:56:08 +00:00
Austin Eng cac0442277 dawn_wire: Support chunked commands
This CL adds support for chunking large commands by first serializing
large commands first into a separate buffer, and then sending the
buffer data chunk by chunk.

This code path is used for large writeBuffer and writeTexture, as well
as the inline memory transfer service for buffer mapping. The transfer
for writeBuffer and writeTexture will be optimized further in Chrome,
and the inline memory transfer service is currently used only in tests.

Bug: chromium:1123861, chromium:951558
Change-Id: I02491a44e653e2383174958d9c3d4a4db6fd7bde
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28882
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-10-13 22:35:34 +00:00
Austin Eng 16e01affcb Reland "Add a per-thread proc table using thread local storage"
This is a reland of b04a92f01b
with the deletion of a duplicate exported function in dawn_wire that
was causing a compilation failure on Windows.

Original change's description:
> Add a per-thread proc table using thread local storage
>
> In situations where both dawn_wire and dawn_native are used on separate
> threads (Chrome with --single-process or --in-process-gpu), it's
> desirable to have a per-thread proc table so that the WebGPU C++ API can
> still be used. This eliminates classes of bugs with manual
> reference/release errors.
>
> This also changes many of the GetProcs functions to return const
> references to the static proc tables known at compile time, instead of a
> copy.
>
> Bug: none
> Change-Id: I8775bb715b312dd9476a1903fbd797d4b1302614
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29240
> Reviewed-by: Stephen White <senorblanco@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

Bug: none
Change-Id: Id90e5372132cd93a2f8631c8185d0e71b01bc1af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29443
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-10-06 16:13:42 +00:00
Kai Ninomiya 326e14f34b Revert "Add a per-thread proc table using thread local storage"
This reverts commit b04a92f01b.

Reason for revert: Build failed on win-archive-dbg; see:
https://chromium-review.googlesource.com/c/chromium/src/+/2450792

Original change's description:
> Add a per-thread proc table using thread local storage
>
> In situations where both dawn_wire and dawn_native are used on separate
> threads (Chrome with --single-process or --in-process-gpu), it's
> desirable to have a per-thread proc table so that the WebGPU C++ API can
> still be used. This eliminates classes of bugs with manual
> reference/release errors.
>
> This also changes many of the GetProcs functions to return const
> references to the static proc tables known at compile time, instead of a
> copy.
>
> Bug: none
> Change-Id: I8775bb715b312dd9476a1903fbd797d4b1302614
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29240
> Reviewed-by: Stephen White <senorblanco@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>

TBR=cwallez@chromium.org,senorblanco@chromium.org,enga@chromium.org

Change-Id: I4587b457b7b2dd5d3c7457065bf4e77b95af59d7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: none
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29442
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-10-05 22:35:40 +00:00
Austin Eng b04a92f01b Add a per-thread proc table using thread local storage
In situations where both dawn_wire and dawn_native are used on separate
threads (Chrome with --single-process or --in-process-gpu), it's
desirable to have a per-thread proc table so that the WebGPU C++ API can
still be used. This eliminates classes of bugs with manual
reference/release errors.

This also changes many of the GetProcs functions to return const
references to the static proc tables known at compile time, instead of a
copy.

Bug: none
Change-Id: I8775bb715b312dd9476a1903fbd797d4b1302614
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29240
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2020-10-05 19:53:58 +00:00
Corentin Wallez 498d5ea20a Rename BC6HRGBSfloat to BC6HRGBFloat
Bug: dawn:22
Change-Id: Ib579e15ff923cbd7c4f523a58c2ef582d39ba7c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27200
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2020-09-10 08:48:57 +00:00
Corentin Wallez f7123d7463 Remove MapRead/WriteAsync and CreateBufferMapped
Bug: dawn:445

Change-Id: I0b0755b6bb754d1fff99aa59b08362f89950e300
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26301
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-08-20 14:22:29 +00:00
Corentin Wallez 2f6e4ec6c0 Add wgpu::TextureFormat::RGB9E5Ufloat
Also update RG11B10Float to be name RG11B10Ufloat

Bug: dawn:22

Change-Id: I0ea76dc25c37ebaeb4c2c2c2a119d00940acc145
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25760
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2020-08-19 21:51:20 +00:00
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