Commit Graph

243 Commits

Author SHA1 Message Date
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
Corentin Wallez aa7109c148 Add copy constructors to the C++ Dawn interface
This removes the need for Clone() so it is removed and also adds tests
for the new constructors.

BUG=dawn:11

Change-Id: Ia45c765c2d30e40b0e036427793a62327b2008fc
Reviewed-on: https://dawn-review.googlesource.com/c/1901
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2018-10-25 10:42:49 +00:00
Corentin Wallez 386b8889bd Wire: Add support for nullptr objects as arguments
BUG=dawn:5

Change-Id: I84c80796e9bdfbcf59fafdd38d33ab2101a1d795
Reviewed-on: https://dawn-review.googlesource.com/1541
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2018-09-21 00:28:33 +00:00
Corentin Wallez fdccb54de5 dawncpp.h: Don't expose the fluent syntax for non-builders
At this point this change is a noop, however encoders introduced in
follow-up patches aren't builders and thus won't have the fluent syntax.

BUG=dawn:5

Change-Id: Idc5f327a1a7788c3ba16a50491aefb054700f257
Reviewed-on: https://dawn-review.googlesource.com/1540
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2018-09-20 20:05:21 +00:00
Corentin Wallez 1e68479cd6 dawn.h: Don't use anonymous structures
Instead make them have the same name as their typedef. This is because
anonymous structures is considered bad practice in C because it prevents
forward declaring them.

BUG=

Change-Id: I2d7a788a0d807a2689567d0bb220adaf5335e07a
Reviewed-on: https://dawn-review.googlesource.com/1521
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2018-09-18 12:09:55 +00:00
Corentin Wallez 03e1813fd2 Add DAWN_UNUSED_FUNC to ignore unused functions in generated code
BUG=dawn:13

Change-Id: I7a224503d0a33ef148e63b8327a6a53df1b3868a
Reviewed-on: https://dawn-review.googlesource.com/1520
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2018-09-17 22:59:08 +00:00
Corentin Wallez 6fee61ca9c Make Dawn error macro more explicit and have an "error type"
The error type will help distinguish between validation errors, context
losts and others which should be handled differently.

Take advantage of advantage of this to change DAWN_RETURN_ERROR to
"return DAWN_FOO_ERROR" to have the return be more explicit. Also
removes usage of DAWN_TRY_ASSERT for more explicit checks.

Change-Id: Icbce16b0c8d8eb084b0af2fc132acee776909a36
2018-09-11 07:55:27 -04:00
Corentin Wallez 8e335a5585 Descriptorize ComputePipeline
Change-Id: Ic9d7014ba44d927d7f9ddf81a8870432c68941e8
2018-09-05 08:32:53 -04:00
Corentin Wallez 82b6573d54 Descriptorize Buffer
We still keep a dummy BufferBuilder object around so that it can be used
for the builder error callback tests of the wire.

Change-Id: If0c502bb8b62ee3ed61815e34e9b6ee6c03a65ef
2018-08-23 08:23:06 -04:00
Corentin Wallez 21a23857dc Add initial BUILD.gn files for libdawn[|_native|_wire] 2018-08-06 16:38:33 +02:00
Corentin Wallez dcb71a131c dawn_native: Factor getting procs into a single function.
Now the backends only expose the creation of devices. Getting the procs
is moved to DawnNative that will over time more backend-agnostic APIs.
2018-08-06 16:38:33 +02:00
Corentin Wallez fe253f135b Generate a single ProcTable instead of one per backend.
This required putting Queue::Submit on QueueBase which is something we
would want to do anyway, and removes the need for Queue::ValidateSubmit
being called in the ProcTable.

This removes the need for all the "GeneratedCodeIncludes" files and
leads to a bunch of simplifications in BindGroup as well as the
dawn_native CMakeLists.txt.

