Cleanup duplicate files; Combine README and build docs.

This PR cleans up some of the documentation post Dawn+Tint merge.
The README is better combined, the building document is moved up
a level as it covers both Tint and Dawn. The various duplicate files
are removed.

Bug: dawn:1339
Change-Id: I829fbc32529a304fbc55eac3fda86d52c1a6952e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88340
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2022-04-28 16:25:43 +00:00 committed by Dawn LUCI CQ
parent 617570a7da
commit 5ee22f3fdb
9 changed files with 99 additions and 533 deletions

View File

@ -1,6 +0,0 @@
# This is the list of Dawn authors for copyright purposes.
#
# This does not necessarily list everyone who has contributed code, since in
# some cases, their employer may be the copyright holder. To see the full list
# of contributors, see the revision history in source control.
Google Inc.

View File

@ -1,8 +0,0 @@
# This is the list of the Tint authors for copyright purposes.
#
# This does not necessarily list everyone who has contributed code, since in
# some cases, their employer may be the copyright holder. To see the full list
# of contributors, see the revision history in source control.
Google LLC
Vasyl Teliman

View File

@ -1,38 +0,0 @@
# Copyright 2018 The Dawn Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import platform
import subprocess
USE_PYTHON3 = True
def _DoCommonChecks(input_api, output_api):
results = []
results.extend(
input_api.canned_checks.CheckChangedLUCIConfigs(input_api, output_api))
results.extend(
input_api.canned_checks.CheckPatchFormatted(input_api,
output_api,
check_python=True))
return results
def CheckChangeOnUpload(input_api, output_api):
return _DoCommonChecks(input_api, output_api)
def CheckChangeOnCommit(input_api, output_api):
return _DoCommonChecks(input_api, output_api)

View File

