Commit Graph

195 Commits

Author SHA1 Message Date
Ryan Harrison 9854295ff6 Add fuzzers for SPIRV-Cross
This CL adds in fuzzers for SPIRV-Cross for HLSL, GLSL, and MSL
outputs. These fuzzers live in Dawn because there is not appropriate
location in the Chromium source repo for them and it is unlikely they
would be land-able in the SPIRV-Cross repo, because it is not coupled
with Chromium's build system and thus Clusterfuzz so would be
effectively dead code. Dawn depends on this code, but it is also
integrated into the Chromium build system, so this was the best place
I could find for them

The code under fuzz unfortunately uses exceptions/aborting as its
error reporting mechanism. This is an acknowledge short coming and
there are efforts to remove this behaviour. To work around this and
reduce the number of false positives found by the fuzzers, a signal
trap has been implemented which will be removed once the code under
fuzz has been updated.

The trap replaces the existing signal handler and silencing signals
while running the code under test. This allows the code under test to
call abort() and not crash the fuzzing process. Theoretically, only
SIGABRT should need to be trapped, but something is causing the signal
from abort() to be converted to SIGSEGV when running under ASAN.

This signal trap has been tested with the fuzzing/sanitizers by
intentionally inserting bad calls that will occur after a few thousand
test cases. It was confirmed that the fuzzer detected the issue and
stops fuzzing.

The alternate to implementing this signal trap would be to turn on
exceptions for the fuzzer. This was attempted, but proved to be
fruitless due to what was reported as an ODR issue, but couldn't
couldn't be silenced. The likely underlying issue was a pre-built
library or other object being built without exceptions was causing
different versions of symbols or the exception version of the standard
library not being instrumented by ASAN. Given the majority of Chromium
eco-system turns off exceptions, fixing this issue would not be
helpful to the larger community and was looking like it would require
significant effort.

BUG=chromium:903380

Change-Id: I63a5595383f99b7a0e150d72bb04c89b8d722631
Reviewed-on: https://dawn-review.googlesource.com/c/2260
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Max Moroz <mmoroz@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2018-11-12 12:20:21 +00:00
Corentin Wallez 146edf5bec Remove support for CMake builds
This also removes support for Travis and AppVeyor, as well as git
submodules for dependencies.

It also adjusts .gitignore to include dependencies (submodules are
implicitly ignored but are removed in this commit).

Finally, removes some CMake-specific code from the code generator.

BUG=

Change-Id: I4ebc04e530a574b412ef0ca81e4672db01f0ed92
Reviewed-on: https://dawn-review.googlesource.com/c/2040
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2018-10-31 10:53:11 +00:00
Corentin Wallez e92ad5bb89 Build with a different gtest harness when in Chromium
Running test in a Chromium build requires using their gtest and gmock
targets as well as a harness that is in //base. Since we want to run
Dawn tests on the Chromium GPU bots, we need to support two
configurations both building tests standalone and in Chromium.

BUG=chromium:870747

Change-Id: I862e62a607e193a27562ece0f1f6d46d8728e446
Reviewed-on: https://dawn-review.googlesource.com/c/2080
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-10-31 10:49:21 +00:00
Corentin Wallez 5aac265dcb Roll glslang and shaderc
These new versions contain the fix for not having static libraries
with no sources depending on source sets in their BUILD.gn

BUG=chromium:870747

Change-Id: Ib979d5ee581f37db22347f0f725086a9b9833d07
Reviewed-on: https://dawn-review.googlesource.com/c/1900
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2018-10-23 12:50:10 +00:00
Corentin Wallez 16092faa16 Roll shaderc and glslang and use their BUILD.gn
This rolls glslang and shaderc to be able to use their BUILD.gn files,
and also rolls SPIRV-Tools and spirv-headers to have compatible
versions.

BUG=chromium:870747

Change-Id: I13c615f6f3d148c9b69f06547992bf5910e04e62
Reviewed-on: https://dawn-review.googlesource.com/c/1680
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2018-10-04 17:17:57 +00:00
Corentin Wallez 299ce6c69c BUILD.gn: Make SPIRV-Cross includes relative to repo.
BUG=chromium:870747

Change-Id: I9dfdc4f88b0f17b9c2a4e102610d9eb125087bba
Reviewed-on: https://dawn-review.googlesource.com/1642
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2018-09-25 21:50:44 +00:00
Corentin Wallez 21d8438ad6 Validate SPIR-V code when creating ShaderModules
This integrates spirv-val in dawn_native so that regular and
WebGPU-specific validation of shaders is done.

Also adds tests to check OpUndef is correctly rejected so we know
WebGPU-specific validation is working.

Change-Id: If49d276c98bca8cd3c6c1a420903fe34923a2942
2018-09-07 05:41:25 -04:00
Corentin Wallez ae62847f1c Roll SPIRV-Tools
Change-Id: I0b30e4d2b0a142bb073e61329a49a517629e3234
2018-09-07 05:41:25 -04:00
Corentin Wallez ec72443bf1 GN: Fix MSVC compilation
third_party/BUILD.gn was adding compile flags to suppress failures that
were GCC/Clang specific and caused MSVC to error out. Replace them by
suppression using MSVC's flags.

Change-Id: Ia25ae315dcf8904dbfd8eff877065a24e8c88769
2018-08-29 17:33:10 -04:00
Corentin Wallez 0fa2feb96a Roll SPIRV-Cross and use upstream repo.
In the DEPS file we are going to use Chromium's mirror of
github.com/KhronosGroup/SPIRV-Cross so we need to adjust .gitmodules to
point to it instead of Kangz/SPIRV-Cross. Also take that opportunity to
roll SPIRV-Cross.

