gpu-dawn: move to github.com/hexops/mach-gpu-dawn

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2023-07-08 14:34:35 -07:00
parent 5373c43f87
commit a97924f884
20 changed files with 0 additions and 2619 deletions

View file

@ -1,2 +0,0 @@
* text=auto eol=lf
upstream/** linguist-vendored

View file

@ -1 +0,0 @@
github: slimsag

View file

@ -1,5 +0,0 @@
Please send your change to [the main repository](https://github.com/hexops/mach/tree/main/libs/gpu-dawn) instead, sorry for the trouble!
This helps us avoid some complex merge conflicts we run into when changes are made to both repositories and history needs to be reconciled. Keeping PRs in just that repository enables us to use `git subtree` to trivially keep the two repositories in sync.
Once your PR is merged over there, it'll automatically sync to this repository.

View file

@ -1,249 +0,0 @@
name: CI
on:
workflow_run:
workflows: ["Draft release"]
types:
- completed
jobs:
x86_64-linux-gnu_debug:
runs-on: ubuntu-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# to the branch.
if: github.event.workflow_run.conclusion == 'success' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Zig
run: |
sudo apt install xz-utils libx11-dev # TODO(libx11) https://github.com/hexops/mach/issues/845
sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.11.0-dev.3883+7166407d8.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: install (debug)
run: zig build install # -Dtarget=x86_64-linux-gnu # TODO(libx11) https://github.com/hexops/mach/issues/845
- name: upload (debug)
run: ./dev/upload-release.sh
env:
RELEASE_NAME: x86_64-linux-gnu_debug
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
x86_64-linux-gnu_release-fast:
runs-on: ubuntu-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# to the branch.
if: github.event.workflow_run.conclusion == 'success' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Zig
run: |
sudo apt install xz-utils libx11-dev # TODO(libx11) https://github.com/hexops/mach/issues/845
sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.11.0-dev.3883+7166407d8.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: install (release-fast)
run: zig build install -Doptimize=ReleaseFast # -Dtarget=x86_64-linux-gnu # TODO(libx11) https://github.com/hexops/mach/issues/845
- name: upload (release-fast)
run: ./dev/upload-release.sh
env:
RELEASE_NAME: x86_64-linux-gnu_release-fast
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# TODO(libx11) https://github.com/hexops/mach/issues/845
# x86_64-linux-musl_debug:
# runs-on: ubuntu-latest
# # We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# # to the branch.
# if: github.event.workflow_run.conclusion == 'success' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Setup Zig
# run: |
# sudo apt install xz-utils libx11-dev # TODO(libx11) https://github.com/hexops/mach/issues/845
# sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.11.0-dev.3883+7166407d8.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
# - name: install (debug)
# run: zig build install -Dtarget=x86_64-linux-musl
# - name: upload (debug)
# run: ./dev/upload-release.sh
# env:
# RELEASE_NAME: x86_64-linux-musl_debug
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# x86_64-linux-musl_release-fast:
# runs-on: ubuntu-latest
# # We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# # to the branch.
# if: github.event.workflow_run.conclusion == 'success' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Setup Zig
# run: |
# sudo apt install xz-utils libx11-dev # TODO(libx11) https://github.com/hexops/mach/issues/845
# sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.11.0-dev.3883+7166407d8.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
# - name: install (release-fast)
# run: zig build install -Doptimize=ReleaseFast -Dtarget=x86_64-linux-musl
# - name: upload (release-fast)
# run: ./dev/upload-release.sh
# env:
# RELEASE_NAME: x86_64-linux-musl_release-fast
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
aarch64-linux-gnu_debug:
runs-on: ubuntu-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# to the branch.
if: github.event.workflow_run.conclusion == 'success' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Zig
run: |
sudo apt install xz-utils libx11-dev # TODO(libx11) https://github.com/hexops/mach/issues/845
sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.11.0-dev.3883+7166407d8.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: install (debug)
run: zig build install # -Dtarget=aarch64-linux-gnu # TODO(libx11) https://github.com/hexops/mach/issues/845
- name: upload (debug)
run: ./dev/upload-release.sh
env:
RELEASE_NAME: aarch64-linux-gnu_debug
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
aarch64-linux-gnu_release-fast:
runs-on: ubuntu-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# to the branch.
if: github.event.workflow_run.conclusion == 'success' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Zig
run: |
sudo apt install xz-utils libx11-dev # TODO(libx11) https://github.com/hexops/mach/issues/845
sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.11.0-dev.3883+7166407d8.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: install (release-fast)
run: zig build install -Doptimize=ReleaseFast # -Dtarget=aarch64-linux-gnu # TODO(libx11) https://github.com/hexops/mach/issues/845
- name: upload (release-fast)
run: ./dev/upload-release.sh
env:
RELEASE_NAME: aarch64-linux-gnu_release-fast
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# TODO(libx11) https://github.com/hexops/mach/issues/845
# aarch64-linux-musl_debug:
# runs-on: ubuntu-latest
# # We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# # to the branch.
# if: github.event.workflow_run.conclusion == 'success' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Setup Zig
# run: |
# sudo apt install xz-utils libx11-dev # TODO(libx11) https://github.com/hexops/mach/issues/845
# sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.11.0-dev.3883+7166407d8.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
# - name: install (debug)
# run: zig build install -Dtarget=aarch64-linux-musl
# - name: upload (debug)
# run: ./dev/upload-release.sh
# env:
# RELEASE_NAME: aarch64-linux-musl_debug
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# aarch64-linux-musl_release-fast:
# runs-on: ubuntu-latest
# # We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# # to the branch.
# if: github.event.workflow_run.conclusion == 'success' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Setup Zig
# run: |
# sudo apt install xz-utils libx11-dev # TODO(libx11) https://github.com/hexops/mach/issues/845
# sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.11.0-dev.3883+7166407d8.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
# - name: install (release-fast)
# run: zig build install -Doptimize=ReleaseFast -Dtarget=aarch64-linux-musl
# - name: upload (release-fast)
# run: ./dev/upload-release.sh
# env:
# RELEASE_NAME: aarch64-linux-musl_release-fast
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
x86_64-windows-gnu_debug:
runs-on: windows-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# to the branch.
if: github.event.workflow_run.conclusion == 'success' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Zig
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://ziglang.org/builds/zig-windows-x86_64-0.11.0-dev.3883+7166407d8.zip" -OutFile "C:\zig.zip"
cd C:\
7z x zig.zip
Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.11.0-dev.3883+7166407d8\"
- name: install (debug)
run: zig build install -Dtarget=x86_64-windows-gnu
- name: upload (debug)
run: ./dev/upload-release.sh
shell: bash
env:
WINDOWS: true
RELEASE_NAME: x86_64-windows-gnu_debug
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
x86_64-windows-gnu_release-fast:
runs-on: windows-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# to the branch.
if: github.event.workflow_run.conclusion == 'success' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Zig
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://ziglang.org/builds/zig-windows-x86_64-0.11.0-dev.3883+7166407d8.zip" -OutFile "C:\zig.zip"
cd C:\
7z x zig.zip
Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.11.0-dev.3883+7166407d8\"
- name: install (release-fast)
run: zig build install -Dtarget=x86_64-windows-gnu -Doptimize=ReleaseFast
- name: upload (release-fast)
run: ./dev/upload-release.sh
shell: bash
env:
WINDOWS: true
RELEASE_NAME: x86_64-windows-gnu_release-fast
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
x86_64-macos_debug:
runs-on: macos-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# to the branch.
if: github.event.workflow_run.conclusion == 'success' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Zig
run: |
brew uninstall --ignore-dependencies libx11 # https://github.com/ziglang/zig/issues/11066
brew install xz
sudo sh -c 'wget -c https://ziglang.org/builds/zig-macos-x86_64-0.11.0-dev.3883+7166407d8.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: install (debug)
run: zig build install -Dtarget=x86_64-macos
- name: upload (debug)
run: ./dev/upload-release.sh
env:
RELEASE_NAME: x86_64-macos-none_debug
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
x86_64-macos_release-fast:
runs-on: macos-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# to the branch.
if: github.event.workflow_run.conclusion == 'success' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Zig
run: |
brew uninstall --ignore-dependencies libx11 # https://github.com/ziglang/zig/issues/11066
brew install xz
sudo sh -c 'wget -c https://ziglang.org/builds/zig-macos-x86_64-0.11.0-dev.3883+7166407d8.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: install (release-fast)
run: zig build install -Doptimize=ReleaseFast -Dtarget=x86_64-macos
- name: upload (release-fast)
run: ./dev/upload-release.sh
env:
RELEASE_NAME: x86_64-macos-none_release-fast
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -1,16 +0,0 @@
name: Draft release
on:
push:
branches:
- 'main'
jobs:
draft:
if: ${{ !contains(github.event.head_commit.message, 'update to latest binary release') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Create draft
run: gh release create "release-$(git rev-parse --short HEAD)" --title "Automatic release of main @ $(git rev-parse --short HEAD)"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -1,35 +0,0 @@
name: M1
on:
workflow_run:
workflows: ["Draft release"]
types:
- completed
jobs:
aarch64-macos:
if: ${{ github.repository == 'hexops/mach-gpu-dawn' && github.event.workflow_run.conclusion == 'success' }}
runs-on: [self-hosted, macOS, ARM64]
defaults:
run:
shell: "/usr/bin/arch -arch arm64e /bin/bash --noprofile --norc -eo pipefail {0}"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: install (debug)
run: zig build install -Dtarget=aarch64-macos
- name: upload (debug)
run: |
./dev/upload-release.sh
# HACK: without this we encounter error: StreamTooLong on the next `zig build` below.
# no clue why.
rm -rf zig-cache zig-out
env:
RELEASE_NAME: aarch64-macos-none_debug
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: install (release-fast)
run: zig build install -Doptimize=ReleaseFast -Dtarget=aarch64-macos
- name: upload (release-fast)
run: ./dev/upload-release.sh
env:
RELEASE_NAME: aarch64-macos-none_release-fast
UPLOAD_HEADERS: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -1,45 +0,0 @@
name: Publish release
on:
workflow_run:
workflows: ["CI"]
types:
- completed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Record latest release version
id: recorded_release_version
# Note: we find the latest non-'update to latest binary release' commit here, which is not
# necessarily HEAD because another build could have succeeded before us and HEAD may now refer
# to 'update to latest binary release' instead of the commit we were building.
# By doing this, we ensure any update we push would refer to the absolute latest binary
# release even if *this* CI run is older.
run: echo "recorded_release_version=$(git log --oneline | grep -v 'update to latest binary release' | head -n1 | cut -d " " -f1)" >> $GITHUB_ENV
# - name: Publish release
# run: echo "TODO(build-system): gh CLI has no way to mark draft as published?"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout hexops/mach monorepo
uses: actions/checkout@v2
with:
repository: hexops/mach
token: ${{ secrets.HEXOPS_MACH_GPU_DAWN_PUSH }}
- name: 'gpu/dawn: update hard-coded binary release version'
env:
RELEASE_COMMIT: ${{env.recorded_release_version}}
run: |
sed -i "/binary_version: \[\]const u8 =/c\ binary_version: []const u8 = \"release-$RELEASE_COMMIT\"," ./libs/gpu-dawn/build.zig
- name: 'gpu/dawn: use latest binary release'
run: |
git config user.name 'Release automation'
git config user.email 'stephen@hexops.com'
git add .
git commit -m 'gpu-dawn: update to latest binary release'
git push -u origin HEAD

View file

@ -1,21 +0,0 @@
# This file is for zig-specific build artifacts.
# If you have OS-specific or editor-specific files to ignore,
# such as *.swp or .DS_Store, put those in your global
# ~/.gitignore and put this in your ~/.gitconfig:
#
# [core]
# excludesfile = ~/.gitignore
#
# Cheers!
# -andrewrk
zig-cache/
zig-out/
/release/
/debug/
/build/
/build-*/
/docgen_tmp/
libs/DirectXShaderCompiler
libs/dawn