@ -1,167 +0,0 @@
# Copyright 2020 The Tint Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Presubmit script for Tint.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into depot_tools.
"""
import re
USE_PYTHON3 = True
def _LicenseHeader(input_api):
"""Returns the license header regexp."""
# Accept any year number from 2019 to the current year
current_year = int(input_api.time.strftime('%Y'))
allowed_years = (str(s) for s in reversed(xrange(2019, current_year + 1)))
years_re = '(' + '|'.join(allowed_years) + ')'
license_header = (
r'.*? Copyright( \(c\))? %(year)s The Tint [Aa]uthors\n '
r'.*?\n'
r'.*? Licensed under the Apache License, Version 2.0 (the "License");\n'
r'.*? you may not use this file except in compliance with the License.\n'
r'.*? You may obtain a copy of the License at\n'
r'.*?\n'
r'.*? http://www.apache.org/licenses/LICENSE-2.0\n'
r'.*?\n'
r'.*? Unless required by applicable law or agreed to in writing, software\n'
r'.*? distributed under the License is distributed on an "AS IS" BASIS,\n'
r'.*? WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n'
r'.*? See the License for the specific language governing permissions and\n'
r'.*? limitations under the License.\n') % {
'year': years_re,
}
return license_header
REGEXES = [
r"(?i)black[-_]?list",
r"(?i)white[-_]?list",
r"(?i)gr[ea]y[-_]?list",
r"(?i)(first class citizen)",
r"(?i)black[-_]?hat",
r"(?i)white[-_]?hat",
r"(?i)gr[ea]y[-_]?hat",
r"(?i)master",
r"(?i)slave",
r"(?i)\bhim\b",
r"(?i)\bhis\b",
r"(?i)\bshe\b",
r"(?i)\bher\b",
r"(?i)\bguys\b",
r"(?i)\bhers\b",
r"(?i)\bman\b",
r"(?i)\bwoman\b",
r"(?i)\she\s",
r"(?i)\she$",
r"(?i)^he\s",
r"(?i)^he$",
r"(?i)\she['|\u2019]d\s",
r"(?i)\she['|\u2019]d$",
r"(?i)^he['|\u2019]d\s",
r"(?i)^he['|\u2019]d$",
r"(?i)\she['|\u2019]s\s",
r"(?i)\she['|\u2019]s$",
r"(?i)^he['|\u2019]s\s",
r"(?i)^he['|\u2019]s$",
r"(?i)\she['|\u2019]ll\s",
r"(?i)\she['|\u2019]ll$",
r"(?i)^he['|\u2019]ll\s",
r"(?i)^he['|\u2019]ll$",
r"(?i)grandfather",
r"(?i)\bmitm\b",
r"(?i)\bcrazy\b",
r"(?i)\binsane\b",
r"(?i)\bblind\sto\b",
r"(?i)\bflying\sblind\b",
r"(?i)\bblind\seye\b",
r"(?i)\bcripple\b",
r"(?i)\bcrippled\b",
r"(?i)\bdumb\b",
r"(?i)\bdummy\b",
r"(?i)\bparanoid\b",
r"(?i)\bsane\b",
r"(?i)\bsanity\b",
r"(?i)red[-_]?line",
]
REGEX_LIST = []
for reg in REGEXES:
REGEX_LIST.append(re.compile(reg))
def CheckNonInclusiveLanguage(input_api, output_api, source_file_filter=None):
"""Checks the files for non-inclusive language."""
matches = []
for f in input_api.AffectedFiles(include_deletes=False,
file_filter=source_file_filter):
for line_num, line in f.ChangedContents():
for reg in REGEX_LIST:
match = reg.search(line)
if match:
matches.append(
"{} ({}): found non-inclusive language: {}".format(
f.LocalPath(), line_num, match.group(0)))
if len(matches):
return [
output_api.PresubmitPromptWarning('Non-inclusive language found:',
items=matches)
]
return []
def CheckChange(input_api, output_api):
results = []
results += input_api.canned_checks.CheckChangeHasDescription(
input_api, output_api)
results += input_api.canned_checks.CheckPatchFormatted(input_api,
output_api,
check_python=True)
results += input_api.canned_checks.CheckGNFormatted(input_api, output_api)
results += input_api.canned_checks.CheckChangeHasNoCrAndHasOnlyOneEol(
input_api, output_api)
results += input_api.canned_checks.CheckChangeHasNoTabs(
input_api, output_api)
results += input_api.canned_checks.CheckChangeTodoHasOwner(
input_api, output_api)
results += input_api.canned_checks.CheckChangeHasNoStrayWhitespace(
input_api, output_api)
results += input_api.canned_checks.CheckDoNotSubmit(input_api, output_api)
results += input_api.canned_checks.CheckChangeLintsClean(input_api,
output_api,
lint_filters="")
def NonInclusiveFileFilter(file):
filter_list = [
"docs/tint/spirv-input-output-variables.md", # External URL
"test/tint/samples/compute_boids.wgsl ", # External URL
]
return file in filter_list
results += CheckNonInclusiveLanguage(input_api, output_api,
NonInclusiveFileFilter)
return results
def CheckChangeOnUpload(input_api, output_api):
return CheckChange(input_api, output_api)
def CheckChangeOnCommit(input_api, output_api):
return CheckChange(input_api, output_api)

119
README.md
View File

@ -16,26 +16,32 @@ Dawn provides several WebGPU building blocks:
- **Vulkan** on Windows, Linux, ChromeOS, Android and Fuchsia
- OpenGL as best effort where available
- **A client-server implementation of WebGPU** for applications that are in a sandbox without access to native drivers
- **Tint** is a compiler for the WebGPU Shader Language (WGSL).
Helpful links:
- [Dawn's bug tracker](https://bugs.chromium.org/p/dawn/issues/entry) if you find issues with Dawn.
- [Dawn bug tracker](https://bugs.chromium.org/p/dawn/issues/entry) if you find issues with Dawn.
- [Tint bug tracker](https://bugs.chromium.org/p/tint/issues/entry) if you find issues with Tint.
- [Dawn's mailing list](https://groups.google.com/forum/#!members/dawn-graphics) for other discussions related to Dawn.
- [Dawn's source code](https://dawn.googlesource.com/dawn)
- [Dawn's Matrix chatroom](https://matrix.to/#/#webgpu-dawn:matrix.org) for live discussion around contributing or using Dawn.
- [WebGPU's Matrix chatroom](https://matrix.to/#/#WebGPU:matrix.org)
- [Tint mirror](https://dawn.googlesource.com/tint) for standalone usage.
## Documentation table of content
Developer documentation:
- [Dawn overview](docs/dawn/overview.md)
- [Building Dawn](docs/dawn/building.md)
- [Contributing to Dawn](docs/dawn/contributing.md)
- [Building](docs/building.md)
- [Contributing](CONTRIBUTING.md)
- [Code of Conduct](CODE_OF_CONDUCT.md)
- [Testing Dawn](docs/dawn/testing.md)
- [Debugging Dawn](docs/dawn/debugging.md)
- [Dawn's infrastructure](docs/dawn/infra.md)
- [Dawn errors](docs/dawn/errors.md)
- [Tint experimental extensions](docs/tint/experimental_extensions.md)
User documentation: (TODO, figure out what overlaps with the webgpu.h docs)
@ -50,110 +56,3 @@ Apache 2.0 Public License, please see [LICENSE](/LICENSE).
## Disclaimer
This is not an officially supported Google product.
# Tint
Tint is a compiler for the WebGPU Shader Language (WGSL).
This is not an officially supported Google product.
## Requirements
* Git
* CMake (3.10.2 or later)
* Ninja (or other build tool)
* Python, for fetching dependencies
* [depot_tools] in your path
## Build options
* `TINT_BUILD_SPV_READER` : enable the SPIR-V input reader (off by default)
* `TINT_BUILD_WGSL_READER` : enable the WGSL input reader (on by default)
* `TINT_BUILD_SPV_WRITER` : enable the SPIR-V output writer (on by default)
* `TINT_BUILD_WGSL_WRITER` : enable the WGSL output writer (on by default)
* `TINT_BUILD_FUZZERS` : enable building fuzzzers (off by default)
## Building
Tint uses Chromium dependency management so you need to install [depot_tools]
and add it to your PATH.
[depot_tools]: http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
### Getting source & dependencies
```sh
# Clone the repo as "tint"
git clone https://dawn.googlesource.com/tint tint
cd tint
# Bootstrap the gclient configuration
cp scripts/standalone.gclient .gclient
# Fetch external dependencies and toolchains with gclient
gclient sync
```
### Compiling using CMake + Ninja
```sh
mkdir -p out/Debug
cd out/Debug
cmake -GNinja ../..
ninja # or autoninja
```
### Compiling using CMake + make
```sh
mkdir -p out/Debug
cd out/Debug
cmake ../..
make # -j N for N-way parallel build
```
### Compiling using gn + ninja
```sh
mkdir -p out/Debug
gn gen out/Debug
autoninja -C out/Debug
```
### Fuzzers on MacOS
If you are attempting fuzz, using `TINT_BUILD_FUZZERS=ON`, the version of llvm
in the XCode SDK does not have the needed libfuzzer functionality included.
The build error that you will see from using the XCode SDK will look something
like this:
```
ld: file not found:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/lib/darwin/libclang_rt.fuzzer_osx.a
```
The solution to this problem is to use a full version llvm, like what you would
get via homebrew, `brew install llvm`, and use something like `CC=<path to full
clang> cmake ..` to setup a build using that toolchain.
### Checking [chromium-style] issues in CMake builds
The gn based work flow uses the Chromium toolchain for building in anticipation
of integration of Tint into Chromium based projects. This toolchain has
additional plugins for checking for style issues, which are marked with
[chromium-style] in log messages. This means that this toolchain is more strict
then the default clang toolchain.
In the future we will have a CQ that will build this work flow and flag issues
automatically. Until that is in place, to avoid causing breakages you can run
the [chromium-style] checks using the CMake based work flows. This requires
setting `CC` to the version of clang checked out by `gclient sync` and setting
the `TINT_CHECK_CHROMIUM_STYLE` to `ON`.
```sh
mkdir -p out/style
cd out/style
cmake ../..
CC=../../third_party/llvm-build/Release+Asserts/bin/clang cmake -DTINT_CHECK_CHROMIUM_STYLE=ON ../../ # add -GNinja for ninja builds
```
## Issues
Please file any issues or feature requests at
https://bugs.chromium.org/p/tint/issues/entry
## Contributing
Please see the CONTRIBUTING and CODE_OF_CONDUCT files on how to contribute to
Tint.
Tint has a process for supporting [experimental extensions](docs/tint/experimental_extensions.md).

View File

@ -1,52 +0,0 @@
![Dawn's logo: a sun rising behind a stylized mountain inspired by the WebGPU logo. The text "Dawn" is written below it.](docs/imgs/dawn_logo.png "Dawn's logo")
# Dawn, a WebGPU implementation
Dawn is an open-source and cross-platform implementation of the work-in-progress [WebGPU](https://webgpu.dev) standard.
More precisely it implements [`webgpu.h`](https://github.com/webgpu-native/webgpu-headers/blob/main/webgpu.h) that is a one-to-one mapping with the WebGPU IDL.
Dawn is meant to be integrated as part of a larger system and is the underlying implementation of WebGPU in Chromium.
Dawn provides several WebGPU building blocks:
- **WebGPU C/C++ headers** that applications and other building blocks use.
- The `webgpu.h` version that Dawn implements.
- A C++ wrapper for the `webgpu.h`.
- **A "native" implementation of WebGPU** using platforms' GPU APIs:
- **D3D12** on Windows 10
- **Metal** on macOS and iOS
- **Vulkan** on Windows, Linux, ChromeOS, Android and Fuchsia
- OpenGL as best effort where available
- **A client-server implementation of WebGPU** for applications that are in a sandbox without access to native drivers
Helpful links:
- [Dawn's bug tracker](https://bugs.chromium.org/p/dawn/issues/entry) if you find issues with Dawn.
- [Dawn's mailing list](https://groups.google.com/forum/#!members/dawn-graphics) for other discussions related to Dawn.
- [Dawn's source code](https://dawn.googlesource.com/dawn)
- [Dawn's Matrix chatroom](https://matrix.to/#/#webgpu-dawn:matrix.org) for live discussion around contributing or using Dawn.
- [WebGPU's Matrix chatroom](https://matrix.to/#/#WebGPU:matrix.org)
## Documentation table of content
Developer documentation:
- [Dawn overview](docs/dawn/overview.md)
- [Building Dawn](docs/dawn/building.md)
- [Contributing to Dawn](docs/dawn/contributing.md)
- [Testing Dawn](docs/dawn/testing.md)
- [Debugging Dawn](docs/dawn/debugging.md)
- [Dawn's infrastructure](docs/dawn/infra.md)
- [Dawn errors](docs/dawn/errors.md)
User documentation: (TODO, figure out what overlaps with the webgpu.h docs)
## Status
(TODO)
## License
Apache 2.0 Public License, please see [LICENSE](/LICENSE).
## Disclaimer
This is not an officially supported Google product.

View File

@ -1,106 +0,0 @@
# Tint
Tint is a compiler for the WebGPU Shader Language (WGSL).
This is not an officially supported Google product.
## Requirements
* Git
* CMake (3.10.2 or later)
* Ninja (or other build tool)
* Python, for fetching dependencies
* [depot_tools] in your path
## Build options
* `TINT_BUILD_SPV_READER` : enable the SPIR-V input reader (off by default)
* `TINT_BUILD_WGSL_READER` : enable the WGSL input reader (on by default)
* `TINT_BUILD_SPV_WRITER` : enable the SPIR-V output writer (on by default)
* `TINT_BUILD_WGSL_WRITER` : enable the WGSL output writer (on by default)
* `TINT_BUILD_FUZZERS` : enable building fuzzzers (off by default)
## Building
Tint uses Chromium dependency management so you need to install [depot_tools]
and add it to your PATH.
[depot_tools]: http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
### Getting source & dependencies
```sh
# Clone the repo as "tint"
git clone https://dawn.googlesource.com/tint tint
cd tint
# Bootstrap the gclient configuration
cp scripts/standalone.gclient .gclient
# Fetch external dependencies and toolchains with gclient
gclient sync
```
### Compiling using CMake + Ninja
```sh
mkdir -p out/Debug
cd out/Debug
cmake -GNinja ../..
ninja # or autoninja
```
### Compiling using CMake + make
```sh
mkdir -p out/Debug
cd out/Debug
cmake ../..
make # -j N for N-way parallel build
```
### Compiling using gn + ninja
```sh
mkdir -p out/Debug
gn gen out/Debug
autoninja -C out/Debug
```
### Fuzzers on MacOS
If you are attempting fuzz, using `TINT_BUILD_FUZZERS=ON`, the version of llvm
in the XCode SDK does not have the needed libfuzzer functionality included.
The build error that you will see from using the XCode SDK will look something
like this:
```
ld: file not found:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/lib/darwin/libclang_rt.fuzzer_osx.a
```
The solution to this problem is to use a full version llvm, like what you would
get via homebrew, `brew install llvm`, and use something like `CC=<path to full
clang> cmake ..` to setup a build using that toolchain.
### Checking [chromium-style] issues in CMake builds
The gn based work flow uses the Chromium toolchain for building in anticipation
of integration of Tint into Chromium based projects. This toolchain has
additional plugins for checking for style issues, which are marked with
[chromium-style] in log messages. This means that this toolchain is more strict
then the default clang toolchain.
In the future we will have a CQ that will build this work flow and flag issues
automatically. Until that is in place, to avoid causing breakages you can run
the [chromium-style] checks using the CMake based work flows. This requires
setting `CC` to the version of clang checked out by `gclient sync` and setting
the `TINT_CHECK_CHROMIUM_STYLE` to `ON`.
```sh
mkdir -p out/style
cd out/style
cmake ../..
CC=../../third_party/llvm-build/Release+Asserts/bin/clang cmake -DTINT_CHECK_CHROMIUM_STYLE=ON ../../ # add -GNinja for ninja builds
```
## Issues
Please file any issues or feature requests at
https://bugs.chromium.org/p/tint/issues/entry
## Contributing
Please see the CONTRIBUTING and CODE_OF_CONDUCT files on how to contribute to
Tint.
Tint has a process for supporting [experimental extensions](docs/tint/experimental_extensions.md).

90
docs/building.md Normal file
View File

@ -0,0 +1,90 @@
# Building Dawn
## System requirements
* Git
* CMake (3.10.2 or later) (if desired)
* GN (if desired)
* Ninja (or other build tool)
* Python, for fetching dependencies
* [depot_tools] in your path
- Linux
- The `pkg-config` command:
```sh
# Install pkg-config on Ubuntu
sudo apt-get install pkg-config
```
- Mac
- [Xcode](https://developer.apple.com/xcode/) 12.2+.
- The macOS 11.0 SDK. Run `xcode-select` to check whether you have it.
```sh
ls `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs
```
## Install `depot_tools`
Dawn uses the Chromium build system and dependency management so you need to [install depot_tools] and add it to the PATH.
[install depot_tools]: http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
## Get the code
```sh
# Clone the repo as "dawn"
git clone https://dawn.googlesource.com/dawn dawn && cd dawn
# Bootstrap the gclient configuration
cp scripts/standalone.gclient .gclient
# Fetch external dependencies and toolchains with gclient
gclient sync
```
## Build Dawn
### Compiling using CMake + Ninja
```sh
mkdir -p out/Debug
cd out/Debug
cmake -GNinja ../..
ninja # or autoninja
```
### Compiling using CMake + make
```sh
mkdir -p out/Debug
cd out/Debug
cmake ../..
make # -j N for N-way parallel build
```
### Compiling using gn + ninja
```sh
mkdir -p out/Debug
gn gen out/Debug
autoninja -C out/Debug
```
The most common GN build option is `is_debug=true/false`; otherwise
`gn args out/Debug --list` shows all the possible options.
On macOS you'll want to add the `use_system_xcode=true` in most cases.
(and if you're a googler please get XCode from go/xcode).
### Fuzzers on MacOS
If you are attempting fuzz, using `TINT_BUILD_FUZZERS=ON`, the version of llvm
in the XCode SDK does not have the needed libfuzzer functionality included.
The build error that you will see from using the XCode SDK will look something
like this:
```
ld: file not found:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/lib/darwin/libclang_rt.fuzzer_osx.a
```
The solution to this problem is to use a full version llvm, like what you would
get via homebrew, `brew install llvm`, and use something like `CC=<path to full
clang> cmake ..` to setup a build using that toolchain.

View File

@ -1,46 +0,0 @@
# Building Dawn
## System requirements
- Linux
- The `pkg-config` command:
```sh
# Install pkg-config on Ubuntu
sudo apt-get install pkg-config
```
- Mac
- [Xcode](https://developer.apple.com/xcode/) 12.2+.
- The macOS 11.0 SDK. Run `xcode-select` to check whether you have it.
```sh
ls `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs
```
## Install `depot_tools`
Dawn uses the Chromium build system and dependency management so you need to [install depot_tools] and add it to the PATH.
[install depot_tools]: http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
## Get the code
```sh
# Clone the repo as "dawn"
git clone https://dawn.googlesource.com/dawn dawn && cd dawn
# Bootstrap the gclient configuration
cp scripts/standalone.gclient .gclient
# Fetch external dependencies and toolchains with gclient
gclient sync
```
## Build Dawn
Then generate build files using `gn args out/Debug` or `gn args out/Release`.
A text editor will appear asking build options, the most common option is `is_debug=true/false`; otherwise `gn args out/Release --list` shows all the possible options.
On macOS you'll want to add the `use_system_xcode=true` in most cases. (and if you're a googler please get XCode from go/xcode).
Then use `ninja -C out/Release` to build dawn and for example `./out/Release/dawn_end2end_tests` to run the tests.