Change-Id: I4f53a4fc54f5b1b9a754ac55e976c81e5eeabeb2
2018-08-24 12:28:28 -04:00
Corentin Wallez 5b61abce09 Fix Windows compilation using GN and clang-cl.
This includes a bunch of fixes for clang warnings in Windows specific
code that was only compiled by MSVC previously. This also tidies up some
BUILD.gn issues on Windows.
2018-08-14 21:42:32 +02:00
Corentin Wallez f5f7ab128f BUILD.gn: Move last third_party deps to third_party/BUILD.gn 2018-08-14 14:33:19 +02:00
Corentin Wallez 4d7d1697fa Add samples to BUILD.gn and their deps to DEPS
Also add missing GLFW DEPS entry
2018-08-14 14:33:19 +02:00
Corentin Wallez d2969a7d3d Make Dawn "gn check" by default (except SPIRV-Tools)
This required adding some missing dependencies, splitting public headers
of libdawn_[native|wire] so they aren't hidden in the
libdawn_[native|wire]_sources targets, and making unittests depend on
sources directly instead of static libraries (which is almost equivalent).

As a byproduct, Empty.cpp is no longer needed and is removed.
2018-08-14 14:33:19 +02:00
Corentin Wallez 649e2feda4 Add GN build for tests and their third party deps. 2018-08-09 20:54:43 +02:00
Corentin Wallez ee2fb75b09 Roll several external dependencies.
This makes their revision match the revision that will be in the gclient
DEPS file.
2018-08-09 20:54:43 +02:00
Corentin Wallez 0a17aa751d Update glad with the fix for the OSX linker issue. 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
Corentin Wallez 012c149fd9 Build with nortti/exceptions and fvisibility=hidden
This both makes the CMake build closer to the Chromium build, and
reduces the binary size heavily.
2018-07-30 17:22:45 +02:00
Corentin Wallez 196ade667f Make libdawn_native a shared library.
The interface exposed by libdawn_native is declared in the new headers
living in src/include/dawn_native so that they both the users and the
libraries use the DAWN_NATIVE_EXPORT macros.
2018-07-27 12:56:26 +02:00
Corentin Wallez fde3f2b5e0 Rename NXT -> Dawn in the rest of CMakeLists 2018-07-18 22:54:06 +02:00
Corentin Wallez f1ded9bea2 Rename CMakeLists variables 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
Kai Ninomiya 6c639c991e
Roll glslang to 1ea8f595 (#215)
Rolling this now to fix some memory leaks.
2018-07-10 10:55:46 -07:00
Corentin Wallez 00935daffc Use shaderc_shared and don't build unnecessary targets
This should speed up compilation on Travis a little bit.
2017-12-12 01:02:35 -05:00
Corentin Wallez b6fb5f3149 Roll shaderc 2017-12-12 01:02:35 -05:00
Corentin Wallez ae7f113fe8 Only compile the used SPIRV-Cross backends 2017-12-12 01:02:35 -05:00
Corentin Wallez a2d2cfe2f5 Import vulkan headers version 1.0.65 2017-11-21 16:09:15 -05:00
Corentin Wallez ff57ccbcf1 OpenGL: Fix rendered textures being flipped.
This was because the clip space of OpenGL has an inverted Y compared to
other APIs. This commit:
 - Updates SPIRV-Cross to the latest version
 - Uses the new vertex.flip_vert_y option in ShaderModuleGL
 - Enables tests that are now passing in GL.
2017-11-16 11:42:38 -05:00
Kai Ninomiya fb9d82c890 Undo accidental revert of spirv-cross from #109 2017-08-11 18:47:27 -07:00
Kai Ninomiya ba7a3224ea fix accidentally lost from #105 (#109) 2017-08-11 18:06:25 -07:00
Corentin Wallez 741e33c394 Use our fork of SPIRV-Cross with HLSL compute patches 2017-08-09 10:46:44 -04:00
Austin Eng 1f6141e38a Roll shaderc to support 4 draw buffers 2017-08-07 18:51:48 -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
Kai Ninomiya 35bf424035 Swap chains, part 1 (#87)
Adds the swap chain interfaces to the API without changing the behavior
of anything else. This includes the C APIs for applications to provide
swap chain implementations. Also adds stub implementations on every
backend.
2017-07-19 15:41:17 -07:00
Corentin Wallez 6fb3aebf0c Better namespace CMake folders for Visual Studio
This helps Visual Studio users have less clutter in their solution
explorer. This also updates spirv-tools to a newer version that folders
itself. This also updates spirv-headers so that spirv-tools compiles.
2017-07-11 13:59:15 -04:00
Corentin Wallez bd0594bab8 Enable warnings on non-MSVC 2017-07-10 19:35:21 -04:00
Corentin Wallez f30dffa75f Roll STB to fix a warning 2017-07-10 19:35:21 -04:00
Austin Eng cd13691783 Update SPRIV-Cross for HLSL SM5.1 register name support 2017-07-04 14:30:34 -04:00
Austin Eng ed54ec0c71 update spirv-cross version for HLSL register declaration support 2017-07-04 14:30:34 -04:00
Corentin Wallez ac06ef34e4 Fix shaderc not finding python when inside VS
Visual Studio 2017 is able to build CMake-based projects directly be
opening the folder containing the CMakeLists.txt. However when doing
this shaderc is not able to find the Python executable (it uses
find_program instead of the special Python CMake module). Help shaderc
by setting the PYTHON_EXE variable before including its CMakeLists.txt
2017-07-04 12:54:39 -04:00
Austin Eng eb6d22242a add D3D12Binding with swap chain 2017-06-07 16:23:10 -04:00
Corentin Wallez fbab31bada Roll spirv-cross bd7c47a0 -> 3ab17000 2017-06-06 10:03:46 -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 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