Nicolas Capens | a5eaa8d | 2017-07-26 13:55:52 -0400 | [diff] [blame] | 1 | # SwiftShader
|
Nicolas Capens | c9d61ae | 2017-06-28 00:58:48 -0400 | [diff] [blame] | 2 |
|
Nicolas Capens | 4c50ae9 | 2020-07-16 23:23:15 -0400 | [diff] [blame] | 3 | [](https://opensource.org/licenses/Apache-2.0)
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 4 |
|
Nicolas Capens | fe5861b | 2018-08-03 16:01:48 -0400 | [diff] [blame] | 5 | Introduction
|
| 6 | ------------
|
| 7 |
|
Nicolas Capens | f8b99b5 | 2020-12-14 01:46:52 -0500 | [diff] [blame] | 8 | SwiftShader is a high-performance CPU-based implementation of the Vulkan graphics API<sup>1</sup><sup>2</sup>. Its goal is to provide hardware independence for advanced 3D graphics.
|
Antonio Maiorano | 6f74415 | 2020-08-17 11:15:16 -0400 | [diff] [blame] | 9 |
|
Nicolas Capens | c0a055b | 2022-04-15 01:42:53 -0400 | [diff] [blame] | 10 | > NOTE: The [ANGLE](http://angleproject.org/) project can be used to achieve a layered implementation of OpenGL ES (aka. "SwANGLE").
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 11 |
|
Nicolas Capens | fe5861b | 2018-08-03 16:01:48 -0400 | [diff] [blame] | 12 | Building
|
| 13 | --------
|
| 14 |
|
Nicolas Capens | f8b99b5 | 2020-12-14 01:46:52 -0500 | [diff] [blame] | 15 | SwiftShader libraries can be built for Windows, Linux, and macOS.\
|
Nicolas Capens | fe5861b | 2018-08-03 16:01:48 -0400 | [diff] [blame] | 16 | Android and Chrome (OS) build environments are also supported.
|
| 17 |
|
Antonio Maiorano | 6f74415 | 2020-08-17 11:15:16 -0400 | [diff] [blame] | 18 | * **CMake**
|
| 19 | \
|
Nicolas Capens | f8b99b5 | 2020-12-14 01:46:52 -0500 | [diff] [blame] | 20 | [Install CMake](https://cmake.org/download/) for Linux, macOS, or Windows and use either [the GUI](https://cmake.org/runningcmake/) or run the following terminal commands:
|
Antonio Maiorano | 6f74415 | 2020-08-17 11:15:16 -0400 | [diff] [blame] | 21 | ```
|
| 22 | cd build
|
| 23 | cmake ..
|
| 24 | cmake --build . --parallel
|
| 25 |
|
| 26 | ./vk-unittests
|
| 27 | ```
|
Nicolas Capens | 7776bf0 | 2022-10-04 00:30:30 -0400 | [diff] [blame] | 28 | Tip: Set the [CMAKE_BUILD_PARALLEL_LEVEL](https://cmake.org/cmake/help/latest/envvar/CMAKE_BUILD_PARALLEL_LEVEL.html) environment variable to control the level of parallelism.
|
Nicolas Capens | f8b99b5 | 2020-12-14 01:46:52 -0500 | [diff] [blame] | 29 |
|
Antonio Maiorano | 6f74415 | 2020-08-17 11:15:16 -0400 | [diff] [blame] | 30 |
|
Nicolas Capens | fe5861b | 2018-08-03 16:01:48 -0400 | [diff] [blame] | 31 | * **Visual Studio**
|
Ben Clayton | e2d8b12 | 2019-02-07 18:13:16 +0000 | [diff] [blame] | 32 | \
|
Antonio Maiorano | 6f74415 | 2020-08-17 11:15:16 -0400 | [diff] [blame] | 33 | To build the Vulkan ICD library, use [Visual Studio 2019](https://visualstudio.microsoft.com/vs/community/) to open the project folder and wait for it to run CMake. Open the [CMake Targets View](https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=vs-2019#ide-integration) in the Solution Explorer and select the vk_swiftshader project to [build](https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=vs-2019#building-cmake-projects) it.
|
Nicolas Capens | a580e2d | 2019-10-03 22:40:25 -0400 | [diff] [blame] | 34 |
|
Nicolas Capens | 64d537a | 2018-10-02 12:40:12 -0400 | [diff] [blame] | 35 |
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 36 | Usage
|
Nicolas Capens | 9eaa19c | 2017-06-28 11:13:55 -0400 | [diff] [blame] | 37 | -----
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 38 |
|
| 39 | The SwiftShader libraries act as drop-in replacements for graphics drivers.
|
| 40 |
|
Antonio Maiorano | 6f74415 | 2020-08-17 11:15:16 -0400 | [diff] [blame] | 41 | On Windows, most applications can be made to use SwiftShader's DLLs by placing them in the same folder as the executable. On Linux, the `LD_LIBRARY_PATH` environment variable or `-rpath` linker option can be used to direct applications to search for shared libraries in the indicated directory first.
|
| 42 |
|
Nicolas Capens | 4bd7fd2 | 2020-11-03 19:46:29 +0000 | [diff] [blame] | 43 | In general, Vulkan applications look for a shared library named `vulkan-1.dll` on Windows (`vulkan-1.so` on Linux). This 'loader' library then redirects API calls to the actual Installable Client Driver (ICD). SwiftShader's ICD is named `libvk_swiftshader.dll`, but it can be renamed to `vulkan-1.dll` to be loaded directly by the application. Alternatively, you can set the `VK_ICD_FILENAMES` environment variable to the path to `vk_swiftshader_icd.json` file that is generated under the build directory (e.g. `.\SwiftShader\build\Windows\vk_swiftshader_icd.json`). To learn more about how Vulkan loading works, read the [official documentation here](https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md).
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 44 |
|
| 45 | Contributing
|
Nicolas Capens | 9eaa19c | 2017-06-28 11:13:55 -0400 | [diff] [blame] | 46 | ------------
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 47 |
|
Nicolas Capens | cf83d16 | 2016-07-02 23:41:30 -0400 | [diff] [blame] | 48 | See [CONTRIBUTING.txt](CONTRIBUTING.txt) for important contributing requirements.
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 49 |
|
Nicolas Capens | cf83d16 | 2016-07-02 23:41:30 -0400 | [diff] [blame] | 50 | The canonical repository for SwiftShader is hosted at:
|
Nicolas Capens | 4ca9630 | 2021-07-03 01:25:58 -0400 | [diff] [blame] | 51 | https://swiftshader.googlesource.com/SwiftShader.
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 52 |
|
Nicolas Capens | cf83d16 | 2016-07-02 23:41:30 -0400 | [diff] [blame] | 53 | All changes must be reviewed and approved in the [Gerrit](https://www.gerritcodereview.com/) review tool at:
|
Nicolas Capens | 51f2036 | 2022-01-25 15:56:03 -0500 | [diff] [blame] | 54 | https://swiftshader-review.googlesource.com. You must sign in to this site with a Google Account before changes can be uploaded.
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 55 |
|
Nicolas Capens | 51f2036 | 2022-01-25 15:56:03 -0500 | [diff] [blame] | 56 | Next, authenticate your account here:
|
Nicolas Capens | 4ca9630 | 2021-07-03 01:25:58 -0400 | [diff] [blame] | 57 | https://swiftshader-review.googlesource.com/new-password (use the same e-mail address as the one configured as the [Git commit author](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup#_your_identity)).
|
Nicolas Capens | cf83d16 | 2016-07-02 23:41:30 -0400 | [diff] [blame] | 58 |
|
Nicolas Capens | 4ca9630 | 2021-07-03 01:25:58 -0400 | [diff] [blame] | 59 | All changes require a [Change-ID](https://gerrit-review.googlesource.com/Documentation/user-changeid.html) tag in the commit message. A [commit hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) may be used to add this tag automatically, and can be found at:
|
| 60 | https://gerrit-review.googlesource.com/tools/hooks/commit-msg. You can execute `git clone https://swiftshader.googlesource.com/SwiftShader` and manually place the commit hook in `SwiftShader/.git/hooks/`, or to clone the repository and install the commit hook in one go:
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 61 |
|
Sean Risser | 3c89f07 | 2021-05-27 16:56:09 -0400 | [diff] [blame] | 62 | git clone https://swiftshader.googlesource.com/SwiftShader && (cd SwiftShader && git submodule update --init --recursive third_party/git-hooks && ./third_party/git-hooks/install_hooks.sh)
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 63 |
|
Nicolas Capens | 4ca9630 | 2021-07-03 01:25:58 -0400 | [diff] [blame] | 64 | On Windows, this command line requires using the [Git Bash Shell](https://www.atlassian.com/git/tutorials/git-bash).
|
| 65 |
|
Nicolas Capens | fe5861b | 2018-08-03 16:01:48 -0400 | [diff] [blame] | 66 | Changes are uploaded to Gerrit by executing:
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 67 |
|
| 68 | git push origin HEAD:refs/for/master
|
| 69 |
|
Nicolas Capens | db74776 | 2020-03-31 12:00:46 -0400 | [diff] [blame] | 70 | When ready, [add](https://gerrit-review.googlesource.com/Documentation/intro-user.html#adding-reviewers) a project [owner](OWNERS) as a reviewer on your change.
|
| 71 |
|
Nicolas Capens | dac99e8 | 2020-11-19 04:18:58 +0000 | [diff] [blame] | 72 | Some tests will automatically be run against the change. Notably, [presubmit.sh](tests/presubmit.sh) verifies the change has been formatted using [clang-format 11.0.1](tests/kokoro/gcp_ubuntu/check_style.sh). Most IDEs come with clang-format support, but may require upgrading/downgrading to the [clang-format version 11.0.0](https://github.com/llvm/llvm-project/releases/tag/llvmorg-11.0.0) *release* version (notably Chromium's buildtools has a clang-format binary which can be an in-between revision which produces different formatting results).
|
Nicolas Capens | db74776 | 2020-03-31 12:00:46 -0400 | [diff] [blame] | 73 |
|
Nicolas Capens | fe5861b | 2018-08-03 16:01:48 -0400 | [diff] [blame] | 74 | Testing
|
| 75 | -------
|
| 76 |
|
Nicolas Capens | 02a91c9 | 2021-08-20 03:49:24 -0400 | [diff] [blame] | 77 | SwiftShader's Vulkan implementation can be tested using the [dEQP](https://github.com/KhronosGroup/VK-GL-CTS) test suite.
|
Nicolas Capens | fe5861b | 2018-08-03 16:01:48 -0400 | [diff] [blame] | 78 |
|
| 79 | See [docs/dEQP.md](docs/dEQP.md) for details.
|
| 80 |
|
Nicolas Capens | 3532c69 | 2017-05-18 11:22:26 -0400 | [diff] [blame] | 81 | Third-Party Dependencies
|
| 82 | ------------------------
|
| 83 |
|
| 84 | The [third_party](third_party/) directory contains projects which originated outside of SwiftShader:
|
| 85 |
|
Nicolas Capens | f8b99b5 | 2020-12-14 01:46:52 -0500 | [diff] [blame] | 86 | [subzero](third_party/subzero/) contains a fork of the [Subzero](https://chromium.googlesource.com/native_client/pnacl-subzero/) project. It originates from Google Chrome's (Portable) [Native Client](https://developer.chrome.com/native-client) project. The fork was made using [git-subtree](https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt) to include all of Subzero's history.
|
Nicolas Capens | 3532c69 | 2017-05-18 11:22:26 -0400 | [diff] [blame] | 87 |
|
| 88 | [llvm-subzero](third_party/llvm-subzero/) contains a minimized set of LLVM dependencies of the Subzero project.
|
| 89 |
|
| 90 | [PowerVR_SDK](third_party/PowerVR_SDK/) contains a subset of the [PowerVR Graphics Native SDK](https://github.com/powervr-graphics/Native_SDK) for running several sample applications.
|
| 91 |
|
| 92 | [googletest](third_party/googletest/) contains the [Google Test](https://github.com/google/googletest) project, as a Git submodule. It is used for running unit tests for Chromium, and Reactor unit tests. Run `git submodule update --init` to obtain/update the code. Any contributions should be made upstream.
|
| 93 |
|
Nicolas Capens | 6388302 | 2016-05-30 11:03:26 -0400 | [diff] [blame] | 94 | Documentation
|
| 95 | -------------
|
| 96 |
|
Nicolas Capens | 1bc6138 | 2016-05-30 15:29:09 -0400 | [diff] [blame] | 97 | See [docs/Index.md](docs/Index.md).
|
Nicolas Capens | 6388302 | 2016-05-30 11:03:26 -0400 | [diff] [blame] | 98 |
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 99 | Contact
|
Nicolas Capens | 9eaa19c | 2017-06-28 11:13:55 -0400 | [diff] [blame] | 100 | -------
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 101 |
|
Nicolas Capens | d851f23 | 2016-08-01 15:36:23 -0400 | [diff] [blame] | 102 | Public mailing list: [swiftshader@googlegroups.com](https://groups.google.com/forum/#!forum/swiftshader)
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 103 |
|
Nicolas Capens | b638dfe | 2020-08-25 13:24:54 +0000 | [diff] [blame] | 104 | General bug tracker: https://g.co/swiftshaderbugs \
|
Nicolas Capens | db309b6 | 2018-05-22 14:49:35 -0400 | [diff] [blame] | 105 | Chrome specific bugs: https://bugs.chromium.org/p/swiftshader
|
Nicolas Capens | 22b17b0 | 2016-06-17 13:39:18 -0400 | [diff] [blame] | 106 |
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 107 | License
|
Nicolas Capens | 9eaa19c | 2017-06-28 11:13:55 -0400 | [diff] [blame] | 108 | -------
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 109 |
|
Nicolas Capens | cf83d16 | 2016-07-02 23:41:30 -0400 | [diff] [blame] | 110 | The SwiftShader project is licensed under the Apache License Version 2.0. You can find a copy of it in [LICENSE.txt](LICENSE.txt).
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 111 |
|
| 112 | Files in the third_party folder are subject to their respective license.
|
| 113 |
|
| 114 | Authors and Contributors
|
Nicolas Capens | 9eaa19c | 2017-06-28 11:13:55 -0400 | [diff] [blame] | 115 | ------------------------
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 116 |
|
Nicolas Capens | cf83d16 | 2016-07-02 23:41:30 -0400 | [diff] [blame] | 117 | The legal authors for copyright purposes are listed in [AUTHORS.txt](AUTHORS.txt).
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 118 |
|
Nicolas Capens | cf83d16 | 2016-07-02 23:41:30 -0400 | [diff] [blame] | 119 | [CONTRIBUTORS.txt](CONTRIBUTORS.txt) contains a list of names of individuals who have contributed to SwiftShader. If you're not on the list, but you've signed the [Google CLA](https://cla.developers.google.com/clas) and have contributed more than a formatting change, feel free to request to be added.
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 120 |
|
| 121 | Disclaimer
|
Nicolas Capens | 9eaa19c | 2017-06-28 11:13:55 -0400 | [diff] [blame] | 122 | ----------
|
Nicolas Capens | 1703e0f | 2016-05-12 17:27:05 -0400 | [diff] [blame] | 123 |
|
| 124 | 1. Trademarks are the property of their respective owners.
|
Antonio Maiorano | 6f74415 | 2020-08-17 11:15:16 -0400 | [diff] [blame] | 125 | 2. This is not an official Google product.
|