Finally this was done in order to simplify the writing of BUILD.gn
files.
2018-08-02 13:39:07 +02:00
Corentin Wallez bdc867713a Make dawn_wire a shared library
Also moves the TerribleCommandBuffer to utils:: because it isn't part of
the implementation of the wire, renames dawn::wire to dawn_wire, moves
src/wire to src/dawn_wire and puts the interface of dawn_wire in
src/include/dawn_wire.
2018-07-30 17:22:45 +02:00
Jimmy Casey 1dd8b12823 Fixed Spelling. 2018-07-30 15:01:15 +02:00
Corentin Wallez 36afbb6a0d Make dawn_native use its own header for Dawn datatypes
The dawn.h and dawncpp.h structure definitions references dawnFoo or
dawn::Foo respectively when it should reference dawn_native::FooBase* in
dawn_native. Autogenerate files to declare the dawn_native version of
the structs and change the ProcTable generation to use it instead.

This is important to make libdawn_native a shared library because
currently it was depending on dawncpp's definition of .Get().
2018-07-27 12:56:26 +02:00
Corentin Wallez 5dcaadb0f9 Make libdawn a shared library, add a DAWN_EXPORT macro 2018-07-25 21:03:49 +02:00
Corentin Wallez e37234cd22 Standardize header guards for libdawn headers 2018-07-25 21:03:49 +02:00
Corentin Wallez 49a65d0c0c dawn_native: Fixup namespace from backend:: to dawn_native:: 2018-07-25 11:27:55 +02:00
Corentin Wallez d37523fbde Move src/backend to src/dawn_native 2018-07-25 11:27:55 +02:00
Corentin Wallez 9fc65344f4 Rename NXT -> Dawn in the comments 2018-07-18 22:54:06 +02:00
Corentin Wallez 923574eed5 Rename IsNXTBitMask and NxtReference/Release to dawn 2018-07-18 22:54:06 +02:00
Corentin Wallez a5ee52d33e Rename NXT -> DAWN in header guards 2018-07-18 22:54:06 +02:00
Corentin Wallez be5ca38351 Rename nxtProcTable and nxtSetProcs to dawn 2018-07-18 22:54:06 +02:00
Corentin Wallez b1669e3fa4 Change the API prefix in generators from nxt to dawn 2018-07-18 22:54:06 +02:00
Corentin Wallez ae79c03d45 Rename the nxt namespace to dawn 2018-07-18 22:54:06 +02:00
Corentin Wallez 3e371b146d Rename files in src/include nxt -> dawn 2018-07-18 22:54:06 +02:00
Corentin Wallez 046cb46bee Rename generated files nxt -> dawn 2018-07-18 22:54:06 +02:00
Corentin Wallez 83a9c9d6d9 Rename src/common macros NXT_* to DAWN_* 2018-07-18 22:54:06 +02:00
Corentin Wallez 33ca49614d Rename Error.h macros from NXT to DAWN 2018-07-18 22:54:06 +02:00
Corentin Wallez 141c0be317 Add a temporary define to help rename nxt:: to dawn:: 2018-07-18 22:54:06 +02:00
Corentin Wallez 4a9ef4ee21 Rename the copyright authors from NXT to Dawn 2018-07-18 22:54:06 +02:00
Corentin Wallez 021c9504d0 Make CommandBufferValidation use Error.h 2018-07-17 22:34:10 +02:00
Kai Ninomiya 21006bbe6f Assert HandleCommands succeeds 2018-07-10 14:00:52 -07:00
Corentin Wallez d5c1ecaf64 WireClient: MapReadCallback, unconditionnally consume the data
When a MapReadRequestCallback arrived late and hit one of the early out
of the handler (for example if the buffer was already unmapped), the
handler wouldn't consume the data payload of the command. This would
cause the command buffer pointer to not be advanced enough and point to
random data instead of the next command.
2018-07-10 14:00:52 -07:00
Kai Ninomiya f53f98bf86
Use a descriptor for PipelineLayout (#206)
Adds support for structures inside descriptors.
2018-06-27 16:21:39 -07:00
Corentin Wallez 40e72d79ca WireCmd: factor code to [de]serialize structs and methods
Methods, when their arguments are stored in a structure, are very
similar to structures (duh?) Take advantage of this to factor the
[de]serialization code between them and not just memcpy structures
around. This will allow structures to contain objects, and pointers to
other structures / array of objects etc.
2018-06-12 14:26:32 -04:00
Corentin Wallez 5ab96e0d40 Wire: Implement MapWriteAsync
The flow of commands is a bit more involved than for MapReadAsync and
goes like this:
 - C->S MapAsync isWrite = true
 - S: Call MapWriteAsync
 - S: MapWriteAsync callback fired
 - S->C: MapWriteAsyncCallback (no data compared to the read case)
 - C: Call the MapWriteAsync callback with a zeroed out buffer
 - C: Application calls unmap.
 - C->S: UpdateMappedData with the content of the mapped pointer
 - S: Copy the data in the mapped pointer
 - C->S: Regular unmap command
 - S: Call unmap

Makes nxt_end2end_tests -w pass all tests.

Also duplicates the MapRead wire tests for the write cases
2018-06-09 13:52:45 +02:00
Corentin Wallez 88fb8fa353 Wire: Move the logic of [de]serialization in WireCmd.
This will help with follow-up changes that add support for a more
complete grammer of types, including structures containing pointers
to objects or other structures.

Instead of having the wire::Client and wire::Server directly act on
buffer memory, a couple interfaces are introduced so that WireCmd can do
things like get the object<->id mapping and temporary allocations.

While the serialization and deserialization of most commands was moved
into WireCmd, the commands that don't directly correspond to NXT methods
have their logic moved inside Client and Server and will be made to
expose the new interface in a follow-up commit.
2018-06-08 13:58:55 +02:00
Corentin Wallez 50e0986e0e Use Error in Sampler and autogenerated validation functions 2018-05-31 15:00:28 -04:00
Corentin Wallez a6416543a4 generator: Add support for structure of non-object values 2018-05-23 14:03:51 -04:00
Corentin Wallez e8c8f020fb Factor autogen validation utilities out of ProcTable 2018-05-23 14:03:51 -04:00
Corentin Wallez cc0a54dbdb Implement MapWrite except in the wire.
Also this MapWrite doesn't zero out memory yet.
2018-04-06 16:03:57 -04:00
Corentin Wallez 8565e0056a Rename "buffer map read status" to "buffer map async status"
This is in preparation of MapWriteAsync that will use the same status
enum.
2018-04-06 16:03:57 -04:00
Corentin Wallez 2da19d5d6b Fix double MapReadCallback trigger when Unmapping in it.
When calling unmap on a mapped buffer for which the callback hasn't
fired yet, the callback should be called with UNKNOWN. The code marked
the callback as called only after calling it, causing problems with
re-entrancy where the callback would be called twice.

This could also get triggered by destroying the buffer inside the
callback.

Fix this in backend::Buffer and the WireClient and add test for both.
2018-04-06 16:03:57 -04:00
Corentin Wallez 42dbde1b65 Member rename: generator/templates 2017-11-23 17:04:10 -05:00
Corentin Wallez f280e87f36 Remove Blink templates from this repository.
The templates will live in the Chromium prototype. This also removes
the blink/ prefix from the Blink template filenames as this won't be
present in anymore.
2017-11-01 22:43:42 -04:00
Corentin Wallez 0d045029fa Update Blink integration
This both makes changes to follow changes in Blink and adds stubs for
SetFooCallback methods
2017-11-01 15:28:38 -04:00
Corentin Wallez 3818e18c5c Forward unhandled builder errors to the device 2017-07-27 21:08:12 -04:00
Kai Ninomiya 78c8b837ea clang/gcc: enable a bunch more warnings (#91)
* clang/gcc: enable -pedantic warnings

* suppress a GCC-specific warning in stb_image

* And some clang-specific warnings

* -Wconversion (clang) -Wold-style-cast (clang+gcc)

and fix a few warnings that show up with these (and a few more with
-Wconversion on gcc, even though that's not enabled by default)

* bunch more warnings

* fixes

* remove merge error
2017-07-21 17:00:22 -07:00
Corentin Wallez fd589f3919 Add an internal ASSERT macro
This macro has some advantages over the standard library one:
 - It prints the place where the macro was triggered
 - It "references" the condition even in Release to avoid warnings
 - In release, if possible, it gives compiler hints

It is basically is stripped down version of the ASSERT macros I wrote
for the Daemon engine in src/common/Assert.h

This commit also removes the stray "backend" namespaces for common/
code.
2017-07-10 19:35:21 -04:00
Corentin Wallez 98c90d4faa Fix clang/GCC warnings 2017-07-10 19:35:21 -04:00
Corentin Wallez fffe6dfa16 Split backend/common in backend/ and common/
This directory used to contain both the state tracking code for the
backends, and the common utilities that could be used both by the
backends and the rest of the code. Things are now:

 - src/common is utility code for the whole repo
 - src/backend contains libNXT's code
 - src/utils is utility code that we don't want in libNXT

This commit also changes all includes to use global paths from src/
bacause it had to touch a bunch of #include statements anyway.
2017-07-06 17:54:52 -04:00
Corentin Wallez 5e03aec75a Remove some unused variables 2017-07-06 16:30:20 -04:00
Corentin Wallez dbb5729e64 Add Device::Tick for periodic work 2017-06-15 13:27:50 -07:00
Corentin Wallez 367cb3515c Fix MapRead error callback being called with a valid pointer
This happened when a request resulted in an error while the buffer was
already mapped. Adds a test that catches the error.
2017-06-13 08:30:01 -07:00
Corentin Wallez 9388b23212 Implement Buffer::MapReadAsync in the wire 2017-06-13 08:30:01 -07:00
Corentin Wallez b1c19eeb4f Add Buffer::MapReadAsync state-tracking 2017-06-13 08:30:01 -07:00
Corentin Wallez 944b60fb75 Fix compilation on Windows
There are still a bunch of warning that we should remove.
2017-05-30 10:48:32 -07:00
Corentin Wallez 635d7d599f Generate an nxtcpp_traits.h with metaprogramming helpers
The files currently has Builder and BuiltObject template type aliases to
go from builder type to built object type or vice-versa.
2017-05-30 10:40:43 -07:00
Corentin Wallez a0a9f633ce Fix ObjectBase's move constructor not setting handle to nullptr
This caused a crash because if handle was set to garbage then the
move-constructor would try to call the Release function on it.
2017-05-30 10:40:43 -07:00
Corentin Wallez 75bbcec543 Add wire test for the maybe monad 2017-05-19 10:41:36 +02:00
Corentin Wallez 42f2d3c5f2 Add wire tests for *SetErrorCallback 2017-05-19 10:41:36 +02:00
Corentin Wallez 1b7c5e3f70 Mock API: special case the SetErrorCallback procs.
Also add a suppression for these procs in wiretests, unless we are
specifically testing them.
2017-05-19 10:41:36 +02:00
Kai Ninomiya 314f3852a3 Fix Linux build 2017-05-16 21:09:14 +02:00
Corentin Wallez 36cf2dd54b Make autogenerated validation produce device or builder errors 2017-05-11 11:31:54 +02:00
Corentin Wallez f79df0c62d Print builder errors by default. 2017-05-11 11:31:54 +02:00
Corentin Wallez cd0ea35889 Implement builder callback forwarding in the wire 2017-05-11 11:31:54 +02:00
Corentin Wallez 7f96177289 Implement the builder error callback in the backends
This makes the Builder base class retain the error status, if any, and
call the callback on GetResult (or ~Builder, whichever comes first).
2017-05-11 11:31:54 +02:00
Corentin Wallez 4b410a33ca Implement the device error callback.
This adds support for "natively defined" API types like callbacks that
will have to be implemented manually for each target language. Also this
splits the concept of "native method" into a set of native methods per
language.

Removes the "Synchronous error" concept that was used to make builders
work in the maybe Monad, this will have to be reinroduced with builder
callbacks.
2017-05-11 11:31:54 +02:00
Corentin Wallez 682a8250b3 Plumb the server->client wire 2017-05-11 11:31:54 +02:00
Corentin Wallez a2d4d14bd4 mock_api: Only mock methods with less than 10 arguments
GoogleMock only handles up to 10 arguments, but functions this big
probably won't be used in mocked tests so we can just skip them.
2017-05-10 19:49:52 +02:00
Corentin Wallez 5473d719f7 Update blink generators for the big Blink rename. 2017-04-26 15:17:03 -04:00
Corentin Wallez f07e3bd4c9 Initial commit of all the NXT integration.
More like squashed history, contributors were:
 - Kai Ninomiya
 - Corentin Wallez
2017-04-20 14:38:20 -04:00