Commit Graph

122 Commits

Author SHA1 Message Date
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 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 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
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
Austin Eng c7f416c0c9 Add wire_cmd.py and dawn_wire.json to autogenerate all wire commands.
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>
2019-01-15 20:49:53 +00:00
Corentin Wallez 1a99f42c7d WireServer: Wrap userdata in unique_ptr in callbacks
This fixes a leak that was introduced in
https://dawn-review.googlesource.com/c/dawn/+/3622 where the early
return doesn't delete the userdata.

BUG=chromium:921360

Change-Id: I500dd2b4fa02121e5c0278c5f6f83a30861815e4
Reviewed-on: https://dawn-review.googlesource.com/c/3942
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-01-14 18:41:13 +00:00
Corentin Wallez bd48385d50 Add static library versions of libdawn*
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>
2019-01-09 09:05:18 +00:00
Austin Eng 5236eb2057 Specialize WireServer objects
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>
2019-01-08 17:58:38 +00:00
Austin Eng 9dc1250d3e Use single DestroyObject command in the wire
Bug: dawn:83
Change-Id: Ic875d5111f59e7166d2decb3dc6a84973d9babdf
Reviewed-on: https://dawn-review.googlesource.com/c/3680
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-01-07 17:52:56 +00:00
Corentin Wallez 1e37db5350 WireServer: check buffer exists before sending the map callback
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>
2019-01-04 09:54:40 +00:00
Corentin Wallez a19c759bc4 WireCmd: guard against overflows when computing array sizes
BUG=chromium:918094
BUG=chromium:918348
BUG=chromium:918260

Change-Id: Ia2ee8930592e436e8d0d76837b70e726e8d87ea7
Reviewed-on: https://dawn-review.googlesource.com/c/3620
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-01-04 09:54:10 +00:00
Corentin Wallez 0d95887dbc WireServer: don't skip destroy on error objects.
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>
2018-12-17 10:55:25 +00:00
Austin Eng 08aa58f8d6 Check if fence is nullptr in PostHandleQueueSignal
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>
2018-12-14 08:29:38 +00:00
Corentin Wallez 48a1923afb Revert "Create new src/tests BUILD.gn file."
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>
2018-12-08 10:35:53 +00:00
Stephen White 672d29d14c 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>
2018-12-07 21:54:48 +00:00
Corentin Wallez 67737f1d4a WireServer: Don't allow freeing the Device
BUG=chromium:907278
BUG=chromium:911155

Change-Id: I6ec721b34b214bb242ac0d217e6ab12832c7323a
Reviewed-on: https://dawn-review.googlesource.com/c/2842
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2018-12-07 16:25:36 +00:00
Corentin Wallez 1d2850a129 WireServer: on destruction, free all objects.
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>
2018-12-07 16:13:36 +00:00
Corentin Wallez 6f0e1f9d82 Remove BufferView and inline offset/size in BindGroup
BUG=dawn:2

Change-Id: I811024c4ac3a6167dd0caff05eca3fbb2640e862
Reviewed-on: https://dawn-review.googlesource.com/c/2941
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2018-12-07 12:31:53 +00:00
Stephen White 0f50114b3c Disable/avoid some warnings.
Implement DAWN_DECLARE_UNUSED macro to avoid -Wunneeded-internal-declaration
warning.

Change-Id: I4d087d2b09b74e35ba7ea69533df2c5adef4ef82
Reviewed-on: https://dawn-review.googlesource.com/c/2943
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2018-12-06 19:01:22 +00:00
Corentin Wallez 5aacd29d5e ProcTable: only cast the return value if needed.
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>
2018-12-06 10:43:33 +00:00
Corentin Wallez 7b3ea34b6b WireCmd: Update buffer pointer when serializing sub elements
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>
2018-12-05 10:13:52 +00:00
Stephen White 006f218392 Use std::nullptr_t in place of nullptr_t.
(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>
2018-12-05 04:10:52 +00:00
Corentin Wallez f48e6b74b7 dawncpp.h: Add nullptr ObjectBase constructor and assignment
BUG=dawn:3

Change-Id: I9f7ec0ae1c7885809888a603ed056c6565751bec
Reviewed-on: https://dawn-review.googlesource.com/c/2840
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2018-12-04 12:13:03 +00:00
Austin Eng f0b761f116 Implement timeline fences in Dawn
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>
2018-12-03 16:57:34 +00:00
Corentin Wallez d8c1a48fc4 WireCmd: require opt-in to treat ID 0 as nullptr instead of error.
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>
2018-11-28 17:00:33 +00:00
Corentin Wallez c7d78088cd Make codegen not cast between fnptrs.
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>
2018-11-20 09:33:35 +00:00
Corentin Wallez c56860e27f WireServer: Check for ID 0 in hand-written handlers.
BUG=chromium:905272

Change-Id: Ib8efb307dbdd6fc57d2cc75366f238c4dfb2beea
Reviewed-on: https://dawn-review.googlesource.com/c/2563
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>
2018-11-20 09:31:45 +00:00
Corentin Wallez dcc488aa7c WireCmd: error out if "self" is null.
BUG=dawn:34

Change-Id: Ic77a6a1b2145ad9572abd6e2f3cd422d8c87f3eb
Reviewed-on: https://dawn-review.googlesource.com/c/2301
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2018-11-12 09:01:36 +00:00