View file

@ -1,13 +0,0 @@
Copyright 2021, Hexops Contributors (given via the Git commit history).
All documentation, image, sound, font, and 2D/3D model files are CC-BY-4.0 licensed unless
otherwise noted. You may get a copy of this license at https://creativecommons.org/licenses/by/4.0
Files in a directory with a separate LICENSE file may contain files under different license terms,
described within that LICENSE file.
All other files are licensed under the Apache License, Version 2.0 (see LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
or the MIT license (see LICENSE-MIT or http://opensource.org/licenses/MIT), at your option.
All files in the project without exclusions may not be copied, modified, or distributed except
according to the terms above.

View file

@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.

View file

@ -1,25 +0,0 @@
Copyright (c) 2021 Hexops Contributors (given via the Git commit history).
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View file

@ -1,98 +0,0 @@
# mach/gpu-dawn, WebGPU/Dawn built with Zig <a href="https://hexops.com"><img align="right" alt="Hexops logo" src="https://raw.githubusercontent.com/hexops/media/master/readme.svg"></img></a>
`mach/gpu-dawn` builds [Dawn](https://dawn.googlesource.com/dawn/), Google Chrome's WebGPU implementation, requiring nothing more than `zig` and `git` to build and cross-compile a static Dawn library for every OS:
* No cmake
* No ninja
* No `gn`
* No system dependencies (xcode, etc.)
* Automagic cross compilation out of the box with nothing more than `zig` and `git`!
* Builds a single static `libdawn.a` with everything you need.
This repository is a separate copy of the same library in the [main Mach repository](https://github.com/hexops/mach), and is automatically kept in sync, so that anyone can use this library in their own project / engine if they like!
## Building from source
Building Dawn from source using this method is simple:
```sh
git clone https://github.com/hexops/mach-gpu-dawn
cd mach-gpu-dawn
rm -rf libs/mach-glfw
git clone --recursive https://github.com/hexops/mach-glfw libs/mach-glfw
zig build
```
(Please make sure to use Zig nightly, e.g. v0.10, not v0.9, which you can get a binary release of at the very top of this page: https://ziglang.org/download/)
This will take ~10 minutes to finish (see the 'binary releases' section below.) You can add the following options:
| Option | Description |
|-------------------------------|------------------------------------------------------------|
| `-Doptimize=ReleaseFast` | Build a release binary instead of a debug binary (default) |
| `-Dtarget=x86_64-macos` | Cross compile to macOS (Intel chipsets) |
| `-Dtarget=aarch64-macos` | Cross compile to macOS (Apple Silicon) |
| `-Dtarget=x86_64-linux-gnu` | Cross compile to x86_64 Linux (glibc) |
| `-Dtarget=x86_64-linux-musl` | Cross compile to x86_64 Linux (musl libc) |
| `-Dtarget=x86_64-windows-gnu` | Cross compile to x86_64 Windows |
The following platforms are not yet supported, but we hope to support soon:
* iOS (Dawn does not officially support it yet)
* Android (Dawn does not officially support it yet)
* ARM Linux (aarch64)
* Windows msvc target (Zig targets MinGW libc on Windows currently, msvc support should not be hard to add.)
## Binary releases
Dawn (specifically all the shader compilers, and the DirectXShaderCompiler) is a large C++ codebase and takes 5-10 minutes to build on a modern laptop. Since waiting is no fun, we also have binary releases produced by our GitHub actions:
**[View binary releases](https://github.com/hexops/mach-gpu-dawn/releases/latest)**
Here's how to read the downloads provided:
* `_debug.tar.gz` and `_release-fast.tar.gz` are tarballs of the static library + headers for each OS and debug/release mode, respectively.
* `headers.json.gz` is a JSON archive of all the Dawn/WebGPU headers.
* Files ending in `.a.gz` and `.lib.gz` are the individual static `libdawn.a` and `dawn.lib` (Windows) gzippped and distributed. These are provided as individual downloads so there is no need to extract a tarball.
## Important: Building WebGPU API symbols
Dawn and other WebGPU implementations (like the Rust one) do not agree on a standard `webgpu.h` API. Aspirationally, they aim to target the same https://github.com/webgpu-native/webgpu-headers header, but in practice they expose different APIs which are not ABI compatible.
When you call a Dawn `webgpu.h` function, Dawn internally diverts this call through a vtable which must be initialized using a call to `dawnProcSetProcs`.
`mach/gpu-dawn` builds since Oct 17th 2022 no longer include the `webgpu.h` symbols by default. If you intend to actually call the WebGPU API, you should build these two source files as part of your application:
1. [`dawn_proc.c`](https://raw.githubusercontent.com/hexops/dawn/generated-2023-06-30.1688174725/out/Debug/gen/src/dawn/dawn_proc.c)
2. [`webgpu_dawn_native_proc.cpp`](https://raw.githubusercontent.com/hexops/dawn/generated-2023-06-30.1688174725/out/Debug/gen/src/dawn/native/webgpu_dawn_native_proc.cpp)
And call `dawnProcSetProcs` to set up the proc table.
## A warning about API stability
You should be aware:
* WebGPU's API is not formalized yet.
* Dawn's API is still changing.
* The `webgpu.h` API is still changing
* Dawn and gfx-rs/wgpu, although both try to implement `webgpu.h`, do not exactly implement the same interface. There are subtle differences in device discovery & creation for example.
## Generated code
Dawn itself relies on a fairly large amount of dependencies, generated code, etc. To avoid having any dependency on Google build tools, code generation, etc. we maintain [a minor fork of Dawn which has generated code and third-party dependencies comitted in "generated" branches.](https://github.com/hexops/dawn/tree/main/mach) We are usually up-to-date with the upstream within a few weeks on average.
It also provides a [few small patches to enable building Dawn with the Zig compiler](https://github.com/hexops/mach/issues/168) which we plan to upstream soon, as well as some [patches to build the DirectXShaderCompiler with Zig](https://github.com/hexops/mach/issues/151).
## Join the community
Join the Mach engine community [on Discord](https://discord.gg/XNG3NZgCqp) to discuss this project, ask questions, get help, etc.
## Issues
Issues are tracked in the [main Mach repository](https://github.com/hexops/mach/issues?q=is%3Aissue+is%3Aopen+label%3Agpu-dawn).
## License
All Mach code (this repository) is under the Apache and MIT license at your choosing described in the `LICENSE` file. Dawn itself is [similarly permissively licensed](https://github.com/hexops/dawn/blob/main/LICENSE).

File diff suppressed because it is too large Load diff

View file

@ -1,30 +0,0 @@
.{
.name = "mach-gpu-dawn",
.version = "0.2.0",
.dependencies = .{
.mach_glfw = .{
.url = "https://github.com/hexops/mach-glfw/archive/b119c63dd77764eeafe758d54accd0329821a729.tar.gz",
.hash = "1220fb0fb65621a4fc7406e4f74a87a0c60208f8a257cd7ca4e20da0925f875e70d0",
},
.glfw = .{
.url = "https://github.com/hexops/glfw/archive/49c21c3d2fcaf9799b593f5320ce8e598a692c74.tar.gz",
.hash = "12200a907165afc4c099d4d19e2f7ce9923a72116006d8f5f5af3a9a071fa66171d2",
},
.direct3d_headers = .{
.url = "https://github.com/hexops/direct3d-headers/archive/773dce3f079eecdccc7c71d1318a0741649d568b.tar.gz",
.hash = "12200d2155216c5eb5f111282cd355b5433cad6a68fd040294e695149cba329f7c12",
},
.vulkan_headers = .{
.url = "https://github.com/hexops/vulkan-headers/archive/e1b061ff624531e82a7daea5dbd56c07e08bf0be.tar.gz",
.hash = "12204967f9d07fda3af6a21d6ab71fb832da2186176c530a7a14aa96043537399e6b",
},
.wayland_headers = .{
.url = "https://github.com/hexops/wayland-headers/archive/7bf46f3d60edab2171643ff85770c392ef62704d.tar.gz",
.hash = "1220689912c40c0880b094f748199c490810d4fa4c58ce1ef9058ce97f46ee28496a",
},
.x11_headers = .{
.url = "https://github.com/hexops/x11-headers/archive/99af89c7bfdc7db503f3a7003571f8e81bcd09f3.tar.gz",
.hash = "1220e6bd3186841c1da38d862d52ba88dec9633d24f409eda27627321937419a0ddb",
},
},
}

View file

@ -1,30 +0,0 @@
#!/usr/bin/env bash
set -exuo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"/..
rm -rf out/ out.tar.gz headers.json headers.json.gz
# Prepare the `out/` directory that we will bundle.
mkdir out/
cp -R libs/dawn/include out/
cp -R libs/dawn/out/Debug/gen/include/* out/include/
cp libs/dawn/LICENSE out/
zig version > out/ZIG_VERSION
# Bundle headers.json.gz
pushd out
python3 ../dev/dir_to_json.py > ../headers.json
popd
gzip -9 headers.json
# Copy the binary into the out/ directory
if [[ "${WINDOWS:-"false"}" == "true" ]]; then
cp zig-out/lib/dawn.lib out/
else
cp zig-out/lib/libdawn.a out/
fi
# Create out.tar.gz bundle
pushd out
tar -czvf ../out.tar.gz .
popd

View file

@ -1,12 +0,0 @@
import os
import json
def dir_to_dict(d):
dict = {}
for dirpath,_,filenames in os.walk(d):
for f in filenames:
path = os.path.join(dirpath, f)
dict[path] = open(path, 'r').read()
return dict
print(json.dumps(dir_to_dict('.')))

View file

@ -1,26 +0,0 @@
#!/usr/bin/env bash
set -exuo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"/..
# Prepare tarball, headers.json.gz, etc.
./dev/bundle-release.sh
if [[ "${UPLOAD_HEADERS:-"false"}" == "true" ]]; then
# Upload headers.json.gz
gh release upload "release-$(git rev-parse --short HEAD)" headers.json.gz
fi
# Upload static library individually.
if [[ "${WINDOWS:-"false"}" == "true" ]]; then
cp zig-out/lib/dawn.lib "dawn_$RELEASE_NAME.lib"
gzip -9 "dawn_$RELEASE_NAME.lib"
gh release upload "release-$(git rev-parse --short HEAD)" "dawn_$RELEASE_NAME.lib.gz"
else
cp zig-out/lib/libdawn.a "libdawn_$RELEASE_NAME.a"
gzip -9 "libdawn_$RELEASE_NAME.a"
gh release upload "release-$(git rev-parse --short HEAD)" "libdawn_$RELEASE_NAME.a.gz"
fi
# Upload tarball of static library + headers.
mv out.tar.gz "$RELEASE_NAME.tar.gz"
gh release upload "release-$(git rev-parse --short HEAD)" "$RELEASE_NAME.tar.gz"

View file

@ -1,56 +0,0 @@
#ifdef __MINGW32__
#include <guiddef.h>
#include <stdint.h>
#define MINGW_UUIDOF(type, spec) \
extern "C++" { \
struct __declspec(uuid(spec)) type; \
template<> const GUID &__mingw_uuidof<type>() { \
static constexpr IID __uuid_inst = guid_from_string(spec); \
return __uuid_inst; \
} \
template<> const GUID &__mingw_uuidof<type*>() { \
return __mingw_uuidof<type>(); \
} \
}
constexpr uint8_t nybble_from_hex(char c) {
return ((c >= '0' && c <= '9')
? (c - '0')
: ((c >= 'a' && c <= 'f')
? (c - 'a' + 10)
: ((c >= 'A' && c <= 'F') ? (c - 'A' + 10)
: /* Should be an error */ -1)));
}
constexpr uint8_t byte_from_hex(char c1, char c2) {
return nybble_from_hex(c1) << 4 | nybble_from_hex(c2);
}
constexpr uint8_t byte_from_hexstr(const char str[2]) {
return nybble_from_hex(str[0]) << 4 | nybble_from_hex(str[1]);
}
constexpr GUID guid_from_string(const char str[37]) {
return GUID{static_cast<uint32_t>(byte_from_hexstr(str)) << 24 |
static_cast<uint32_t>(byte_from_hexstr(str + 2)) << 16 |
static_cast<uint32_t>(byte_from_hexstr(str + 4)) << 8 |
byte_from_hexstr(str + 6),
static_cast<uint16_t>(
static_cast<uint16_t>(byte_from_hexstr(str + 9)) << 8 |
byte_from_hexstr(str + 11)),
static_cast<uint16_t>(
static_cast<uint16_t>(byte_from_hexstr(str + 14)) << 8 |
byte_from_hexstr(str + 16)),
{byte_from_hexstr(str + 19), byte_from_hexstr(str + 21),
byte_from_hexstr(str + 24), byte_from_hexstr(str + 26),
byte_from_hexstr(str + 28), byte_from_hexstr(str + 30),
byte_from_hexstr(str + 32), byte_from_hexstr(str + 34)}};
}
#endif // __MINGW32__
// The point of this helper file is to export the specializations for MINGW_UUIDOF
// below, since MinGW does not have these as part of dxguid yet (not completely up
// to date.)
MINGW_UUIDOF(IDXGraphicsAnalysis, "9f251514-9d4d-4902-9d60-18988ab7d4b5")

View file

@ -1 +0,0 @@
pub fn main() void {}