Commit Graph

242 Commits

Author SHA1 Message Date
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 916046c956 Add stub Vulkan backend 2017-08-29 13:37:24 -07:00
Austin Eng d474c2597a CMAKE_SOURCE_DIR -> PROJECT_SOURCE_DIR 2017-08-14 17:38:36 -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 240343f9db Add NXT_GENERATED_FLAGS using set_property 2017-07-20 16:33:02 -04:00
Corentin Wallez 0f833f30ed Enable warnings on Windows 2017-07-11 13:59:15 -04: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 bd0594bab8 Enable warnings on non-MSVC 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
Austin Eng fc2bac7e45 add null D3D12 backend 2017-06-07 16:23:10 -04:00
Corentin Wallez 698c2d1d8d Don't rely on Jinja2's lstrip_blocks
Travis has Jinja 2.6 but the option appeared in Jinj 2.7. Manually
perform the stripping in the preprocessing step instead.
2017-05-30 15:55:34 -07:00
Corentin Wallez 97bc020cf4 Make the NULL backend proctables be generated in a .cpp
Previously they were in a .mm and GCC didn't know what to do with it.
2017-05-30 15:55:34 -07:00
Corentin Wallez b38ff68b88 Make wire_autogen have all symbols defined internally
Previously WireCmd.h/cpp that is used in wire_autogen wasn't included in
the sources, causing a link error on some platforms.

With WireCmd.* moved in the EXTRA_SOURCES, the nxt_wire target didn't
contain any non-header file and caused a link error on OSX. Fix it by
properly splitting the declaration and implementation of
TerribleCommandBuffer in a .h and .cpp file.
2017-05-30 15:55:34 -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 26275d0a16 Make all libraries STATIC for now
For shared library to work on Windows to work, we need to add
declspec(export) and declspec(import) annotations to the symbols to
export. This fixes the problem by making all libraries static on
Windows, but we'll need to revisit and do proper symbol exports.
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 79a62bf6e3 Create a Null backend.
This will be useful to run validation unittests without using the GPU.
2017-05-24 15:23:53 -04: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
Kai Ninomiya faa5894500 Add shebang to generator/main.py to use python2
Fixes #3
2017-04-27 10:46:53 -04: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